[lkml]   [2022]   [Oct]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
Patch in this message
Subject[PATCH 5/5] x86: Add prefix symbols for function padding
When code is compiled with:


functions will have PADDING_BYTES of NOP in front of them. Unwinders
and other things that symbolize code locations will typically
attribute these bytes to the preceding function.

Given that these bytes nominally belong to the following symbol this
mis-attribution is confusing.

Inspired by the fact that CFI_CLANG emits __cfi_##name symbols to
claim these bytes, use objtool to emit __pfx_##name symbols to do
the same when CFI_CLANG is not used.

This then shows the callthunk for symbol 'name' as:


Signed-off-by: Peter Zijlstra (Intel) <>
arch/x86/Kconfig | 4 ++++
scripts/Makefile.lib | 1 +
2 files changed, 5 insertions(+)

--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -2472,6 +2472,10 @@ config CALL_THUNKS
def_bool n

+ def_bool y
+ depends on CALL_THUNKS && !CFI_CLANG
bool "Mitigations for speculative execution vulnerabilities"
default y
--- a/scripts/Makefile.lib
+++ b/scripts/Makefile.lib
@@ -265,6 +265,7 @@ objtool-args-$(CONFIG_STACK_VALIDATION)
objtool-args-$(CONFIG_HAVE_STATIC_CALL_INLINE) += --static-call
objtool-args-$(CONFIG_HAVE_UACCESS_VALIDATION) += --uaccess
objtool-args-$(CONFIG_GCOV_KERNEL) += --no-unreachable

objtool-args = $(objtool-args-y) \
$(if $(delay-objtool), --link) \

 \ /
  Last update: 2022-10-28 21:49    [W:0.209 / U:2.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site