Add path interposer

This will allow us to track (and eventually limit) the commands that the
build references via $PATH. These are mostly implicit dependencies on
the host system -- for Linux, we assume something similar to Ubuntu
14.04 with a few extra packages, but this will let us better define
that.

This will not catch uses of tools with absolute paths (/bin/bash, etc),
but most uses shouldn't be relying on absolute path names anyways.

Adds ~400ms on the first startup, ~140ms on subsequent runs, and
overhead of a few ms for every forwarded execution.

Test: m
Test: build/soong/build_test.bash
Test: Add `gcc --version`, TEMPORARY_DISABLE_PATH_RESTRICTIONS=true m
Change-Id: Id68cbb1c8ceef65bbbb10751e83722c7662d2351
This commit is contained in:
Dan Willemsen
2017-10-28 22:57:22 -07:00
parent 6af008fc0f
commit a14704c12b
11 changed files with 997 additions and 2 deletions

View File

@@ -12,10 +12,23 @@
// See the License for the specific language governing permissions and
// limitations under the License.
bootstrap_go_package {
name: "soong-ui-build-paths",
pkgPath: "android/soong/ui/build/paths",
srcs: [
"paths/config.go",
"paths/logs.go",
],
testSrcs: [
"paths/logs_test.go",
],
}
bootstrap_go_package {
name: "soong-ui-build",
pkgPath: "android/soong/ui/build",
deps: [
"soong-ui-build-paths",
"soong-ui-logger",
"soong-ui-tracer",
"soong-shared",
@@ -33,6 +46,7 @@ bootstrap_go_package {
"finder.go",
"kati.go",
"ninja.go",
"path.go",
"proc_sync.go",
"signal.go",
"soong.go",