platform_bionic/tests/libs
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
..
Android.bp Merge "Remove XOM properties." 2020-02-14 14:42:49 +00:00
Android.build.dlext_testzip.mk dlfcn.dt_runpath* tests are amended to handle LIB 2019-01-30 21:05:03 +09:00
Android.mk Convert more bionic tests to Android.bp 2020-01-16 10:12:46 -08:00
atexit_testlib.cpp Add atexit test for attributed c-tor/d-tor 2014-08-15 14:22:07 -07:00
bionic_tests_zipalign.cpp Move off the Next ZipString overload. 2019-05-22 18:50:53 -07:00
cfi_test_bad_lib.cpp Runtime support for CFI 2017-01-18 13:13:52 -08:00
cfi_test_helper.cpp Disable a few bionic tests under HWASan. 2018-11-06 16:59:25 -08:00
cfi_test_helper2.cpp Fix CFI initialization crash on x86. 2017-02-02 14:44:46 -08:00
cfi_test_lib.cpp Use PROT_NONE on the unused parts of CFI shadow. 2020-06-12 12:22:32 -07:00
check_rtld_next_from_library.cpp Fix for dlfcn.rtld_next_from_library. 2017-11-03 15:00:09 -07:00
dl_df_1_global.cpp Fix symbol lookup order during relocation 2014-10-31 11:39:51 -07:00
dl_df_1_global_dummy.cpp Fix: linker segfault on dlopen of a DF_1_GLOBAL so 2017-10-19 15:13:54 +09:00
dl_df_1_use_global.cpp Fix symbol lookup order during relocation 2014-10-31 11:39:51 -07:00
dl_preempt_library_1.cpp Fix symbol lookup order during relocation 2014-10-31 11:39:51 -07:00
dl_preempt_library_2.cpp Fix symbol lookup order during relocation 2014-10-31 11:39:51 -07:00
dlext_test_library.cpp Move libraries for unit-tests to separate folder 2014-06-17 15:08:53 -07:00
dlext_test_recursive_library.cpp linker: allow using reserved space for multiple libraries. 2019-02-20 17:29:36 -05:00
dlopen_2_parents_reloc_answer.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_b.cpp Make dt_runpath work for libraries opened from apk 2015-10-07 11:44:53 -07:00
dlopen_check_init_fini_child.cpp Add test checking init/fini call order 2017-02-09 14:07:05 -08:00
dlopen_check_init_fini_grand_child.cpp Add test checking init/fini call order 2017-02-09 14:07:05 -08:00
dlopen_check_init_fini_root.cpp Add test checking init/fini call order 2017-02-09 14:07:05 -08:00
dlopen_check_order_dlsym_answer.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_check_order_reloc_answer.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_check_order_reloc_answer_impl.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_check_order_reloc_grandchild_answer.cpp Yet another relocation test 2014-11-19 10:39:05 -08:00
dlopen_check_order_reloc_grandchild_answer_impl.cpp Yet another relocation test 2014-11-19 10:39:05 -08:00
dlopen_check_order_reloc_nephew_answer.cpp Fix jump to unmapped memory on atexit 2014-11-18 13:16:27 -08:00
dlopen_check_order_reloc_root_answer.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_check_order_reloc_root_answer_impl.cpp Fix relocation to look for symbols in local group 2014-10-23 12:13:54 -07:00
dlopen_nodelete_1.cpp Add RTLD_NODELETE flag support 2014-10-01 11:09:37 -07:00
dlopen_nodelete_2.cpp Add RTLD_NODELETE flag support 2014-10-01 11:09:37 -07:00
dlopen_nodelete_dt_flags_1.cpp Add RTLD_NODELETE flag support 2014-10-01 11:09:37 -07:00
dlopen_testlib_dlopen_from_ctor.cpp Minimize calls to mprotect 2015-01-23 16:30:34 -08:00
dlopen_testlib_ifunc.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
dlopen_testlib_ifunc_variable.cpp Add ifunc for variable test-case 2017-05-02 16:35:20 -07:00
dlopen_testlib_ifunc_variable_impl.cpp Modernize codebase by replacing NULL with nullptr 2018-08-02 18:09:44 -07:00
dlopen_testlib_loopy_a.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_loopy_b.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_loopy_c.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_loopy_invalid.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_loopy_root.cpp Count references for groups instead of instances 2014-12-02 10:54:26 -08:00
dlopen_testlib_missing_symbol.cpp Fix logic in loading dependencies crossing namespace boundaries 2017-12-10 22:04:55 +01:00
dlopen_testlib_relo_check_dt_needed_order.cpp Fix order of soinfo links (repairs libcxx tests). 2014-09-05 16:01:47 -07:00
dlopen_testlib_relo_check_dt_needed_order_1.cpp Fix order of soinfo links (repairs libcxx tests). 2014-09-05 16:01:47 -07:00
dlopen_testlib_relo_check_dt_needed_order_2.cpp Fix order of soinfo links (repairs libcxx tests). 2014-09-05 16:01:47 -07:00
dlopen_testlib_simple.cpp Fix dlsym() to take into account RTLD_GLOBAL/LOCAL 2014-09-15 17:39:48 -07:00
dlopen_weak_undefined.cpp Add another test for weak-reference 2014-12-16 19:46:45 +00:00
dlsym_from_this_functions.cpp Improved dlsym tests and fixes to linker 2015-05-12 13:46:40 -07:00
dlsym_from_this_symbol.cpp Improved dlsym tests and fixes to linker 2015-05-12 13:46:40 -07:00
dlsym_from_this_symbol2.cpp Improved dlsym tests and fixes to linker 2015-05-12 13:46:40 -07:00
dlsym_weak_function.cpp Fix weak function lookups 2014-06-17 16:18:18 -07:00
elftls_dlopen_ie_error_helper.cpp Add tests for static ELF TLS 2019-01-18 22:44:55 +00:00
elftls_dynamic.cpp Fix dlsym and dladdr for TLS symbols 2019-04-03 18:19:50 -07:00
elftls_dynamic_filler.cpp Add tests for dynamic ELF TLS 2019-01-29 08:35:10 +00:00
elftls_shared_var.cpp Add tests for static ELF TLS 2019-01-18 22:44:55 +00:00
elftls_shared_var_ie.cpp Add tests for static ELF TLS 2019-01-18 22:44:55 +00:00
elftls_tprel.cpp Add tests for static ELF TLS 2019-01-18 22:44:55 +00:00
empty.cpp Move libraries for unit-tests to separate folder 2014-06-17 15:08:53 -07:00
exec_linker_helper.cpp Use shared globals to init __progname + environ 2018-11-28 14:26:14 -08:00
exec_linker_helper_lib.cpp Allow invoking the linker on an executable. 2018-10-10 14:31:06 -07:00
ld_config_test_helper.cpp vdso should be available in all namespaces 2018-05-12 10:58:00 +02:00
ld_config_test_helper_lib1.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_config_test_helper_lib2.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_config_test_helper_lib3.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_preload_test_helper.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_preload_test_helper_lib1.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
ld_preload_test_helper_lib2.cpp linker: the global group is added to all built-in namespaces 2017-08-03 01:02:07 +09:00
libnstest_ns_a_public1.cpp linker: Allow link namespaces without name filters 2018-01-25 14:45:29 +08:00
libnstest_ns_a_public1_internal.cpp linker: Allow link namespaces without name filters 2018-01-25 14:45:29 +08:00
libnstest_ns_b_public2.cpp linker: Allow link namespaces without name filters 2018-01-25 14:45:29 +08:00
libnstest_ns_b_public3.cpp linker: Allow link namespaces without name filters 2018-01-25 14:45:29 +08:00
libs_utils.h Fix x86 system calls made from ELF preinit. 2017-03-29 13:48:02 -07:00
namespaces_dlopened.cpp Introducing linker namespaces 2015-11-15 12:09:16 -08:00
namespaces_private.cpp Introducing linker namespaces 2015-11-15 12:09:16 -08:00
namespaces_public.cpp Introducing linker namespaces 2015-11-15 12:09:16 -08:00
namespaces_public_internal.cpp Replace public library list with shared lib sonames (part 2/2) 2017-02-09 23:26:44 -08:00
namespaces_root.cpp Replace public library list with shared lib sonames (part 2/2) 2017-02-09 23:26:44 -08:00
ns_hidden_child_app.cpp Ignore symbols of imported libs' dependencies 2020-02-03 14:20:40 -08:00
ns_hidden_child_global.cpp Ignore symbols of imported libs' dependencies 2020-02-03 14:20:40 -08:00
ns_hidden_child_helper.cpp Ignore symbols of imported libs' dependencies 2020-02-03 14:20:40 -08:00
ns_hidden_child_internal.cpp Ignore symbols of imported libs' dependencies 2020-02-03 14:20:40 -08:00
ns_hidden_child_public.cpp Ignore symbols of imported libs' dependencies 2020-02-03 14:20:40 -08:00
preinit_getauxval_test_helper.cpp Fix x86 system calls made from ELF preinit. 2017-03-29 13:48:02 -07:00
preinit_syscall_test_helper.cpp Fix x86 system calls made from ELF preinit. 2017-03-29 13:48:02 -07:00
pthread_atfork.cpp Unregister pthread_atfork handlers on dlclose() 2015-04-24 17:57:37 -07:00
relocations.cpp Test all four supported relocation encodings. 2020-01-28 17:59:23 -08:00
segment_gap_inner.cpp linker: Handle libraries with disjoint mappings correctly. 2019-03-08 18:34:34 -08:00
segment_gap_outer.cpp Remove unnecessary jni.h 2020-04-07 09:21:41 +01:00
segment_gap_outer.lds Merge changes from topic "clang-r365631-switch-over" 2019-08-22 18:35:54 +00:00
thread_local_dtor.cpp Fix/suppress bionic google-explicit-constructor warnings 2019-01-02 11:04:05 -08:00
thread_local_dtor2.cpp Fix/suppress bionic google-explicit-constructor warnings 2019-01-02 11:04:05 -08:00
versioned_lib_other.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_other.map Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v1.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v1.map Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v2.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v2.map Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v3.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_lib_v3.map Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_uselib.cpp Support symbol versioning 2015-04-16 17:57:30 -07:00
versioned_uselib.map Support symbol versioning 2015-04-16 17:57:30 -07:00