Skip to content

Commit 18292a4

Browse files
authored
[sanitizer_common] Drop remaining support for Android 5 or older (#146187)
Dependent on #145227
1 parent 48ff068 commit 18292a4

File tree

5 files changed

+1
-100
lines changed

5 files changed

+1
-100
lines changed

compiler-rt/lib/asan/asan_rtl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,6 @@ static bool AsanInitInternal() {
528528
AsanThread *main_thread = CreateMainThread();
529529
CHECK_EQ(0, main_thread->tid());
530530
force_interface_symbols(); // no-op.
531-
SanitizerInitializeUnwinder();
532531

533532
if (CAN_SANITIZE_LEAKS) {
534533
__lsan::InitCommonLsan();

compiler-rt/lib/memprof/memprof_rtl.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,6 @@ static void MemprofInitInternal() {
219219
MemprofThread *main_thread = CreateMainThread();
220220
CHECK_EQ(0, main_thread->tid());
221221
force_interface_symbols(); // no-op.
222-
SanitizerInitializeUnwinder();
223222

224223
Symbolizer::LateInitialize();
225224

compiler-rt/lib/sanitizer_common/sanitizer_common.h

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -925,12 +925,6 @@ class ListOfModules {
925925
// Callback type for iterating over a set of memory ranges.
926926
typedef void (*RangeIteratorCallback)(uptr begin, uptr end, void *arg);
927927

928-
enum AndroidApiLevel {
929-
ANDROID_NOT_ANDROID = 0,
930-
ANDROID_LOLLIPOP_MR1 = 22,
931-
ANDROID_POST_LOLLIPOP = 23
932-
};
933-
934928
void WriteToSyslog(const char *buffer);
935929

936930
#if defined(SANITIZER_WINDOWS) && defined(_MSC_VER) && !defined(__clang__)
@@ -963,19 +957,8 @@ inline void AndroidLogInit() {}
963957
inline void SetAbortMessage(const char *) {}
964958
#endif
965959

966-
#if SANITIZER_ANDROID
967-
void SanitizerInitializeUnwinder();
968-
AndroidApiLevel AndroidGetApiLevel();
969-
#else
970-
inline void AndroidLogWrite(const char *buffer_unused) {}
971-
inline void SanitizerInitializeUnwinder() {}
972-
inline AndroidApiLevel AndroidGetApiLevel() { return ANDROID_NOT_ANDROID; }
973-
#endif
974-
975960
inline uptr GetPthreadDestructorIterations() {
976-
#if SANITIZER_ANDROID
977-
return (AndroidGetApiLevel() == ANDROID_LOLLIPOP_MR1) ? 8 : 4;
978-
#elif SANITIZER_POSIX
961+
#if SANITIZER_POSIX
979962
return 4;
980963
#else
981964
// Unused on Windows.

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1901,54 +1901,6 @@ int internal_uname(struct utsname *buf) {
19011901
}
19021902
# endif
19031903

1904-
# if SANITIZER_ANDROID
1905-
static int dl_iterate_phdr_test_cb(struct dl_phdr_info *info, size_t size,
1906-
void *data) {
1907-
// Any name starting with "lib" indicates a bug in L where library base names
1908-
// are returned instead of paths.
1909-
if (info->dlpi_name && info->dlpi_name[0] == 'l' &&
1910-
info->dlpi_name[1] == 'i' && info->dlpi_name[2] == 'b') {
1911-
*(bool *)data = true;
1912-
return 1;
1913-
}
1914-
return 0;
1915-
}
1916-
1917-
static atomic_uint32_t android_api_level;
1918-
1919-
static AndroidApiLevel AndroidDetectApiLevelStatic() {
1920-
# if __ANDROID_API__ <= 22
1921-
return ANDROID_LOLLIPOP_MR1;
1922-
# else
1923-
return ANDROID_POST_LOLLIPOP;
1924-
# endif
1925-
}
1926-
1927-
static AndroidApiLevel AndroidDetectApiLevel() {
1928-
bool base_name_seen = false;
1929-
dl_iterate_phdr(dl_iterate_phdr_test_cb, &base_name_seen);
1930-
if (base_name_seen)
1931-
return ANDROID_LOLLIPOP_MR1; // L MR1
1932-
return ANDROID_POST_LOLLIPOP; // post-L
1933-
// Plain L (API level 21) is completely broken wrt ASan and not very
1934-
// interesting to detect.
1935-
}
1936-
1937-
extern "C" __attribute__((weak)) void *_DYNAMIC;
1938-
1939-
AndroidApiLevel AndroidGetApiLevel() {
1940-
AndroidApiLevel level =
1941-
(AndroidApiLevel)atomic_load(&android_api_level, memory_order_relaxed);
1942-
if (level)
1943-
return level;
1944-
level = &_DYNAMIC == nullptr ? AndroidDetectApiLevelStatic()
1945-
: AndroidDetectApiLevel();
1946-
atomic_store(&android_api_level, level, memory_order_relaxed);
1947-
return level;
1948-
}
1949-
1950-
# endif
1951-
19521904
static HandleSignalMode GetHandleSignalModeImpl(int signum) {
19531905
switch (signum) {
19541906
case SIGABRT:

compiler-rt/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -91,38 +91,6 @@ _Unwind_Reason_Code Unwind_Trace(struct _Unwind_Context *ctx, void *param) {
9191

9292
} // namespace
9393

94-
#if SANITIZER_ANDROID
95-
void SanitizerInitializeUnwinder() {
96-
if (AndroidGetApiLevel() >= ANDROID_LOLLIPOP_MR1) return;
97-
98-
// Pre-lollipop Android can not unwind through signal handler frames with
99-
// libgcc unwinder, but it has a libcorkscrew.so library with the necessary
100-
// workarounds.
101-
void *p = dlopen("libcorkscrew.so", RTLD_LAZY);
102-
if (!p) {
103-
VReport(1,
104-
"Failed to open libcorkscrew.so. You may see broken stack traces "
105-
"in SEGV reports.");
106-
return;
107-
}
108-
acquire_my_map_info_list =
109-
(acquire_my_map_info_list_func)(uptr)dlsym(p, "acquire_my_map_info_list");
110-
release_my_map_info_list =
111-
(release_my_map_info_list_func)(uptr)dlsym(p, "release_my_map_info_list");
112-
unwind_backtrace_signal_arch = (unwind_backtrace_signal_arch_func)(uptr)dlsym(
113-
p, "unwind_backtrace_signal_arch");
114-
if (!acquire_my_map_info_list || !release_my_map_info_list ||
115-
!unwind_backtrace_signal_arch) {
116-
VReport(1,
117-
"Failed to find one of the required symbols in libcorkscrew.so. "
118-
"You may see broken stack traces in SEGV reports.");
119-
acquire_my_map_info_list = 0;
120-
unwind_backtrace_signal_arch = 0;
121-
release_my_map_info_list = 0;
122-
}
123-
}
124-
#endif
125-
12694
void BufferedStackTrace::UnwindSlow(uptr pc, u32 max_depth) {
12795
CHECK_GE(max_depth, 2);
12896
size = 0;

0 commit comments

Comments
 (0)