[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <qtaf3nlbje7xzrypzn2gevue2uhmrrx6tqvgp3kgzgmia77mmd@ofabxb75cydw>
Date: Thu, 5 Jun 2025 15:14:59 -0700
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Joe Lawrence <joe.lawrence@...hat.com>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>, Miroslav Benes <mbenes@...e.cz>, 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>
Subject: Re: [PATCH v2 45/62] x86/extable: Define ELF section entry size for
exception tables
On Wed, May 28, 2025 at 10:40:55AM -0400, Joe Lawrence wrote:
> On 5/9/25 4:17 PM, Josh Poimboeuf wrote:
> > In preparation for the objtool klp diff subcommand, define the entry
> > size for the __ex_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/asm.h | 20 ++++++++++++--------
> > kernel/extable.c | 2 ++
> > 2 files changed, 14 insertions(+), 8 deletions(-)
> >
> > diff --git a/arch/x86/include/asm/asm.h b/arch/x86/include/asm/asm.h
> > index f963848024a5..62dff336f206 100644
> > --- a/arch/x86/include/asm/asm.h
> > +++ b/arch/x86/include/asm/asm.h
> > @@ -138,15 +138,17 @@ static __always_inline __pure void *rip_rel_ptr(void *p)
> >
> > # include <asm/extable_fixup_types.h>
> >
> > +#define EXTABLE_SIZE 12
> >
> > + > [ ... snip ... ]
> >
>
> EXTABLE_SIZE defined in arch/x86/ ...
>
> > diff --git a/kernel/extable.c b/kernel/extable.c
> > index 71f482581cab..0ae3ee2ef266 100644
> > --- a/kernel/extable.c
> > +++ b/kernel/extable.c
> > @@ -55,6 +55,8 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr)
> > {
> > const struct exception_table_entry *e;
> >
> > + BUILD_BUG_ON(EXTABLE_SIZE != sizeof(struct exception_table_entry));
> > +
>
> but referenced in kernel/ where a non-x86 build like ppc64le build won't
> know what EXTABLE_SIZE is :(
Thanks, I'll move the BUILD_BUG_ON() to the x86 extable code:
diff --git a/arch/x86/mm/extable.c b/arch/x86/mm/extable.c
index bf8dab18be97..d4aae98b3739 100644
--- a/arch/x86/mm/extable.c
+++ b/arch/x86/mm/extable.c
@@ -303,6 +303,8 @@ int fixup_exception(struct pt_regs *regs, int trapnr, unsigned long error_code,
const struct exception_table_entry *e;
int type, reg, imm;
+ BUILD_BUG_ON(EXTABLE_SIZE != sizeof(struct exception_table_entry));
+
#ifdef CONFIG_PNPBIOS
if (unlikely(SEGMENT_IS_PNP_CODE(regs->cs))) {
extern u32 pnp_bios_fault_eip, pnp_bios_fault_esp;
diff --git a/kernel/extable.c b/kernel/extable.c
index 0ae3ee2ef266..71f482581cab 100644
--- a/kernel/extable.c
+++ b/kernel/extable.c
@@ -55,8 +55,6 @@ const struct exception_table_entry *search_exception_tables(unsigned long addr)
{
const struct exception_table_entry *e;
- BUILD_BUG_ON(EXTABLE_SIZE != sizeof(struct exception_table_entry));
-
e = search_kernel_exception_table(addr);
if (!e)
e = search_module_extables(addr);
Powered by blists - more mailing lists