summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Collingbourne <pcc@google.com>2021-04-06 23:02:29 +0000
committerGerrit Code Review <noreply-gerritcodereview@google.com>2021-04-06 23:02:29 +0000
commit2b9719e3612149aa0a2124e135bc8ed2d5b911dd (patch)
tree9402bf2f36482396b2ee0a1548c9b1d589658b91
parente71143e8c0016137a5fe005d7c39fbb03922f1f4 (diff)
parent811d180e892f757d052cf9d6c6b7494a8c4a8c2f (diff)
Merge "Reset PAC keys on thread creation instead of on zygote fork."
-rw-r--r--libc/bionic/pthread_create.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 206d5fdeb..f3fee8805 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -344,6 +344,12 @@ static int __pthread_start(void* arg) {
__set_stack_and_tls_vma_name(false);
__init_additional_stacks(thread);
__rt_sigprocmask(SIG_SETMASK, &thread->start_mask, nullptr, sizeof(thread->start_mask));
+#ifdef __aarch64__
+ // Chrome's sandbox prevents this prctl, so only reset IA if the target SDK level is high enough.
+ if (android_get_application_target_sdk_version() >= __ANDROID_API_S__) {
+ prctl(PR_PAC_RESET_KEYS, PR_PAC_APIAKEY, 0, 0, 0);
+ }
+#endif
void* result = thread->start_routine(thread->start_routine_arg);
pthread_exit(result);