Messages in this thread Patch in this message | | | From | Padmanabha Srinivasaiah <> | Subject | [PATCH v2] kallsyms: strip ThinLTO postfix ".cfi_jt" | Date | Tue, 27 Jul 2021 16:06:15 +0200 |
| |
Clang ThinLTO adds a postfix ".cfi_jt" to a symbols of extern functions. For example this breaks syscall tracer that doesn't expect such postfix, so strip out the postfix from the output.
Signed-off-by: Padmanabha Srinivasaiah <treasure4paddy@gmail.com> --- Change in v2: - Use existing routine in kallsyms to strip postfix ".cfi_jt" from extern function name. - Modified the commit message accordingly
kernel/kallsyms.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c index 0ba87982d017..e9148626ae6c 100644 --- a/kernel/kallsyms.c +++ b/kernel/kallsyms.c @@ -166,16 +166,20 @@ static unsigned long kallsyms_sym_address(int idx) #if defined(CONFIG_CFI_CLANG) && defined(CONFIG_LTO_CLANG_THIN) /* - * LLVM appends a hash to static function names when ThinLTO and CFI are - * both enabled, i.e. foo() becomes foo$707af9a22804d33c81801f27dcfe489b. - * This causes confusion and potentially breaks user space tools, so we - * strip the suffix from expanded symbol names. + * LLVM appends a hash to static function names and just ".cfi_jt" postfix + * for non-static functions when both ThinLTO and CFI are enabled, + * i.e. for example foo() becomes foo$707af9a22804d33c81801f27dcfe489b. + * This causes confusion and potentially breaks user space tools and + * built-in components, so we strip the suffix from expanded symbol names. */ static inline bool cleanup_symbol_name(char *s) { char *res; res = strrchr(s, '$'); + if (!res) + res = strstr(s, ".cfi_jt"); + if (res) *res = '\0'; -- 2.17.1
| |