[compiler-rt] b316c30 - [NFC][compiler-rt][test] when using ptrauth, strip before checking if poisoned
Emily Shi via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 16 17:13:26 PDT 2021
Author: Emily Shi
Date: 2021-07-16T17:13:19-07:00
New Revision: b316c30269c35559dd99b1902a97f873c44ac413
URL: https://github.com/llvm/llvm-project/commit/b316c30269c35559dd99b1902a97f873c44ac413
DIFF: https://github.com/llvm/llvm-project/commit/b316c30269c35559dd99b1902a97f873c44ac413.diff
LOG: [NFC][compiler-rt][test] when using ptrauth, strip before checking if poisoned
ptrauth stores info in the address of functions, so it's not the right address we should check if poisoned
rdar://75246928
Differential Revision: https://reviews.llvm.org/D106199
Added:
Modified:
compiler-rt/test/asan/TestCases/Darwin/linked-only.cpp
Removed:
################################################################################
diff --git a/compiler-rt/test/asan/TestCases/Darwin/linked-only.cpp b/compiler-rt/test/asan/TestCases/Darwin/linked-only.cpp
index bb19ea8535e27..d404af6ff05fb 100644
--- a/compiler-rt/test/asan/TestCases/Darwin/linked-only.cpp
+++ b/compiler-rt/test/asan/TestCases/Darwin/linked-only.cpp
@@ -10,6 +10,9 @@
#include <string.h>
#include "sanitizer/asan_interface.h"
+#if __has_feature(ptrauth_calls)
+# include <ptrauth.h>
+#endif
void test_shadow(char *p, size_t size) {
fprintf(stderr, "p = %p\n", p);
@@ -23,7 +26,13 @@ int main(int argc, char *argv[]) {
free(p);
// CHECK: =-1=
- test_shadow((char *)&main, 1);
+ char *mainptr;
+#if __has_feature(ptrauth_calls)
+ mainptr = (char *)ptrauth_strip((void *)&main, ptrauth_key_return_address);
+#else
+ mainptr = (char *)&main;
+#endif
+ test_shadow(mainptr, 1);
// CHECK: =-1=
test_shadow((char *)&p, 1);
More information about the llvm-commits
mailing list