diff options
author | Max Moroz <mmoroz@chromium.org> | 2020-07-24 12:38:00 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-07-24 12:38:00 -0700 |
commit | 70d278bb53147c23c4fc7f2c4528e485c50cfe1f (patch) | |
tree | 0f915c2411f5019242f07306a118671ce8eea087 | |
parent | a9d0062a554b1598fbbb71ccd1c38d46c3c80c45 (diff) | |
download | oss-fuzz-70d278bb53147c23c4fc7f2c4528e485c50cfe1f.tar.gz |
[infra] Rename msan-builder to msan-libs-builder (#3388). (#4190)
* [infra] Rename msan-builder to msan-libs-builder and add (broken) dfsan-libs-builder (#3388).
* remove dfsan-libs-builder for now
* presubmit format
-rw-r--r-- | docs/getting-started/new_project_guide.md | 4 | ||||
-rw-r--r-- | infra/base-images/base-sanitizer-libs-builder/Dockerfile | 6 | ||||
-rw-r--r-- | infra/base-images/msan-libs-builder/Dockerfile (renamed from infra/base-images/msan-builder/Dockerfile) | 7 | ||||
-rw-r--r-- | infra/build/functions/expected_build_steps.json | 4 | ||||
-rwxr-xr-x | infra/gcb/build_msan_libs.py | 16 | ||||
-rw-r--r-- | infra/gcb/build_project.py | 4 | ||||
-rwxr-xr-x | infra/helper.py | 23 |
7 files changed, 30 insertions, 34 deletions
diff --git a/docs/getting-started/new_project_guide.md b/docs/getting-started/new_project_guide.md index f47d70413..17ff2376f 100644 --- a/docs/getting-started/new_project_guide.md +++ b/docs/getting-started/new_project_guide.md @@ -116,7 +116,7 @@ sanitizers (currently ["address"](https://clang.llvm.org/docs/AddressSanitizer.h and recommended, but is not enabled by default due to the likelihood of false positives from un-instrumented system dependencies. If you want to use "memory," first make sure your project's runtime dependencies are listed in the OSS-Fuzz -[msan-builder Dockerfile](https://github.com/google/oss-fuzz/blob/master/infra/base-images/msan-builder/Dockerfile#L20). +[msan-libs-builder Dockerfile](https://github.com/google/oss-fuzz/blob/master/infra/base-images/msan-libs-builder/Dockerfile#L20). Then, you can opt in by adding "memory" to your list of sanitizers. If your project does not build with a particular sanitizer configuration and you need some time to fix @@ -315,7 +315,7 @@ fuzz targets get to the code you expect. Please refer to [code coverage]({{ site **Note:** Currently, we only support AddressSanitizer (address) and UndefinedBehaviorSanitizer (undefined) configurations. MemorySanitizer is recommended, but needs to be enabled manually once you verify that all system dependencies are -[instrumented](https://github.com/google/oss-fuzz/blob/master/infra/base-images/msan-builder/Dockerfile#L20). +[instrumented](https://github.com/google/oss-fuzz/blob/master/infra/base-images/msan-libs-builder/Dockerfile#L20). <b>Make sure to test each of the supported build configurations with the above commands (build_fuzzers -> run_fuzzer -> coverage).</b> diff --git a/infra/base-images/base-sanitizer-libs-builder/Dockerfile b/infra/base-images/base-sanitizer-libs-builder/Dockerfile index 315730b61..b1a17b96c 100644 --- a/infra/base-images/base-sanitizer-libs-builder/Dockerfile +++ b/infra/base-images/base-sanitizer-libs-builder/Dockerfile @@ -18,11 +18,5 @@ FROM gcr.io/oss-fuzz-base/base-clang RUN sed -i -r 's/#\s*deb-src/deb-src/g' /etc/apt/sources.list RUN apt-get update && apt-get install -y python dpkg-dev patchelf python-apt zip -# Take all libraries from lib/msan -RUN cp -R /usr/msan/lib/* /usr/lib/ - COPY compiler_wrapper.py msan_build.py patch_build.py wrapper_utils.py /usr/local/bin/ COPY packages /usr/local/bin/packages - -RUN mkdir /msan -WORKDIR /msan diff --git a/infra/base-images/msan-builder/Dockerfile b/infra/base-images/msan-libs-builder/Dockerfile index 319b72de6..7780c1f33 100644 --- a/infra/base-images/msan-builder/Dockerfile +++ b/infra/base-images/msan-libs-builder/Dockerfile @@ -15,6 +15,13 @@ ################################################################################ FROM gcr.io/oss-fuzz-base/base-sanitizer-libs-builder + +# Take all libraries from lib/msan +RUN cp -R /usr/msan/lib/* /usr/lib/ + +RUN mkdir /msan +WORKDIR /msan + ENV PYTHONUNBUFFERED 1 RUN msan_build.py --work-dir=$WORK \ libarchive13 \ diff --git a/infra/build/functions/expected_build_steps.json b/infra/build/functions/expected_build_steps.json index a2d8bb95e..f5b98563b 100644 --- a/infra/build/functions/expected_build_steps.json +++ b/infra/build/functions/expected_build_steps.json @@ -29,7 +29,7 @@ ] }, { - "name": "gcr.io/oss-fuzz-base/msan-builder", + "name": "gcr.io/oss-fuzz-base/msan-libs-builder", "args": [ "bash", "-c", @@ -327,4 +327,4 @@ "rm -r /workspace/out/address" ] } -]
\ No newline at end of file +] diff --git a/infra/gcb/build_msan_libs.py b/infra/gcb/build_msan_libs.py index 124ad8900..4b58fd565 100755 --- a/infra/gcb/build_msan_libs.py +++ b/infra/gcb/build_msan_libs.py @@ -20,13 +20,11 @@ def main(): if 'GCB_OPTIONS' in os.environ: options = yaml.safe_load(os.environ['GCB_OPTIONS']) - image = 'gcr.io/oss-fuzz-base/msan-builder' - steps = build_base_images.get_steps( - [ - 'base-sanitizer-libs-builder', - 'msan-builder', - ] - ) + image = 'gcr.io/oss-fuzz-base/msan-libs-builder' + steps = build_base_images.get_steps([ + 'base-sanitizer-libs-builder', + 'msan-libs-builder', + ]) ts = datetime.datetime.utcnow().strftime('%Y%m%d%H%M') upload_name = 'msan-libs-' + ts + '.zip' @@ -59,8 +57,8 @@ def main(): credentials = GoogleCredentials.get_application_default() cloudbuild = build('cloudbuild', 'v1', credentials=credentials) - build_info = cloudbuild.projects().builds().create( - projectId='oss-fuzz-base', body=build_body).execute() + build_info = cloudbuild.projects().builds().create(projectId='oss-fuzz-base', + body=build_body).execute() build_id = build_info['metadata']['build']['id'] print >> sys.stderr, 'Logs:', build_base_images.get_logs_url(build_id) diff --git a/infra/gcb/build_project.py b/infra/gcb/build_project.py index c7db87d60..7f233c196 100644 --- a/infra/gcb/build_project.py +++ b/infra/gcb/build_project.py @@ -139,7 +139,7 @@ def get_build_steps(project_name, project_yaml_file, dockerfile_lines, build_steps = build_lib.project_image_steps(name, image, language) # Copy over MSan instrumented libraries. build_steps.append({ - 'name': 'gcr.io/{0}/msan-builder'.format(base_images_project), + 'name': 'gcr.io/{0}/msan-libs-builder'.format(base_images_project), 'args': [ 'bash', '-c', @@ -224,7 +224,7 @@ def get_build_steps(project_name, project_yaml_file, dockerfile_lines, # Patch dynamic libraries to use instrumented ones. build_steps.append({ 'name': - 'gcr.io/{0}/msan-builder'.format(base_images_project), + 'gcr.io/{0}/msan-libs-builder'.format(base_images_project), 'args': [ 'bash', '-c', diff --git a/infra/helper.py b/infra/helper.py index caec83b82..41551dc92 100755 --- a/infra/helper.py +++ b/infra/helper.py @@ -40,7 +40,7 @@ BASE_IMAGES = [ 'gcr.io/oss-fuzz-base/base-runner', 'gcr.io/oss-fuzz-base/base-runner-debug', 'gcr.io/oss-fuzz-base/base-sanitizer-libs-builder', - 'gcr.io/oss-fuzz-base/msan-builder', + 'gcr.io/oss-fuzz-base/msan-libs-builder', ] VALID_PROJECT_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_-]+$') @@ -524,7 +524,7 @@ def build_fuzzers_impl( # pylint: disable=too-many-arguments,too-many-locals,to if sanitizer == 'memory': docker_run([ '-v', - '%s:/work' % project_work_dir, 'gcr.io/oss-fuzz-base/msan-builder', + '%s:/work' % project_work_dir, 'gcr.io/oss-fuzz-base/msan-libs-builder', 'bash', '-c', 'cp -r /msan /work' ]) env.append('MSAN_LIBS_PATH=' + '/work/msan') @@ -562,17 +562,14 @@ def build_fuzzers_impl( # pylint: disable=too-many-arguments,too-many-locals,to # Patch MSan builds to use instrumented shared libraries. if sanitizer == 'memory': - docker_run( - [ - '-v', - '%s:/out' % project_out_dir, '-v', - '%s:/work' % project_work_dir - ] + _env_to_docker_args(env) + [ - 'gcr.io/oss-fuzz-base/base-sanitizer-libs-builder', - 'patch_build.py', - '/out' - ] - ) + docker_run([ + '-v', + '%s:/out' % project_out_dir, '-v', + '%s:/work' % project_work_dir + ] + _env_to_docker_args(env) + [ + 'gcr.io/oss-fuzz-base/base-sanitizer-libs-builder', 'patch_build.py', + '/out' + ]) return 0 |