diff options
author | Florian Mayer <fmayer@google.com> | 2024-05-17 15:14:07 -0700 |
---|---|---|
committer | Florian Mayer <fmayer@google.com> | 2024-05-17 15:14:07 -0700 |
commit | 34c1fe34b022afa8c8059f6558a92fdadefefc7d (patch) | |
tree | e1a268297b16a7a4234c56b6c1025ecc7a222deb | |
parent | d484c4d3501a7ff3d00a6e0cfad026a3b01d320c (diff) |
[𝘀𝗽𝗿] initial versionupstream/users/fmayer/spr/sanitizer-disallow-external_symbolizer_path-with-at_secure
Created using spr 1.3.4
-rw-r--r-- | compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp index 0ddc24802d21..68d51dd1cb9b 100644 --- a/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp +++ b/compiler-rt/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp @@ -25,6 +25,7 @@ # include "sanitizer_common.h" # include "sanitizer_file.h" # include "sanitizer_flags.h" +# include "sanitizer_getauxval.h" # include "sanitizer_internal_defs.h" # include "sanitizer_linux.h" # include "sanitizer_placement_new.h" @@ -408,7 +409,13 @@ const char *Symbolizer::PlatformDemangle(const char *name) { static SymbolizerTool *ChooseExternalSymbolizer(LowLevelAllocator *allocator) { const char *path = common_flags()->external_symbolizer_path; - + // This is so we can use the weak definition from sanitizer_getauxval.h + if (&getauxval && getauxval(/* AT_SECURE */ 23) != 0) { + Report( + "ERROR: external_symbolizer_path cannot be used for AT_SECURE " + "(e.g. setuid binaries).\n"); + Die(); + } if (path && internal_strchr(path, '%')) { char *new_path = (char *)InternalAlloc(kMaxPathLength); SubstituteForFlagValue(path, new_path, kMaxPathLength); |