This is an automated email from the ASF dual-hosted git repository.

raiden00pl pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 7253e706590a24741af76cce91038d3ebe483152
Author: leisiji <[email protected]>
AuthorDate: Tue Jun 9 07:55:44 2026 +0800

    mm/kasan: fix build fail when CONFIG_MM_KASAN_GLOBAL and 
CONFIG_BUILD_KERNEL on
    
    When CONFIG_MM_KASAN_GLOBAL is enabled, hook.c is also linked into
    libmm.a. However, g_global_region (defined in global.c) is only
    injected into the nuttx ELF by kasan_global.py — it does not process
    the app binary. This causes undefined symbol errors when linking an
    app against libmm.a.
    
    Guard the inclusion of global.c with __KERNEL__ so that only kernel
    builds pull in the global KASAN region, while app builds fall back
    to the no-op stub.
    
    Signed-off-by: leisiji <[email protected]>
---
 mm/kasan/hook.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/mm/kasan/hook.c b/mm/kasan/hook.c
index e1d1e129aa3..dcac69e5205 100644
--- a/mm/kasan/hook.c
+++ b/mm/kasan/hook.c
@@ -31,7 +31,7 @@
 #include <stdint.h>
 #include <stdio.h>
 
-#ifdef CONFIG_MM_KASAN_GLOBAL
+#if defined(CONFIG_MM_KASAN_GLOBAL) && defined(__KERNEL__)
 #  include "global.c"
 #else
 #  define kasan_global_is_poisoned(addr, size) false

Reply via email to