platform_system_core/libprocessgroup
mtk16036 540b1556c9 race condition in libprocessgroup
while enable fdsan (file descriptor sanitizer),
fdsan report use-after-close error after boot complete (sedom).

Because, in SetCgroupAction::EnableResourceCaching() currently has a data race against all the
use fd_ functions like SetCgroupAction::ExecuteForProcess(uid_t uid, pid_t pid) etc.

ThreadA                                     | ThreadB
-------------------------------------------------------------------------------------------------
in SetCgroupAction::EnableResourceCaching() | in SetCgroupAction::ExecuteForProcess(...)
-------------------------------------------------------------------------------------------------
                                            | in SetCgroupAction::AddTidToCgroup(int tid, int fd)
-------------------------------------------------------------------------------------------------
fd_ = std::move(fd); /*modified fd_ value*/ |
-------------------------------------------------------------------------------------------------
                                            | write(fd)  /* crash here, fd is closed by ThreadA*/
-------------------------------------------------------------------------------------------------

So, add mutex lock to protect fd_ data race.

Bug: 134120826
Test: auto test, run the adb reboot test 100 times and no fdsan error report on libprocessgroup
Merged-In: Iccf2f705e030f79324f1164509e715dc5be825de
Change-Id: Iccf2f705e030f79324f1164509e715dc5be825de
2019-06-12 19:27:14 +00:00
..
cgrouprc libprocessgroup: add flags to indicate when a controller failed to mount 2019-05-17 16:18:29 -07:00
cgrouprc_format libprocessgroup: add flags to indicate when a controller failed to mount 2019-05-17 16:18:29 -07:00
include/processgroup libprocessgroup: limit libprocessgroup's VNDK API surface 2019-04-22 17:09:54 -07:00
profiles libprocessgroup: Add VTS tests for vendor JSON files 2019-03-15 16:28:42 -07:00
setup libprocessgroup: add flags to indicate when a controller failed to mount 2019-05-17 16:18:29 -07:00
Android.bp Static link libjsoncpp in libprocessgroup 2019-05-08 13:04:11 -07:00
cgroup_map.cpp libprocessgroup: add flags to indicate when a controller failed to mount 2019-05-17 16:18:29 -07:00
cgroup_map.h libprocessgroup: add flags to indicate when a controller failed to mount 2019-05-17 16:18:29 -07:00
OWNERS Add OWNERS for libprocessgroup 2018-09-14 11:13:22 -07:00
processgroup.cpp libprocessgroup: add flags to indicate when a controller failed to mount 2019-05-17 16:18:29 -07:00
sched_policy.cpp libprocessgroup: add flags to indicate when a controller failed to mount 2019-05-17 16:18:29 -07:00
task_profiles.cpp race condition in libprocessgroup 2019-06-12 19:27:14 +00:00
task_profiles.h race condition in libprocessgroup 2019-06-12 19:27:14 +00:00