From 08ba820d9e210178795e9b9cb3a8e419fee7d991 Mon Sep 17 00:00:00 2001 From: Pirama Arumuga Nainar Date: Wed, 18 Nov 2020 06:14:22 +0000 Subject: [PATCH] Revert "Revert "Added mitigation for b/122921367"" This reverts commit ebfadfd82b6e200c0f078f41322675db162edaf9. Reason for revert: Breaks aosp_cf_x86_pasan: ld.lld: error: can't create dynamic relocation R_386_32 against local symbol in readonly segment; recompile object files with -fPIC or pass '-Wl,-z,notext' to allow text relocations in the output Change-Id: I304b0eee72b67a1c90b0b3f4c9089276d4d8f07d --- core/jni/com_android_internal_os_Zygote.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index 691027dbf83d6..827d13f3deb99 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -14,6 +14,15 @@ * limitations under the License. */ +/* + * Disable optimization of this file if we are compiling with the address + * sanitizer. This is a mitigation for b/122921367 and can be removed once the + * bug is fixed. + */ +#if __has_feature(address_sanitizer) +#pragma clang optimize off +#endif + #define LOG_TAG "Zygote" // sys/mount.h has to come before linux/fs.h due to redefinition of MS_RDONLY, MS_BIND, etc