Skip to content

rpm: Require policycoreutils >= 3.10 for policydb version 24 support#451

Draft
lsm5 wants to merge 1 commit intocontainers:mainfrom
lsm5:centos-stream-dep
Draft

rpm: Require policycoreutils >= 3.10 for policydb version 24 support#451
lsm5 wants to merge 1 commit intocontainers:mainfrom
lsm5:centos-stream-dep

Conversation

@lsm5
Copy link
Copy Markdown
Member

@lsm5 lsm5 commented Apr 15, 2026

The container-selinux %post script uses semodule to install policy modules. On CentOS Stream 10 / RHEL 10, the HLL/PP converter in policycoreutils < 3.10 doesn't support policydb module version 24, causing installation failures:

libsepol.policydb_read: policydb module version 24 does not match
my version range 4-23

policycoreutils 3.10 added support for version 24. This change adds a conditional requirement using the old_policydb macro for RHEL 9 and earlier, while RHEL 10+ and Fedora require >= 3.10.

Resolves: RHEL-151636

Summary by Sourcery

Adjust container-selinux packaging requirements to ensure compatibility with newer SELinux policy module versions on RHEL and Fedora.

Bug Fixes:

  • Prevent container-selinux post-installation failures on RHEL 10+ by requiring a policycoreutils version that supports policydb module version 24.

Enhancements:

  • Introduce a conditional spec macro to distinguish legacy RHEL (<= 9) from RHEL 10+ and Fedora when declaring policycoreutils post-install requirements.

Build:

  • Update RPM spec to conditionally require policycoreutils >= 3.10 for post scripts on RHEL 10+ and Fedora while keeping an unversioned requirement on older RHEL releases.

@sourcery-ai
Copy link
Copy Markdown

sourcery-ai Bot commented Apr 15, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds conditional RPM post-install dependency on policycoreutils >= 3.10 for Fedora and RHEL 10+, while preserving a looser dependency for RHEL 9 and earlier via a new macro, to ensure support for policydb module version 24 in the container-selinux %post script.

File-Level Changes

Change Details Files
Introduce an RPM macro to flag RHEL 9 and earlier builds as using the older policydb toolchain.
  • Define an old_policydb macro when the rhel macro is defined and its value is less than or equal to 9.
  • Gate the macro definition behind a comment referencing RHEL-151636 for traceability.
rpm/container-selinux.spec
Tighten the policycoreutils post-install dependency for newer platforms while keeping existing behavior for older RHEL.
  • Wrap the policycoreutils Requires(post) line in a conditional on the old_policydb macro.
  • For builds with old_policydb defined (RHEL <= 9), keep the unversioned Requires(post): policycoreutils.
  • For other builds (Fedora, RHEL 10+), require policycoreutils >= 3.10 in %post to guarantee support for policydb module version 24.
rpm/container-selinux.spec

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

The container-selinux %post script uses semodule to install policy
modules. On CentOS Stream 10 / RHEL 10, the HLL/PP converter in
policycoreutils < 3.10 doesn't support policydb module version 24,
causing installation failures:

```
libsepol.policydb_read: policydb module version 24 does not match
my version range 4-23
```

policycoreutils 3.10 added support for version 24. This change adds
a conditional requirement using the `old_policydb` macro for
RHEL 9 and earlier, while RHEL 10+ and Fedora require >= 3.10.

Resolves: RHEL-151636

Signed-off-by: Lokesh Mandvekar <[email protected]>
@lsm5 lsm5 force-pushed the centos-stream-dep branch from d3ecd64 to 77ef4c3 Compare April 15, 2026 19:02
@lsm5 lsm5 changed the title Require policycoreutils >= 3.10 for policydb version 24 support rpm: Require policycoreutils >= 3.10 for policydb version 24 support Apr 15, 2026
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces conditional logic to define old_policydb for RHEL 9 and older, which adjusts the policycoreutils dependency version. Feedback indicates that the current implementation will cause installation failures on Fedora because it lacks the old_policydb definition while having a policycoreutils version lower than 3.10. It is suggested to refine the conditional logic to include Fedora and to double-check the version string '3.10'.

Comment on lines +24 to +26
%if %{defined rhel} && 0%{?rhel} <= 9
%define old_policydb 1
%endif
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The logic for defining old_policydb currently excludes Fedora and generic distributions, forcing them to require policycoreutils >= 3.10. Since current Fedora releases (like F40 and F41) ship with versions 3.6 or 3.7, this requirement will cause installation failures on those platforms.

Additionally, please verify if 3.10 is the intended version string. In RPM versioning, 3.10 is significantly higher than 3.7. If you intended to reference version 3.1 with a specific release (e.g., 3.1-10), the current string will not match as expected. Consider aligning this block with the no_user_namespace logic above to include generic distributions, and verify the impact on Fedora.

%if %{!defined fedora} && %{!defined rhel} || %{defined rhel} && 0%{?rhel} <= 9
%define old_policydb 1
%endif

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.

1 participant