kallsyms: Drop CONFIG_CFI_CLANG workarounds
authorSami Tolvanen <samitolvanen@google.com>
Thu, 8 Sep 2022 21:55:00 +0000 (14:55 -0700)
committerKees Cook <keescook@chromium.org>
Mon, 26 Sep 2022 17:13:15 +0000 (10:13 -0700)
With -fsanitize=kcfi, the compiler no longer renames static
functions with CONFIG_CFI_CLANG + ThinLTO. Drop the code that cleans
up the ThinLTO hash from the function names.

Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Reviewed-by: Kees Cook <keescook@chromium.org>
Tested-by: Kees Cook <keescook@chromium.org>
Tested-by: Nathan Chancellor <nathan@kernel.org>
Acked-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Tested-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Kees Cook <keescook@chromium.org>
Link: https://lore.kernel.org/r/20220908215504.3686827-19-samitolvanen@google.com
kernel/kallsyms.c

index 3e7e2c2ad2f75ef603c32750e94c7afe5fdef994..b27e6ea31f8bc3ededc2b9b290861f7c14e57bc1 100644 (file)
@@ -159,7 +159,6 @@ static bool cleanup_symbol_name(char *s)
         * character in an identifier in C. Suffixes observed:
         * - foo.llvm.[0-9a-f]+
         * - foo.[0-9a-f]+
-        * - foo.[0-9a-f]+.cfi_jt
         */
        res = strchr(s, '.');
        if (res) {
@@ -167,22 +166,6 @@ static bool cleanup_symbol_name(char *s)
                return true;
        }
 
-       if (!IS_ENABLED(CONFIG_CFI_CLANG) ||
-           !IS_ENABLED(CONFIG_LTO_CLANG_THIN) ||
-           CONFIG_CLANG_VERSION >= 130000)
-               return false;
-
-       /*
-        * Prior to LLVM 13, the following suffixes were observed when thinLTO
-        * and CFI are both enabled:
-        * - foo$[0-9]+
-        */
-       res = strrchr(s, '$');
-       if (res) {
-               *res = '\0';
-               return true;
-       }
-
        return false;
 }