diff options
author | android-build-team Robot <android-build-team-robot@google.com> | 2020-08-25 23:13:37 +0000 |
---|---|---|
committer | android-build-team Robot <android-build-team-robot@google.com> | 2020-08-25 23:13:37 +0000 |
commit | 647fbd99572971634d194eaffad780a230d31a7e (patch) | |
tree | a3ade2dcd82b5720001080c97e9ec2a95ab81318 | |
parent | 8edfd6fbc36687aa0b54b7929faf03fe63245cdb (diff) | |
parent | 8860af56c35d2797a9ed934eb2fd1cb0f39f6130 (diff) | |
download | bionic-647fbd99572971634d194eaffad780a230d31a7e.tar.gz |
Snap for 6790172 from 8860af56c35d2797a9ed934eb2fd1cb0f39f6130 to rvc-qpr1-release
Change-Id: Ide3f4bf6161974c6ecdad11b3b17b107b04e9cd6
-rw-r--r-- | libc/async_safe/async_safe_log.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/libc/async_safe/async_safe_log.cpp b/libc/async_safe/async_safe_log.cpp index 207035a15..8b2a32b14 100644 --- a/libc/async_safe/async_safe_log.cpp +++ b/libc/async_safe/async_safe_log.cpp @@ -30,6 +30,7 @@ #include <ctype.h> #include <errno.h> #include <fcntl.h> +#include <linux/net.h> #include <pthread.h> #include <stdarg.h> #include <stddef.h> @@ -51,12 +52,22 @@ #include "private/ErrnoRestorer.h" #include "private/ScopedPthreadMutexLocker.h" -// Don't call libc's close, since it might call back into us as a result of fdsan. +// Don't call libc's close or socket, since it might call back into us as a result of fdsan/fdtrack. #pragma GCC poison close static int __close(int fd) { return syscall(__NR_close, fd); } +static int __socket(int domain, int type, int protocol) { +#if defined(__i386__) + unsigned long args[3] = {static_cast<unsigned long>(domain), static_cast<unsigned long>(type), + static_cast<unsigned long>(protocol)}; + return syscall(__NR_socketcall, SYS_SOCKET, &args); +#else + return syscall(__NR_socket, domain, type, protocol); +#endif +} + // Must be kept in sync with frameworks/base/core/java/android/util/EventLog.java. enum AndroidEventLogType { EVENT_TYPE_INT = 0, @@ -460,7 +471,7 @@ static int open_log_socket() { // found that all logd crashes thus far have had no problem stuffing // the UNIX domain socket and moving on so not critical *today*. - int log_fd = TEMP_FAILURE_RETRY(socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)); + int log_fd = TEMP_FAILURE_RETRY(__socket(PF_UNIX, SOCK_DGRAM | SOCK_CLOEXEC | SOCK_NONBLOCK, 0)); if (log_fd == -1) { return -1; } |