Skip to content

Confined user fixes and bump to v2.247.0#443

Merged
haircommander merged 4 commits intocontainers:mainfrom
lsm5:confined-user-fixes
Mar 13, 2026
Merged

Confined user fixes and bump to v2.247.0#443
haircommander merged 4 commits intocontainers:mainfrom
lsm5:confined-user-fixes

Conversation

@lsm5
Copy link
Member

@lsm5 lsm5 commented Feb 26, 2026

See individual commits.

Summary by Sourcery

Update SELinux container policy and main plan configuration for confined user support and bump the project version to v2.247.0.

Bug Fixes:

  • Adjust SELinux container policy to correctly handle confined user scenarios.

Enhancements:

  • Refresh main plan configuration to align with updated confined user behavior and new version.

Build:

  • Bump project version to v2.247.0 in build-related metadata.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 26, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Updates SELinux container policy and main test plan configuration to support new confined user behavior and align everything with version v2.247.0.

File-Level Changes

Change Details Files
Update SELinux container policy for confined user behavior
  • Adjust SELinux policy rules governing container behavior under confined users
  • Refine permissions and access controls to match updated confined user requirements
  • Ensure policy remains compatible with the v2.247.0 behavior and security expectations
container.te
Refresh main test plan metadata and configuration for v2.247.0 and confined users
  • Update plan metadata to reference version v2.247.0
  • Align test matrix and/or environment parameters with new confined user behavior
  • Ensure tests reflect updated SELinux container policy expectations
plans/main.fmf

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

@gemini-code-assist
Copy link

Summary of Changes

Hello @lsm5, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request primarily enhances SELinux policies to improve the functionality for confined users when interacting with container runtimes, addressing permissions for process signaling and socket management crucial for user-level systemd services. Additionally, it refines the execution logic for a specific test, making it conditional based on the triggering mechanism.

Highlights

  • SELinux Policy Enhancement: Updated the SELinux policy to allow confined users greater interaction with container runtimes, specifically enabling unprivileged users to signal container processes and manage Unix stream sockets for systemd activation.
  • Test Plan Configuration: Adjusted the xmllint_validation test in plans/main.fmf to be disabled by default and only enabled when the test initiator is packit.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • container.te
    • Added unprivuser_role_change_to(system_r) to permit unprivileged users to change their role to system_r.
    • Granted user_t permissions to send signals to container_runtime_t and container_domain processes.
    • Allowed staff_t and user_t to perform various socket operations (create, bind, listen, getattr, setattr, setopt, shutdown) on container_runtime_t labeled Unix stream sockets, supporting user-level systemd activation.
  • plans/main.fmf
    • Disabled the /xmllint_validation test by default.
    • Configured the /xmllint_validation test to be enabled only when the initiator is packit.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link

@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 primarily focuses on enhancing SELinux policy to properly support confined users, allowing them to manage processes and sockets necessary for podman.socket activation. The changes in container.te appear to be well-targeted and essential for the described functionality. Additionally, the FMF test plan has been updated to conditionally enable xmllint_validation only for packit initiated runs. While the SELinux policy updates are clear, the change in the test plan could potentially reduce the overall validation coverage for XML files in non-Packit testing environments.

Comment on lines +25 to +28
enabled: false
adjust:
- when: initiator == packit
enabled: true

Choose a reason for hiding this comment

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

medium

Disabling the xmllint_validation test by default and only enabling it for packit runs might lead to reduced validation coverage in other testing environments. If this test is crucial for maintaining the integrity of XML files, it should ideally run in all relevant contexts. Consider if the test can be made more robust or efficient to run universally, or if there's a specific reason it's problematic outside of packit.

If the test is consistently failing or causing issues, it might be better to address the root cause rather than conditionally disabling it, as this could mask potential problems in other CI pipelines or local development environments.

Copy link
Member Author

Choose a reason for hiding this comment

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

Testing upstream suffices for now. I will need to change some of the propose-downstream Packit job setup if we want to fetch the entire upstream source tree for downstream tests. Ignoring this for now.

@packit-as-a-service
Copy link

Ephemeral COPR build failed. @containers/packit-build please check.

@lsm5 lsm5 changed the title Confined user fixes Confined user fixes and bump to v2.247.0 Feb 26, 2026
@lsm5 lsm5 marked this pull request as ready for review February 26, 2026 12:46
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@lsm5
Copy link
Member Author

