Repository navigation
Conversation
Since commit 499c3eb ("linux: apply the exec process oomScoreAdj"), crun exec writes the process oomScoreAdj to /proc/self/oom_score_adj. Without CAP_SYS_RESOURCE, the kernel refuses with EACCES a value lower than the minimum set by a privileged writer. systemd sets that minimum to 100 for every process under user@.service (OOMScoreAdjust=100). So a rootless "podman exec" from podman.service or from a healthcheck timer fails when Podman asks for 0. On EACCES, keep the inherited value, which is what exec did before 1.31. Other errors still fail the exec. Fixes: containers#2466 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Signed-off-by: Randy Fay <randy@randyfay.com>
Author
|
Reopened after accidental closure via text in DDEV PR. |
|
TMT tests failed. @containers/packit-build please check. |
Author
|
/packit retest-failed |
Member
|
@rfay thanks for the patch but I am not sure it is correct to ignore a setting that was explicitly set. There is already a patch for Podman: podman-container-tools/podman#30243 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2466
Since 499c3eb (#2425),
crun execwrites the processoomScoreAdjto/proc/self/oom_score_adj. WithoutCAP_SYS_RESOURCE, the kernel refuses withEACCESa value below the minimum that a privileged writer set. systemd sets that minimum to 100 underuser@.service(OOMScoreAdjust=100). A rootlesspodman execfrompodman.serviceor a healthcheck timer therefore fails when Podman asks for 0:This change handles
EACCESin the exec path only. crun logs it at debug level and keeps the inherited value, which is what exec did before 1.31. Any other error still fails the exec.Two choices a reviewer may want changed:
libcrun_debugrather thanlibcrun_warning, because healthchecks run exec every few seconds and a warning would repeat on each one.libcrun_set_oomfrominit_container) can fail the same way. I left it alone because that behavior is older than 1.31, and Podman already passes a value it can write there.Testing
New test
exec-oom-score-adj-below-minintests/test_exec.py. As root, it sets the minimum with a privileged write and dropsCAP_SYS_RESOURCEwithsetpriv. Then it execs withoomScoreAdjbelow the minimum and expects the inherited value. It skips when rootless or whensetprivis missing.Fedora 44 privileged container, as root: all 25 tests in
test_exec.pypass. Without thecontainer.cchange, the new test fails with exit status 255.Ubuntu 26.04 arm64, rootless, Homebrew podman 6.2.0, with the reproducer from 1.31: exec fails with "write to /proc/self/oom_score_adj: Permission denied" under a systemd user manager (rootless podman API, healthchecks) #2466:
systemd-run --userexec, container adj 0Permission deniedsystemd-run --userexec, container adj 500Same host, rootless inside
podman unshare: all tests intest_exec.pyandtest_error_handling.pypass or skip.I prepared this with Claude Code (AI-assisted). I reviewed the change and the kernel behavior, and ran the tests above.