Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 17 Nov 2021 14:27:27 GMT
From:      Mark Johnston <markj@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: 3a15ccadf87e - stable/13 - kasan: Disable validation of function parameters passed by value
Message-ID:  <202111171427.1AHERR3q079985@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=3a15ccadf87ec55068656e6a87c8b19eea1fd390

commit 3a15ccadf87ec55068656e6a87c8b19eea1fd390
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-11-03 16:28:48 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-17 14:27:16 +0000

    kasan: Disable validation of function parameters passed by value
    
    It appears that the emitted code in the caller does not update shadow
    state for values passed on the stack to the callee, which it seemingly
    ought to do after pushing values on the stack and prior to the call
    itself.  This leaves open a window where an interrupt handler can cause
    regions of the stack containing these values to be poisoned, resulting
    in rare false positive reports.  This happens particularly in the amd64
    TLB invalidation code, where we liberally pass cpuset_t's around by
    value.
    
    LLVM has a flag to disable validation of accesses of function parameters
    passed by value.  Such validation is itself a relatively new feature.
    Turn it off for now.
    
    Reported by:    pho, syzkaller
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 2a519c3b14c29688e42d11f916655318b13c8409)
---
 sys/conf/kern.pre.mk | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/sys/conf/kern.pre.mk b/sys/conf/kern.pre.mk
index daba78135c79..e57c187f940d 100644
--- a/sys/conf/kern.pre.mk
+++ b/sys/conf/kern.pre.mk
@@ -114,7 +114,8 @@ SAN_CFLAGS+=	-fsanitize=kernel-address \
 		-mllvm -asan-instrument-dynamic-allocas=true \
 		-mllvm -asan-globals=true \
 		-mllvm -asan-use-after-scope=true \
-		-mllvm -asan-instrumentation-with-call-threshold=0
+		-mllvm -asan-instrumentation-with-call-threshold=0 \
+		-mllvm -asan-instrument-byval=false
 .endif
 
 KCSAN_ENABLED!=	grep KCSAN opt_global.h || true ; echo



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202111171427.1AHERR3q079985>