Skip to content

Conversation

@hunsche
Copy link
Contributor

@hunsche hunsche commented Oct 13, 2025

What this PR does

This PR resolves a critical GLIBC mismatch error in the parallel trial_build CI pipeline by enabling dynamic selection of the base-runner image. It introduces a hybrid approach to ensure a project's runtime environment always matches its build environment.

Why this PR is important

Currently, fuzzers built on a newer OS (e.g., Ubuntu 24.04) during parallel CI runs fail during the check_build step because they are always tested against an older, hardcoded base-runner:latest image (Ubuntu 20.04). This change is crucial to unblock parallel builds and allow projects to use newer base images without breaking the CI.

How the changes were implemented

  • CI-Level Override: The trial_build function now passes a --base-image-tag to helper.py. This tag corresponds to the OS version of the build job (e.g., ubuntu-24-04), ensuring the check_build step uses the correct runner image.
  • Project-Level Configuration: A new base_os_version field is introduced in project.yaml. This allows developers to specify a base OS for local runs of run_fuzzer, reproduce, etc., making local testing consistent with CI.
  • Centralized Image Logic: All commands in helper.py that use a runner image now call a refactored _get_base_runner_image function. This function implements the priority system: --base-image-tag > base_os_version > legacy default.
  • New Consistency Check: A new GitHub Actions workflow (check_base_os.yml) is added. It triggers on pull requests modifying projects/ and verifies that the base_os_version in project.yaml matches the FROM tag in the project's Dockerfile, preventing configuration errors.
  • Bug Fix: The logic for selecting debug images (reproduce --valgrind) was also corrected as part of the refactoring.

How to test

  1. The primary validation is through the CI itself. A trial_build for a project using a newer Dockerfile (e.g., based on Ubuntu 24.04) should now pass the check_build step.
  2. Locally, a developer can add base_os_version: ubuntu-24-04 to a project.yaml (assuming a matching Dockerfile) and confirm that python3 infra/helper.py run_fuzzer <project> <fuzzer> uses the gcr.io/oss-fuzz-base/base-runner:ubuntu-24-04 image.

Is it a breaking change?

No. The default behavior is unchanged. All existing projects without the new base_os_version field will continue to use the legacy (:latest) runner image, making the change fully backward-compatible.

Related Task

hunsche and others added 3 commits October 13, 2025 18:17
Introduces a hybrid approach for selecting the base-runner image to fix
GLIBC version mismatches in the parallel trial_build CI pipeline.

The image tag is now determined with the following priority:
1. --base-image-tag: A new command-line argument for CI.
2. base_os_version: A new field in project.yaml for local runs.
3. 'legacy': The default tag, preserving backward compatibility.

A new GitHub Actions workflow is added to ensure consistency between
the `base_os_version` in `project.yaml` and the `FROM` tag in the
project's Dockerfile, preventing configuration errors.

Fixes b/441792502
@hunsche
Copy link
Contributor Author

hunsche commented Oct 13, 2025

/gcbrun trial_build.py zlib bad_example --fuzzing-engines libfuzzer --sanitizers address --force

@hunsche
Copy link
Contributor Author

hunsche commented Oct 13, 2025

/gcbrun trial_build.py zlib bad_example --fuzzing-engines libfuzzer --sanitizers address --force

@hunsche
Copy link
Contributor Author

hunsche commented Oct 13, 2025

/gcbrun trial_build.py zlib bad_example --fuzzing-engines libfuzzer --sanitizers address --force

config = yaml.safe_load(file_handle)
version = 'legacy'
if config and 'base_os_version' in config:
version = config['base_os_version']
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder why base_os_version is needed given that it can be extracted from dockerfiles? Currently ubuntu-24-04 should be specified in two different places to get it to work with Ubuntu 24.04 as far as I can see.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just to clarify it does work but I think ideally there should be one place where it should be specified instead of

diff --git a/projects/.../Dockerfile b/projects/.../Dockerfile
...
-FROM gcr.io/oss-fuzz-base/base-builder
+FROM gcr.io/oss-fuzz-base/base-builder:ubuntu-24-04
...
diff --git a/projects/.../project.yaml b/projects/.../project.yaml
...
+base_os_version: "ubuntu-24-04"

It isn't the end of the world though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand your point. It is necessary in the project.yaml file because some projects, like ClusterFuzz, don't parse the Dockerfile; they only analyze the project.yaml file. That's why it's important there.

Think of it as a small redundancy to support the upgrade. In the future, this field can default to ubuntu-24-04 once we phase out ubuntu-20.04 entirely.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it.

project.yaml is omitted in some projects using ClusterFuzzLite though so there it has to be created to bump the images.

@hunsche
Copy link
Contributor Author

hunsche commented Oct 14, 2025

/gcbrun trial_build.py zlib bad_example --fuzzing-engines libfuzzer --sanitizers address --force

@hunsche
Copy link
Contributor Author

hunsche commented Oct 14, 2025

/gcbrun trial_build.py zlib bad_example --fuzzing-engines libfuzzer --sanitizers address --force

@hunsche
Copy link
Contributor Author

hunsche commented Oct 14, 2025

/gcbrun trial_build.py zlib bad_example --fuzzing-engines libfuzzer --sanitizers address --force

@hunsche hunsche merged commit eb47f56 into master Oct 14, 2025
19 checks passed
@hunsche hunsche deleted the feat/base-os-version branch October 14, 2025 14:36
oliverchang added a commit that referenced this pull request Oct 16, 2025
yuwata added a commit to yuwata/systemd that referenced this pull request Oct 19, 2025
With google/oss-fuzz#14112 and
google/oss-fuzz#14128, we can now use Ubuntu
24.04. Let's bump the image version.
yuwata added a commit to yuwata/systemd that referenced this pull request Oct 19, 2025
With
google/oss-fuzz#14112 and
google/oss-fuzz#14128,
we can now use Ubuntu 24.04. Let's bump the image version.

Note, the i386 build failure mentioned in the removed comment is related to
https://bugs.launchpad.net/ubuntu/+source/linux-signed-azure/+bug/2071445
actions/runner-images#9977
and has been already fixed.
yuwata added a commit to systemd/systemd that referenced this pull request Oct 21, 2025
With
google/oss-fuzz#14112 and
google/oss-fuzz#14128,
we can now use Ubuntu 24.04. Let's bump the image version.

Note, the i386 build failure mentioned in the removed comment is related to
https://bugs.launchpad.net/ubuntu/+source/linux-signed-azure/+bug/2071445
actions/runner-images#9977
and has been already fixed.
jouyouyun pushed a commit to jouyouyun/systemd that referenced this pull request Nov 3, 2025
With
google/oss-fuzz#14112 and
google/oss-fuzz#14128,
we can now use Ubuntu 24.04. Let's bump the image version.

Note, the i386 build failure mentioned in the removed comment is related to
https://bugs.launchpad.net/ubuntu/+source/linux-signed-azure/+bug/2071445
actions/runner-images#9977
and has been already fixed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants