[llvm-branch-commits] [compiler-rt] 704831f - Revert "Hwasan InitPrctl check for error using internal_iserror"

Nico Weber via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed Jan 13 05:34:42 PST 2021


Author: Nico Weber
Date: 2021-01-13T08:30:11-05:00
New Revision: 704831fe1f1f02e41ab7440a6f6c2c390ec183b1

URL: https://github.com/llvm/llvm-project/commit/704831fe1f1f02e41ab7440a6f6c2c390ec183b1
DIFF: https://github.com/llvm/llvm-project/commit/704831fe1f1f02e41ab7440a6f6c2c390ec183b1.diff

LOG: Revert "Hwasan InitPrctl check for error using internal_iserror"

This reverts commit 1854594b80b444dc21b830b51e53e05d38fc7d60.
See https://reviews.llvm.org/D94425#2495621

Added: 
    

Modified: 
    compiler-rt/lib/hwasan/hwasan_linux.cpp

Removed: 
    


################################################################################
diff  --git a/compiler-rt/lib/hwasan/hwasan_linux.cpp b/compiler-rt/lib/hwasan/hwasan_linux.cpp
index 793fd2fab6bf..e99926d355cf 100644
--- a/compiler-rt/lib/hwasan/hwasan_linux.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_linux.cpp
@@ -119,10 +119,8 @@ void InitPrctl() {
 #define PR_GET_TAGGED_ADDR_CTRL 56
 #define PR_TAGGED_ADDR_ENABLE (1UL << 0)
   // Check we're running on a kernel that can use the tagged address ABI.
-  int local_errno = 0;
-  if (internal_iserror(internal_prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0),
-                       &local_errno) &&
-      local_errno == EINVAL) {
+  if (internal_prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0) == (uptr)-1 &&
+      errno == EINVAL) {
 #if SANITIZER_ANDROID
     // Some older Android kernels have the tagged pointer ABI on
     // unconditionally, and hence don't have the tagged-addr prctl while still
@@ -139,8 +137,8 @@ void InitPrctl() {
   }
 
   // Turn on the tagged address ABI.
-  if (internal_iserror(internal_prctl(PR_SET_TAGGED_ADDR_CTRL,
-                                      PR_TAGGED_ADDR_ENABLE, 0, 0, 0)) ||
+  if (internal_prctl(PR_SET_TAGGED_ADDR_CTRL, PR_TAGGED_ADDR_ENABLE, 0, 0, 0) ==
+          (uptr)-1 ||
       !internal_prctl(PR_GET_TAGGED_ADDR_CTRL, 0, 0, 0, 0)) {
     Printf(
         "FATAL: HWAddressSanitizer failed to enable tagged address syscall "


        


More information about the llvm-branch-commits mailing list