Skip to content

Commit

Permalink
[cifuzz] Handle upgrade to Ubuntu 20.04 (#6249)
Browse files Browse the repository at this point in the history
Handle upgrade to Ubuntu 20.04

1. Don't do any special handling for MSAN anymore. It isn't needed.
2. Don't do any special handling for msan-libs-builder it doesn't
exist anymore.

Related: #6180
  • Loading branch information
jonathanmetzman authored Aug 26, 2021
1 parent 03d1837 commit b30e4f4
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 45 deletions.
32 changes: 0 additions & 32 deletions infra/cifuzz/build_fuzzers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,6 @@ def build_fuzzers(self):
docker_args.extend(
_get_docker_build_fuzzers_args_not_container(self.host_repo_path))

if self.config.sanitizer == 'memory':
docker_args.extend(
_get_docker_build_fuzzers_args_msan(self.workspace.work))
self.handle_msan_prebuild(docker_container)

docker_args.extend([
docker.get_project_image_name(self.config.oss_fuzz_project_name),
'/bin/bash',
Expand All @@ -107,8 +102,6 @@ def build_fuzzers(self):
logging.error('Building fuzzers failed.')
return False

if self.config.sanitizer == 'memory':
self.handle_msan_postbuild(docker_container)
return True

def upload_build(self):
Expand All @@ -119,23 +112,6 @@ def upload_build(self):

return True

def handle_msan_postbuild(self, container):
"""Post-build step for MSAN builds. Patches the build to use MSAN
libraries."""
helper.docker_run([
'--volumes-from', container, '-e', f'WORK={self.workspace.work}',
docker.MSAN_LIBS_BUILDER_TAG, 'patch_build.py', '/out'
])

def handle_msan_prebuild(self, container):
"""Pre-build step for MSAN builds. Copies MSAN libs to |msan_libs_dir| and
returns docker arguments to use that directory for MSAN libs."""
logging.info('Copying MSAN libs.')
helper.docker_run([
'--volumes-from', container, docker.MSAN_LIBS_BUILDER_TAG, 'bash', '-c',
f'cp -r /msan {self.workspace.work}'
])

def build(self):
"""Builds the image, checkouts the source (if needed), builds the fuzzers
and then removes the unaffectted fuzzers. Returns True on success."""
Expand Down Expand Up @@ -226,11 +202,3 @@ def _get_docker_build_fuzzers_args_not_container(host_repo_path):
|host_repo_path| when the host of the OSS-Fuzz builder container is not
another container."""
return ['-v', f'{host_repo_path}:{host_repo_path}']


def _get_docker_build_fuzzers_args_msan(work_dir):
"""Returns arguments to the docker build command that are needed to use
MSAN."""
# TODO(metzman): MSAN is broken, fix.
msan_libs_path = os.path.join(work_dir, 'msan')
return ['-e', f'MSAN_LIBS_PATH={msan_libs_path}']
11 changes: 0 additions & 11 deletions infra/cifuzz/build_fuzzers_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -369,16 +369,5 @@ def test_get_docker_build_fuzzers_args_no_container(self):
self.assertEqual(result, expected_result)


class GetDockerBuildFuzzersArgsMsanTest(unittest.TestCase):
"""Tests that _get_docker_build_fuzzers_args_msan works as intended."""

def test_get_docker_build_fuzzers_args_msan(self):
"""Tests that _get_docker_build_fuzzers_args_msan works as intended."""
work_dir = '/work_dir'
result = build_fuzzers._get_docker_build_fuzzers_args_msan(work_dir)
expected_result = ['-e', 'MSAN_LIBS_PATH=/work_dir/msan']
self.assertEqual(result, expected_result)


if __name__ == '__main__':
unittest.main()
1 change: 0 additions & 1 deletion infra/cifuzz/docker.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
import utils

BASE_BUILDER_TAG = 'gcr.io/oss-fuzz-base/base-builder'
MSAN_LIBS_BUILDER_TAG = 'gcr.io/oss-fuzz-base/msan-libs-builder'
PROJECT_TAG_PREFIX = 'gcr.io/oss-fuzz/'

# Default fuzz configuration.
Expand Down
1 change: 0 additions & 1 deletion infra/cifuzz/run_fuzzers_entrypoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ def delete_unneeded_docker_images(config):
project_image = docker.get_project_image_name(config.oss_fuzz_project_name)
images = [
project_image,
docker.MSAN_LIBS_BUILDER_TAG,
]
docker.delete_images(images)

Expand Down

0 comments on commit b30e4f4

Please sign in to comment.