From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1921) id 0FD48385C32C; Mon, 11 Jul 2022 09:53:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0FD48385C32C Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Sebastian Huber To: newlib-cvs@sourceware.org Subject: [newlib-cygwin] cdefs: Make __nosanitizeaddress work for KASAN as well X-Act-Checkin: newlib-cygwin X-Git-Author: Mark Johnston X-Git-Refname: refs/heads/master X-Git-Oldrev: 65338d7299bde3182805a187f77e2bbbaf929784 X-Git-Newrev: 8801440e4f8e2d67d94716fafa59847198522f11 Message-Id: <20220711095348.0FD48385C32C@sourceware.org> Date: Mon, 11 Jul 2022 09:53:48 +0000 (GMT) X-BeenThere: newlib-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Newlib GIT logs List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 11 Jul 2022 09:53:48 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D8801440e4f8= e2d67d94716fafa59847198522f11 commit 8801440e4f8e2d67d94716fafa59847198522f11 Author: Mark Johnston Date: Fri May 7 14:26:28 2021 -0400 cdefs: Make __nosanitizeaddress work for KASAN as well =20 Add __nosanitizememory while I'm here. =20 Reviewed by: andrew, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D30126 Diff: --- newlib/libc/include/sys/cdefs.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdef= s.h index 6d179c2b4..7eb6c0430 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) =20 /* - * 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