From: Ross Lagerwall <ross.lagerwall@citrix.com>
To: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Cc: xen-devel@lists.xenproject.org
Subject: Re: Livepatch, symbol resolutions between two livepatchs (new_symbol=0)
Date: Thu, 11 Aug 2016 09:11:10 +0100 [thread overview]
Message-ID: <c434b489-c304-0c04-d3a6-5f8025562ed5@citrix.com> (raw)
In-Reply-To: <20160811012831.GB11611@localhost.localdomain>
On 08/11/2016 02:28 AM, Konrad Rzeszutek Wilk wrote:
> Hey Ross,
>
> I am running in a symbol dependency issue that I am not exactly
> sure how to solve.
>
> I have an payload that introduces a new function (xen_foobar) which
> will patch over xen_extra_version().
>
snip
>
> As livepatch_symbols_lookup_by_name only looks for symbols that
> have the ->new_symbol set. And xen_foobar does not. So the loading is
> aborted.
>
> Which makes sense - we don't want to match the symbols as they haven't
> really been "finally loaded" in.
>
> But what if the xen_foobar is applied. In that case we should
> change the xen_foobar to be new_symbol=1?
I think you're confused about the purpose of new_symbol. The purpose is
to ensure that you link against the correct symbol from the base
hypervisor or the live patch that first introduced it. So, new_symbol=0
is when a symbol overrides an existing symbol. new_symbol=1 is set when
a symbol is new introduced in a live patch.
Since all the linking happens during load and not apply, it is perfectly
OK to link against a symbol that hasn't been applied -- the dependencies
are there to ensure that you can't apply a patch which links against
unapplied symbols.
The assumption is that when overriding an existing symbol, the symbol in
the payload has the same name as the one it is overriding. You're having
issues above because you're breaking this assumption.
>
> This following patch does that, but I am wondering if there is a better
> way?
The patch is misusing new_symbol for something completely different from
how it was intended so I hope there is a better way :-P
>
> P.S.
> The reason for this is that I am trying to implement NOP patching.
> And to have some regression testing of this I wrote an function
> (xen_foobar) which calls two functions: foo and bar - and their output is what
> the call to XENVER_extra_version will show (b/c we patch over
> xen_extra_version()).
>
> Then there is another payload - which will want to NOP the call to
> the 'bar' function inside xen_foobar. And for that I need to be able to
> lookup the symbol of xen_foobar.
This is quite a different use case from what currently exists. Currently
we're only ever interested in writing over the start of the function
pointed to by a symbol from the base hypervisor or first instance of a
symbol in a live patch (aka new_symbol=1). Now you need to be able to
lookup and write over an arbitrary symbol -- how do you choose between
the n different loaded versions of the same symbol?
I must admit to not seeing the point in NOP patching. It just seems to
be a special case of arbitrary data patching that could be more easily
achieved using other means.
Let's have a discussion about this and the symbol issues here at the Xen
Summit in a couple of weeks time.
--
Ross Lagerwall
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-08-11 8:11 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-11 1:28 Livepatch, symbol resolutions between two livepatchs (new_symbol=0) Konrad Rzeszutek Wilk
2016-08-11 8:11 ` Ross Lagerwall [this message]
2016-08-12 13:51 ` Konrad Rzeszutek Wilk
2016-08-12 15:45 ` Konrad Rzeszutek Wilk
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=c434b489-c304-0c04-d3a6-5f8025562ed5@citrix.com \
--to=ross.lagerwall@citrix.com \
--cc=konrad.wilk@oracle.com \
--cc=xen-devel@lists.xenproject.org \
/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).