xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Martin Pohlack <mpohlack@amazon.com>
Cc: Elena Ufimtseva <elena.ufimtseva@oracle.com>,
	jeremy@goop.org, hanweidong@huawei.com, jbeulich@suse.com,
	john.liuqiming@huawei.com,
	Paul Voccio <paul.voccio@rackspace.com>,
	Daniel Kiper <daniel.kiper@oracle.com>,
	Major Hayden <major.hayden@rackspace.com>,
	liuyingdong@huawei.com, aliguori@amazon.com,
	xiantao.zxt@alibaba-inc.com, lars.kurth@citrix.com,
	Steven Wilson <steven.wilson@rackspace.com>,
	peter.huangpeng@huawei.com, msw@amazon.com,
	xen-devel@lists.xenproject.org,
	Rick Harris <rick.harris@rackspace.com>,
	boris.ostrovsky@oracle.com,
	Josh Kearney <josh.kearney@rackspace.com>,
	jinsong.liu@alibaba-inc.com,
	Antony Messerli <amesserl@rackspace.com>,
	konrad@darnok.org, fanhenglong@huawei.com,
	andrew.cooper3@citrix.com
Subject: Re: [RFC v2] xSplice design
Date: Mon, 8 Jun 2015 11:19:45 -0400	[thread overview]
Message-ID: <20150608151945.GO15682@l.oracle.com> (raw)
In-Reply-To: <5575A8F7.3070006@amazon.com>

. snip ..
> >> * You may need support for adapting or augmenting exception tables if
> >>   patching such code is desired (it probably is).  Hotpatches may need
> >>   to bring their own small exception tables (similar to how Linux
> >>   modules support this).  If you don't plan on supporting hotpatches
> >>   that introduce additional exception-locations, one could also change
> >>   the exception table in-place and reorder it afterwards.
> > 
> > Each patch carries 'section' structures which define what kind
> > of massaging needs to be done. As in each of these 'section' structues
> > says:
> >  - At the original address X there was an excetion table
> >  - (or) At the origian address Y there was an alt assembler
> > 
> > And we would:
> >  - During 'check' state, confirm that indeed X is in the exception table
> >    (or Y in the alt assembler)
> > 
> >  - During the apply state, fix the exception table X offset to point to
> >    the new virtual address.
> > 
> > Or perhaps I am over-simplying it? My recollection of the exception
> > table code is that it would be mostly dealing with the table and
> > changing the virtual address, but I hadn't dug it in details.
> 
> A simple approach would indeed be to patch the table in-place with the
> new addresses for the replacement functions and fix-up sections.  But,
> you would also have to reorder the table to keep the binary search working.
> 
> And of course this approach would not support adding additional entries
> to the table as it is allocated at compile / link time.  So you cannot
> support a hotpatch that would introduce an additional entry.
> 
> Linux modules, in contrast can bring their own exception tables and
> those are walked by the handler whenever the main table does not contain
> an entry.  I have not implemented that aspect yet, but would consider
> this to be the most desirable design upon first look.

It is in some way an implementation part. I will include it in the doc
as there are many parts here and having them all nicely outlined
makes my head spin less.
.. snip..
> >>>
> >>> We must also have a mechanism to: provide an copy of the old code - so that
> >>> the hypervisor can verify it against the code in memory; the new code;
> >>
> >> As Xen has no stable in-hypervisor API / ABI, you need to make sure
> >> that a generated module matches a target hypervisor.  In our design,
> >> we use build IDs for that (ld --build-id).  We embed build IDs at Xen
> >> compile time and can query a running hypervisor for its ID and only
> >> load matching patches.
> >>
> >> This seems to be an alternative to your proposal to include old code
> >> into hotpatch modules.
> > 
> > That is much simpler.
> 
> Just to clarify, are you agreeing that the build ID approach is much
> simpler?

