lkml.org 
[lkml]   [2022]   [Apr]   [19]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] objtool: Add CONFIG_HAVE_UACCESS_VALIDATION
Date
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>
---
arch/Kconfig | 4 ++++
arch/x86/Kconfig | 1 +
scripts/Makefile.build | 2 +-
scripts/link-vmlinux.sh | 4 +++-
4 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/arch/Kconfig b/arch/Kconfig
index 1e19da774e55..694e0c2bc369 100644
--- a/arch/Kconfig
+++ b/arch/Kconfig
@@ -1041,6 +1041,10 @@ config HAVE_NOINSTR_HACK
config HAVE_NOINSTR_VALIDATION
bool

+config HAVE_UACCESS_VALIDATION
+ bool
+ select OBJTOOL
+
config HAVE_STACK_VALIDATION
bool
help
diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
index f1320d9a3da3..1a207a805102 100644
--- a/arch/x86/Kconfig
+++ b/arch/x86/Kconfig
@@ -257,6 +257,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
diff --git a/scripts/Makefile.build b/scripts/Makefile.build
index f89d3fcff39f..de0d88f32f58 100644
--- a/scripts/Makefile.build
+++ b/scripts/Makefile.build
@@ -236,7 +236,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)
diff --git a/scripts/link-vmlinux.sh b/scripts/link-vmlinux.sh
index d7f26f02f142..3e23a1babad4 100755
--- a/scripts/link-vmlinux.sh
+++ b/scripts/link-vmlinux.sh
@@ -153,7 +153,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
--
2.34.1
\
 
 \ /
  Last update: 2022-04-19 18:06    [W:0.034 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site