Skip to content

Conversation

@openshift-cherrypick-robot
Copy link
Collaborator

This is an automated cherry-pick of #27604

/assign Luap99

Fixed a possible nil deref during podman system migrate.
Improved the reliability  of the podman rootless userns creating when conmon and the pause process where killed unexpectedly.

There is no good reason to use logrus and os.Exit() here, other parts of
this function already return the error so do the same. The main podman
process will exit then with the normal formatted error message.

And also log an error about the last return which should never happen as
we should have exited above if the re-exec worked or errored out.

Signed-off-by: Paul Holzinger <[email protected]>
Based on the description in commit 63ef557 this was added so that the
migrate command does not move the pause process into a separate cgroup.

It should however not disable the rejoining of the userns when the pause
process join failed. BEcause of this we end up calling migrate without a
userns and that then can fail if there are actual contianer it tries to
cleanup.

Fixes: 63ef557 ("command: migrate doesn't move process to cgroup")

Signed-off-by: Paul Holzinger <[email protected]>
Just a minor improvement as we know the size needed for the slice we can
allocate it only once instead of the append having to resize it.

Signed-off-by: Paul Holzinger <[email protected]>
When trying to join the conmon pid to recreate the pause process based
on the namespace it can be that the pid is no longer valid, i.e. when
conmon crashed or was killed.

Currently we have a big issue that can be reproduced using:
$ podman run -d quay.io/libpod/testimage:20241011 sleep 100
$ killall -9 conmon
$ killall catatonit

All commands would fail as we keep trying to rejoin the namespace of the
non existing conmon process.

So to address that fall back to creating a new namespace if we fail to
join the conmon pids.

Signed-off-by: Paul Holzinger <[email protected]>
There doesn't seem any reason why the system commands should not join
the userns. In particular the main commands use ParentNSRequired and
UnshareNSRequired when they don't want to be joined to the main userns.
Since the system command don't set these the go code does the join and
re-exec anyway so might as well use the shortcut to speed that up.

Signed-off-by: Paul Holzinger <[email protected]>
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Nov 26, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: openshift-cherrypick-robot
Once this PR has been reviewed and has the lgtm label, please ask for approval from luap99. For more information see the Code Review Process.

The full list of commands accepted by this bot can be found here.

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants