public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Missing __asan_stack_free in Custom KASAN Implementation
@ 2024-03-20 15:49 Julian Zboril
  0 siblings, 0 replies; only message in thread
From: Julian Zboril @ 2024-03-20 15:49 UTC (permalink / raw)
  To: gcc-help

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


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-03-20 15:49 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-20 15:49 Missing __asan_stack_free in Custom KASAN Implementation Julian Zboril

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).