diff options
author | Josh Gao <jmgao@google.com> | 2020-05-07 19:43:38 -0700 |
---|---|---|
committer | Josh Gao <jmgao@google.com> | 2020-05-12 01:42:18 -0700 |
commit | 7501c6de1a6a4474f78b3296460d4fa2d099b9d4 (patch) | |
tree | 36677c56f6bf669dc93e29973bb0cc164da2cb54 /libc | |
parent | 1bf410b5f9e47ead5b78d5d030bbc830ffb2719d (diff) | |
download | bionic-7501c6de1a6a4474f78b3296460d4fa2d099b9d4.tar.gz |
fdtrack: don't do anything while vforked.
Bug: http://b/153926671
Test: 32/64-bit bionic-unit-tests on blueline, x86_64 emulator
Change-Id: If42905f3d6a76ed70a45e5b9edd029ffd7789045
(cherry picked from commit 41291131284471eed7cb6c22cac8b442fd3d1c52)
Diffstat (limited to 'libc')
-rw-r--r-- | libc/private/bionic_fdtrack.h | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/libc/private/bionic_fdtrack.h b/libc/private/bionic_fdtrack.h index 174ba1d9b..752dd8dc5 100644 --- a/libc/private/bionic_fdtrack.h +++ b/libc/private/bionic_fdtrack.h @@ -47,7 +47,8 @@ extern "C" _Atomic(android_fdtrack_hook_t) __android_fdtrack_hook; #define FDTRACK_CREATE_NAME(name, fd_value) \ ({ \ int __fd = (fd_value); \ - if (__fd != -1 && __predict_false(__android_fdtrack_hook)) { \ + if (__fd != -1 && __predict_false(__android_fdtrack_hook) && \ + !__predict_false(__get_thread()->is_vforked())) { \ bionic_tls& tls = __get_bionic_tls(); \ /* fdtrack_disabled is only true during reentrant calls. */ \ if (!__predict_false(tls.fdtrack_disabled)) { \ @@ -76,7 +77,8 @@ extern "C" _Atomic(android_fdtrack_hook_t) __android_fdtrack_hook; #define FDTRACK_CLOSE(fd_value) \ ({ \ int __fd = (fd_value); \ - if (__fd != -1 && __predict_false(__android_fdtrack_hook)) { \ + if (__fd != -1 && __predict_false(__android_fdtrack_hook) && \ + !__predict_false(__get_thread()->is_vforked())) { \ bionic_tls& tls = __get_bionic_tls(); \ if (!__predict_false(tls.fdtrack_disabled)) { \ int saved_errno = errno; \ |