lsm5 commented Feb 26, 2026

@containers/container-selinux-maintainers PTAL.

@rhatdan
Copy link
Member

rhatdan commented Feb 26, 2026

The issue here is transitioning from a user_r to a system_r and a user_t to a container_runtime_t, are pretty liberal changes. container_runtime_t is a unconfined domain, and system_r are roles usually assigned to a more powerful confined users.

@lsm5 lsm5 marked this pull request as draft February 27, 2026 11:04
@lsm5
Copy link
Member Author

lsm5 commented Feb 27, 2026

The issue here is transitioning from a user_r to a system_r and a user_t to a container_runtime_t, are pretty liberal changes. container_runtime_t is a unconfined domain, and system_r are roles usually assigned to a more powerful confined users.

@rhatdan ack, thanks. Would wrapping this behind a new boolean be acceptable?

@rhatdan
Copy link
Member

rhatdan commented Feb 27, 2026

Sure confined_user_run_containers or something.

@lsm5 lsm5 force-pushed the confined-user-fixes branch from e78377b to 48e89ba Compare February 27, 2026 12:17
@lsm5
Copy link
Member Author

lsm5 commented Feb 27, 2026

/packit rebuild-failed
/packit retest-failed

@lsm5
Copy link
Member Author

lsm5 commented Feb 27, 2026

COPR infra is down. Will retry in a bit.

@lsm5 lsm5 marked this pull request as ready for review February 27, 2026 13:00
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@lsm5
Copy link
Member Author

lsm5 commented Feb 27, 2026

@rhatdan PTAL. Ignore the CI issues for now.

container.te Outdated
# Allow confined user systemd instances to create and manage sockets
# for podman.socket activation (user-level systemd pre-labels the
# socket as container_runtime_t via setsockcreatecon)
allow staff_t container_runtime_t:unix_stream_socket { create bind listen getattr setattr setopt shutdown };
Copy link
Member

Choose a reason for hiding this comment

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

That's maybe stupid question, but do we really need setattr and shutdown?

Copy link
Member Author

Choose a reason for hiding this comment

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

@jankaluza ack. I can try without those.

@rhatdan btw, I see many occurrences of the create_stream_socket_perms macro which includes a bunch of perms. Are we ok to use it or should we consider fine-tuning / perhaps creating a separate macro?

@lsm5 lsm5 marked this pull request as draft February 27, 2026 14:23
@lsm5 lsm5 force-pushed the confined-user-fixes branch from 48e89ba to f908d02 Compare February 27, 2026 14:23
@lsm5
Copy link
Member Author

lsm5 commented Feb 27, 2026

Please hold off on further reviews for now. I need to test this further.

@lsm5 lsm5 force-pushed the confined-user-fixes branch from f908d02 to f1ee8d5 Compare March 5, 2026 11:20
@packit-as-a-service
Copy link

Tests failed. @containers/packit-build please check.

@lsm5 lsm5 force-pushed the confined-user-fixes branch 2 times, most recently from eeac906 to adfe197 Compare March 9, 2026 10:02
@lsm5 lsm5 marked this pull request as ready for review March 9, 2026 10:19
Copy link

@sourcery-ai sourcery-ai bot left a comment

Choose a reason for hiding this comment

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

Hey - I've reviewed your changes and they look great!


Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@lsm5
Copy link
Member Author

lsm5 commented Mar 9, 2026

@containers/container-selinux-maintainers PTAL, good for another look. The eln-aarch64 test fails on not finding bats rpm but eln-x86_64 does not. I've notified the compose maintainers already, need to check on that again, but we can ignore that failure for now.

@lsm5
Copy link
Member Author

lsm5 commented Mar 10, 2026

@rhatdan @haircommander @jankaluza PTAL

lsm5 added 4 commits March 11, 2026 18:56
When confined users run "systemctl --user start podman.socket", their
user-level systemd instance needs to create a unix stream socket
pre-labeled as container_runtime_t (via setsockcreatecon). No policy
rule existed to permit this, causing an AVC denial on the socket
create syscall.

Grant staff_t and user_t the necessary unix_stream_socket permissions
on container_runtime_t so that systemd socket activation of podman
works for both confined user types.

Fixes the following AVCs:

