[compiler-rt] c747451 - [compiler-rt][hwasan] Massage prctl/arch_prctl API constants.

Alexander Potapenko via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 25 01:09:43 PDT 2022


Author: Alexander Potapenko
Date: 2022-08-25T10:09:29+02:00
New Revision: c747451dc0439f0e422d99cc456575d8fa04087f

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

LOG: [compiler-rt][hwasan] Massage prctl/arch_prctl API constants.

Move the definitions outside InitializeOsSupport(). Also remove the
undefs, as these constants won't be visible outside the .cpp file anyway.

Differential Revision: https://reviews.llvm.org/D132543

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 2d7a44525c5ff..e81b55f7e4573 100644
--- a/compiler-rt/lib/hwasan/hwasan_linux.cpp
+++ b/compiler-rt/lib/hwasan/hwasan_linux.cpp
@@ -110,12 +110,13 @@ static void InitializeShadowBaseAddress(uptr shadow_size_bytes) {
       FindDynamicShadowStart(shadow_size_bytes);
 }
 
-void InitializeOsSupport() {
 #  define PR_SET_TAGGED_ADDR_CTRL 55
 #  define PR_GET_TAGGED_ADDR_CTRL 56
 #  define PR_TAGGED_ADDR_ENABLE (1UL << 0)
 #  define ARCH_GET_UNTAG_MASK 0x4001
 #  define ARCH_ENABLE_TAGGED_ADDR 0x4002
+
+void InitializeOsSupport() {
   // Check we're running on a kernel that can use the tagged address ABI.
   int local_errno = 0;
   bool has_abi;
@@ -169,9 +170,6 @@ void InitializeOsSupport() {
       Die();
     }
   }
-#  undef PR_SET_TAGGED_ADDR_CTRL
-#  undef PR_GET_TAGGED_ADDR_CTRL
-#  undef PR_TAGGED_ADDR_ENABLE
 }
 
 bool InitShadow() {


        


More information about the llvm-commits mailing list