public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/105396] missed stack-buffer-overflow by -O0 Date: Tue, 26 Apr 2022 14:39:30 +0000 [thread overview] Message-ID: <bug-105396-4-9AqB5Yfuz4@http.gcc.gnu.org/bugzilla/> (raw) In-Reply-To: <bug-105396-4@http.gcc.gnu.org/bugzilla/> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105396 --- Comment #3 from Jakub Jelinek <jakub at gcc dot gnu.org> --- So, the bug is clearly in asan_redzone_buffer::emit_redzone_byte. The off == offset case is handled correctly, but the other case is valid only if the gap is bigger such that we need to flush in between. --- gcc/asan.cc.jj 2022-02-19 09:03:50.000000000 +0100 +++ gcc/asan.cc 2022-04-26 16:36:55.717551793 +0200 @@ -1502,6 +1502,15 @@ asan_redzone_buffer::emit_redzone_byte ( m_shadow_bytes.safe_push (value); flush_if_full (); } + else if (offset < m_prev_offset + ASAN_SHADOW_GRANULARITY * RZ_BUFFER_SIZE + && !m_shadow_bytes.is_empty ()) + { + /* Shadow memory byte with a small gap. */ + for (; off < offset; off += ASAN_SHADOW_GRANULARITY) + m_shadow_bytes.safe_push (0); + m_shadow_bytes.safe_push (value); + flush_if_full (); + } else { if (!m_shadow_bytes.is_empty ()) fixes this.
next prev parent reply other threads:[~2022-04-26 14:39 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2022-04-26 12:43 [Bug sanitizer/105396] New: " shaohua.li at inf dot ethz.ch 2022-04-26 13:40 ` [Bug sanitizer/105396] " marxin at gcc dot gnu.org 2022-04-26 13:47 ` jakub at gcc dot gnu.org 2022-04-26 14:39 ` jakub at gcc dot gnu.org [this message] 2022-04-26 14:41 ` jakub at gcc dot gnu.org 2022-04-26 15:05 ` jakub at gcc dot gnu.org 2022-04-27 6:35 ` cvs-commit at gcc dot gnu.org 2022-04-27 6:36 ` [Bug sanitizer/105396] [9/10/11 Regression] " jakub at gcc dot gnu.org 2022-05-06 23:44 ` cvs-commit at gcc dot gnu.org 2022-05-09 11:26 ` [Bug sanitizer/105396] [9/10 " jakub at gcc dot gnu.org 2022-05-10 8:26 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:26 ` cvs-commit at gcc dot gnu.org 2022-05-11 6:36 ` jakub 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-105396-4-9AqB5Yfuz4@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).