Yes.
> 
> > There is a nice part of the old code check - you
> > can check (and deal with) patching an already patched code.
> > As in, if the payload was configured to be applied on top of an already
> > patched function it would patch nicely. But if the payload is against
> > the virgin code - and the hypervisor is running an older patch, we would
> > bail out.
> 
> You can do that too with the build IDs if there is some mechanism that
> loads hotpatches in the same order as they were built in (if they
> overlap).  The simplest approach that comes to mind is a hotpatch stack,
> instead of independent patches.

True. Murphy law though says somebody will do this in reverse order :-)
And that is my worry - some system admin will reverse the order, or pick
an patch out of order, and we end up patching .. and things eventually
break and blow up.

  reply	other threads:[~2015-06-08 15:20 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-15 19:44 [RFC v2] xSplice design Konrad Rzeszutek Wilk
2015-05-18 12:41 ` Jan Beulich
2015-06-05 14:49   ` Konrad Rzeszutek Wilk
2015-06-05 15:16     ` Jan Beulich
2015-06-05 16:00       ` Konrad Rzeszutek Wilk
2015-06-05 16:14         ` Jan Beulich
2015-05-18 12:54 ` Liuqiming (John)
2015-05-18 13:11   ` Daniel Kiper
2015-06-05 14:50   ` Konrad Rzeszutek Wilk
2015-05-19 19:13 ` Lars Kurth
2015-05-20 15:11 ` Martin Pohlack
2015-06-05 15:00   ` Konrad Rzeszutek Wilk
2015-06-05 15:15     ` Andrew Cooper
2015-06-05 15:27     ` Jan Beulich
2015-06-08  8:34       ` Martin Pohlack
2015-06-08  8:51         ` Jan Beulich
2015-06-08 14:38     ` Martin Pohlack
2015-06-08 15:19       ` Konrad Rzeszutek Wilk [this message]
2015-06-12 11:51         ` Martin Pohlack
2015-06-12 14:06           ` Konrad Rzeszutek Wilk
2015-06-12 11:39 ` Martin Pohlack
2015-06-12 14:03   ` Konrad Rzeszutek Wilk
2015-06-12 14:31     ` Martin Pohlack
2015-06-12 14:43       ` Jan Beulich
2015-06-12 17:31         ` Martin Pohlack
2015-06-12 18:46           ` Konrad Rzeszutek Wilk
2015-06-12 16:09       ` Konrad Rzeszutek Wilk
2015-06-12 16:17         ` Andrew Cooper
2015-06-12 16:39           ` Konrad Rzeszutek Wilk
2015-06-12 18:36             ` Martin Pohlack
2015-06-12 18:51               ` Konrad Rzeszutek Wilk
2015-07-06 19:36         ` Konrad Rzeszutek Wilk
2015-10-27 12:05   ` Ross Lagerwall
2015-10-29 16:55     ` Ross Lagerwall
2015-10-30 10:39       ` Martin Pohlack
2015-10-30 14:03         ` Ross Lagerwall
2015-10-30 14:06           ` Martin Pohlack

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=20150608151945.GO15682@l.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=aliguori@amazon.com \
    --cc=amesserl@rackspace.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=daniel.kiper@oracle.com \
    --cc=elena.ufimtseva@oracle.com \
    --cc=fanhenglong@huawei.com \
    --cc=hanweidong@huawei.com \
    --cc=jbeulich@suse.com \
    --cc=jeremy@goop.org \
    --cc=jinsong.liu@alibaba-inc.com \
    --cc=john.liuqiming@huawei.com \
    --cc=josh.kearney@rackspace.com \
    --cc=konrad@darnok.org \
    --cc=lars.kurth@citrix.com \
    --cc=liuyingdong@huawei.com \
    --cc=major.hayden@rackspace.com \
    --cc=mpohlack@amazon.com \
    --cc=msw@amazon.com \
    --cc=paul.voccio@rackspace.com \
    --cc=peter.huangpeng@huawei.com \
    --cc=rick.harris@rackspace.com \
    --cc=steven.wilson@rackspace.com \
    --cc=xen-devel@lists.xenproject.org \
    --cc=xiantao.zxt@alibaba-inc.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;
as well as URLs for NNTP newsgroup(s).