Merge "[MTE] Change scudo init order to get correct PROT_MTE pages."
diff --git a/libc/Android.bp b/libc/Android.bp
index 8f07ef4..0ee353d 100644
--- a/libc/Android.bp
+++ b/libc/Android.bp
@@ -2084,6 +2084,8 @@
local_include_dirs: ["include"],
srcs: ["arch-common/bionic/crtbegin.c"],
defaults: ["crt_defaults"],
+ // When using libc.a, we're using the latest library regardless of target API level.
+ min_sdk_version: "current",
}
cc_object {
@@ -2094,6 +2096,8 @@
"crtbrand",
],
defaults: ["crt_defaults"],
+ // When using libc.a, we're using the latest library regardless of target API level.
+ min_sdk_version: "current",
}
cc_object {
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index 7cf7a2d..33a8a61 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -113,6 +113,7 @@
int msync(const void*, size_t, int) all
int mprotect(const void*, size_t, int) all
int madvise(void*, size_t, int) all
+int process_madvise(int, const struct iovec*, size_t, int, unsigned int) all
int mlock(const void* addr, size_t len) all
int mlock2(const void* addr, size_t len, int flags) all
int munlock(const void* addr, size_t len) all
diff --git a/libc/arch-arm64/bionic/setjmp.S b/libc/arch-arm64/bionic/setjmp.S
index 07270c9..351516f 100644
--- a/libc/arch-arm64/bionic/setjmp.S
+++ b/libc/arch-arm64/bionic/setjmp.S
@@ -118,7 +118,7 @@
// int sigsetjmp(sigjmp_buf env, int save_signal_mask);
ENTRY(sigsetjmp)
__BIONIC_WEAK_ASM_FOR_NATIVE_BRIDGE(sigsetjmp)
- hint #25 // paciasp
+ paciasp
.cfi_negate_ra_state
stp x0, x30, [sp, #-16]!
.cfi_def_cfa_offset 16
@@ -186,7 +186,7 @@
#endif
mov w0, #0
- hint #29 // autiasp
+ autiasp
.cfi_negate_ra_state
ret
END(sigsetjmp)
@@ -296,7 +296,7 @@
// Set return value.
cmp w1, wzr
csinc w0, w1, wzr, ne
- hint #29 // autiasp
+ autiasp
.cfi_negate_ra_state
ret
END(siglongjmp)
diff --git a/libc/arch-arm64/bionic/vfork.S b/libc/arch-arm64/bionic/vfork.S
index 81b84a3..df7b063 100644
--- a/libc/arch-arm64/bionic/vfork.S
+++ b/libc/arch-arm64/bionic/vfork.S
@@ -67,7 +67,7 @@
// Clean up stack shadow in the parent process.
// https://github.com/google/sanitizers/issues/925
- hint #25 // paciasp
+ paciasp
.cfi_negate_ra_state
stp x0, x30, [sp, #-16]!
.cfi_adjust_cfa_offset 16
@@ -81,7 +81,7 @@
.cfi_adjust_cfa_offset -16
.cfi_restore x0
.cfi_restore x30
- hint #29 // autiasp
+ autiasp
.cfi_negate_ra_state
#endif
diff --git a/libc/arch-common/bionic/crtbegin.c b/libc/arch-common/bionic/crtbegin.c
index 29b02dc..f2b6638 100644
--- a/libc/arch-common/bionic/crtbegin.c
+++ b/libc/arch-common/bionic/crtbegin.c
@@ -49,7 +49,7 @@
#define POST "; .size _start, .-_start"
#if defined(__aarch64__)
-__asm__(PRE "/* BTI J */ hint #36; mov x0,sp; b _start_main" POST);
+__asm__(PRE "bti j; mov x0,sp; b _start_main" POST);
#elif defined(__arm__)
__asm__(PRE "mov r0,sp; b _start_main" POST);
#elif defined(__i386__)
diff --git a/libc/include/android/legacy_signal_inlines.h b/libc/include/android/legacy_signal_inlines.h
index 90eda7d..a673446 100644
--- a/libc/include/android/legacy_signal_inlines.h
+++ b/libc/include/android/legacy_signal_inlines.h
@@ -45,12 +45,16 @@
int __libc_current_sigrtmin() __attribute__((__weak__)) __VERSIONER_NO_GUARD;
static __inline int __ndk_legacy___libc_current_sigrtmax() {
- if (__libc_current_sigrtmax) return __libc_current_sigrtmax();
+ if (__builtin_available(android 21, *)) {
+ return __libc_current_sigrtmax();
+ }
return __SIGRTMAX; /* Should match __libc_current_sigrtmax. */
}
static __inline int __ndk_legacy___libc_current_sigrtmin() {
- if (__libc_current_sigrtmin) return __libc_current_sigrtmin();
+ if (__builtin_available(android 21, *)) {
+ return __libc_current_sigrtmin();
+ }
return __SIGRTMIN + 7; /* Should match __libc_current_sigrtmin. */
}
diff --git a/libc/include/android/versioning.h b/libc/include/android/versioning.h
index 3ea414a..2b9a027 100644
--- a/libc/include/android/versioning.h
+++ b/libc/include/android/versioning.h
@@ -33,13 +33,62 @@
#else
-#define __INTRODUCED_IN(api_level)
-#define __DEPRECATED_IN(api_level)
-#define __REMOVED_IN(api_level)
-#define __INTRODUCED_IN_32(api_level)
+// When headers are not processed by the versioner (i.e. compiled into object files),
+// the availability attributed is emitted instead. The clang compiler will make the symbol weak
+// when targeting old api_level and enforce the reference to the symbol to be guarded with
+// __builtin_available(android api_level, *).
+
+// The 'strict' flag is required for NDK clients where the use of "-Wunguarded-availability" cannot
+// be enforced. In the case, the absence of 'strict' makes it possible to call an unavailable API
+// without the __builtin_available check, which will cause a link error at runtime.
+// Android platform build system defines this macro along with -Wunguarded-availability
+#if defined(__ANDROID_UNGUARDED_AVAILABILITY__)
+#define __MAYBE_STRICT
+#else
+#define __MAYBE_STRICT ,strict
+#endif
+
+#define __INTRODUCED_IN(api_level) \
+ __attribute__((availability(android __MAYBE_STRICT,introduced=api_level)))
+#define __DEPRECATED_IN(api_level) \
+ __attribute__((availability(android __MAYBE_STRICT,deprecated=api_level)))
+#define __REMOVED_IN(api_level) \
+ __attribute__((availability(android __MAYBE_STRICT,obsoleted=api_level)))
+
+// The same availability attribute can't be annotated multiple times. Therefore, the macros are
+// defined for the configuration that it is valid for so that declarations like the below doesn't
+// cause inconsistent availability values which is an error with -Wavailability:
+//
+// void foo() __INTRODUCED_IN_32(30) __INTRODUCED_IN_64(31);
+//
+// This also takes the advantage of the fact that we never use bitness-specific macro with
+// arch-specific macro. In other words,
+//
+// void foo() __INTRODUCED_IN_ARM(30) __INTRODUCED_IN_64(31);
+//
+// hasn't been supported and won't be.
+#if !defined(__LP64__)
+#define __INTRODUCED_IN_32(api_level) \
+ __attribute__((availability(android __MAYBE_STRICT,introduced=api_level)))
#define __INTRODUCED_IN_64(api_level)
+#else
+#define __INTRODUCED_IN_32(api_level)
+#define __INTRODUCED_IN_64(api_level) \
+ __attribute__((availability(android __MAYBE_STRICT,introduced=api_level)))
+#endif
+
+#if defined(__arm__) || defined(__aarch64__)
+#define __INTRODUCED_IN_ARM(api_level) \
+ __attribute__((availability(android __MAYBE_STRICT,introduced=api_level)))
+#define __INTRODUCED_IN_X86(api_level)
+#elif defined(__i386__) || defined(__x86_64__)
+#define __INTRODUCED_IN_ARM(api_level)
+#define __INTRODUCED_IN_X86(api_level) \
+ __attribute__((availability(android __MAYBE_STRICT,introduced=api_level)))
+#else
#define __INTRODUCED_IN_ARM(api_level)
#define __INTRODUCED_IN_X86(api_level)
+#endif
#define __VERSIONER_NO_GUARD
#define __VERSIONER_FORTIFY_INLINE
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index fe4ea7f..3b44dab 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -32,6 +32,7 @@
#include <sys/types.h>
#include <linux/memfd.h>
#include <linux/mman.h>
+#include <linux/uio.h>
__BEGIN_DECLS
@@ -161,6 +162,15 @@
*/
int madvise(void* __addr, size_t __size, int __advice);
+/**
+ * [process_madvise(2)](http://man7.org/linux/man-pages/man2/process_madvise.2.html)
+ * works just like madvise(2) but applies to the process specified by the given
+ * PID file descriptor.
+ *
+ * Returns 0 on success, and returns -1 and sets `errno` on failure.
+ */
+int process_madvise(int __pid_fd, const struct iovec* __iov, size_t __count, int __advice, unsigned int __flags);
+
#if defined(__USE_GNU)
/**
diff --git a/libc/libc.map.txt b/libc/libc.map.txt
index a17a33f..f4f35ac 100644
--- a/libc/libc.map.txt
+++ b/libc/libc.map.txt
@@ -1552,12 +1552,13 @@
LIBC_S { # introduced=S
global:
- ffsl;
- ffsll;
__libc_get_static_tls_bounds;
__libc_register_thread_exit_callback;
__libc_iterate_dynamic_tls;
__libc_register_dynamic_tls_listeners;
+ ffsl;
+ ffsll;
+ process_madvise;
} LIBC_R;
LIBC_PRIVATE {
diff --git a/libc/private/bionic_asm_arm64.h b/libc/private/bionic_asm_arm64.h
index e73f25d..ee51a8e 100644
--- a/libc/private/bionic_asm_arm64.h
+++ b/libc/private/bionic_asm_arm64.h
@@ -45,7 +45,7 @@
#if defined(__ARM_FEATURE_BTI_DEFAULT)
#define __bionic_asm_aarch64_feature_bti (1 << 0)
#undef __bionic_asm_custom_entry
-#define __bionic_asm_custom_entry(f) hint #34 // BTI C
+#define __bionic_asm_custom_entry(f) bti c
#else
#define __bionic_asm_aarch64_feature_bti 0
#endif
diff --git a/linker/linker.cpp b/linker/linker.cpp
index c240c56..3488f5c 100644
--- a/linker/linker.cpp
+++ b/linker/linker.cpp
@@ -1242,7 +1242,7 @@
return false;
}
- // find and set DT_RUNPATH and dt_soname
+ // Find and set DT_RUNPATH, DT_SONAME, and DT_FLAGS_1.
// Note that these field values are temporary and are
// going to be overwritten on soinfo::prelink_image
// with values from PT_LOAD segments.
@@ -1254,6 +1254,10 @@
if (d->d_tag == DT_SONAME) {
si->set_soname(elf_reader.get_string(d->d_un.d_val));
}
+ // We need to identify a DF_1_GLOBAL library early so we can link it to namespaces.
+ if (d->d_tag == DT_FLAGS_1) {
+ si->set_dt_flags_1(d->d_un.d_val);
+ }
}
#if !defined(__ANDROID__)
@@ -1552,6 +1556,7 @@
});
ZipArchiveCache zip_archive_cache;
+ soinfo_list_t new_global_group_members;
// Step 1: expand the list of load_tasks to include
// all DT_NEEDED libraries (do not load them just yet)
@@ -1586,13 +1591,31 @@
// When ld_preloads is not null, the first
// ld_preloads_count libs are in fact ld_preloads.
+ bool is_ld_preload = false;
if (ld_preloads != nullptr && soinfos_count < ld_preloads_count) {
ld_preloads->push_back(si);
+ is_ld_preload = true;
}
if (soinfos_count < library_names_count) {
soinfos[soinfos_count++] = si;
}
+
+ // Add the new global group members to all initial namespaces. Do this secondary namespace setup
+ // at the same time that libraries are added to their primary namespace so that the order of
+ // global group members is the same in the every namespace. Only add a library to a namespace
+ // once, even if it appears multiple times in the dependency graph.
+ if (is_ld_preload || (si->get_dt_flags_1() & DF_1_GLOBAL) != 0) {
+ if (!si->is_linked() && namespaces != nullptr && !new_global_group_members.contains(si)) {
+ new_global_group_members.push_back(si);
+ for (auto linked_ns : *namespaces) {
+ if (si->get_primary_namespace() != linked_ns) {
+ linked_ns->add_soinfo(si);
+ si->add_secondary_namespace(linked_ns);
+ }
+ }
+ }
+ }
}
// Step 2: Load libraries in random order (see b/24047022)
@@ -1649,39 +1672,15 @@
register_soinfo_tls(si);
}
- // Step 4: Construct the global group. Note: DF_1_GLOBAL bit of a library is
- // determined at step 3.
-
- // Step 4-1: DF_1_GLOBAL bit is force set for LD_PRELOADed libs because they
- // must be added to the global group
+ // Step 4: Construct the global group. DF_1_GLOBAL bit is force set for LD_PRELOADed libs because
+ // they must be added to the global group. Note: The DF_1_GLOBAL bit for a library is normally set
+ // in step 3.
if (ld_preloads != nullptr) {
for (auto&& si : *ld_preloads) {
si->set_dt_flags_1(si->get_dt_flags_1() | DF_1_GLOBAL);
}
}
- // Step 4-2: Gather all DF_1_GLOBAL libs which were newly loaded during this
- // run. These will be the new member of the global group
- soinfo_list_t new_global_group_members;
- for (auto&& task : load_tasks) {
- soinfo* si = task->get_soinfo();
- if (!si->is_linked() && (si->get_dt_flags_1() & DF_1_GLOBAL) != 0) {
- new_global_group_members.push_back(si);
- }
- }
-
- // Step 4-3: Add the new global group members to all the linked namespaces
- if (namespaces != nullptr) {
- for (auto linked_ns : *namespaces) {
- for (auto si : new_global_group_members) {
- if (si->get_primary_namespace() != linked_ns) {
- linked_ns->add_soinfo(si);
- si->add_secondary_namespace(linked_ns);
- }
- }
- }
- }
-
// Step 5: Collect roots of local_groups.
// Whenever needed_by->si link crosses a namespace boundary it forms its own local_group.
// Here we collect new roots to link them separately later on. Note that we need to avoid
diff --git a/tests/dl_test.cpp b/tests/dl_test.cpp
index 6adba19..6c9bf3f 100644
--- a/tests/dl_test.cpp
+++ b/tests/dl_test.cpp
@@ -268,8 +268,16 @@
}
#endif
-// _lib1.so and _lib2.so are now searchable by having another namespace 'ns2'
+// lib1.so and lib2.so are now searchable by having another namespace 'ns2'
// whose search paths include the 'ns2/' subdir.
+//
+// lib1.so is linked with DF_1_GLOBAL, so both it and the executable are added
+// to every namespace.
+//
+// namespace configuration ('*' indicates primary ns)
+// - default: exe[*], lib1.so
+// - ns2: exe, lib1.so[*], lib2.so[*]
+//
TEST(dl, exec_with_ld_config_file) {
#if defined(__BIONIC__)
SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config";
@@ -285,13 +293,28 @@
ExecTestHelper eth;
eth.SetArgs({ helper.c_str(), nullptr });
eth.SetEnv({ env.c_str(), nullptr });
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, "12345");
+ eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0,
+ "foo lib1\n"
+ "lib1_call_funcs\n"
+ "foo lib1\n"
+ "bar lib2\n");
#endif
}
-// _lib3.so has same symbol as lib2.so but returns 54321. _lib3.so is
-// LD_PRELOADed. This test is to ensure LD_PRELOADed libs are available to
-// additional namespaces other than the default namespace.
+// lib3.so has same foo and bar symbols as lib2.so. lib3.so is LD_PRELOADed.
+// This test ensures that LD_PRELOADed libs are available to all namespaces.
+//
+// namespace configuration ('*' indicates primary ns)
+// - default: exe[*], lib3.so[*], lib1.so
+// - ns2: exe, lib3.so, lib1.so[*], lib2.so[*]
+//
+// Ensure that, in both namespaces, a call to foo calls the lib3.so symbol,
+// which then calls the lib1.so symbol using RTLD_NEXT. Ensure that RTLD_NEXT
+// finds nothing when called from lib1.so.
+//
+// For the bar symbol, lib3.so's primary namespace is the default namespace, but
+// lib2.so is not in the default namespace, so using RTLD_NEXT from lib3.so
+// doesn't find the symbol in lib2.so.
TEST(dl, exec_with_ld_config_file_with_ld_preload) {
#if defined(__BIONIC__)
SKIP_WITH_HWASAN << "libclang_rt.hwasan is not found with custom ld config";
@@ -308,7 +331,17 @@
ExecTestHelper eth;
eth.SetArgs({ helper.c_str(), nullptr });
eth.SetEnv({ env.c_str(), env2.c_str(), nullptr });
- eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0, "54321");
+ eth.Run([&]() { execve(helper.c_str(), eth.GetArgs(), eth.GetEnv()); }, 0,
+ "foo lib3\n"
+ "foo lib1\n"
+ "lib1_call_funcs\n"
+ "foo lib3\n"
+ "foo lib1\n"
+ "bar lib3\n"
+ "lib3_call_funcs\n"
+ "foo lib3\n"
+ "foo lib1\n"
+ "bar lib3\n");
#endif
}
diff --git a/tests/dlext_test.cpp b/tests/dlext_test.cpp
index 01bf8ab..e3caf0e 100644
--- a/tests/dlext_test.cpp
+++ b/tests/dlext_test.cpp
@@ -717,13 +717,12 @@
uint64_t addr = reinterpret_cast<uint64_t>(ptr);
std::string found_name = "<not found>";
- EXPECT_TRUE(android::procinfo::ReadMapFile(
- "/proc/self/maps",
- [&](uint64_t start, uint64_t end, uint16_t, uint16_t, ino_t, const char* name) {
- if (addr >= start && addr < end) {
- found_name = name;
- }
- }));
+ EXPECT_TRUE(android::procinfo::ReadMapFile("/proc/self/maps",
+ [&](const android::procinfo::MapInfo& mapinfo) {
+ if (addr >= mapinfo.start && addr < mapinfo.end) {
+ found_name = mapinfo.name;
+ }
+ }));
return found_name;
}
diff --git a/tests/libs/Android.bp b/tests/libs/Android.bp
index 385d120..ba1c198 100644
--- a/tests/libs/Android.bp
+++ b/tests/libs/Android.bp
@@ -1478,6 +1478,8 @@
srcs: ["ld_config_test_helper_lib1.cpp"],
shared_libs: ["ld_config_test_helper_lib2"],
relative_install_path: "bionic-loader-test-libs/ns2",
+ // Mark the library DF_1_GLOBAL so it is added to every linker namespace.
+ ldflags: ["-Wl,-z,global"]
}
cc_test_library {
diff --git a/tests/libs/ld_config_test_helper.cpp b/tests/libs/ld_config_test_helper.cpp
index 87e512e..1249121 100644
--- a/tests/libs/ld_config_test_helper.cpp
+++ b/tests/libs/ld_config_test_helper.cpp
@@ -22,7 +22,9 @@
#endif
#include <unistd.h>
-extern int get_value_from_lib();
+extern "C" void foo();
+void lib1_call_funcs();
+__attribute__((weak)) void lib3_call_funcs();
int main() {
bool skip_vdso_check = false;
@@ -45,6 +47,9 @@
dlclose(handle);
}
- printf("%d", get_value_from_lib());
+ foo();
+ lib1_call_funcs();
+ if (lib3_call_funcs) lib3_call_funcs();
+
return 0;
}
diff --git a/tests/libs/ld_config_test_helper_lib1.cpp b/tests/libs/ld_config_test_helper_lib1.cpp
index fc5401a..ffa9a45 100644
--- a/tests/libs/ld_config_test_helper_lib1.cpp
+++ b/tests/libs/ld_config_test_helper_lib1.cpp
@@ -1,4 +1,19 @@
-extern int get_value_from_another_lib();
-int get_value_from_lib() {
- return get_value_from_another_lib();
+#include <dlfcn.h>
+#include <stdio.h>
+
+// Mark foo and bar weak so that Clang allows the run-time linker to decide which DSO's symbol to
+// use.
+
+__attribute__((weak)) extern "C" void foo() {
+ printf("foo lib1\n");
+ void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "foo"));
+ if (next != nullptr) next();
+}
+
+__attribute__((weak)) extern "C" void bar();
+
+void lib1_call_funcs() {
+ printf("lib1_call_funcs\n");
+ foo();
+ bar();
}
diff --git a/tests/libs/ld_config_test_helper_lib2.cpp b/tests/libs/ld_config_test_helper_lib2.cpp
index a620a6c..d5bca2c 100644
--- a/tests/libs/ld_config_test_helper_lib2.cpp
+++ b/tests/libs/ld_config_test_helper_lib2.cpp
@@ -1,3 +1,11 @@
-int get_value_from_another_lib() {
- return 12345;
+#include <dlfcn.h>
+#include <stdio.h>
+
+// Mark foo and bar weak so that Clang allows the run-time linker to decide which DSO's symbol to
+// use.
+
+__attribute__((weak)) extern "C" void bar() {
+ printf("bar lib2\n");
+ void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "bar"));
+ if (next != nullptr) next();
}
diff --git a/tests/libs/ld_config_test_helper_lib3.cpp b/tests/libs/ld_config_test_helper_lib3.cpp
index 93d1cd8..94e1570 100644
--- a/tests/libs/ld_config_test_helper_lib3.cpp
+++ b/tests/libs/ld_config_test_helper_lib3.cpp
@@ -1,3 +1,23 @@
-int get_value_from_another_lib() {
- return 54321;
+#include <dlfcn.h>
+#include <stdio.h>
+
+// Mark foo and bar weak so that Clang allows the run-time linker to decide which DSO's symbol to
+// use.
+
+__attribute__((weak)) extern "C" void foo() {
+ printf("foo lib3\n");
+ void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "foo"));
+ if (next != nullptr) next();
+}
+
+__attribute__((weak)) extern "C" void bar() {
+ printf("bar lib3\n");
+ void (*next)(void) = reinterpret_cast<void (*)()>(dlsym(RTLD_NEXT, "bar"));
+ if (next != nullptr) next();
+}
+
+void lib3_call_funcs() {
+ printf("lib3_call_funcs\n");
+ foo();
+ bar();
}
diff --git a/tests/malloc_iterate_test.cpp b/tests/malloc_iterate_test.cpp
index 738a57b..e896c90 100644
--- a/tests/malloc_iterate_test.cpp
+++ b/tests/malloc_iterate_test.cpp
@@ -95,7 +95,8 @@
test_data->total_allocated_bytes = 0;
// Find all of the maps that are from the native allocator.
- auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
+ auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name,
+ bool) {
if (strcmp(name, "[anon:libc_malloc]") == 0 || strncmp(name, "[anon:scudo:", 12) == 0 ||
strncmp(name, "[anon:GWP-ASan", 14) == 0) {
malloc_iterate(start, end - start, SavePointers, test_data);
@@ -192,7 +193,8 @@
TestDataType test_data = {};
// Only attempt to get memory data for maps that are not from the native allocator.
- auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name) {
+ auto callback = [&](uint64_t start, uint64_t end, uint16_t, uint64_t, ino_t, const char* name,
+ bool) {
if (strcmp(name, "[anon:libc_malloc]") != 0 && strncmp(name, "[anon:scudo:", 12) != 0 &&
strncmp(name, "[anon:GWP-ASan", 14) != 0) {
size_t total = test_data.total_allocated_bytes;
diff --git a/tests/signal_test.cpp b/tests/signal_test.cpp
index f465458..ffbb667 100644
--- a/tests/signal_test.cpp
+++ b/tests/signal_test.cpp
@@ -803,15 +803,13 @@
#endif
TEST(signal, sigset_size) {
- // The setjmp implementations for ARM, AArch64, x86, and x86_64 assume that sigset_t can fit in a
- // long. This is true because ARM and x86 have broken rt signal support, and AArch64 and x86_64
- // both have a SIGRTMAX defined as 64.
-#if defined(__arm__) || defined(__aarch64__) || defined(__i386__) || defined(__x86_64__)
+ // The setjmp implementations assume that sigset_t can fit in a
+ // long. This is true because ARM and x86 have broken rt signal support,
+ // and AArch64 and x86_64 both have a SIGRTMAX defined as 64.
#if defined(__BIONIC__)
static_assert(sizeof(sigset_t) <= sizeof(long), "sigset_t doesn't fit in a long");
#endif
static_assert(sizeof(sigset64_t)*8 >= 64, "sigset64_t too small for real-time signals");
-#endif
}
TEST(signal, sigignore_EINVAL) {
diff --git a/tests/time_test.cpp b/tests/time_test.cpp
index b1de0a4..93ba426 100644
--- a/tests/time_test.cpp
+++ b/tests/time_test.cpp
@@ -851,11 +851,11 @@
}
TEST(time, clock) {
- // clock(3) is hard to test, but a 1s sleep should cost less than 5ms.
+ // clock(3) is hard to test, but a 1s sleep should cost less than 10ms.
clock_t t0 = clock();
sleep(1);
clock_t t1 = clock();
- ASSERT_LT(t1 - t0, 5 * (CLOCKS_PER_SEC / 1000));
+ ASSERT_LT(t1 - t0, 10 * (CLOCKS_PER_SEC / 1000));
}
static pid_t GetInvalidPid() {