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: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>,
	Ross Lagerwall <ross.lagerwall@citrix.com>, <doebel@amazon.de>,
	<xen-devel@lists.xenproject.org>
Subject: Re: [PATCH 3/3] livepatch: correctly handle altinstruction sections
Date: Fri, 11 Mar 2022 09:12:23 +0100	[thread overview]
Message-ID: <YisEZ2gYrVIAozYU@Air-de-Roger> (raw)
In-Reply-To: <2e2781eb-2c62-1c93-ef8e-75054a213fb8@suse.com>

On Fri, Mar 11, 2022 at 08:35:18AM +0100, Jan Beulich wrote:
> On 10.03.2022 16:08, Roger Pau Monne wrote:
> > --- a/common.c
> > +++ b/common.c
> > @@ -249,19 +249,22 @@ int is_text_section(struct section *sec)
> >  		(sec->sh.sh_flags & SHF_EXECINSTR));
> >  }
> >  
> > +#define SEC_MATCH(n) !strncmp(sec->name, n, strlen(n) - 1)
> >  int is_rodata_section(struct section *sec)
> >  {
> >  	return sec->sh.sh_type == SHT_PROGBITS &&
> >  	       !(sec->sh.sh_flags & (SHF_EXECINSTR | SHF_WRITE)) &&
> > -	       !strncmp(sec->name, ".rodata", 7);
> > +	       (SEC_MATCH(".rodata") || SEC_MATCH(".data.ro_after_init"));
> >  }
> >  
> >  int is_init_section(struct section *sec)
> >  {
> >  	return sec->sh.sh_type == SHT_PROGBITS &&
> >  	       (sec->sh.sh_flags & SHF_ALLOC) &&
> > -	       !strncmp(sec->name, ".init", 5);
> > +	       (SEC_MATCH(".init") || SEC_MATCH(".text.startup") ||
> > +	        SEC_MATCH(".altinstr") || SEC_MATCH(".ctors"));
> 
> Having dealt with this recently - what about .init_array? Modern gcc
> prefers that over .ctors. Of course the question is whether either
> really needs dealing with here - these sections, to my knowledge,
> appear only with gcov support enabled. Not sure that's a case where
> livepatching is actually expected to be used.

.init_array will match the .init comparison, and thus is already
handled.

Regarding .ctors, it's certainly an .init section, so it doesn't hurt
to get added here in any case? (regardless of us only knowing it being
used for code coverage so far)

Thanks, Roger.


  reply	other threads:[~2022-03-11  8:12 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-10 15:08 [PATCH 0/3] livepatch: further fixes Roger Pau Monne
2022-03-10 15:08 ` [PATCH 1/3] livepatch: use basename to perform object file matching Roger Pau Monne
2022-03-10 17:22   ` Doebel, Bjoern
2022-03-10 15:08 ` [PATCH 2/3] livepatch: add extra efi/ objects to be ignored Roger Pau Monne
2022-03-10 17:23   ` Doebel, Bjoern
2022-03-10 15:08 ` [PATCH 3/3] livepatch: correctly handle altinstruction sections Roger Pau Monne
2022-03-10 17:25   ` Doebel, Bjoern
2022-03-11  7:35   ` Jan Beulich
2022-03-11  8:12     ` Roger Pau Monné [this message]
2022-03-11  8:18       ` Jan Beulich
2022-03-15 15:41   ` Roger Pau Monné

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=YisEZ2gYrVIAozYU@Air-de-Roger \
    --to=roger.pau@citrix.com \
    --cc=doebel@amazon.de \
    --cc=jbeulich@suse.com \
    --cc=konrad.wilk@oracle.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.