From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: ross.lagerwall@citrix.com, andrew.cooper3@citrix.com,
mpohlack@amazon.com, xen-devel@lists.xensource.com,
Marcos Matsunaga <Marcos.Matsunaga@oracle.com>
Subject: Livepatch for Xen 4.9
Date: Mon, 3 Oct 2016 10:16:41 -0400 [thread overview]
Message-ID: <20161003141641.GG20896@char.us.oracle.com> (raw)
Hey!
[CC-ing xen-devel]
Xen 4.8-rc1 is out and means taking a break from some of the Livepatch hypervisor
parts for me.
My plan for 4.8 is to concentrate on any livepatch fallout and doing OSSTest along
with Marcos (CC-ed) and see if we can wrestle it to expand on what
we want to have done.
However going forward (Xen 4.9) I believe the top issues we need
to get addressed are:
a) "A better mechanism to "mask" NMIs during patching. The existing mechanism looses
NMI if they have been sent and we don't have a mechanism to replay them. Note that
this is also fixes alternative section patching. Could (like Linux) annotate handlers don't get patched."
(https://wiki.xenproject.org/wiki/LivePatch).
b) Restart the shrinking of code using__LINE__
c) When figuring out the new_addr, take into account name being <symbol>+<offset>.
d) Make asm code be in its own section. That eases the livepatch tools work in figuring out a change.
See https://lkml.org/lkml/2009/2/24/364
e) ?
g) Make XENPF_get_symbol also include Live Patch symbols.
I was wondering if folks could put in their preference and what they are thinking
to work on during 4.9?
During 4.8 I took a stab at a) and c).
The 'a)' is a thorny one as:
1) If we get an NMI during patching we better not be patching MCE/NMI code! This could be avoided
by annotating all the MCE/NMI code and have a 'blacklist' of functions that MUST NEVER BE PATCHED.
But that may be difficult as that code can reach in many parts (especially MCE which wants to
send an event channel, hence touches normal event channel code).
2) We could also do some form of restartable patching. That is seed the code (where we are going to
put a trampoline) with 'CC'. Then do memcpy over the the 'CC' the new instructions (jump). If the
NMI/MCE handler hits that code it would call the int3 - which we expand now to take over and check
whether the EIP is in the location which we just seeded with 'CC' - and if so it can memcpy the
trampoline code in (with a slight twist - we first memcpy the displacement, so the start of a function
would be say: CC 00 23 00 10 - and then we do a single write to replace 'CC' with 'E9').
We could also (to combat bitrotting) change this a bit more - the debugger handler is in charge of
actually memcpying and the arch_livepatch_apply just calls 'int 3' (after it has seeded the area with 'CC').
Either of this would would require some global livepatch->debugger handler handover structure with
the EIP to patch over and the insns.
The 'c)' needs a bit more work.
Also I was thinking we can drop the IRC meeting we have setup. It has been quite useful during the
starting stage to re-sync patches but at this point I think emails are more suited?
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next reply other threads:[~2016-10-03 14:16 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-10-03 14:16 Konrad Rzeszutek Wilk [this message]
2016-10-03 14:37 ` Livepatch for Xen 4.9 Jan Beulich
2016-10-03 15:33 ` Andrew Cooper
2016-10-24 11:25 ` Ross Lagerwall
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=20161003141641.GG20896@char.us.oracle.com \
--to=konrad.wilk@oracle.com \
--cc=Marcos.Matsunaga@oracle.com \
--cc=andrew.cooper3@citrix.com \
--cc=mpohlack@amazon.com \
--cc=ross.lagerwall@citrix.com \
--cc=xen-devel@lists.xensource.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).