public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "stsp at users dot sourceforge.net" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/101476] AddressSanitizer check failed, points out a (potentially) non-existing stack error Date: Tue, 18 Jan 2022 17:01:29 +0000 [thread overview] Message-ID: <bug-101476-4-aM1aENcQfB@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-101476-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101476 Stas Sergeev <stsp at users dot sourceforge.net> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |stsp at users dot sourceforge.net --- Comment #2 from Stas Sergeev <stsp at users dot sourceforge.net> --- I have the very same crash with the multi-threaded app. The test-case from this ticket doesn't reproduce it for me either, but my app crashes nevertheless. So I debugged it a bit myself. gcc-11.2.1. The crash happens here: https://github.com/gcc-mirror/gcc/blob/master/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc#L10168 Here asan checks that sigaltstack() didn't corrupt anything while writing the "old setting" to "oss" ptr. Next, some check is later fails here: https://code.woboq.org/gcc/libsanitizer/asan/asan_thread.cc.html#340 Asan failed to find the canary value kCurrentStackFrameMagic. The search was done the following way: it walks the shadow stack down, and looks for the kAsanStackLeftRedzoneMagic to find the bottom of redzone. Then, at the bottom of redzone, it looks for the canary value. I checked that the lowest canary value is overwritten by the call to GetAltStackSize(). It uses SIGSTKSZ macro: https://code.woboq.org/llvm/compiler-rt/lib/sanitizer_common/sanitizer_posix_libcdep.cpp.html#170 which expands into a getconf() call, so eats up quite a lot. Now I am not entirely sure what conclusion can be derived out of that. I think that the culprit is probably here: https://code.woboq.org/gcc/libsanitizer/asan/asan_interceptors_memintrinsics.h.html#26 They say that they expect 16 bytes of a redzone, but it seems to be completely exhausted with all canaries overwritten. Does something of the above makes sense? This is the first time I am looking into an asan code.
next prev parent reply other threads:[~2022-01-18 17:01 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-16 19:43 [Bug sanitizer/101476] New: " franek.balcerak at o2 dot pl 2021-07-22 10:19 ` [Bug sanitizer/101476] " marxin at gcc dot gnu.org 2022-01-18 17:01 ` stsp at users dot sourceforge.net [this message] 2022-01-18 17:56 ` stsp at users dot sourceforge.net 2022-01-18 18:14 ` stsp at users dot sourceforge.net 2022-01-18 20:24 ` stsp at users dot sourceforge.net 2022-01-18 22:23 ` stsp at users dot sourceforge.net 2022-01-18 23:01 ` stsp at users dot sourceforge.net 2022-01-19 9:04 ` marxin at gcc dot gnu.org 2022-01-19 14:02 ` stsp at users dot sourceforge.net 2022-01-19 14:13 ` marxin at gcc dot gnu.org 2022-01-20 9:58 ` stsp at users dot sourceforge.net 2022-01-21 9:43 ` pinskia at gcc dot gnu.org 2022-01-25 10:35 ` [Bug sanitizer/101476] AddressSanitizer check failed, points out a (potentially) non-existing stack error and pthread_cancel stsp at users dot sourceforge.net 2022-01-25 11:25 ` marxin at gcc dot gnu.org 2022-01-25 11:31 ` stsp at users dot sourceforge.net 2022-01-25 18:28 ` stsp at users dot sourceforge.net 2022-02-11 12:45 ` stsp at users dot sourceforge.net 2022-10-18 18:03 ` stsp at users dot sourceforge.net 2023-03-19 16:58 ` pinskia at gcc dot gnu.org
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-101476-4-aM1aENcQfB@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).