public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c/107963] New: Support __attribute__((disable_sanitizer_instrumentation))
@ 2022-12-04  6:38 i at maskray dot me
  2022-12-04  6:45 ` [Bug sanitizer/107963] " pinskia at gcc dot gnu.org
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: i at maskray dot me @ 2022-12-04  6:38 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107963

            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-sanitizer-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=9b448bc25b776daab3215393c3ce6953dd3bb8ad)

__attribute__((disable_sanitizer_instrumentation)) int foo(int *a) {
  *a = 42;
  return *a;
}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug sanitizer/107963] Support __attribute__((disable_sanitizer_instrumentation))
  2022-12-04  6:38 [Bug c/107963] New: Support __attribute__((disable_sanitizer_instrumentation)) i at maskray dot me
@ 2022-12-04  6:45 ` pinskia at gcc dot gnu.org
  2022-12-04 21:50 ` sam at gentoo dot org
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-04  6:45 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107963

--- Comment #1 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
https://gcc.gnu.org/pipermail/gcc/2021-November/237787.html

If I read this correctly, there is no reason for a new attribute for gcc.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug sanitizer/107963] Support __attribute__((disable_sanitizer_instrumentation))
  2022-12-04  6:38 [Bug c/107963] New: Support __attribute__((disable_sanitizer_instrumentation)) i at maskray dot me
  2022-12-04  6:45 ` [Bug sanitizer/107963] " pinskia at gcc dot gnu.org
@ 2022-12-04 21:50 ` sam at gentoo dot org
  2022-12-04 23:24 ` i at maskray dot me
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: sam at gentoo dot org @ 2022-12-04 21:50 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107963

Sam James <sam at gentoo dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |sam at gentoo dot org

--- Comment #2 from Sam James <sam at gentoo dot org> ---
(In reply to Andrew Pinski from comment #1)
> https://gcc.gnu.org/pipermail/gcc/2021-November/237787.html
> 
> If I read this correctly, there is no reason for a new attribute for gcc.

Sounds like a possible documentation issue then.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug sanitizer/107963] Support __attribute__((disable_sanitizer_instrumentation))
  2022-12-04  6:38 [Bug c/107963] New: Support __attribute__((disable_sanitizer_instrumentation)) i at maskray dot me
  2022-12-04  6:45 ` [Bug sanitizer/107963] " pinskia at gcc dot gnu.org
  2022-12-04 21:50 ` sam at gentoo dot org
@ 2022-12-04 23:24 ` i at maskray dot me
  2022-12-05  0:01 ` pinskia at gcc dot gnu.org
  2022-12-05  8:18 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: i at maskray dot me @ 2022-12-04 23:24 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107963

--- Comment #3 from Fangrui Song <i at maskray dot me> ---
GCC doesn't implement -fsanitize=memory.
In the absence of it, __attribute__((disable_sanitizer_instrumentation)) is
like __attribute__((no_sanitize("all"))).

When -fsanitize=memory is implemented, the two attribute will be different.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug sanitizer/107963] Support __attribute__((disable_sanitizer_instrumentation))
  2022-12-04  6:38 [Bug c/107963] New: Support __attribute__((disable_sanitizer_instrumentation)) i at maskray dot me
                   ` (2 preceding siblings ...)
  2022-12-04 23:24 ` i at maskray dot me
@ 2022-12-05  0:01 ` pinskia at gcc dot gnu.org
  2022-12-05  8:18 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: pinskia at gcc dot gnu.org @ 2022-12-05  0:01 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107963

--- Comment #4 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Fangrui Song from comment #3)
> GCC doesn't implement -fsanitize=memory.
> In the absence of it, __attribute__((disable_sanitizer_instrumentation)) is
> like __attribute__((no_sanitize("all"))).
> 
> When -fsanitize=memory is implemented, the two attribute will be different.

Why do you think GCC will implement no_sanitize that way. It already didn't
implement  no_sanitize  that way for -fsanitize=thread too.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [Bug sanitizer/107963] Support __attribute__((disable_sanitizer_instrumentation))
  2022-12-04  6:38 [Bug c/107963] New: Support __attribute__((disable_sanitizer_instrumentation)) i at maskray dot me
                   ` (3 preceding siblings ...)
  2022-12-05  0:01 ` pinskia at gcc dot gnu.org
@ 2022-12-05  8:18 ` rguenth at gcc dot gnu.org
  4 siblings, 0 replies; 6+ messages in thread
From: rguenth at gcc dot gnu.org @ 2022-12-05  8:18 UTC (permalink / raw)
  To: gcc-bugs

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107963

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
         Resolution|---                         |WONTFIX
             Status|UNCONFIRMED                 |RESOLVED

--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Yep, that would just be confusing.  If "not unpoison the shadow for *a" is
useful and no_sanitize("all") shouldn't cover that then no_unpoison_shadow
would have been better.

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-12-05  8:18 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-04  6:38 [Bug c/107963] New: Support __attribute__((disable_sanitizer_instrumentation)) i at maskray dot me
2022-12-04  6:45 ` [Bug sanitizer/107963] " pinskia at gcc dot gnu.org
2022-12-04 21:50 ` sam at gentoo dot org
2022-12-04 23:24 ` i at maskray dot me
2022-12-05  0:01 ` pinskia at gcc dot gnu.org
2022-12-05  8:18 ` rguenth at gcc dot gnu.org

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).