git: 79e5fc020e0c - stable/13 - ksan: Build sanitizer runtimes without stack-smashing protection

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 21 Nov 2022 13:53:27 UTC
The branch stable/13 has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=79e5fc020e0cd02d81f7d3ec9ff974ddff8e4ca0

commit 79e5fc020e0cd02d81f7d3ec9ff974ddff8e4ca0
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2022-11-07 21:07:26 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2022-11-21 13:48:39 +0000

    ksan: Build sanitizer runtimes without stack-smashing protection
    
    On arm64 with per-thread stack canaries enabled (the PERTHREAD_SSP
    option), the compiler may load curthread->td_md.md_canary in function
    prologues.  This is not safe in data_abort(); see commit 2c10be9e06d4.
    Thus, sanitizer runtimes must also avoid accessing the current thread's
    canary.
    
    Since SSP has limited utility in sanitizer runtimes, simply disable it
    unconditionally to avoid unpleasant surprises in the future.
    
    MFC after:      2 weeks
    Sponsored by:   Juniper Networks, Inc.
    Sponsored by:   Klara, Inc.
    
    (cherry picked from commit 3c0e9169a357f6d99b80c02dd27210d742797cf2)
---
 sys/conf/files | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sys/conf/files b/sys/conf/files
index 5a02fe8f9f36..8d8b27940948 100644
--- a/sys/conf/files
+++ b/sys/conf/files
@@ -3916,7 +3916,7 @@ kern/stack_protector.c		standard \
 kern/subr_acl_nfs4.c		optional ufs_acl | zfs
 kern/subr_acl_posix1e.c		optional ufs_acl
 kern/subr_asan.c		optional kasan \
-	compile-with "${NORMAL_C:N-fsanitize*}"
+	compile-with "${NORMAL_C:N-fsanitize*:N-fstack-protector*}"
 kern/subr_autoconf.c		standard
 kern/subr_blist.c		standard
 kern/subr_boot.c		standard
@@ -3931,7 +3931,7 @@ kern/subr_coverage.c		optional coverage \
 	compile-with "${NORMAL_C:N-fsanitize*}"
 kern/subr_counter.c		standard
 kern/subr_csan.c		optional kcsan \
-	compile-with "${NORMAL_C:N-fsanitize*}"
+	compile-with "${NORMAL_C:N-fsanitize*:N-fstack-protector*}"
 kern/subr_devstat.c		standard
 kern/subr_disk.c		standard
 kern/subr_early.c		standard