W-M-R opened a new pull request, #21360:
URL: https://github.com/apache/nuttx/pull/21360
## Summary
`kasan_register()` unconditionally appended a new entry to `g_region[]`. The
heap is registered once as a whole and then again for sub-ranges (for example
when a memory pool is created inside it), which grows `g_region[]` until it
overflows and, with SW tags, makes shadow lookups ambiguous.
Check whether the new range is already contained in a registered region and
return early in that case.
## Impact
- Prevents `g_region[]` exhaustion and duplicate shadow metadata.
- Registration of genuinely new regions is unchanged.
## Testing
Host: Ubuntu 22.04, qemu-system-aarch64 8.2.
./tools/configure.sh -l qemu-armv8a:sw_tags
# menuconfig: enable a memory pool inside the heap (CONFIG_MM_POOL)
make -j
qemu-system-aarch64 -cpu cortex-a53 -nographic \
-machine virt,virtualization=on,gic-version=3 \
-chardev stdio,id=con,mux=on -serial chardev:con \
-mon chardev=con,mode=readline -kernel ./nuttx
nsh> kasantest
Before: the same heap range is registered twice, `g_region[]` grows on every
pool creation and eventually overflows. After: boot and `kasantest` pass with
a constant region count.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]