From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 25C7C385841D; Wed, 12 Apr 2023 09:01:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 25C7C385841D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1681290063; bh=g4Ul3xQKnv+Vkzeb8b8nS7E4ORL4cTZByDswkguFHcc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ggKuA4OxLvDuOVF7NBAAYtVS9ImWAHkl8iYkE3OoPgSepXXWuwes/8V9oDVwuF3WU 0FL6pD3bgW1wGbjm6zdZGWfr9OYdyLudruT5AHqpFeT9Y2InxKoj9db5JZYPkp5dk1 HJiYF42Jy7gb6YKMswEcRHVmx+gXi9dBiHVQtOnM= From: "marxin at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug sanitizer/109446] Possible destination array overflow without diagnosis in memcpy Date: Wed, 12 Apr 2023 09:01:02 +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: 8.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: marxin at gcc dot gnu.org X-Bugzilla-Status: NEW 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109446 --- Comment #9 from Martin Li=C5=A1ka --- (In reply to Richard Biener from comment #8) > (In reply to Jakub Jelinek from comment #7) > > (In reply to Richard Biener from comment #6) > > > not sure if we should prevent all of those transforms. But the quest= ion is > > > why ASAN doesn't instrument the generated aggregate copy? Maybe beca= use > > > in C/C++ you cannot write an aggregate array copy? > >=20 > > We do instrument those. But only instrument them by checking the first= and > > last byte > > of the copy, not all bytes in between (because that would be for inline > > checking too large - we'd need to emit inline a loop over those bytes). >=20 > OK, that's lack of an appropriate API then? But still the first and last > byte should be sufficient to detect the problem (but maybe I'm missing > something here). No, because the last byte is out of redzone: =3D>0x7ffff5300000: f1 f1 f1 f1 00 00 00[f3]f3 f3 f3 f3 00 00 00 00 the 'f3' redzone is covering 5*8 bytes after the data type only.=