summaryrefslogtreecommitdiff
path: root/libarttools/include
AgeCommit message (Collapse)Author
2024-06-06Make teardown faster and more reliable. Jiakai Zhang
Before this change, we only trigger GC and sleep 5 seconds, hoping that processes in chroot exit within that 5 seconds. After this change, we use pidfd to wait for processes to exit, so teardown can be performed as soon as all processes have exited, making teardown considerably faster. Also, if the processes don't exit within 5 seconds, we kill them, making teardown more reliable. Only one more SELinux permission is needed, which is the permission to send `sigkill` to artd and its subprocesses. system_server already has all the other permissions to perform the operations used in this CL. 1. system_server has supplementary group "readproc" (3009), to list all pids in "/proc", bypassing "hidepid=2" (see proc(5)). - https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/com/android/internal/os/ZygoteInit.java;l=658;drc=7d3ffbae618e9e728644a96647ed709bf39ae759 2. system_server can read /proc/<pid>/* for all domains. - https://cs.android.com/android/platform/superproject/main/+/main:system/sepolicy/private/system_server.te;l=213;drc=ca2f3851afaee866d37caae16598b3d5c20844d4 3. system_server has CAP_SYS_PTRACE, to read the "/proc/<pid>/exe" link of anyprocess (see proc(5)). - https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/com/android/internal/os/ZygoteInit.java;l=635;drc=7d3ffbae618e9e728644a96647ed709bf39ae759 - https://cs.android.com/android/platform/superproject/main/+/main:system/sepolicy/private/system_server.te;l=145;drc=ca2f3851afaee866d37caae16598b3d5c20844d4 4. system_server has CAP_KILL, to kill processes that belong to other users (see kill(2)). - https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/com/android/internal/os/ZygoteInit.java;l=628;drc=7d3ffbae618e9e728644a96647ed709bf39ae759 - https://cs.android.com/android/platform/superproject/main/+/main:system/sepolicy/private/system_server.te;l=138;drc=ca2f3851afaee866d37caae16598b3d5c20844d4 Bug: 311377497 Test: m test-art-host-gtest-art_libarttools_tests Test: atest art_standalone_libarttools_tests --iterations 10 Test: adb shell pm art pr-dexopt-job --test Test: Run and cancel Pre-reboot Dexopt multiple times. Change-Id: I1e41cd71402944e31b33e410ac1635766afe55c4
2024-05-28Add move constructor back to art::tools::SystemProperties. Jiakai Zhang
To allow deleting an object through pointer to base, we have added a virtual destructor to this class (https://en.cppreference.com/w/cpp/language/destructor#Virtual_destructors). However, this essentially deletes the implicit move constructor (https://en.cppreference.com/w/cpp/language/move_constructor#Implicitly-declared_move_constructor), so the implicit copy constructor is currently being picked, and we get Wdeprecated-copy-with-dtor because the implicit copy constructor is deprecated for classes with a user-declared destructor (https://en.cppreference.com/w/cpp/language/copy_constructor#Implicitly-defined_copy_constructor). This CL adds the move constructor back. Bug: 311377497 Change-Id: I02470aa1aa62009876834887b7a2ae1ee920060d Test: Build and see no more Wdeprecated-copy-with-dtor
2024-03-07Move common code from artd to libarttools. Jiakai Zhang
The code will be shared with dexopt_chroot_setup. Bug: 311377497 Test: m com.android.art Change-Id: I2b320e0d4effa7e7a1c75ab5fe40fe8c4ff170ba
2023-11-20Restructure the files in libarttools. Jiakai Zhang
- Move headers into an "include" dir. - Move cc files to the root of libarttools. Bug: 311377497 Test: m com.android.art Change-Id: I2f83d38051bbc24082db5aba7278a07fb14b8c29