platform_bionic/tests
Evgenii Stepanov 071416b700 Use PROT_NONE on the unused parts of CFI shadow.
This replaces a single 2Gb readable memory region with a bunch of tiny
regions, and leaves the bulk of 2Gb mapped but unaccessible. This makes
it harder to defeat ASLR by probing for the CFI shadow region.

Sample CFI shadow mapping with this change:
7165151000-716541f000 ---p 00000000 00:00 0                              [anon:cfi shadow]
716541f000-7165420000 r--p 00000000 00:00 0                              [anon:cfi shadow]
7165420000-71654db000 ---p 00000000 00:00 0                              [anon:cfi shadow]
71654db000-71654dc000 r--p 00000000 00:00 0                              [anon:cfi shadow]
71654dc000-71654dd000 r--p 00000000 00:00 0                              [anon:cfi shadow]
71654dd000-71654f0000 ---p 00000000 00:00 0                              [anon:cfi shadow]
71654f0000-71654f1000 r--p 00000000 00:00 0                              [anon:cfi shadow]
71654f1000-71e5151000 ---p 00000000 00:00 0                              [anon:cfi shadow]

This change degrades CFI diagnostics for wild jumps and casts (i.e. when
the target of a CFI check is outside of any known library bounds). This
is acceptable, because CFI does not have much to tell about those cases
anyway. Such bugs will show up as SEGV_ACCERR crashes inside
__cfi_slowpath in libdl.so from now on.

Bug: 158113540
Test: bionic-unit-tests/cfi_test.*
Test: adb shell cat /proc/$PID/maps | grep cfi

