From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: Xen-devel <xen-devel@lists.xenproject.org>,
Jan Beulich <JBeulich@suse.com>,
Ross Lagerwall <ross.lagerwall@citrix.com>
Subject: Re: [PATCH 6/8] xen/livepatch: Support new altcall scheme
Date: Wed, 23 Apr 2025 13:16:49 +0200 [thread overview]
Message-ID: <aAjMIeYaPzxlsV8_@macbook.lan> (raw)
In-Reply-To: <20250423010237.1528582-7-andrew.cooper3@citrix.com>
On Wed, Apr 23, 2025 at 02:02:35AM +0100, Andrew Cooper wrote:
> The new altcall scheme uses an .alt_call_sites section. Wire this up in very
> much the same way as the .altinstructions section, although there is less
> sanity checking necessary.
>
> Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
One nit/comment below.
> ---
> CC: Jan Beulich <JBeulich@suse.com>
> CC: Roger Pau Monné <roger.pau@citrix.com>
> CC: Ross Lagerwall <ross.lagerwall@citrix.com>
> ---
> xen/arch/x86/alternative.c | 6 ++++
> xen/common/livepatch.c | 58 ++++++++++++++++++++++++++++++
> xen/include/xen/alternative-call.h | 8 +++--
> 3 files changed, 70 insertions(+), 2 deletions(-)
>
> diff --git a/xen/arch/x86/alternative.c b/xen/arch/x86/alternative.c
> index f6594e21a14c..22af224f08f7 100644
> --- a/xen/arch/x86/alternative.c
> +++ b/xen/arch/x86/alternative.c
> @@ -479,6 +479,12 @@ int apply_alternatives(struct alt_instr *start, struct alt_instr *end)
> {
> return _apply_alternatives(start, end, true);
> }
> +
> +int livepatch_apply_alt_calls(const struct alt_call *start,
> + const struct alt_call *end)
> +{
> + return apply_alt_calls(start, end);
> +}
> #endif
>
> #define ALT_INSNS (1U << 0)
> diff --git a/xen/common/livepatch.c b/xen/common/livepatch.c
> index 6ce77bf021b7..be9b7e367553 100644
> --- a/xen/common/livepatch.c
> +++ b/xen/common/livepatch.c
> @@ -905,6 +905,64 @@ static int prepare_payload(struct payload *payload,
> #endif
> }
>
> + sec = livepatch_elf_sec_by_name(elf, ".alt_call_sites");
> + if ( sec )
> + {
> +#ifdef CONFIG_ALTERNATIVE_CALL
> + const struct alt_call *a, *start, *end;
> +
> + if ( !section_ok(elf, sec, sizeof(*a)) )
> + return -EINVAL;
> +
> + /* Tolerate an empty .alt_call_sites section... */
> + if ( sec->sec->sh_size == 0 )
You could possibly move this check to the outer `if` condition, and
avoid the alt_call_done label?
As even in the !CONFIG_ALTERNATIVE_CALL case skipping an empty section
would be OK.
Thanks, Roger.
next prev parent reply other threads:[~2025-04-23 11:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-23 1:02 [PATCH 0/8] x86/altcall: Switch to a simpler scheme Andrew Cooper
2025-04-23 1:02 ` [PATCH 1/8] x86/altcall: Split alternative-call.h out of alternative.h Andrew Cooper
2025-04-23 7:55 ` Jan Beulich
2025-04-23 1:02 ` [PATCH 2/8] x86/altcall: Rename alternative_branches() to boot_apply_alt_calls() Andrew Cooper
2025-04-23 7:55 ` Jan Beulich
2025-04-23 1:02 ` [PATCH 3/8] x86/alternatives: Rework information passing into nmi_apply_alternatives() Andrew Cooper
2025-04-23 8:06 ` Jan Beulich
2025-04-23 1:02 ` [PATCH 4/8] x86/alternatives: Factor seal_endbr64() out of _apply_alternatives() Andrew Cooper
2025-04-23 8:07 ` Jan Beulich
2025-04-23 1:02 ` [PATCH 5/8] x86/altcall: Introduce new simpler scheme Andrew Cooper
2025-04-23 8:16 ` Jan Beulich
2025-04-23 1:02 ` [PATCH 6/8] xen/livepatch: Support new altcall scheme Andrew Cooper
2025-04-23 8:20 ` Jan Beulich
2025-04-23 11:16 ` Roger Pau Monné [this message]
2025-04-23 12:04 ` Andrew Cooper
2025-04-23 1:02 ` [PATCH 7/8] x86/altcall: Switch to simpler scheme Andrew Cooper
2025-04-23 9:01 ` Jan Beulich
2025-04-23 9:12 ` Andrew Cooper
2025-04-23 1:02 ` [PATCH 8/8] x86/alternatives: Simplify _apply_alternatives() now altcall is separate Andrew Cooper
2025-04-23 9:03 ` 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=aAjMIeYaPzxlsV8_@macbook.lan \
--to=roger.pau@citrix.com \
--cc=JBeulich@suse.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.