All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Jan Beulich <jbeulich@suse.com>
Cc: Ross Lagerwall <ross.lagerwall@citrix.com>,
	xen-devel@lists.xenproject.org
Subject: Re: [PATCH 1/3] xen/livepatch: simplify and unify logic in prepare_payload()
Date: Mon, 23 Sep 2024 15:10:31 +0200	[thread overview]
Message-ID: <ZvFoxyWcd_7TCHdI@macbook.local> (raw)
In-Reply-To: <83886b54-8687-4b4b-b356-7093758498d9@suse.com>

On Mon, Sep 23, 2024 at 01:01:57PM +0200, Jan Beulich wrote:
> On 20.09.2024 11:36, Roger Pau Monne wrote:
> > The following sections: .note.gnu.build-id, .livepatch.xen_depends and
> > .livepatch.depends are mandatory and ensured to be present by
> > check_special_sections() before prepare_payload() is called.
> > 
> > Simplify the logic in prepare_payload() by introducing a generic function to
> > parse the sections that contain a buildid.  Note the function assumes the
> > buildid related section to always be present.
> > 
> > No functional change intended.
> > 
> > Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
> > ---
> >  xen/common/livepatch.c | 106 ++++++++++++++++++-----------------------
> >  1 file changed, 46 insertions(+), 60 deletions(-)
> > 
> > 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)
> > +{
> > +    const Elf_Note *n = sec->load_addr;
> > +    int rc;
> > +
> > +    ASSERT(sec);
> > +
> > +    if ( sec->sec->sh_size <= sizeof(*n) )
> > +        return -EINVAL;
> 
> Oh, after my reply to Andrew's reply, now looking at the actual change -
> is it perhaps ASSERT(sec->sec) that was meant?

The original check before moving the code was against 'sec', not
'sec->sec'.  That's what I intending to retain with the assert.

I can do the `n = sec->load_addr` assign after the assert if that's
better analysis wise.

Thanks, Roger.


  reply	other threads:[~2024-09-23 13:10 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é
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é [this message]
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=ZvFoxyWcd_7TCHdI@macbook.local \
    --to=roger.pau@citrix.com \
    --cc=jbeulich@suse.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.