git: c8701777c0e8 - stable/13 - Fix the KCSAN_ENABLED check when building modules

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Mon, 29 Jul 2024 16:12:58 UTC
The branch stable/13 has been updated by markj:

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

commit c8701777c0e8654f060e46b067dd86452f48c364
Author:     Andrew Turner <andrew@FreeBSD.org>
AuthorDate: 2021-06-02 10:07:55 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-07-29 16:10:50 +0000

    Fix the KCSAN_ENABLED check when building modules
    
    The KCSAN_ENABLED variable is non-empty when the kernel is being built
    with KCSAN. This allows us to disable modules that are known to be
    broken.
    
    There was a bug where we would check if it was defined. As this is
    always the case the KCSAN_ENABLED variable would be set when building
    modules so we would never build such a module. Fix this by checking
    if the value is empty before passing it on to the module stage.
    
    This doesn't affect how modules are built as the CFLAGS passed to
    modules has the correct check.
    
    PR:             280212
    Reported by:    rstone
    Sponsored by:   Innovate UK
    
    (cherry picked from commit 2422138952d86dd8b02ff33c55f747ca8e381afe)
---
 sys/conf/kern.post.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/conf/kern.post.mk b/sys/conf/kern.post.mk
index 4e22c07ef8d8..6664afc2bf16 100644
--- a/sys/conf/kern.post.mk
+++ b/sys/conf/kern.post.mk
@@ -37,7 +37,7 @@ MKMODULESENV+=	WITH_CTF="${WITH_CTF}"
 MKMODULESENV+=	WITH_EXTRA_TCP_STACKS="${WITH_EXTRA_TCP_STACKS}"
 .endif
 
-.if defined(KCSAN_ENABLED)
+.if !empty(KCSAN_ENABLED)
 MKMODULESENV+=	KCSAN_ENABLED="yes"
 .endif