Reference to non-existing config X86_SMAP in config UBSAN_UNREACHABLE

Lukas Bulwahn posted 1 patch 3 years, 11 months ago
Reference to non-existing config X86_SMAP in config UBSAN_UNREACHABLE
Posted by Lukas Bulwahn 3 years, 11 months ago
Dear Josh,

Commit dbae0a934f09 ("x86/cpu: Remove CONFIG_X86_SMAP and "nosmap"")
from Borislav removes the config X86_SMAP and makes smap on x86
default.

Josh, your commit 03f16cd020eb ("objtool: Add CONFIG_OBJTOOL") makes
config UBSAN_UNREACHABLE in lib/Kconfig.ubsan refer to this
non-existing config X86_SMAP.

See this hunk in lib/Kconfig.ubsan:

diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
index f3c57ed51838..c4fe15d38b60 100644
--- a/lib/Kconfig.ubsan
+++ b/lib/Kconfig.ubsan
@@ -94,7 +94,7 @@ config UBSAN_UNREACHABLE
        bool "Perform checking for unreachable code"
        # objtool already handles unreachable checking and gets angry about
        # seeing UBSan instrumentation located in unreachable places.
-       depends on !STACK_VALIDATION
+       depends on !(OBJTOOL && (STACK_VALIDATION || UNWINDER_ORC || X86_SMAP))
        depends on $(cc-option,-fsanitize=unreachable)
        help
          This option enables -fsanitize=unreachable which checks for control

I think X86_SMAP can just be dropped in this line, but I leave it up
to you to change, as I am not completely certain on the needed change
and if that just breaks the config dependencies for stack validation.

By the way, this issue was identified with the script
./scripts/checkkconfigsymbols.py

Best regards,

Lukas
Re: Reference to non-existing config X86_SMAP in config UBSAN_UNREACHABLE
Posted by Josh Poimboeuf 3 years, 11 months ago
On Wed, Jun 01, 2022 at 12:50:47PM +0200, Lukas Bulwahn wrote:
> Dear Josh,
> 
> Commit dbae0a934f09 ("x86/cpu: Remove CONFIG_X86_SMAP and "nosmap"")
> from Borislav removes the config X86_SMAP and makes smap on x86
> default.
> 
> Josh, your commit 03f16cd020eb ("objtool: Add CONFIG_OBJTOOL") makes
> config UBSAN_UNREACHABLE in lib/Kconfig.ubsan refer to this
> non-existing config X86_SMAP.
> 
> See this hunk in lib/Kconfig.ubsan:
> 
> diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan
> index f3c57ed51838..c4fe15d38b60 100644
> --- a/lib/Kconfig.ubsan
> +++ b/lib/Kconfig.ubsan
> @@ -94,7 +94,7 @@ config UBSAN_UNREACHABLE
>         bool "Perform checking for unreachable code"
>         # objtool already handles unreachable checking and gets angry about
>         # seeing UBSan instrumentation located in unreachable places.
> -       depends on !STACK_VALIDATION
> +       depends on !(OBJTOOL && (STACK_VALIDATION || UNWINDER_ORC || X86_SMAP))
>         depends on $(cc-option,-fsanitize=unreachable)
>         help
>           This option enables -fsanitize=unreachable which checks for control
> 
> I think X86_SMAP can just be dropped in this line, but I leave it up
> to you to change, as I am not completely certain on the needed change
> and if that just breaks the config dependencies for stack validation.
> 
> By the way, this issue was identified with the script
> ./scripts/checkkconfigsymbols.py

Hi Lukas,

Thanks for reporting this.  I'll post a fix shortly.

-- 
Josh