Linux Modules
 help / color / mirror / Atom feed
From: Josh Poimboeuf <jpoimboe@kernel.org>
To: Puranjay Mohan <puranjay@kernel.org>
Cc: sashiko-bot@kernel.org, linux-modules@vger.kernel.org,
	 Puranjay Mohan <puranjay12@gmail.com>,
	live-patching@vger.kernel.org
Subject: Re: [PATCH 05/14] objtool/klp: Add .klp.symid for sympos disambiguation
Date: Wed, 12 Aug 2026 13:22:53 -0700	[thread overview]
Message-ID: <anzWBbrO2H0ohACw@jpoimboe> (raw)
In-Reply-To: <m24igzlbxf.fsf@kernel.org>

On Wed, Aug 12, 2026 at 02:13:00PM +0100, Puranjay Mohan wrote:
> Applying the patch below fixes it:
> 
> -- >8 --
> 
> From 93c99313870d7375ab07e494c2d0d971758578eb Mon Sep 17 00:00:00 2001
> From: Puranjay Mohan <puranjay@kernel.org>
> Date: Fri, 7 Aug 2026 11:16:29 -0700
> Subject: [PATCH] objtool/klp: Fix vmlinux .klp.symid link error for
>  .exitcall.exit symbols
> 
> Building a kernel via klp-build fails to link:
> 
>   `__exitcall_aes_mod_exit' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.exitcall.exit' of vmlinux.o
>   `__exitcall_dax_exit' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.exitcall.exit' of vmlinux.o
>   `__exitcall_hid_exit' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.exitcall.exit' of vmlinux.o
>   `__exitcall_usb_serial_module_exit' referenced in section `.klp.symid' of vmlinux.o: defined in discarded section `.exitcall.exit' of vmlinux.o
> 
> module_exit() on a built-in emits a static __exitcall_$fn pointer into
> .exitcall.exit, which vmlinux.lds.h discards unconditionally via
> EXIT_CALL.  When two built-in translation units define a module_exit()
> function of the same name, the resulting local symbols collide,
> symid_needed() sees a duplicate and emits a .klp.symid entry for each,
> referencing symbols the linker then throws away.
> 
> Same-named module_exit() functions are not rare:
> 
>   dax_exit                drivers/dax/device.c, drivers/dax/fsdev.c
>   hid_exit                drivers/hid/hid-core.c, drivers/hid/usbhid/hid-core.c
>   aes_mod_exit            arch/arm64/crypto/aes-ce-ccm-glue.c, lib/crypto/aes.c
>   usb_serial_module_exit  module_usb_serial_driver() expands to this fixed
>                           name in each of its ~49 users
> 
> The last one makes the collision structural rather than accidental: any
> kernel with two built-in USB serial drivers has it.  This is not arch
> specific either; it only requires the objects to be built in rather than
> modular, which is why a monolithic config trips it while a typical
> distro config does not.
> 
> Add .exitcall.exit to the discarded section list so its symbols don't get
> symids.
> 
> This is the same failure mode as "objtool/klp: Fix vmlinux .klp.symid
> link error for .no_trim_symbol symbols", for another unconditionally
> discarded allocated section.
> 
> Fixes: 029223d30162 ("objtool/klp: Add .klp.symid for sympos disambiguation")
> Signed-off-by: Puranjay Mohan <puranjay@kernel.org>

Indeed, I'll add it to the queue, thanks!

-- 
Josh

  reply	other threads:[~2026-08-12 20:22 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-08-03  3:24 [PATCH 00/14] objtool/klp: sympos/module/alternative/etc fixes Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 01/14] objtool/klp: Fix module name normalization for paths with dots Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 02/14] objtool/klp: Normalize Module.symvers paths to module names Josh Poimboeuf
2026-08-03  3:37   ` sashiko-bot
2026-08-03  5:37     ` Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 03/14] objtool/klp: Fix false module dependencies caused by dead relocs Josh Poimboeuf
2026-08-12 17:33   ` Sean Christopherson
2026-08-12 20:27     ` Josh Poimboeuf
2026-08-12 22:31       ` Sean Christopherson
2026-08-03  3:24 ` [PATCH 04/14] objtool/klp: Skip hidden directories when finding objects Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 05/14] objtool/klp: Add .klp.symid for sympos disambiguation Josh Poimboeuf
2026-08-03  3:41   ` sashiko-bot
2026-08-03  5:42     ` Josh Poimboeuf
2026-08-12 13:13       ` Puranjay Mohan
2026-08-12 20:22         ` Josh Poimboeuf [this message]
2026-08-03  3:24 ` [PATCH 06/14] objtool/klp: Fix symbol resolution for duplicate data symbols Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 07/14] module: Add module_kallsyms_on_each_core_symbol() Josh Poimboeuf
2026-08-03  6:24   ` Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 08/14] objtool/klp,livepatch: Resolve module symbols against core kallsyms Josh Poimboeuf
2026-08-03  3:53   ` sashiko-bot
2026-08-03  6:26   ` Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 09/14] objtool/klp: Fix size of empty special section entries Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 10/14] objtool/klp: Ignore replacement offset of empty x86 alternatives Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 11/14] objtool/klp: Explicitly disallow patching or referencing init code/data Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 12/14] objtool/klp: Fix cross-module klp relocation section naming Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 13/14] objtool/klp: Don't match local symbols against exports Josh Poimboeuf
2026-08-03  3:24 ` [PATCH 14/14] objtool/klp: Allow new references to module exports Josh Poimboeuf

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=anzWBbrO2H0ohACw@jpoimboe \
    --to=jpoimboe@kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=live-patching@vger.kernel.org \
    --cc=puranjay12@gmail.com \
    --cc=puranjay@kernel.org \
    --cc=sashiko-bot@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox