Prevent subprocesses from accessing FDs opened in other threads.
Unlike installd, artd is multi-threaded. When we fork & exec, the
subprocess gets FDs opened in all threads. This is unexpected. For
example, profman gets FDs opened for dex2oat. This CL prevents this by
closing other FDs before we exec.
Bug: 262230400
Test: m test-art-host-gtest-art_artd_tests
Test: m test-art-host-gtest-art_libarttools_tests
Test: atest ArtGtestsTargetChroot:ArtExecTest
Test: -
1. adb shell setprop pm.dexopt.bg-dexopt.concurrency 4
2. adb shell pm art optimize-packages bg-dexopt
3. No longer see SELinux complaining that profman is trying to read
some files opened for dex2oat.
Ignore-AOSP-First: ART Services.
Change-Id: Ia8068d804294debe0de6c947f3878da4dbf8c8ca
9 files changed