All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel@lists.xenproject.org,
	Ross Lagerwall <ross.lagerwall@citrix.com>
Subject: Re: [PATCH 1/3] xen/livepatch: simplify and unify logic in prepare_payload()
Date: Mon, 23 Sep 2024 09:46:26 +0200	[thread overview]
Message-ID: <ZvEc0qpq2fTJtMjo@macbook.local> (raw)
In-Reply-To: <d7dfa01e-740d-4274-b9fb-8475224ae7a6@citrix.com>

On Sun, Sep 22, 2024 at 11:19:01AM +0200, Andrew Cooper wrote:
> On 20/09/2024 11:36 am, Roger Pau Monne wrote:
> > diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
> > index d93a556bcda2..cea47ffe4c84 100644
> > --- a/xen/common/livepatch.c
> > +++ b/xen/common/livepatch.c
> > @@ -647,15 +647,37 @@ static inline int livepatch_check_expectations(const struct payload *payload)
> >      nhooks = __sec->sec->sh_size / sizeof(*hook);                                         \
> >  } while (0)
> >  
> > +static int fetch_buildid(const struct livepatch_elf_sec *sec,
> > +                         struct livepatch_build_id *id)
> 
> Is this really fetch?  I'd describe it as parse, more than fetch.

I can indeed change the naming.  I've used fetch because it 'fetches'
the contents of livepatch_build_id.

> > +{
> > +    const Elf_Note *n = sec->load_addr;
> > +    int rc;
> > +
> > +    ASSERT(sec);
> 
> This needs to turn back into a runtime check.  Now, if a livepatch is
> missing one of the sections, we'll dereference NULL below, rather than
> leaving no data in the struct livepatch_build_id.

Loading should never get here without those sections being present,
check_special_sections() called earlier will return error if any of
the sections is not present, hence the ASSERT() is fine IMO.

I could do `if ( !sec ) { ASSERT_UNREACHABLE(); return -ENOENT; }`,
but given the code in check_special_sections() that checks the section
presence just ahead it seemed unnecessary convoluted.

Thanks, Roger.


  reply	other threads:[~2024-09-23  7:47 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-20  9:36 [PATCH 0/3] xen/livepatch: improvements to loading Roger Pau Monne
2024-09-20  9:36 ` [PATCH 1/3] xen/livepatch: simplify and unify logic in prepare_payload() Roger Pau Monne
2024-09-22  9:19   ` Andrew Cooper
2024-09-23  7:46     ` Roger Pau Monné [this message]
2024-09-23  9:43       ` Andrew Cooper
2024-09-23 11:00         ` Jan Beulich
2024-09-23 11:01   ` Jan Beulich
2024-09-23 13:10     ` Roger Pau Monné
2024-09-20  9:36 ` [PATCH 2/3] xen/livepatch: do Xen build-id check earlier Roger Pau Monne
2024-09-23 11:04   ` Jan Beulich
2024-09-23 11:04   ` Andrew Cooper
2024-09-23 11:55     ` Andrew Cooper
2024-09-23 16:02     ` Roger Pau Monné
2024-09-20  9:36 ` [PATCH 2/3] xen/livepatch: do " Roger Pau Monne
2024-09-20  9:56   ` Roger Pau Monné
2024-09-20  9:36 ` [PATCH 3/3] x86/alternatives: relax apply BUGs during runtime Roger Pau Monne
2024-09-23 11:12   ` Jan Beulich
2024-09-23 11:17   ` Andrew Cooper
2024-09-23 13:06     ` Roger Pau Monné
2024-09-23 13:12       ` Andrew Cooper

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=ZvEc0qpq2fTJtMjo@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=andrew.cooper3@citrix.com \
    --cc=ross.lagerwall@citrix.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.