diff options
author | Peter Collingbourne <pcc@google.com> | 2021-03-05 13:31:41 -0800 |
---|---|---|
committer | Peter Collingbourne <pcc@google.com> | 2021-03-05 14:29:17 -0800 |
commit | 2659d7b6c221402b9fc58709fdab4d0790c47b4f (patch) | |
tree | 35a268ac00847c20d5f109a10f75a44703dfe695 /linker | |
parent | 15ade069b10f7f5291e48c01db2da4852dae04b7 (diff) |
Add some slack at the end of large allocations when target SDK level < S.
This works around buggy applications that read a few bytes past the
end of their allocation, which would otherwise cause a segfault with
the concurrent Scudo change that aligns large allocations to the right.
Because the implementation of
android_set_application_target_sdk_version() lives in the linker,
we need to introduce a hook so that libc is notified when the target
SDK version changes.
Bug: 181344545
Change-Id: Id4be6645b94fad3f64ae48afd16c0154f1de448f
Diffstat (limited to 'linker')
-rw-r--r-- | linker/linker_sdk_versions.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/linker/linker_sdk_versions.cpp b/linker/linker_sdk_versions.cpp index 29c0f4af2..0d5796e6c 100644 --- a/linker/linker_sdk_versions.cpp +++ b/linker/linker_sdk_versions.cpp @@ -31,6 +31,8 @@ #include <android/api-level.h> #include <android/fdsan.h> +#include "private/bionic_globals.h" + #include "linker.h" static std::atomic<int> g_target_sdk_version(__ANDROID_API__); @@ -45,6 +47,9 @@ void set_application_target_sdk_version(int target) { if (target < 30) { android_fdsan_set_error_level_from_property(ANDROID_FDSAN_ERROR_LEVEL_WARN_ONCE); } + if (__libc_shared_globals()->set_target_sdk_version_hook) { + __libc_shared_globals()->set_target_sdk_version_hook(target); + } } int get_application_target_sdk_version() { |