staff_t:
```
type=PROCTITLE msg=audit(1764134806.202:243): proctitle="(systemd)"
type=SYSCALL msg=audit(1764134806.202:243): arch=c000003e syscall=41 success=no exit=-13
a0=1 a1=80801 a2=0 a3=0 items=0 ppid=1 pid=943 auid=1000 uid=1000 gid=1000 euid=1000
suid=1000 fsuid=1000 egid=1000 sgid=1000 fsgid=1000 tty=(none) ses=1
comm="systemd" exe="/usr/lib/systemd/systemd" subj=staff_u:staff_r:staff_t:s0-s0:c0.c1023 key=(null)
type=AVC msg=audit(1764134806.202:243): avc: denied
{ create } for pid=943 comm="systemd" scontext=staff_u:staff_r:staff_t:s0-s0:c0.c1023
tcontext=staff_u:staff_r:container_runtime_t:s0-s0:c0.c1023 tclass=unix_stream_socket permissive=0
```

user_t:
```
type=PROCTITLE msg=audit(1772104645.324:301): proctitle="(systemd)"
type=SYSCALL msg=audit(1772104645.324:301): arch=c000003e syscall=41 success=no exit=-13
a0=1 a1=80801 a2=0 a3=0 items=0 ppid=1 pid=1649 auid=1001 uid=1001 gid=1001 euid=1001
suid=1001 fsuid=1001 egid=1001 sgid=1001 fsgid=1001 tty=(none) ses=11
comm="systemd" exe="/usr/lib/systemd/systemd" subj=user_u:user_r:user_t:s0 key=(null)
type=AVC msg=audit(1772104645.324:301): avc:  denied
{ create } for  pid=1649 comm="systemd" scontext=user_u:user_r:user_t:s0
tcontext=user_u:user_r:container_runtime_t:s0 tclass=unix_stream_socket permissive=0
```

Fixes: RHEL-132875, RHEL-135340

Signed-off-by: Lokesh Mandvekar <[email protected]>
Add unprivuser_role_change_to(system_r) so user_r can transition to
system_r for container processes. Replace container_runtime_run(user_t,
user_r) with its RBAC components (role statements) kept unconditional
and move container_runtime_domtrans(user_t) plus signal_perms into a
new tunable_policy block gated by user_t_run_containers (default: off).

RBAC rules cannot be placed inside tunable_policy blocks, so the role
statements and unprivuser_role_change_to(system_r) remain unconditional.
The domain transition from user_t to container_runtime_t is only
permitted when the boolean is enabled.

Fixes the following error and AVC:
```
$ id -Z
user_u:user_r:user_t:s0
$ podman run --rm -it ubi9
exec /bin/bash: permission denied

type=PROCTITLE msg=audit(1772104167.258:882):
proctitle=2F7573722F62696E2F72756E6300696E6974
type=SYSCALL msg=audit(1772104167.258:882): arch=c000003e syscall=59 success=no
exit=-13 a0=c0002d1ae0 a1=c00002d5e0 a2=c0002153b0 a3=0 items=0 ppid=7581 pid=7593
auid=1001 uid=1001 gid=1001 euid=1001 suid=1001 fsuid=1001 egid=1001 sgid=1001
fsgid=1001 tty=pts0 ses=16 comm="runc:[2:INIT]" exe="/runc"
subj=user_u:user_r:container_runtime_t:s0 key=(null)
type=AVC msg=audit(1772104167.258:882): avc:  denied  { transition } for
pid=7593 comm="runc:[2:INIT]" path="/usr/bin/bash" dev="overlay" ino=411042085
scontext=user_u:user_r:container_runtime_t:s0
tcontext=system_u:system_r:container_t:s0:c273,c965 tclass=process permissive=0
```

Fixes: RHEL-135342

Signed-off-by: Lokesh Mandvekar <[email protected]>
The xmllint test requires container-selinux source cloned which is
currently only done in upstream CI environments. Disable it by
default and enable it only when the initiator is packit.

Signed-off-by: Lokesh Mandvekar <[email protected]>
Signed-off-by: Lokesh Mandvekar <[email protected]>
@lsm5 lsm5 force-pushed the confined-user-fixes branch from adfe197 to 9c8eb84 Compare March 11, 2026 13:26
@lsm5
Copy link
Member Author

lsm5 commented Mar 11, 2026

rebased on the latest from main. No changes.

@haircommander haircommander merged commit f336064 into containers:main Mar 13, 2026
31 checks passed
@lsm5 lsm5 deleted the confined-user-fixes branch March 13, 2026 14:00
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