Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1655734

Re: [PATCH 0/3] livepatch: add shadow variable API

Path csiph.com!goblin3!goblin.stu.neva.ru!news.redatomik.org!aioe.org!news.servidellagleba.it!bofh.it!news.nic.it!robomod
From Joe Lawrence <joe.lawrence@redhat.com>
Newsgroups linux.kernel
Subject Re: [PATCH 0/3] livepatch: add shadow variable API
Date Thu, 01 Jun 2017 22:30:02 +0200
Message-ID <tNETg-7v6-5@gated-at.bofh.it> (permalink)
References <tND17-68x-3@gated-at.bofh.it> <tNEzU-7oF-13@gated-at.bofh.it>
Dmarc-Filter OpenDMARC Filter v1.3.2 mx1.redhat.com 80F00334590
Authentication-Results ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com
Authentication-Results ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=joe.lawrence@redhat.com
Dkim-Filter OpenDKIM Filter v2.11.0 mx1.redhat.com 80F00334590
Organization Red Hat
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0
MIME-Version 1.0
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding 7bit
X-Scanned-By MIMEDefang 2.79 on 10.5.11.12
X-Greylist Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 01 Jun 2017 20:23:45 +0000 (UTC)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 58
X-Original-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>
X-Original-Date Thu, 1 Jun 2017 16:23:44 -0400
X-Original-Message-ID <bf7958e9-27c0-85a6-7de6-027051a25dae@redhat.com>
X-Original-References <1496341526-19061-1-git-send-email-joe.lawrence@redhat.com> <alpine.LSU.2.20.1706012202490.26873@cbobk.fhfr.pm>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1655734

Show key headers only | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/3] livepatch: add shadow variable API Joe Lawrence <joe.lawrence@redhat.com> - 2017-06-01 20:30 +0200
  [PATCH 3/3] livepatch: add shadow variable sample program Joe Lawrence <joe.lawrence@redhat.com> - 2017-06-01 20:30 +0200
  [PATCH 2/3] livepatch: add shadow variable documentation Joe Lawrence <joe.lawrence@redhat.com> - 2017-06-01 20:30 +0200
  Re: [PATCH 0/3] livepatch: add shadow variable API Jiri Kosina <jikos@kernel.org> - 2017-06-01 22:10 +0200
    Re: [PATCH 0/3] livepatch: add shadow variable API Joe Lawrence <joe.lawrence@redhat.com> - 2017-06-01 22:30 +0200
      Re: [PATCH 0/3] livepatch: add shadow variable API Jiri Kosina <jikos@kernel.org> - 2017-06-01 22:40 +0200

csiph-web