Skip to content

linux: fix regressions from PR #2054 performance improvements#2060

Merged
kolyshkin merged 2 commits intocontainers:mainfrom
jnovy:fix-mount-propagation-leak
Mar 24, 2026
Merged

linux: fix regressions from PR #2054 performance improvements#2060
kolyshkin merged 2 commits intocontainers:mainfrom
jnovy:fix-mount-propagation-leak

Conversation

@jnovy
Copy link
Copy Markdown
Contributor

@jnovy jnovy commented Mar 23, 2026

Two fixes for regressions introduced by PR #2054:

Commit 1: Revert 38e1719 (Fixes #2058)
Skipping signal handler reset in the non-prefork paths caused containers to inherit SIG_IGN for SIGPIPE from the Go runtime parent, breaking trap ... SIGPIPE in shells.

Commit 2: Set MS_PRIVATE on detached mounts (Fixes #2059)
Detached mounts from open_tree(OPEN_TREE_CLONE) do not inherit propagation from the parent mount tree, so they keep shared propagation when root_propagation_private skips the MS_PRIVATE call in do_mount(). Set attr.propagation = MS_PRIVATE in get_bind_mount() to prevent mount leaks into the host namespace. Includes a regression test.

Fixes: #2058
Fixes: #2059

@gemini-code-assist
Copy link
Copy Markdown

Summary of Changes

Hello, 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 addresses a potential mount leak vulnerability where detached mounts, specifically those created using open_tree(OPEN_TREE_CLONE), could inadvertently propagate mount events back to the host namespace. By explicitly setting the MS_PRIVATE flag during the creation of these mounts, the change ensures proper isolation and prevents unintended exposure of container mount operations to the host system.

Highlights

  • Mount Propagation: Ensured that detached mounts created by open_tree(OPEN_TREE_CLONE) always have MS_PRIVATE propagation set to prevent mount events from leaking into the host namespace.

🧠 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.

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.

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.

@gemini-code-assist
Copy link
Copy Markdown

Warning

Gemini encountered an error creating the review. You can try again by commenting /gemini review.

@jnovy jnovy force-pushed the fix-mount-propagation-leak branch from 7402d14 to 44ed9fa Compare March 23, 2026 15:48
Copy link
Copy Markdown
Collaborator

@kolyshkin kolyshkin left a comment

Choose a reason for hiding this comment

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

Can we have a test case added?

return ret;

ret = libcrun_container_run_internal (container, context, NULL, false, err);
ret = libcrun_container_run_internal (container, context, NULL, true, err);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It looks like after this change all calls to libcrun_container_run_internal have reset_signal_handlers == true. If that's what you want, then it makes more sense to revert commit 38e1719.

jnovy added 2 commits March 24, 2026 06:34
…n path"

This reverts commit 38e1719.

Skipping signal handler reset in the non-prefork paths caused
containers to inherit SIG_IGN for SIGPIPE from the Go runtime
parent, breaking "trap ... SIGPIPE" in shells.

Fixes: containers#2058
Signed-off-by: Jindrich Novy <jnovy@redhat.com>
Detached mounts from open_tree(OPEN_TREE_CLONE) do not inherit
propagation from the parent mount tree, so they keep shared
propagation when root_propagation_private skips the MS_PRIVATE
call in do_mount().  Set attr.propagation = MS_PRIVATE in
get_bind_mount() to prevent mount leaks into the host namespace.

Add a regression test that verifies bind mounts inside the
container have private propagation.

Fixes: containers#2059
Signed-off-by: Jindrich Novy <jnovy@redhat.com>
@jnovy jnovy force-pushed the fix-mount-propagation-leak branch from 44ed9fa to c4e3fd2 Compare March 24, 2026 05:36
@jnovy jnovy changed the title linux: set MS_PRIVATE on detached mounts from get_bind_mount() linux: fix regressions from PR #2054 performance improvements Mar 24, 2026
@jnovy
Copy link
Copy Markdown
Contributor Author

jnovy commented Mar 24, 2026

@kolyshkin Added test and reverted 38e1719

@lsm5
Copy link
Copy Markdown
Member

lsm5 commented Mar 24, 2026

What do people think of running the entire podman system test suite, maybe just local-root and local-rootless on crun PRs? Need not block this PR. These can be added to the existing testing-farm jobs.

Copy link
Copy Markdown
Member

@giuseppe giuseppe left a comment

Choose a reason for hiding this comment

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

LGTM

@giuseppe
Copy link
Copy Markdown
Member

What do people think of running the entire podman system test suite, maybe just local-root and local-rootless on crun PRs? Need not block this PR. These can be added to the existing testing-farm jobs.

yes, that would be helpful

@giuseppe
Copy link
Copy Markdown
Member

@kolyshkin please merge if you are fine with the last version

@kolyshkin kolyshkin merged commit 26f059a into containers:main Mar 24, 2026
48 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

4 participants