Skip to content

Commit f495054

Browse files
committed
objtool/klp: Fix unexported static call key access for manually built livepatch modules
Enabling CONFIG_MEM_ALLOC_PROFILING_DEBUG with CONFIG_SAMPLE_LIVEPATCH results in the following error: samples/livepatch/livepatch-shadow-fix1.o: error: objtool: static_call: can't find static_call_key symbol: __SCK__WARN_trap This is caused an extra file->klp sanity check which was added by commit 164c920 ("objtool: Add base objtool support for livepatch modules"). That check was intended to ensure that livepatch modules built with klp-build always have full access to their static call keys. However, it failed to account for the fact that manually built livepatch modules (i.e., not built with klp-build) might need access to unexported static call keys, for which read-only access is typically allowed for modules. While the livepatch-shadow-fix1 module doesn't explicitly use any static calls, it does have a memory allocation, which can cause CONFIG_MEM_ALLOC_PROFILING_DEBUG to insert a WARN() call. And WARN() is now an unexported static call as of commit 860238a ("x86_64/bug: Inline the UD1"). Fix it by removing the overzealous file->klp check, restoring the original behavior for manually built livepatch modules. Fixes: 164c920 ("objtool: Add base objtool support for livepatch modules") Reported-by: Arnd Bergmann <arnd@arndb.de> Acked-by: Song Liu <song@kernel.org> Tested-by: Arnd Bergmann <arnd@arndb.de> Link: https://patch.msgid.link/0bd3ae9a53c3d743417fe842b740a7720e2bcd1c.1770058775.git.jpoimboe@kernel.org Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
1 parent 1832854 commit f495054

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

tools/objtool/check.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -682,7 +682,7 @@ static int create_static_call_sections(struct objtool_file *file)
682682

683683
key_sym = find_symbol_by_name(file->elf, tmp);
684684
if (!key_sym) {
685-
if (!opts.module || file->klp) {
685+
if (!opts.module) {
686686
ERROR("static_call: can't find static_call_key symbol: %s", tmp);
687687
return -1;
688688
}

0 commit comments

Comments
 (0)