objtool: Add CONFIG_HAVE_UACCESS_VALIDATION
authorJosh Poimboeuf <jpoimboe@redhat.com>
Tue, 19 Apr 2022 16:05:09 +0000 (09:05 -0700)
committerPeter Zijlstra <peterz@infradead.org>
Fri, 27 May 2022 10:34:43 +0000 (12:34 +0200)
Allow an arch specify that it has objtool uaccess validation with
CONFIG_HAVE_UACCESS_VALIDATION.  For now, doing so unconditionally
selects CONFIG_OBJTOOL.

Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://lkml.kernel.org/r/d393d5e2fe73aec6e8e41d5c24f4b6fe8583f2d8.1650384225.git.jpoimboe@redhat.com
arch/Kconfig
arch/x86/Kconfig
scripts/Makefile.build
scripts/link-vmlinux.sh

index 904ed51736d4fd230127b584fdf291be69371c8c..cb2954027d1024e4099d19c578ed7fb2af0d5c79 100644 (file)
@@ -1050,6 +1050,10 @@ config HAVE_NOINSTR_HACK
 config HAVE_NOINSTR_VALIDATION
        bool
 
+config HAVE_UACCESS_VALIDATION
+       bool
+       select OBJTOOL
+
 config HAVE_STACK_VALIDATION
        bool
        help
index cf531fbcd2295ec2a77007274ad529180c84cd0b..5f41f3c3df9a258d2cdeb3275a64c1a57cf4ffcc 100644 (file)
@@ -258,6 +258,7 @@ config X86
        select HAVE_PREEMPT_DYNAMIC_CALL
        select HAVE_RSEQ
        select HAVE_SYSCALL_TRACEPOINTS
+       select HAVE_UACCESS_VALIDATION          if HAVE_OBJTOOL
        select HAVE_UNSTABLE_SCHED_CLOCK
        select HAVE_USER_RETURN_NOTIFIER
        select HAVE_GENERIC_VDSO
index 06400504150b3ce795a780b96439b591ed639aa6..6a663b27b2868e4fd8dbcd4ce3e3133aa1149f09 100644 (file)
@@ -218,7 +218,7 @@ objtool_args =                                                              \
        $(if $(CONFIG_SLS), --sls)                                      \
        $(if $(CONFIG_STACK_VALIDATION), --stackval)                    \
        $(if $(CONFIG_HAVE_STATIC_CALL_INLINE), --static-call)          \
-       --uaccess                                                       \
+       $(if $(CONFIG_HAVE_UACCESS_VALIDATION), --uaccess)              \
        $(if $(linked-object), --link)                                  \
        $(if $(part-of-module), --module)                               \
        $(if $(CONFIG_GCOV_KERNEL), --no-unreachable)
index a7f6196c7e411c6a6cafb2ee532c7d00f7836314..fd578c3809193e91c4f759ecc8005405e50d9340 100755 (executable)
@@ -134,7 +134,9 @@ objtool_link()
                        objtoolopt="${objtoolopt} --static-call"
                fi
 
-               objtoolopt="${objtoolopt} --uaccess"
+               if is_enabled CONFIG_HAVE_UACCESS_VALIDATION; then
+                       objtoolopt="${objtoolopt} --uaccess"
+               fi
        fi
 
        if is_enabled CONFIG_NOINSTR_VALIDATION; then