From: Josh Poimboeuf <jpoimboe@redhat.com>
To: Joe Lawrence <joe.lawrence@redhat.com>
Cc: Petr Mladek <pmladek@suse.com>, Jiri Kosina <jikos@kernel.org>,
Miroslav Benes <mbenes@suse.cz>, Jessica Yu <jeyu@kernel.org>,
Nicolai Stange <nstange@suse.de>,
live-patching@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/2] livepatch: Initialize shadow variables by init function safely
Date: Wed, 14 Mar 2018 14:44:36 -0500 [thread overview]
Message-ID: <20180314194436.fl5xro6aixroqzxk@treble> (raw)
In-Reply-To: <20180314192702.h6fvqoo7myt426ww@redhat.com>
On Wed, Mar 14, 2018 at 03:27:02PM -0400, Joe Lawrence wrote:
> On Tue, Mar 13, 2018 at 04:54:47PM +0100, Petr Mladek wrote:
> > The existing API allows to pass a sample data to initialize the shadow
> > data. It works well when the data are position independent. But it fails
> > miserably when we need to set a pointer to the shadow structure itself.
> >
> > Unfortunately, we might need to initialize the pointer surprisingly
> > often because of struct list_head. It is even worse because the list
> > might be hidden in other common structures, for example, struct mutex,
> > struct wait_queue_head.
> >
> > This patch makes the API more safe. A custom init function and data
> > are passed to klp_shadow_*alloc() functions instead of the sample data.
>
> Yup, this looks kinda familiar, I remember tinkering with the same idea
> last year [1] before settling on the simpler API.
>
> [1] https://github.com/torvalds/linux/compare/master...joe-lawrence:shadow_variables_v2_c
>
> > Note that the init_data are not longer a template for the shadow->data.
> > It might point to any data that might be necessary when the init
> > function is called.
>
> I'm not opposed to changing the API, but I was wondering if you had
> thought about expanding it as an alternative?
>
> When working on this last summer, I remember holding onto to some less
> than intuitive naming conventions so that I could support a basic API
> and an extended API with bells and whistles like this patchset
> implements. It didn't seem too difficult to layer the basic API ontop
> of one like this (see [1] for example), so maybe that's an option to
> keep basic shadow variable usage a little simpler. /two cents
I like Petr's new API. It's not a big deal to just pass a couple of
NULLs if you don't need the callback.
And I prefer fewer functions anyway -- maybe it's my functionitis
allergies acting up again.
> Perhaps shadow variables are another candidate for some kind of
> kselftest?
Indeed!
--
Josh
next prev parent reply other threads:[~2018-03-14 19:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-13 15:54 [PATCH 0/2] livepatch: Allocate and free shadow variables more safely Petr Mladek
2018-03-13 15:54 ` [PATCH 1/2] livepatch: Initialize shadow variables by init function safely Petr Mladek
2018-03-14 19:27 ` Joe Lawrence
2018-03-14 19:44 ` Josh Poimboeuf [this message]
2018-04-04 13:08 ` Petr Mladek
2018-03-14 19:28 ` Josh Poimboeuf
2018-03-14 19:43 ` Joe Lawrence
2018-03-14 20:22 ` Josh Poimboeuf
2018-03-21 12:55 ` Miroslav Benes
2018-03-13 15:54 ` [PATCH 2/2] livepatch: Allow to unregister or free shadow data using a custom function Petr Mladek
2018-03-14 19:32 ` Josh Poimboeuf
2018-03-21 13:05 ` Miroslav Benes
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180314194436.fl5xro6aixroqzxk@treble \
--to=jpoimboe@redhat.com \
--cc=jeyu@kernel.org \
--cc=jikos@kernel.org \
--cc=joe.lawrence@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=mbenes@suse.cz \
--cc=nstange@suse.de \
--cc=pmladek@suse.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®