From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BBF1E385B534; Sun, 4 Dec 2022 06:38:39 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BBF1E385B534 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1670135919; bh=sGi4xCLaSK7fB4ueyv1oAQZvJ7vIydm8mWzx+ZKlPeA=; h=From:To:Subject:Date:From; b=gEkRBkZC8pIRHleVKmdtTo93A6WL1JxStg0JbQvSY99kxd/4PtCOumdHxy4nnuCKx gVP8RU5Yg2k6XEglOIeoZRODayTSDSXetGMIQTQjfE8zAV+A750AcSXhYIzdOblmT9 MEZdl/UgPV888obnYF7Q9sVxE0pvcT2f3CPF8vgY= From: "i at maskray dot me" To: gcc-bugs@gcc.gnu.org Subject: [Bug c/107963] New: Support __attribute__((disable_sanitizer_instrumentation)) Date: Sun, 04 Dec 2022 06:38:39 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: i at maskray dot me 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D107963 Bug ID: 107963 Summary: Support __attribute__((disable_sanitizer_instrumentation)) Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: i at maskray dot me Target Milestone: --- Clang introduced the attribute in https://reviews.llvm.org/D108029 (2021-08= ). It disables instrumentations for all kinds of sanitizers. For non-memory sanitizers, it's like the union of all available no_sanitize("xxx"). For msan, it disables all instrumentations, therefore the following function does not unpoison the shadow for *a, which may lead to a false positive for= a subsequent function (https://clang.llvm.org/docs/MemorySanitizer.html#attribute-disable-sanitiz= er-instrumentation). That said, such functionality is useful in some scenarios, e.g. `noinstr` in the Linux kernel (https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/= ?id=3D9b448bc25b776daab3215393c3ce6953dd3bb8ad) __attribute__((disable_sanitizer_instrumentation)) int foo(int *a) { *a =3D 42; return *a; }=