All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Roger Pau Monne <roger.pau@citrix.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 08:35:18 +0100	[thread overview]
Message-ID: <2e2781eb-2c62-1c93-ef8e-75054a213fb8@suse.com> (raw)
In-Reply-To: <20220310150834.98815-4-roger.pau@citrix.com>

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.

Jan



  parent reply	other threads:[~2022-03-11  7:35 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 [this message]
2022-03-11  8:12     ` Roger Pau Monné
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=2e2781eb-2c62-1c93-ef8e-75054a213fb8@suse.com \
    --to=jbeulich@suse.com \
    --cc=doebel@amazon.de \
    --cc=konrad.wilk@oracle.com \
    --cc=roger.pau@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.