Hello,
I am currently working on a Kernel Address Sanitizer implementation for
my universities teaching operating system. My current goal is getting
use-after-return detection to work (with a fake stack allocator). While
gcc inserts the __asan_stack_malloc* calls seemingly fine, it does not
add any __asan_stack_free* calls at all.
It also does not detect my artificial example, which consists of
returning a pointer to a (constant) integer on the stack. This causes an
exception to be thrown, but no detection by the address sanitizer. It is
possible that this is a direct consequence of my issue with
__asan_stack_free*, as the allocator fills up quite quickly when the
stack frames are not freed.
These are the (ASan-related) flags I use for compilation:
-fsanitize=kernel-address -DKASAN_OFFSET=$(KASAN_OFFSET) -DKASAN=1
--param asan-stack=1 --param asan-use-after-return=1 --param
asan-instrumentation-with-call-threshold=0
-fsanitize-address-use-after-scope -fasan-shadow-offset=$(KASAN_OFFSET)
The custom asan-runtime is built as an external static library archive.
Any help or ideas would be greatly appreciated.
Greetings,
Julian