Merge "Initialize _nres only once"
diff --git a/libc/SYSCALLS.TXT b/libc/SYSCALLS.TXT
index d263508..ec34828 100644
--- a/libc/SYSCALLS.TXT
+++ b/libc/SYSCALLS.TXT
@@ -113,7 +113,7 @@
int msync(const void*, size_t, int) all
int mprotect(const void*, size_t, int) all
int madvise(void*, size_t, int) all
-int process_madvise(int, const struct iovec*, size_t, int, unsigned int) all
+ssize_t process_madvise(int, const struct iovec*, size_t, int, unsigned int) all
int mlock(const void* addr, size_t len) all
int mlock2(const void* addr, size_t len, int flags) all
int munlock(const void* addr, size_t len) all
diff --git a/libc/bionic/pthread_create.cpp b/libc/bionic/pthread_create.cpp
index 206d5fd..f3fee88 100644
--- a/libc/bionic/pthread_create.cpp
+++ b/libc/bionic/pthread_create.cpp
@@ -344,6 +344,12 @@
__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);
diff --git a/libc/include/sys/mman.h b/libc/include/sys/mman.h
index 3b44dab..6ef0c12 100644
--- a/libc/include/sys/mman.h
+++ b/libc/include/sys/mman.h
@@ -167,9 +167,9 @@
* works just like madvise(2) but applies to the process specified by the given
* PID file descriptor.
*
- * Returns 0 on success, and returns -1 and sets `errno` on failure.
+ * Returns the number of bytes advised on success, and returns -1 and sets `errno` on failure.
*/
-int process_madvise(int __pid_fd, const struct iovec* __iov, size_t __count, int __advice, unsigned int __flags);
+ssize_t process_madvise(int __pid_fd, const struct iovec* __iov, size_t __count, int __advice, unsigned __flags);
#if defined(__USE_GNU)