Change-Id: I57cbd0d3f87eb1610ad99b48d98ffd497ba214b4
Merged-In: I57cbd0d3f87eb1610ad99b48d98ffd497ba214b4
2020-06-12 12:22:32 -07:00
..
headers Add ffsl(3), ffsll(3). 2020-03-26 11:43:05 -07:00
libs Use PROT_NONE on the unused parts of CFI shadow. 2020-06-12 12:22:32 -07:00
math_data
prebuilt-elf-files Remove mips test workarounds. 2020-02-13 09:48:14 -08:00
__aeabi_read_tp_test.cpp Make tls related header files platform accessible. 2019-09-27 12:14:24 -07:00
__cxa_atexit_test.cpp Rewrite __cxa_atexit / __cxa_finalize 2020-03-06 21:04:32 -08:00
__cxa_thread_atexit_test.cpp
_FILE_OFFSET_BITS_test.cpp _FILE_OFFSET_BITS=64 support for fcntl. 2020-01-29 19:36:14 -08:00
alloca_test.cpp A few new bionic tests. 2017-12-07 15:44:20 -08:00
Android.bp Merge "Introduce a new heap tagging level, M_HEAP_TAGGING_LEVEL_SYNC." 2020-05-07 17:51:51 +00:00
Android.build.prebuilt.mk Remove mips test workarounds. 2020-02-13 09:48:14 -08:00
Android.mk fortify: import tests from Chrome OS 2019-06-10 12:46:49 -07:00
android_get_device_api_level.cpp Fix argument order in api level test 2020-05-03 20:10:51 -07:00
android_unsafe_frame_pointer_chase_test.cpp Handle the alternate signal stack correctly in android_unsafe_frame_pointer_chase. 2020-02-27 10:44:15 -08:00
arpa_inet_test.cpp
assert_test.cpp Stop #define'ing __func__ and __restrict. 2016-07-25 11:13:47 -07:00
async_safe_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
atexit_test.cpp Remove workarounds for old versions of clang and GCC. 2018-07-11 13:18:29 -07:00
bionic_allocator_test.cpp Add BionicAllocator::memalign 2019-01-25 15:31:35 -08:00
BionicDeathTest.h Add struct sigaction64 and sigaction64. 2018-02-01 14:45:15 -08:00
buffer_tests.cpp Cleanup bionic tests with hwasan. 2019-02-06 13:59:16 -08:00
buffer_tests.h Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
bug_26110743_test.cpp Fix uses of readlink in tests. 2018-08-23 11:30:56 -07:00
byteswap_test.cpp A few new bionic tests. 2017-12-07 15:44:20 -08:00
cfi_test.cpp Fix possible issue with cfi_basic test. 2020-04-02 05:48:05 +00:00
clang_fortify_asan.cpp fortify: allow diagnostics without run-time checks (attempt #2) 2019-11-19 14:20:26 -08:00
clang_fortify_tests.cpp Fix foritfy test for clang update. 2020-04-17 19:07:36 +00:00
complex_force_long_double_test.cpp Use __RENAME for long double functions. 2017-09-14 16:10:43 -07:00
complex_test.cpp Remove __INTRODUCED_IN_FUTURE. 2019-03-14 13:34:21 -07:00
core_shared_libs.h Ignore symbols of imported libs' dependencies 2020-02-03 14:20:40 -08:00
ctype_test.cpp Reimplement the <ctype.h> is* functions. 2019-10-08 12:04:09 -07:00
dirent_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
dl_test.cpp Remove mips test workarounds. 2020-02-13 09:48:14 -08:00
dlext_private.h Move API levels from uint32_t to int. 2018-11-13 21:25:07 -08:00
dlext_test.cpp Revert "Disable dlfcn#dlopen_system_libicuuc_ tests due to test failures on cuttlefish" 2020-05-15 22:01:00 +00:00
dlfcn_symlink_support.cpp EndsWith now accepts std::string suffixes. 2017-12-20 12:28:30 -08:00
dlfcn_symlink_support.h bionic-unit-tests: Create symlinks in runtime 2016-10-10 04:41:56 -07:00
dlfcn_test.cpp Remove mips test workarounds. 2020-02-13 09:48:14 -08:00
elf_test.cpp Restore ELF32_ST_INFO/ELF64_ST_INFO. 2017-04-30 22:56:10 -07:00
elftls_dl_test.cpp [Elf TLS] [GWP-ASan] Update ELF TLS test. 2020-02-07 01:40:05 +00:00
elftls_test.cpp Only test tprel_missing_weak in dynamic binaries 2019-02-11 18:37:17 -08:00
endian_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
errno_test.cpp Remove volatile from the __errno declaration. 2017-06-13 16:02:07 -07:00
error_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
eventfd_test.cpp Add EFD_SEMAPHORE flag for eventfd. 2019-09-03 09:35:51 -07:00
fcntl_test.cpp _FILE_OFFSET_BITS=64 support for fcntl. 2020-01-29 19:36:14 -08:00
fdsan_test.cpp Revert "Temporarily disable FdsanTest.vfork." 2020-05-18 12:59:38 -07:00
fdtrack_test.cpp Merge changes If42905f3,Id351a993,I8a082fd0 2020-05-12 07:04:58 +00:00
fenv_test.cpp Fix new clang compiler warning 2020-01-24 14:28:45 -08:00
float_test.cpp Fix up a few bionic tests for the clang-r339409 update. 2018-09-24 16:59:08 -07:00
fortify_test.cpp fortify: add __mempcpy_chk 2019-06-13 23:29:37 -07:00
fortify_test_main.cpp
ftw_test.cpp bionic tests: switch to using android-base/file.h for TemporaryFile 2018-11-13 10:57:28 -08:00
getauxval_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
getcwd_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
glob_test.cpp bionic tests: switch to using android-base/file.h for TemporaryFile 2018-11-13 10:57:28 -08:00
grp_pwd_file_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
grp_pwd_test.cpp Tighten pwd/grp iteration tests. 2020-04-10 13:00:42 -07:00
gtest_globals.cpp Add newline at end of error message 2020-05-30 16:46:20 -07:00
gtest_globals.h Move isolated test runner out of bionic. 2018-09-27 22:22:17 -07:00
gtest_globals_cts.cpp Remove reference to deprecated option. 2020-05-14 16:48:44 -07:00
gtest_main.cpp Move isolated test runner out of bionic. 2018-09-27 22:22:17 -07:00
gtest_preinit_debuggerd.cpp Rename libdebuggerd_client to libdebuggerd_handler. 2017-01-17 15:11:46 -08:00
gtest_utils.h Move isolated test runner out of bionic. 2018-09-27 22:22:17 -07:00
heap_tagging_level_test.cpp Introduce a new heap tagging level, M_HEAP_TAGGING_LEVEL_SYNC. 2020-05-05 13:28:16 -07:00
iconv_test.cpp Add an extra test for a POSIX iconv requirement. 2017-08-31 14:14:16 -07:00
ifaddrs_test.cpp Fix ifaddrs error handling. 2016-10-14 14:35:26 -07:00
ifunc_test.cpp Fix ifunc_test for hwasan builds. 2020-04-13 14:16:17 -07:00
inttypes_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
iso646_test.c Add tests for all C11 headers. 2017-08-29 15:32:18 -07:00
langinfo_test.cpp Implement <langinfo.h>. 2016-11-19 11:46:54 -08:00
leak_test.cpp Skip pthread_leak* tests with native_bridge 2020-06-09 19:24:25 +02:00
libdl_test.cpp Make android_get_application_target_sdk_version available to the NDK. 2018-11-15 11:07:30 -08:00
libgen_basename_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
libgen_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
limits_test.cpp Fix WORD_BIT test. 2017-10-23 12:06:30 -07:00
link_test.cpp Add additional dl_phdr_info fields 2019-08-22 12:43:17 -07:00
linux_swab_test.cpp Add POSIX swab. 2017-10-18 13:34:32 -07:00
locale_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
make_fortify_compile_test.mk fortify: import tests from Chrome OS 2019-06-10 12:46:49 -07:00
malloc_iterate_test.cpp [GWP-ASan] [malloc-tests] Scan GWP-ASan regions in maps. 2020-02-11 16:08:17 -08:00
malloc_stress_test.cpp [GWP-ASan] [malloc-tests] Scan GWP-ASan regions in maps. 2020-02-11 16:08:17 -08:00
malloc_test.cpp Introduce a new heap tagging level, M_HEAP_TAGGING_LEVEL_SYNC. 2020-05-05 13:28:16 -07:00
math_data_test.h Fix sscanf/wcstod parsing of NaNs. 2016-09-07 15:01:54 -07:00
math_force_long_double_test.cpp Use __RENAME for long double functions. 2017-09-14 16:10:43 -07:00
math_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
membarrier_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
mntent_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
mte_test.cpp Reland "Make bionic_platform_headers available only for Bionic targets". 2020-04-29 18:14:11 +01:00
net_if_test.cpp
netdb_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
netinet_ether_test.cpp Fix the <netinet/ether.h> tests. 2016-05-16 16:21:37 -07:00
netinet_in_test.cpp Use in_addr in ip_mreq_source and ip_msfilter. 2017-12-14 10:07:27 -08:00
netinet_ip_icmp_test.cpp <netinet/ip_icmp.h>: ensure struct icmphdr is available. 2018-06-27 12:29:06 -07:00
netinet_udp_test.cpp
nl_types_test.cpp Add trivial no-op <nl_types.h>. 2016-04-06 17:22:44 -07:00
poll_test.cpp Add a test for poll with null fds. 2018-08-30 12:15:56 -07:00
pthread_dlfcn_test.cpp Eliminate deadlock in forked child due to delayed resetting mutex lock 2016-11-07 03:32:57 +00:00
pthread_test.cpp Skip pthread.pthread_create__mmap_failures with native_bridge 2020-06-09 15:58:49 +02:00
pty_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
regex_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
resolv_test.cpp Expose __res_randomid. 2018-07-17 13:02:52 -07:00
run-on-host.sh Fix running tests/benchmarks on the host. 2019-04-26 17:45:17 -07:00
sched_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
scs_test.cpp Allocate a small guard region around the shadow call stack. 2018-11-16 14:37:08 -08:00
scsi_sg_test.cpp Enable exporting the non-uapi scsi headers. 2017-05-25 19:17:55 -07:00
search_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
semaphore_test.cpp Stop using the __ANDROID_API_x__ constants. 2019-12-20 13:26:14 -08:00
setjmp_test.cpp Remove mips test workarounds. 2020-02-13 09:48:14 -08:00
signal_test.cpp Rewrite sigwait tests in the style of the sigwaitinfo tests. 2020-03-20 16:27:57 -07:00
SignalUtils.h Block TIMER_SIGNAL in sigprocmask(SIG_SETMASK, ...). 2018-10-09 16:27:22 -07:00
spawn_test.cpp dynamic libc: ignore ART profiling signal by default. 2020-03-27 19:22:00 +01:00
sstream_test.cpp
stack_protector_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
stack_protector_test_helper.cpp stack_protector_DeathTest: work w/ local reorder 2020-01-14 14:11:16 -08:00
stack_unwinding_test.cpp Reenable signal-frame-unwind test on x86 2020-04-09 16:46:53 -07:00
stdalign_test.cpp Add tests for all C11 headers. 2017-08-29 15:32:18 -07:00
stdarg_test.cpp Add tests for all C11 headers. 2017-08-29 15:32:18 -07:00
stdatomic_test.cpp Increase iteration count for ordering test 2020-03-25 12:50:21 -07:00
stdbool_test.c Add tests for all C11 headers. 2017-08-29 15:32:18 -07:00
stdint_test.cpp
stdio_ext_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
stdio_nofortify_test.cpp
stdio_test.cpp Update upstream OpenBSD gdtoa. 2020-06-11 12:57:37 -07:00
stdlib_test.cpp Merge "Reimplement realpath." 2020-01-23 20:34:15 +00:00
stdnoreturn_test.cpp Add tests for all C11 headers. 2017-08-29 15:32:18 -07:00
string_nofortify_test.cpp
string_posix_strerror_r_test.cpp Rationalize visibility. 2016-06-09 17:40:19 -07:00
string_test.cpp Sync with upstream OpenBSD strstr(). 2019-11-22 11:16:23 -08:00
strings_nofortify_test.cpp
strings_test.cpp Add ffsl(3), ffsll(3). 2020-03-26 11:43:05 -07:00
sys_auxv_test.cpp Make the HWCAP/HWCAP2 constants available from <sys/auxv.h>. 2020-02-24 09:52:14 -08:00
sys_epoll_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
sys_ioctl_diag_test.cpp libc: silence unsigned->signed warnings with ioctl 2018-03-20 15:59:46 -07:00
sys_mman_test.cpp Add memfd_create(2) and mlock2(2). 2019-08-05 16:31:08 -07:00
sys_msg_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
sys_param_test.cpp Make powerof2 macro ubsan safe 2019-03-25 13:51:33 -07:00
sys_personality_test.cpp Remove mips test workarounds. 2020-02-13 09:48:14 -08:00
sys_prctl_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
sys_procfs_test.cpp
sys_ptrace_test.cpp Remove mips test workarounds. 2020-02-13 09:48:14 -08:00
sys_quota_test.cpp Add <sys/quota.h>. 2016-04-06 11:06:09 -07:00
sys_random_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
sys_resource_test.cpp Modernise code to use override specifier 2019-03-29 14:27:27 -07:00
sys_select_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
sys_sem_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
sys_sendfile_test.cpp bionic tests: switch to using android-base/file.h for TemporaryFile 2018-11-13 10:57:28 -08:00
sys_shm_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
sys_signalfd_test.cpp Rewrite system(3) to use posix_spawn(3). 2018-03-05 17:20:12 -08:00
sys_socket_test.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
sys_stat_test.cpp Remove return after GTEST_SKIP. 2020-02-28 18:27:09 -08:00
sys_statvfs_test.cpp
sys_syscall_test.cpp Don't declare SYS_* constants for unavailable __NR_* constants. 2016-07-18 12:48:39 -07:00
sys_sysinfo_test.cpp Relax flaky _SC_AVPHYS_PAGES check in sys_sysinfo_test 2017-05-25 14:27:37 -07:00
sys_sysmacros_test.cpp
sys_time_test.cpp Allow more leeway to fix sys_time.gettimeofday flakiness. 2019-01-18 08:20:55 -08:00
sys_timex_test.cpp
sys_ttydefaults_test.cpp Make <sys/ttydefaults.h> more usable. 2017-07-06 10:33:15 -07:00
sys_types_test.cpp
sys_uio_test.cpp bionic tests: switch to using android-base/file.h for TemporaryFile 2018-11-13 10:57:28 -08:00
sys_un_test.cpp <sys/un.h>: add SUN_LEN. 2018-06-27 14:08:48 -07:00
sys_vfs_test.cpp
sys_xattr_test.cpp bionic tests: switch to using android-base/file.h for TemporaryFile 2018-11-13 10:57:28 -08:00
system_properties_test.cpp Revert "Revert "Make system property reads wait-free"" 2019-11-12 20:41:55 +00:00
system_properties_test2.cpp Check that __system_property_set() doesn't leak FDs 2019-11-05 12:33:33 -08:00
termios_test.cpp Add trivial termios tests. 2017-12-14 09:46:50 -08:00
tgmath_test.c Add tests for all C11 headers. 2017-08-29 15:32:18 -07:00
thread_local_test.cpp Remove workarounds for old versions of clang and GCC. 2018-07-11 13:18:29 -07:00
threads_test.cpp threads.h: Add C11 thread support. 2019-04-24 09:12:29 -07:00
time_test.cpp Trivial test for difftime(3). 2020-06-05 17:19:00 -07:00
touch-obj-on-success Stop using grep -P. 2019-07-08 15:03:19 -07:00
uchar_test.cpp Updates for glibc 2.17. 2019-01-30 13:52:36 -08:00
unistd_nofortify_test.cpp
unistd_test.cpp Track whether a thread is currently vforked. 2020-05-07 19:44:27 -07:00
utils.h Add util to skip tests with native_bridge 2020-06-08 21:12:56 +02:00
utmp_test.cpp
wchar_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00
wctype_test.cpp bionic tests: use GTEST_SKIP. 2019-03-12 10:26:39 -07:00