mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Joe Lawrence <joe.lawrence@redhat.com>
To: Jiri Kosina <jikos@kernel.org>
Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Jessica Yu <jeyu@redhat.com>, Miroslav Benes <mbenes@suse.cz>,
	Petr Mladek <pmladek@suse.com>
Subject: Re: [PATCH 0/3] livepatch: add shadow variable API
Date: Thu, 1 Jun 2017 16:23:44 -0400	[thread overview]
Message-ID: <bf7958e9-27c0-85a6-7de6-027051a25dae@redhat.com> (raw)
In-Reply-To: <alpine.LSU.2.20.1706012202490.26873@cbobk.fhfr.pm>

On 06/01/2017 04:05 PM, Jiri Kosina wrote:
> On Thu, 1 Jun 2017, Joe Lawrence wrote:
> 
>> This patchset is a simplified livepatch port of kpatch's "shadow"
>> variable API [1].  The kpatch project has successfully employed such
>> shadow variables to implement patches that have extended data structure
>> elements.  This API provides livepatch a means of associating new,
>> shadow data fields with existing data structures. 
>>
>> See the first patch for the implementation, the second for further
>> documentation (API, conccurency notes, use-case code snippets) and the
>> third patch for an update to the sample livepatch module using shadow
>> variables.
> 
> Thanks a lot for initiating this. 
> 
> The only issue I've spotted so far -- is there any reason, why the API 
> completely ignores task_struct->patch_state, and always returns the 'new' 
> value?
> 
> This basically offloads the responsibility for deciding between old/new to 
> each and every caller, and that feels much more error prone compared to 
> having this automatically done by klp_shadow_get().
> 

Hi Jiri,

I'm a little confused about the question.  Maybe this clarifies a few
things:

 * klp_shadow_get() is only returning a pointer to the shadow data, the
additional storage that klp_shadow_attach() has associated with the
original data structure.  Callers will have to handle this shadow
structure accordingly, ie, not through old_struct->new_value, but rather
*new_value).

 * the intention is that only livepatched code will be calling
klp_shadow_*, so it can assume that the current task is patched

 * callers might need to verify klp_shadow_get() is returning non-NULL
if it's possible that some data-structures don't have a shadow var attached

If you are referring to stacking livepatches ... to be honest I hadn't
thought of that scenario.  In that case, we might be able to get away
with pushing something like this into the hash:

 klp #1:  klp_shadow_attach(ptr, "shadow_var", ...)
 klp #2:  klp_shadow_attach(ptr, "shadow_var_v2", ...)

... but that's just off the top of my head :)  I was hoping to handle
the easy case first.

Maybe I misunderstood the question... if so, I can update the
documentation file to better describe what's going on.

Regards,

-- Joe

  reply	other threads:[~2017-06-01 20:23 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-01 18:25 Joe Lawrence
2017-06-01 18:25 ` [PATCH 1/3] livepatch: introduce " Joe Lawrence
2017-06-08 16:49   ` Josh Poimboeuf
2017-06-09 15:36     ` Joe Lawrence
2017-06-09 18:34       ` Josh Poimboeuf
2017-06-12 13:49         ` Joe Lawrence
2017-06-14 12:59   ` Petr Mladek
2017-06-14 13:17     ` Josh Poimboeuf
2017-06-14 14:26       ` Petr Mladek
2017-06-19 16:09     ` Miroslav Benes
2017-06-01 18:25 ` [PATCH 2/3] livepatch: add shadow variable documentation Joe Lawrence
2017-06-14 13:10   ` Petr Mladek
2017-06-01 18:25 ` [PATCH 3/3] livepatch: add shadow variable sample program Joe Lawrence
2017-06-09 18:38   ` Josh Poimboeuf
2017-06-09 19:05     ` Joe Lawrence
2017-06-13 11:00   ` Miroslav Benes
2017-06-13 17:32     ` Joe Lawrence
2017-06-14  7:45       ` Miroslav Benes
2017-06-14 14:21   ` Petr Mladek
2017-06-14 14:57     ` Josh Poimboeuf
2017-06-15 10:59       ` Petr Mladek
2017-06-15 13:49         ` Josh Poimboeuf
     [not found]           ` <20170615143800.d6f5p5bdm4ueecly@redhat.com>
2017-06-15 15:23             ` Josh Poimboeuf
2017-06-19 16:56           ` Miroslav Benes
2017-06-30 20:32             ` Josh Poimboeuf
2017-07-01  6:53               ` Miroslav Benes
2017-06-14 15:15     ` Joe Lawrence
2017-06-19 16:43       ` Miroslav Benes
2017-06-01 20:05 ` [PATCH 0/3] livepatch: add shadow variable API Jiri Kosina
2017-06-01 20:23   ` Joe Lawrence [this message]
2017-06-01 20:32     ` Jiri Kosina
2017-06-13 10:19     ` Miroslav Benes
2017-06-13 17:29       ` Joe Lawrence
2017-06-14  8:02         ` 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=bf7958e9-27c0-85a6-7de6-027051a25dae@redhat.com \
    --to=joe.lawrence@redhat.com \
    --cc=jeyu@redhat.com \
    --cc=jikos@kernel.org \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=mbenes@suse.cz \
    --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®