diff options
author | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-24 00:08:23 +0000 |
---|---|---|
committer | Android Build Coastguard Worker <android-build-coastguard-worker@google.com> | 2024-01-24 00:08:23 +0000 |
commit | 0a182a23717f10be5efaa98ba7ed6760a9c9aadc (patch) | |
tree | 158f5f4eba68adeaa20d94d9626b0ff92114be9e | |
parent | 8757472100f81dd4faaa33fe8fbc0e32abc17391 (diff) | |
parent | b7e85046deeb05a730ccc3750dea2c47dd559129 (diff) | |
download | libbrillo-0a182a23717f10be5efaa98ba7ed6760a9c9aadc.tar.gz |
Snap for 11348195 from b7e85046deeb05a730ccc3750dea2c47dd559129 to 24Q2-releaseandroid-14.0.0_r54android-14.0.0_r53android-14.0.0_r52android-14.0.0_r51android-14.0.0_r50android14-qpr3-s2-releaseandroid14-qpr3-release
Change-Id: I2a5d011346ba3732160d8a76b0ec71250236c158
-rw-r--r-- | Android.bp | 4 | ||||
-rw-r--r-- | brillo/process.cc | 25 |
2 files changed, 18 insertions, 11 deletions
@@ -171,7 +171,9 @@ cc_library { static_libs: [ "libmodpb64", ], - header_libs: ["libgtest_prod_headers"], + header_libs: [ + "libgtest_prod_headers", + ], cflags: libbrillo_CFLAGS, export_include_dirs: ["."], diff --git a/brillo/process.cc b/brillo/process.cc index 5623db8..1fb33bf 100644 --- a/brillo/process.cc +++ b/brillo/process.cc @@ -4,6 +4,10 @@ #include "brillo/process.h" +#ifdef __BIONIC__ +#include <android/fdsan.h> +#endif + #include <fcntl.h> #include <signal.h> #include <stdint.h> @@ -37,11 +41,9 @@ bool ReturnTrue() { return true; } -Process::Process() { -} +Process::Process() {} -Process::~Process() { -} +Process::~Process() {} bool Process::ProcessExists(pid_t pid) { return base::DirectoryExists( @@ -55,8 +57,7 @@ ProcessImpl::ProcessImpl() pre_exec_(base::Bind(&ReturnTrue)), search_path_(false), inherit_parent_signal_mask_(false), - close_unused_file_descriptors_(false) { -} + close_unused_file_descriptors_(false) {} ProcessImpl::~ProcessImpl() { Reset(0); @@ -167,8 +168,7 @@ bool ProcessImpl::PopulatePipeMap() { bool ProcessImpl::IsFileDescriptorInPipeMap(int fd) const { for (const auto& pipe : pipe_map_) { - if (fd == pipe.second.parent_fd_ || - fd == pipe.second.child_fd_ || + if (fd == pipe.second.parent_fd_ || fd == pipe.second.child_fd_ || fd == pipe.first) { return true; } @@ -259,6 +259,11 @@ bool ProcessImpl::Start() { } void ProcessImpl::ExecChildProcess(char** argv) { +#ifdef __BIONIC__ + // Disable fdsan and fdtrack post-fork, so we don't falsely trigger on + // processes that fork, close all of their fds, and then exec. + android_fdsan_set_error_level(ANDROID_FDSAN_ERROR_LEVEL_DISABLED); +#endif // Executing inside the child process. // Close unused file descriptors. if (close_unused_file_descriptors_) { @@ -361,8 +366,8 @@ int ProcessImpl::Wait() { // kill the process that has just exited. UpdatePid(0); if (!WIFEXITED(status)) { - DCHECK(WIFSIGNALED(status)) << old_pid - << " neither exited, nor died on a signal?"; + DCHECK(WIFSIGNALED(status)) + << old_pid << " neither exited, nor died on a signal?"; LOG(ERROR) << "Process " << old_pid << " did not exit normally: " << WTERMSIG(status); return -1; |