[infra][build] Reset HOME using env instead of bash. (#6079)

Followup on #6069.
This commit is contained in:
jonathanmetzman 2021-07-21 09:09:08 -07:00 committed by GitHub
parent 399382a728
commit 6c5fffc019
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 26 additions and 15 deletions

View File

@ -195,6 +195,10 @@ def get_build_steps(project_name, project_yaml_file, dockerfile_lines,
env.append('ARCHITECTURE=' + architecture)
env.append('FUZZING_LANGUAGE=' + language)
# Set HOME so that it doesn't point to a persisted volume (see
# https://github.com/google/oss-fuzz/issues/6035).
env.append('HOME=/root')
workdir = workdir_from_dockerfile(dockerfile_lines)
if not workdir:
workdir = '/src'
@ -224,9 +228,7 @@ def get_build_steps(project_name, project_yaml_file, dockerfile_lines,
# `cd /src && cd {workdir}` (where {workdir} is parsed from
# the Dockerfile). Container Builder overrides our workdir
# so we need to add this step to set it back.
# Reset HOME so that it doesn't point to a persisted volume
# (see https://github.com/google/oss-fuzz/issues/6035).
('export HOME=/root; rm -r /out && cd /src && cd {workdir} '
('rm -r /out && cd /src && cd {workdir} '
'&& mkdir -p {out} && compile || (echo "{failure_msg}" '
'&& false)').format(workdir=workdir,
out=out,

View File

@ -44,12 +44,13 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",
"-c",
"export HOME=/root; rm -r /out && cd /src && cd /src && mkdir -p /workspace/out/address && compile || (echo \"********************************************************************************\nFailed to build.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine afl --architecture x86_64 test-project\n********************************************************************************\" && false)"
"rm -r /out && cd /src && cd /src && mkdir -p /workspace/out/address && compile || (echo \"********************************************************************************\nFailed to build.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine afl --architecture x86_64 test-project\n********************************************************************************\" && false)"
]
},
{
@ -60,7 +61,8 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",
@ -76,7 +78,8 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",
@ -141,12 +144,13 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",
"-c",
"export HOME=/root; rm -r /out && cd /src && cd /src && mkdir -p /workspace/out/address && compile || (echo \"********************************************************************************\nFailed to build.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine honggfuzz --architecture x86_64 test-project\n********************************************************************************\" && false)"
"rm -r /out && cd /src && cd /src && mkdir -p /workspace/out/address && compile || (echo \"********************************************************************************\nFailed to build.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine honggfuzz --architecture x86_64 test-project\n********************************************************************************\" && false)"
]
},
{
@ -157,7 +161,8 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",
@ -173,7 +178,8 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",
@ -238,12 +244,13 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",
"-c",
"export HOME=/root; rm -r /out && cd /src && cd /src && mkdir -p /workspace/out/address && compile || (echo \"********************************************************************************\nFailed to build.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine libfuzzer --architecture x86_64 test-project\n********************************************************************************\" && false)"
"rm -r /out && cd /src && cd /src && mkdir -p /workspace/out/address && compile || (echo \"********************************************************************************\nFailed to build.\nTo reproduce, run:\npython infra/helper.py build_image test-project\npython infra/helper.py build_fuzzers --sanitizer address --engine libfuzzer --architecture x86_64 test-project\n********************************************************************************\" && false)"
]
},
{
@ -254,7 +261,8 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",
@ -270,7 +278,8 @@
"OUT=/workspace/out/address",
"MSAN_LIBS_PATH=/workspace/msan",
"ARCHITECTURE=x86_64",
"FUZZING_LANGUAGE=c++"
"FUZZING_LANGUAGE=c++",
"HOME=/root"
],
"args": [
"bash",