git: bdfb568f8dfc - stable/13 - redzone: Raise a compile error if KASAN is configured

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 01 Nov 2021 14:33:16 UTC
The branch stable/13 has been updated by markj:

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

commit bdfb568f8dfc8f1fb22b12cd8281c47bcd388b14
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2021-07-23 14:30:29 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2021-11-01 14:07:31 +0000

    redzone: Raise a compile error if KASAN is configured
    
    redzone(9) does some munging of the allocation to insert redzones before
    and after a valid memory buffer, but KASAN does not know about this and
    will raise false positives if both are configured.  Until this is fixed,
    do not allow both to be configured.  Note that KASAN provides similar
    checking on its own but currently does not force the creation of
    redzones for all UMA allocations; this should be addressed as well.
    
    Sponsored by:   The FreeBSD Foundation
    
    (cherry picked from commit 4e8e26a00471f1a5e7a2af322265c45b1529c5b8)
---
 sys/vm/redzone.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/sys/vm/redzone.c b/sys/vm/redzone.c
index affaa5008a22..88e36c41b928 100644
--- a/sys/vm/redzone.c
+++ b/sys/vm/redzone.c
@@ -37,6 +37,10 @@ __FBSDID("$FreeBSD$");
 
 #include <vm/redzone.h>
 
+#ifdef KASAN
+#error KASAN and DEBUG_REDZONE cannot be configured together
+#endif
+
 static SYSCTL_NODE(_vm, OID_AUTO, redzone, CTLFLAG_RW | CTLFLAG_MPSAFE, NULL,
     "RedZone data");
 static u_long redzone_extra_mem = 0;