xen-devel.lists.xenproject.org archive mirror
 help / color / mirror / Atom feed
From: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	Stefano Stabellini <sstabellini@kernel.org>,
	Xen-devel <xen-devel@lists.xen.org>,
	Ross Lagerwall <ross.lagerwall@citrix.com>
Subject: Re: [PATCH 1/2] xen/livepatch: Clean up arch relocation handling
Date: Tue, 20 Jun 2017 09:36:15 -0400	[thread overview]
Message-ID: <20170620133615.GF8119@char.us.oracle.com> (raw)
In-Reply-To: <5948F14C02000078001645DF@prv-mh.provo.novell.com>

On Tue, Jun 20, 2017 at 01:56:28AM -0600, Jan Beulich wrote:
> >>> On 20.06.17 at 09:39, <andrew.cooper3@citrix.com> wrote:
> > On 20/06/2017 08:36, Jan Beulich wrote:
> >>>>> On 19.06.17 at 20:18, <konrad.wilk@oracle.com> wrote:
> >>> On Wed, Jun 14, 2017 at 07:28:39PM +0100, Andrew Cooper wrote:
> >>>> Having said that, there is no sanity check that r->r_offset is within
> >>>> base->load_addr + sec->sh_size in arm32, whereas both arm64 and x86
> >>>> appear to do this check.
> >>> True.
> >>>
> >>> And the tricky part (it was to me at least) was that ARM32 is all
> >>> REL and not RELA so the opcode gets modified after the operation.
> >>>
> >>> Which means it gets a bit complex to add a boundary check in
> >>> 'get_addend' .
> >>>
> >>> Hm, it would seem the best way is to add a
> >>>
> >>> if ( r->r_offset >= base->sec->sh_size ||                               
> >>>     (r->r_offset + sizeof(uint32_t)) > base->sec->sh_size )             
> >> Where's the uint32_t coming from here?
> > 
> > ARM32.  It's a range check that (void *)&disp is within r_offset, as it
> > (void *)&disp + sizeof(disp) -1
> 
> But not all ARM32 relocations fiddle with a 32-bit word. Granted all

Correct. However 'dest' (which is what get_addend operates on) at this point
is the combination of base->load_addr + r->r_offset.

It is more of making sure that what 'get_addend' operates on is
within the livepatch and not somewhere outside of it.

Then get_addend can get more fine grain approach to figuring out the
next part - that is based on the instruction whether the offset
there is OK or not (and boy the semantics for ARM32 ELF REL are
a complex beast).

> that livepatch code currently supports are, but baking something like
> this in makes future modifications more error prone.
> 
> Jan
> 

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

  reply	other threads:[~2017-06-20 13:36 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-13 20:51 [PATCH 1/2] xen/livepatch: Clean up arch relocation handling Andrew Cooper
2017-06-13 20:51 ` [PATCH 2/2] xen/livepatch: Don't crash on encountering STN_UNDEF relocations Andrew Cooper
2017-06-13 21:13   ` Andrew Cooper
2017-06-14 10:03     ` Jan Beulich
2017-06-14 10:11   ` Jan Beulich
2017-06-14 10:13     ` Andrew Cooper
2017-06-14 10:24       ` Jan Beulich
2017-06-14 14:18         ` Konrad Rzeszutek Wilk
2017-06-14 18:33           ` Andrew Cooper
2017-06-14 18:49             ` Jan Beulich
2017-06-19 18:30               ` Konrad Rzeszutek Wilk
2017-06-19 23:05                 ` Andrew Cooper
2017-06-20  7:15                   ` Jan Beulich
2017-06-20 13:30                     ` Konrad Rzeszutek Wilk
2017-06-14 19:08             ` Konrad Rzeszutek Wilk
2017-06-21 18:13   ` [PATCH for-4.9 v2] " Andrew Cooper
2017-06-22  1:26     ` Konrad Rzeszutek Wilk
2017-06-22 15:27       ` Konrad Rzeszutek Wilk
2017-06-22 16:10         ` Konrad Rzeszutek Wilk
2017-06-22 16:33           ` Konrad Rzeszutek Wilk
2017-06-22 17:05             ` Konrad Rzeszutek Wilk
2017-06-23  9:44               ` Jan Beulich
2017-06-22  7:40     ` Jan Beulich
2017-06-22  9:49     ` Ross Lagerwall
2017-06-14  9:25 ` [PATCH 1/2] xen/livepatch: Clean up arch relocation handling Jan Beulich
2017-06-14 13:44 ` Konrad Rzeszutek Wilk
2017-06-14 14:02   ` Jan Beulich
2017-06-14 18:28     ` Andrew Cooper
2017-06-19 18:18       ` Konrad Rzeszutek Wilk
2017-06-20  7:36         ` Jan Beulich
2017-06-20  7:39           ` Andrew Cooper
2017-06-20  7:41             ` Andrew Cooper
2017-06-20  7:56             ` Jan Beulich
2017-06-20 13:36               ` Konrad Rzeszutek Wilk [this message]
2017-06-22  1:27 ` Is [PATCH for-4.9] Was:Re: " 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=20170620133615.GF8119@char.us.oracle.com \
    --to=konrad.wilk@oracle.com \
    --cc=JBeulich@suse.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=julien.grall@arm.com \
    --cc=ross.lagerwall@citrix.com \
    --cc=sstabellini@kernel.org \
    --cc=xen-devel@lists.xen.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).