aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar jonathanmetzman <31354670+jonathanmetzman@users.noreply.github.com>2021-08-25 08:36:05 -0700
committerGravatar GitHub <noreply@github.com>2021-08-25 15:36:05 +0000
commit3a4e6e4484a1395f0f007fe431aab7d1c88a37ad (patch)
tree86c91281c50460d085c2d000fbb29890f59c16ae
parentffe20d3857f020d7e4620494b6ee9e2c271920c7 (diff)
[Ubuntu upgrade] Remove support for prebuilt MSAN libraries. (#6280)
This is done in anticipation of the upgrade to Ubuntu 20.04 which wont support this. We'll do this first so we can handle any breakages caused by this step before needing to handle breakages caused by the upgrade. However, there shouldn't be any breakages due to #6281, but there may be some projects we overlooked. The only exception to this is libcxx. Related: #6180.
-rwxr-xr-xinfra/base-images/base-builder/compile8
-rw-r--r--infra/base-images/msan-libs-builder/Dockerfile45
-rw-r--r--infra/build/functions/base_images.py42
-rwxr-xr-xinfra/build/functions/build_project.py9
-rw-r--r--infra/build/functions/main.py5
-rw-r--r--infra/build/functions/test_data/expected_build_steps.json8
-rw-r--r--infra/build/functions/test_data/expected_coverage_build_steps.json2
-rwxr-xr-xinfra/helper.py19
8 files changed, 2 insertions, 136 deletions
diff --git a/infra/base-images/base-builder/compile b/infra/base-images/base-builder/compile
index 9af91b2e..85ccd693 100755
--- a/infra/base-images/base-builder/compile
+++ b/infra/base-images/base-builder/compile
@@ -73,13 +73,7 @@ then
# export CXXFLAGS_EXTRA="-L/usr/msan/lib $CXXFLAGS_EXTRA"
cp -R /usr/msan/lib/* /usr/lib/
- if [[ -z "${MSAN_LIBS_PATH-}" ]]; then
- echo 'WARNING: Building without MSan instrumented libraries.'
- else
- # Copy all static libraries only. Don't include .so files because they can
- # break non MSan compiled programs.
- (cd "$MSAN_LIBS_PATH" && find . -name '*.a' -exec cp --parents '{}' / ';')
- fi
+ echo 'Building without MSan instrumented libraries.'
fi
# Coverage flag overrides.
diff --git a/infra/base-images/msan-libs-builder/Dockerfile b/infra/base-images/msan-libs-builder/Dockerfile
deleted file mode 100644
index 7780c1f3..00000000
--- a/infra/base-images/msan-libs-builder/Dockerfile
+++ /dev/null
@@ -1,45 +0,0 @@
-# Copyright 2017 Google Inc.
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-################################################################################
-
-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 \
- libattr1 \
- libbz2-1.0 \
- libfontconfig1 \
- libfreetype6 \
- libfribidi0 \
- libglib2.0-0 \
- libicu55 \
- liblz4-1 \
- liblzma5 \
- liblzo2-2 \
- libnettle6 \
- libpcre2-posix0 \
- libpcre3 \
- libpng12-0 \
- libssl1.0.0 \
- libxml2 \
- zlib1g \
- /msan
diff --git a/infra/build/functions/base_images.py b/infra/build/functions/base_images.py
index 9914be1d..cbcd599d 100644
--- a/infra/build/functions/base_images.py
+++ b/infra/build/functions/base_images.py
@@ -15,7 +15,6 @@
################################################################################
"""Cloud function to build base images on Google Cloud Builder."""
-import datetime
import logging
import google.auth
@@ -34,7 +33,6 @@ BASE_PROJECT = 'oss-fuzz-base'
TAG_PREFIX = f'gcr.io/{BASE_PROJECT}/'
BASE_SANITIZER_LIBS_IMAGE = TAG_PREFIX + 'base-sanitizer-libs-builder'
-MSAN_LIBS_IMAGE = TAG_PREFIX + 'msan-libs-builder'
def _get_base_image_steps(images, tag_prefix=TAG_PREFIX):
@@ -100,43 +98,3 @@ def base_builder(event, context):
images = [tag_prefix + base_image for base_image in BASE_IMAGES]
run_build(steps, images)
-
-
-def _get_msan_steps(image):
- """Get build steps for msan-libs-builder."""
- timestamp = datetime.datetime.utcnow().strftime('%Y%m%d%H%M')
- upload_name = 'msan-libs-' + timestamp + '.zip'
-
- steps = _get_base_image_steps([
- 'base-sanitizer-libs-builder',
- 'msan-libs-builder',
- ])
- steps.extend([{
- 'name': image,
- 'args': [
- 'bash',
- '-c',
- 'cd /msan && zip -r /workspace/libs.zip .',
- ],
- }, {
- 'name':
- 'gcr.io/cloud-builders/gsutil',
- 'args': [
- 'cp',
- '/workspace/libs.zip',
- 'gs://oss-fuzz-msan-libs/' + upload_name,
- ],
- }])
- return steps
-
-
-def base_msan_builder(event, context):
- """Cloud function to build base images."""
- del event, context
- steps = _get_msan_steps(MSAN_LIBS_IMAGE)
- images = [
- BASE_SANITIZER_LIBS_IMAGE,
- MSAN_LIBS_IMAGE,
- ]
-
- run_build(steps, images)
diff --git a/infra/build/functions/build_project.py b/infra/build/functions/build_project.py
index ea98d02c..a96f5758 100755
--- a/infra/build/functions/build_project.py
+++ b/infra/build/functions/build_project.py
@@ -144,15 +144,6 @@ def get_build_steps(project_name, project_yaml_file, dockerfile_lines,
time_stamp = datetime.datetime.now().strftime('%Y%m%d%H%M')
build_steps = build_lib.project_image_steps(name, image, language)
- # Copy over MSan instrumented libraries.
- build_steps.append({
- 'name': f'gcr.io/{base_images_project}/msan-libs-builder',
- 'args': [
- 'bash',
- '-c',
- 'cp -r /msan /workspace',
- ],
- })
# Sort engines to make AFL first to test if libFuzzer has an advantage in
# finding bugs first since it is generally built first.
diff --git a/infra/build/functions/main.py b/infra/build/functions/main.py
index 1bfd3581..c34dc132 100644
--- a/infra/build/functions/main.py
+++ b/infra/build/functions/main.py
@@ -45,8 +45,3 @@ def coverage_build(event, context):
def builds_status(event, context):
"""Entry point for builds status cloud function."""
update_build_status.update_status(event, context)
-
-
-def build_msan(event, context):
- """Entry point for base msan builder."""
- base_images.base_msan_builder(event, context)
diff --git a/infra/build/functions/test_data/expected_build_steps.json b/infra/build/functions/test_data/expected_build_steps.json
index 271e43fe..f8c525c2 100644
--- a/infra/build/functions/test_data/expected_build_steps.json
+++ b/infra/build/functions/test_data/expected_build_steps.json
@@ -29,14 +29,6 @@
]
},
{
- "name": "gcr.io/oss-fuzz-base/msan-libs-builder",
- "args": [
- "bash",
- "-c",
- "cp -r /msan /workspace"
- ]
- },
- {
"name": "gcr.io/oss-fuzz/test-project",
"env": [
"FUZZING_ENGINE=afl",
diff --git a/infra/build/functions/test_data/expected_coverage_build_steps.json b/infra/build/functions/test_data/expected_coverage_build_steps.json
index 19b1d5b8..8db36a37 100644
--- a/infra/build/functions/test_data/expected_coverage_build_steps.json
+++ b/infra/build/functions/test_data/expected_coverage_build_steps.json
@@ -141,4 +141,4 @@
"test_url"
]
}
-] \ No newline at end of file
+]
diff --git a/infra/helper.py b/infra/helper.py
index 532101fe..4eb945c4 100755
--- a/infra/helper.py
+++ b/infra/helper.py
@@ -44,7 +44,6 @@ 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-libs-builder',
]
VALID_PROJECT_NAME_REGEX = re.compile(r'^[a-zA-Z0-9_-]+$')
@@ -633,15 +632,6 @@ def build_fuzzers_impl( # pylint: disable=too-many-arguments,too-many-locals,to
if env_to_add:
env += env_to_add
- # Copy instrumented libraries.
- if sanitizer == 'memory':
- docker_run([
- '-v',
- '%s:/work' % project.work, 'gcr.io/oss-fuzz-base/msan-libs-builder',
- 'bash', '-c', 'cp -r /msan /work'
- ])
- env.append('MSAN_LIBS_PATH=' + '/work/msan')
-
command = ['--cap-add', 'SYS_PTRACE'] + _env_to_docker_args(env)
if source_path:
workdir = _workdir_from_dockerfile(project)
@@ -672,15 +662,6 @@ def build_fuzzers_impl( # pylint: disable=too-many-arguments,too-many-locals,to
logging.error('Building fuzzers failed.')
return False
- # Patch MSan builds to use instrumented shared libraries.
- if sanitizer == 'memory':
- docker_run(
- ['-v', '%s:/out' % project.out, '-v',
- '%s:/work' % project.work] + _env_to_docker_args(env) + [
- 'gcr.io/oss-fuzz-base/base-sanitizer-libs-builder',
- 'patch_build.py', '/out'
- ])
-
return True