public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Szabolcs Nagy <nsz@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/nsz/pacbti-v6] aarch64: redefine RETURN_ADDRESS to strip PAC Date: Thu, 2 Jul 2020 08:39:14 +0000 (GMT) [thread overview] Message-ID: <20200702083914.3A99D3861024@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=09c1ff256bbfb8d21474e74ae3bd449239aa32c7 commit 09c1ff256bbfb8d21474e74ae3bd449239aa32c7 Author: Szabolcs Nagy <szabolcs.nagy@arm.com> Date: Wed Apr 15 17:40:45 2020 +0100 aarch64: redefine RETURN_ADDRESS to strip PAC RETURN_ADDRESS is used at several places in glibc to mean a valid code address of the call site, but with pac-ret it may contain a pointer authentication code (PAC), so its definition is adjusted. This is gcc PR target/94891: __builtin_return_address should not expose signed pointers to user code where it can cause ABI issues. In glibc RETURN_ADDRESS is only changed if it is built with pac-ret. There is no detection for the specific gcc issue because it is hard to test and the additional xpac does not cause problems. Diff: --- sysdeps/aarch64/sysdep.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/sysdeps/aarch64/sysdep.h b/sysdeps/aarch64/sysdep.h index 2879aeaa5c..48fa8e9e90 100644 --- a/sysdeps/aarch64/sysdep.h +++ b/sysdeps/aarch64/sysdep.h @@ -44,6 +44,13 @@ strip_pac (void *p) asm ("hint 7 // xpaclri" : "+r"(ra)); return ra; } + +/* This is needed when glibc is built with -mbranch-protection=pac-ret + with a gcc that is affected by PR target/94891. */ +# if HAVE_AARCH64_PAC_RET +# undef RETURN_ADDRESS +# define RETURN_ADDRESS(n) strip_pac (__builtin_return_address (n)) +# endif #endif #ifdef __ASSEMBLER__
next reply other threads:[~2020-07-02 8:39 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-07-02 8:39 Szabolcs Nagy [this message] -- strict thread matches above, loose matches on Subject: below -- 2020-07-01 14:33 Szabolcs Nagy
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=20200702083914.3A99D3861024@sourceware.org \ --to=nsz@sourceware.org \ --cc=glibc-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: linkBe 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).