diff mbox series

[RFC,v3,16/20] kallsyms: Drop CONFIG_CFI_CLANG workarounds

Message ID 20220610233513.1798771-17-samitolvanen@google.com (mailing list archive)
State New, archived
Headers show
Series KCFI support | expand

Commit Message

Sami Tolvanen June 10, 2022, 11:35 p.m. UTC
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>
---
 kernel/kallsyms.c | 17 -----------------
 1 file changed, 17 deletions(-)

Comments

Nick Desaulniers June 10, 2022, 11:40 p.m. UTC | #1
On Fri, Jun 10, 2022 at 4:35 PM Sami Tolvanen <samitolvanen@google.com> wrote:
>
> 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.

Good riddance!
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>

>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> ---
>  kernel/kallsyms.c | 17 -----------------
>  1 file changed, 17 deletions(-)
>
> diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
> index fbdf8d3279ac..2fbb94817e02 100644
> --- a/kernel/kallsyms.c
> +++ b/kernel/kallsyms.c
> @@ -179,7 +179,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) {
> @@ -187,22 +186,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;
>  }
>
> --
> 2.36.1.476.g0c4daa206d-goog
>
Bill Wendling June 13, 2022, 7:19 p.m. UTC | #2
On Fri, Jun 10, 2022 at 4:40 PM Nick Desaulniers
<ndesaulniers@google.com> wrote:
>
> On Fri, Jun 10, 2022 at 4:35 PM Sami Tolvanen <samitolvanen@google.com> wrote:
> >
> > 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.
>
> Good riddance!
> Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
>
Much clapping!

-bw

> >
> > Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> > ---
> >  kernel/kallsyms.c | 17 -----------------
> >  1 file changed, 17 deletions(-)
> >
> > diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
> > index fbdf8d3279ac..2fbb94817e02 100644
> > --- a/kernel/kallsyms.c
> > +++ b/kernel/kallsyms.c
> > @@ -179,7 +179,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) {
> > @@ -187,22 +186,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;
> >  }
> >
> > --
> > 2.36.1.476.g0c4daa206d-goog
> >
>
>
> --
> Thanks,
> ~Nick Desaulniers
diff mbox series

Patch

diff --git a/kernel/kallsyms.c b/kernel/kallsyms.c
index fbdf8d3279ac..2fbb94817e02 100644
--- a/kernel/kallsyms.c
+++ b/kernel/kallsyms.c
@@ -179,7 +179,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) {
@@ -187,22 +186,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;
 }