mm/umm_heap: disable KASAN for user-space heap in kernel build

When CONFIG_BUILD_KERNEL is enabled, user-space and kernel-space have
separate address spaces. User-space addresses passed via syscalls
(e.g., open) are registered by KASAN but should not be monitored,
as they are not kernel heap allocations. This causes KASAN to
report false positives on user-space pointers accessed through
system calls.

Mark the user-space heap with nokasan=true so KASAN skips checking
its address range, consistent with how rptun already handles this.

Signed-off-by: leisiji <2265215145@qq.com>
This commit is contained in:
leisiji 2026-06-09 10:22:28 +08:00 committed by Mateusz Szafoni
parent 7253e70659
commit dd86c92405

View file

@ -92,6 +92,7 @@ void umm_initialize(FAR void *heap_start, size_t heap_size)
config.start = heap_start;
config.size = heap_size;
#ifdef CONFIG_BUILD_KERNEL
config.nokasan = true;
USR_HEAP = mm_initialize_pool(&config, NULL);
#else
config.name = "Umem";