Re: Problem with Kernel Address Sanitizer and data on stack

Andrey Tarasevich via Gcc-help <[email protected]> Wed, 31 Dec 2025 10:05:53 -0800 (PST)
Newsgroups gmane.comp.gcc.help
Message-ID <[email protected]>
If I recall correctly, the stack address sanitizer works by properly poisoning the shadow 
in function prologue and then properly _unpoisoning_ it (i.e. zeroing it out) in the function 
epilogue. I.e. the AS operates under assumption that on function entry the corresponding shadow 
is already pre-zeroed. This is why your second version does not make any effort to do anything 
about that nice and even 32-byte block on entry.

If you encounter AS false positives in your case, it is probably not a problem with the 
poisoning (prologue) code you quoted, but rather a problem with some other epilogue code 
that operated on the same shadow previously. That previous code failed to zero out shadow 
memory that was supposed to be zeroed out.

-- 
Best regards,
Andrey