From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D72F23858D28; Sun, 24 Apr 2022 12:17:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D72F23858D28 From: "avi at scylladb dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/105336] truncated address sanitizer stack traces Date: Sun, 24 Apr 2022 12:17:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: sanitizer X-Bugzilla-Version: 11.3.1 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: avi at scylladb dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 24 Apr 2022 12:17:00 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D105336 --- Comment #5 from Avi Kivity --- I reduced it to a few lines (attached, intentionally triggers use-after-fre= e). The culprit is -Og. With g++ coroutine-asan.cc -o coroutine-asan --std=3Dc++20 -fsanitize=3Daddre= ss -Og I see READ of size 8 at 0x607000000020 thread T0 #0 0x4018e2 in test() (/home/avi/tests/coroutine-asan+0x4018e2) #1 0x40192b in main (/home/avi/tests/coroutine-asan+0x40192b) #2 0x7fb2e0a1d58f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f) #3 0x7fb2e0a1d648 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x2d64= 8) #4 0x401144 in _start (/home/avi/tests/coroutine-asan+0x401144) 0x607000000020 is located 0 bytes inside of 80-byte region [0x607000000020,0x607000000070) freed by thread T0 here: #0 0x7fb2e0fdebc8 in operator delete(void*) (/lib64/libasan.so.8+0xbbbc= 8) #1 0x40164f in test_coroutine(test_coroutine(std::__n4861::coroutine_handle&)::_Z14t= est_coroutineRNSt7__n486116coroutine_handleIvEE.Frame*) [clone .actor] (/home/avi/tests/coroutine-asan+0x40164f) #2 0x40200f (/home/avi/tests/coroutine-asan+0x40200f) previously allocated by thread T0 here: #0 0x7fb2e0fde188 in operator new(unsigned long) (/lib64/libasan.so.8+0xbb188) #1 0x4016c0 in test_coroutine(std::__n4861::coroutine_handle&) (/home/avi/tests/coroutine-asan+0x4016c0) The stack traces are truncated, compared to g++ coroutine-asan.cc -o coroutine-asan --std=3Dc++20 -fsanitize=3Daddr= ess which yields READ of size 8 at 0x607000000020 thread T0 #0 0x401cef in std::__n4861::coroutine_handle::resume() const (/home/avi/tests/coroutine-asan+0x401cef) #1 0x401b0f in test() (/home/avi/tests/coroutine-asan+0x401b0f) #2 0x401b85 in main (/home/avi/tests/coroutine-asan+0x401b85) #3 0x7f79b8be958f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f) #4 0x7f79b8be9648 in __libc_start_main_alias_1 (/lib64/libc.so.6+0x2d64= 8) #5 0x4011a4 in _start (/home/avi/tests/coroutine-asan+0x4011a4) 0x607000000020 is located 0 bytes inside of 80-byte region [0x607000000020,0x607000000070) freed by thread T0 here: #0 0x7f79b91aabc8 in operator delete(void*) (/lib64/libasan.so.8+0xbbbc= 8) #1 0x4019a5 in test_coroutine(test_coroutine(std::__n4861::coroutine_handle&)::_Z14t= est_coroutineRNSt7__n486116coroutine_handleIvEE.Frame*) [clone .actor] (/home/avi/tests/coroutine-asan+0x4019a5) #2 0x401cf7 in std::__n4861::coroutine_handle::resume() const (/home/avi/tests/coroutine-asan+0x401cf7) #3 0x401b0f in test() (/home/avi/tests/coroutine-asan+0x401b0f) #4 0x401b85 in main (/home/avi/tests/coroutine-asan+0x401b85) #5 0x7f79b8be958f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f) previously allocated by thread T0 here: #0 0x7f79b91aa188 in operator new(unsigned long) (/lib64/libasan.so.8+0xbb188) #1 0x401293 in test_coroutine(std::__n4861::coroutine_handle&) (/home/avi/tests/coroutine-asan+0x401293) #2 0x401af9 in test() (/home/avi/tests/coroutine-asan+0x401af9) #3 0x401b85 in main (/home/avi/tests/coroutine-asan+0x401b85) #4 0x7f79b8be958f in __libc_start_call_main (/lib64/libc.so.6+0x2d58f) The traces go all the away to main.=