[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250627104818.GW1613200@noisy.programming.kicks-ass.net>
Date: Fri, 27 Jun 2025 12:48:18 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>, Miroslav Benes <mbenes@...e.cz>,
Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org, Song Liu <song@...nel.org>,
laokz <laokz@...mail.com>, Jiri Kosina <jikos@...nel.org>,
Marcos Paulo de Souza <mpdesouza@...e.com>,
Weinan Liu <wnliu@...gle.com>,
Fazla Mehrab <a.mehrab@...edance.com>,
Chen Zhongjin <chenzhongjin@...wei.com>,
Puranjay Mohan <puranjay@...nel.org>,
Dylan Hatch <dylanbhatch@...gle.com>
Subject: Re: [PATCH v3 44/64] x86/jump_label: Define ELF section entry size
for jump labels
On Thu, Jun 26, 2025 at 04:55:31PM -0700, Josh Poimboeuf wrote:
> In preparation for the objtool klp diff subcommand, define the entry
> size for the __jump_table section in its ELF header. This will allow
> tooling to extract individual entries.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
> ---
> arch/x86/include/asm/jump_label.h | 17 +++++++++++------
> kernel/bounds.c | 4 ++++
> 2 files changed, 15 insertions(+), 6 deletions(-)
>
> diff --git a/arch/x86/include/asm/jump_label.h b/arch/x86/include/asm/jump_label.h
> index cd21554b3675..7a6b0e5d85c1 100644
> --- a/arch/x86/include/asm/jump_label.h
> +++ b/arch/x86/include/asm/jump_label.h
> @@ -12,12 +12,17 @@
> #include <linux/stringify.h>
> #include <linux/types.h>
>
> -#define JUMP_TABLE_ENTRY(key, label) \
> - ".pushsection __jump_table, \"a\"\n\t" \
> - _ASM_ALIGN "\n\t" \
> - ".long 1b - . \n\t" \
> - ".long " label " - . \n\t" \
> - _ASM_PTR " " key " - . \n\t" \
> +#ifndef COMPILE_OFFSETS
> +#include <generated/bounds.h>
> +#endif
> +
> +#define JUMP_TABLE_ENTRY(key, label) \
> + ".pushsection __jump_table, \"aM\", @progbits, " \
> + __stringify(JUMP_ENTRY_SIZE) "\n\t" \
Argh, can you please not do this line-break. Yes it'll be long, but this
is most confusing.
> + _ASM_ALIGN "\n\t" \
> + ".long 1b - . \n\t" \
> + ".long " label " - . \n\t" \
> + _ASM_PTR " " key " - . \n\t" \
> ".popsection \n\t"
>
> /* This macro is also expanded on the Rust side. */
> diff --git a/kernel/bounds.c b/kernel/bounds.c
> index 02b619eb6106..e4c7ded3dc48 100644
> --- a/kernel/bounds.c
> +++ b/kernel/bounds.c
> @@ -13,6 +13,7 @@
> #include <linux/kbuild.h>
> #include <linux/log2.h>
> #include <linux/spinlock_types.h>
> +#include <linux/jump_label.h>
>
> int main(void)
> {
> @@ -29,6 +30,9 @@ int main(void)
> #else
> DEFINE(LRU_GEN_WIDTH, 0);
> DEFINE(__LRU_REFS_WIDTH, 0);
> +#endif
> +#if defined(CONFIG_HAVE_ARCH_JUMP_LABEL_RELATIVE) && defined(CONFIG_JUMP_LABEL)
How is HAVE_ARCH_JUMP_LABEL_RELATIVE relevant here?
> + DEFINE(JUMP_ENTRY_SIZE, sizeof(struct jump_entry));
> #endif
> /* End of constants */
>
> --
> 2.49.0
>
Powered by blists - more mailing lists