aboutsummaryrefslogtreecommitdiff
path: root/newlib/libc/include
diff options
context:
space:
mode:
authorMark Johnston <markj@FreeBSD.org>2021-05-07 14:26:28 -0400
committerSebastian Huber <sebastian.huber@embedded-brains.de>2022-07-11 11:52:46 +0200
commit8801440e4f8e2d67d94716fafa59847198522f11 (patch)
tree2d5ac218c8754867169a6e31e551795ca774ceb6 /newlib/libc/include
parent65338d7299bde3182805a187f77e2bbbaf929784 (diff)
downloadnewlib-8801440e4f8e2d67d94716fafa59847198522f11.zip
newlib-8801440e4f8e2d67d94716fafa59847198522f11.tar.gz
newlib-8801440e4f8e2d67d94716fafa59847198522f11.tar.bz2
cdefs: Make __nosanitizeaddress work for KASAN as well
Add __nosanitizememory while I'm here. Reviewed by: andrew, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30126
Diffstat (limited to 'newlib/libc/include')
-rw-r--r--newlib/libc/include/sys/cdefs.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index 6d179c2..7eb6c04 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -699,12 +699,18 @@
#define __no_lock_analysis __lock_annotate(no_thread_safety_analysis)
/*
- * Function or variable should not be sanitized, i.e. by AddressSanitizer.
+ * Function or variable should not be sanitized, e.g., by AddressSanitizer.
* GCC has the nosanitize attribute, but as a function attribute only, and
* warns on use as a variable attribute.
*/
#if __has_attribute(no_sanitize) && defined(__clang__)
+#ifdef _KERNEL
+#define __nosanitizeaddress __attribute__((no_sanitize("kernel-address")))
+#define __nosanitizememory __attribute__((no_sanitize("kernel-memory")))
+#else
#define __nosanitizeaddress __attribute__((no_sanitize("address")))
+#define __nosanitizememory __attribute__((no_sanitize("memory")))
+#endif
#define __nosanitizethread __attribute__((no_sanitize("thread")))
#else
#define __nosanitizeaddress