public inbox for newlib-cvs@sourceware.org
help / color / mirror / Atom feed
From: Sebastian Huber <sh@sourceware.org>
To: newlib-cvs@sourceware.org
Subject: [newlib-cygwin] amd64: prevent KCSan false positives on LAPIC mapping
Date: Mon, 26 Oct 2020 13:31:47 +0000 (GMT)	[thread overview]
Message-ID: <20201026133147.B9031385703B@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=303c61925d9256be02dcbda8f1e5e0d4adf8b3b9

commit 303c61925d9256be02dcbda8f1e5e0d4adf8b3b9
Author: jah <jah@FreeBSD.org>
Date:   Sat Sep 12 07:04:00 2020 +0000

    amd64: prevent KCSan false positives on LAPIC mapping
    
    For configurations without x2APIC support (guests, older hardware), the global
    LAPIC MMIO mapping will trigger false-positive KCSan reports as it will appear
    that multiple CPUs are concurrently reading and writing the same address.
    This isn't actually true, as the underlying physical access will be performed
    on the local CPU's APIC. Additionally, because LAPIC access can happen during
    event timer configuration, the resulting KCSan printf can produce a panic due
    to attempted recursion on event timer resources.
    
    Add a __nosanitizethread preprocessor define to prevent the compiler from
    inserting TSan hooks, and apply it to the x86 LAPIC accessors.
    
    PR:             249149
    Reported by:    gbe
    Reviewed by:    andrew, kib
    Tested by:      gbe
    Differential Revision:  https://reviews.freebsd.org/D26354

Diff:
---
 newlib/libc/include/sys/cdefs.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index 1be994ffd..da7290921 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -716,8 +716,10 @@
  */
 #if __has_attribute(no_sanitize) && defined(__clang__)
 #define __nosanitizeaddress	__attribute__((no_sanitize("address")))
+#define __nosanitizethread	__attribute__((no_sanitize("thread")))
 #else
 #define __nosanitizeaddress
+#define __nosanitizethread
 #endif
 
 /* Guard variables and structure members by lock. */


                 reply	other threads:[~2020-10-26 13:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20201026133147.B9031385703B@sourceware.org \
    --to=sh@sourceware.org \
    --cc=newlib-cvs@sourceware.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: link
Be 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).