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: Stefano Stabellini <sstabellini@kernel.org>,
	ross.lagerwall@citrix.com,
	Andrew Cooper <andrew.cooper3@citrix.com>,
	Julien Grall <julien.grall@arm.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH v3 6/9] livepatch: Add parsing for the symbol+0x<offset>/<len>
Date: Mon, 15 Aug 2016 10:35:22 -0400	[thread overview]
Message-ID: <20160815143522.GI26970@char.us.oracle.com> (raw)
In-Reply-To: <57B1BB5C0200007800105E76@prv-mh.provo.novell.com>

On Mon, Aug 15, 2016 at 04:53:48AM -0600, Jan Beulich wrote:
> >>> On 14.08.16 at 23:52, <konrad.wilk@oracle.com> wrote:
> > in case we want to patch at specific offsets inside
> > a function. (for example if we want to do NOP patching).
> > 
> > We also assume that the 'len' is only the size of
> > an isns that would be for a call opcode (so 5 bytes
> > on x86, and 4 on ARM 32/64).
> 
> Which makes the notation using a slash quite confusing: Normally
> if we see <symbol>+<offset>/<length> the length part is assumed
> to be the overall size of the object/function the name refers to.

Oh, I somehow had the length of instruction on my mind.

> Could I talk you into using a different separator, like colon or
> semicolon?

Of course. Whatever is easier to folks.

I can also ditch the <length> part altogether?

> 
> > --- a/xen/common/livepatch.c
> > +++ b/xen/common/livepatch.c
> > @@ -234,14 +234,46 @@ static const char *livepatch_symbols_lookup(unsigned long addr,
> >  
> >  static int lookup_symbol(struct livepatch_func *f, struct livepatch_elf *elf)
> >  {
> > +    const char *s;
> > +    char *plus = NULL, *slash = NULL;
> 
> Pointless initializers, afaict. Also the latter can be const.
> 
> > +    unsigned long offset = 0;
> > +
> >      if ( f->old_addr )
> >          return 0;
> >  
> > +    s = f->name;
> > +    /* +<offset>/<len> */
> > +    plus = strchr(f->name, '+');
> > +    if ( plus )
> > +    {
> > +        slash = strchr(plus, '/');
> > +
> > +        if ( slash )
> > +        {
> > +            const char *endp = NULL;
> > +            unsigned int len;
> > +
> > +            offset = simple_strtoul(plus+1, &endp, 16);
> 
> Missing blanks around +.
> 
> > +            if ( endp != slash )
> > +                return -EINVAL;
> > +
> > +            len = simple_strtoul(slash+1, NULL, 16);
> 
> Would you perhaps want to be even more precise and verify that
> nothing follows this number?

/me nods.
> 
> Jan
> 

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

  reply	other threads:[~2016-08-15 14:35 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-14 21:52 [PATCH v3] Livepatch fixes and features for v4.8 Konrad Rzeszutek Wilk
2016-08-14 21:52 ` [PATCH v3 1/9] livepatch: Clear .bss when payload is reverted Konrad Rzeszutek Wilk
2016-08-15 10:27   ` Jan Beulich
2016-08-15 14:29     ` Konrad Rzeszutek Wilk
2016-08-15 15:10       ` Jan Beulich
2016-08-19  8:37         ` Ross Lagerwall
2016-08-19  8:42           ` Jan Beulich
2016-08-14 21:52 ` [PATCH v3 2/9] livepatch: Deal with payloads without any .text Konrad Rzeszutek Wilk
2016-08-15 10:28   ` Jan Beulich
2016-08-19  9:31   ` Ross Lagerwall
2016-08-14 21:52 ` [PATCH v3 3/9] version/livepatch: Move xen_build_id_check to version.h Konrad Rzeszutek Wilk
2016-08-15 10:35   ` Jan Beulich
2016-08-19  9:29   ` Ross Lagerwall
2016-08-14 21:52 ` [PATCH v3 4/9] livepatch: Sync cache of build-id before using it first time Konrad Rzeszutek Wilk
2016-08-15 10:38   ` Jan Beulich
2016-08-15 10:46     ` Andrew Cooper
2016-08-15 14:33       ` Konrad Rzeszutek Wilk
2016-08-14 21:52 ` [PATCH v3 5/9] livepatch: Move code from prepare_payload to own routine Konrad Rzeszutek Wilk
2016-08-15 10:41   ` Jan Beulich
2016-08-19  9:37   ` Ross Lagerwall
2016-08-14 21:52 ` [PATCH v3 6/9] livepatch: Add parsing for the symbol+0x<offset>/<len> Konrad Rzeszutek Wilk
2016-08-15 10:53   ` Jan Beulich
2016-08-15 14:35     ` Konrad Rzeszutek Wilk [this message]
2016-08-15 15:12       ` Jan Beulich
2016-08-15 15:21         ` Konrad Rzeszutek Wilk
2016-08-14 21:52 ` [PATCH v3 7/9] livepatch: NOP if func->new_[addr, size] is zero Konrad Rzeszutek Wilk
2016-08-15 10:59   ` Jan Beulich
2016-08-15 14:38     ` Konrad Rzeszutek Wilk
2016-08-14 21:52 ` [PATCH v3 8/9] symbols: Generate an xen-sym.map Konrad Rzeszutek Wilk
2016-08-15 11:02   ` Jan Beulich
2016-08-14 21:52 ` [PATCH v3 9/9] livepach: Add .livepatch.hooks functions and test-case Konrad Rzeszutek Wilk
2016-08-15 11:15   ` Jan Beulich
2016-08-15 14:46     ` Konrad Rzeszutek Wilk
2016-08-15 15:17       ` Jan Beulich

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=20160815143522.GI26970@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.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).