public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "marxin at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/107258] ASAN at -O1 failed to detect a stack-under-flow Date: Fri, 14 Oct 2022 09:04:11 +0000 [thread overview] Message-ID: <bug-107258-4-jhgvYo0lvb@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-107258-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107258 Martin Liška <marxin at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Resolution|--- |INVALID Status|UNCONFIRMED |RESOLVED --- Comment #1 from Martin Liška <marxin at gcc dot gnu.org> --- Well, it's a stack underflow and it depends how are the variables placed in the stack frame: setting a = -1 is caught also in -O1: ==3723==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffd5dc at pc 0x000000401404 bp 0x7fffffffd580 sp 0x7fffffffd578 READ of size 4 at 0x7fffffffd5dc thread T0 #0 0x401403 in main (/home/marxin/Programming/testcases/a.out+0x401403) #1 0x7ffff762c5af in __libc_start_call_main (/lib64/libc.so.6+0x275af) #2 0x7ffff762c678 in __libc_start_main_impl (/lib64/libc.so.6+0x27678) #3 0x4010e4 in _start ../sysdeps/x86_64/start.S:115 Address 0x7fffffffd5dc is located in stack of thread T0 at offset 76 in frame #0 0x4012ab in main (/home/marxin/Programming/testcases/a.out+0x4012ab) This frame has 2 object(s): [48, 64) 'g' (line 13) [80, 120) 'b' (line 3) <== Memory access at offset 76 underflows this variable HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork (longjmp and C++ exceptions *are* supported) SUMMARY: AddressSanitizer: stack-buffer-overflow (/home/marxin/Programming/testcases/a.out+0x401403) in main Shadow bytes around the buggy address: 0x10007fff7a60: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7a70: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7a80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7a90: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7aa0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 =>0x10007fff7ab0: 00 00 f1 f1 f1 f1 f1 f1 00 00 f2[f2]00 00 00 00 0x10007fff7ac0: 00 f3 f3 f3 f3 f3 00 00 00 00 00 00 00 00 00 00 0x10007fff7ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7af0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0x10007fff7b00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 Shadow byte legend (one shadow byte represents 8 application bytes): As seen using a == -5 causes we load variable 'g'. That's the risk of bigger overflows and they can happen.
prev parent reply other threads:[~2022-10-14 9:04 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-10-14 8:44 [Bug sanitizer/107258] New: " shaohua.li at inf dot ethz.ch 2022-10-14 9:04 ` marxin at gcc dot gnu.org [this message]
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-107258-4-jhgvYo0lvb@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).