public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: newlib@sourceware.org
Subject: [PATCH 2/5] Don't sanitize linker_set
Date: Mon, 19 Oct 2020 17:55:34 +0200	[thread overview]
Message-ID: <20201019155537.15290-3-sebastian.huber@embedded-brains.de> (raw)
In-Reply-To: <20201019155537.15290-1-sebastian.huber@embedded-brains.de>

From: dab <dab@FreeBSD.org>

The assumptions of linker_set don't play nicely with
AddressSanitizer. AddressSanitizer adds a 'redzone' of zeros around
globals (including those in named sections), whereas linker_set
assumes they are all packed consecutively like a pointer array. So:
let's annotate linker_set so that AddressSanitizer ignores it.

Submitted by:	Matthew Bryan <matthew.bryan@isilon.com>
Reviewed by:	kib, rang_acm.org
Sponsored by:	Dell EMC Isilon
Differential Revision:	https://reviews.freebsd.org/D22239
---
 newlib/libc/include/sys/cdefs.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index 9a0466fff..1f2ce063d 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -709,6 +709,13 @@
 /* Function should not be analyzed. */
 #define	__no_lock_analysis	__lock_annotate(no_thread_safety_analysis)
 
+/* Function or variable should not be sanitized, ie. by AddressSanitizer */
+#if __has_attribute(no_sanitize)
+#define __nosanitizeaddress	__attribute__((no_sanitize("address")))
+#else
+#define __nosanitizeaddress
+#endif
+
 /* Guard variables and structure members by lock. */
 #define	__guarded_by(x)		__lock_annotate(guarded_by(x))
 #define	__pt_guarded_by(x)	__lock_annotate(pt_guarded_by(x))
-- 
2.26.2


  parent reply	other threads:[~2020-10-19 15:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-19 15:55 [PATCH 0/5] Synchronize <sys/cdefs.h> and <stdatomic.h> with FreeBSD Sebastian Huber
2020-10-19 15:55 ` [PATCH 1/5] Make the system C11 atomics headers fully compatible with external GCC Sebastian Huber
2020-10-19 15:55 ` Sebastian Huber [this message]
2020-10-19 15:55 ` [PATCH 3/5] gcc: quiet Wattribute for no_sanitize("address") Sebastian Huber
2020-10-19 15:55 ` [PATCH 4/5] sys: clean up empty lines in .c and .h files Sebastian Huber
2020-10-19 15:55 ` [PATCH 5/5] amd64: prevent KCSan false positives on LAPIC mapping Sebastian Huber
2020-10-26  9:51 ` [PATCH 0/5] Synchronize <sys/cdefs.h> and <stdatomic.h> with FreeBSD Corinna Vinschen

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=20201019155537.15290-3-sebastian.huber@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=newlib@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).