Replies: 26 comments 2 replies
-
@vrothberg PTAL, I think this one's in libimage |
Beta Was this translation helpful? Give feedback.
-
Podman prefers the / be mounted -rshared. This could be triggering the issue. |
Beta Was this translation helpful? Give feedback.
-
Is this something I could test? I dont have sudo rights inside the sandbox, so I can't run I did figure out a bit more how to debug the bazel sandbox. By adding --sandbox_debug all the sandbox files will be saved after execution, and --verbose_failures, I get the failing command, including how the sandbox is setup. So to reproduce this panic, I can run
-w makes the folder or file writable from within the sandbox, everything else should still be readable. If I change /run/user/1000 to be mounted as an empty tempfs dir, I no longer get the panic, but instead I get this error (not sure if that is of any use):
If I run
|
Beta Was this translation helpful? Give feedback.
-
It's a Podman-side issue. It seems we're calling the libimage runtime without having initialized it; the nil deref is on the runtime object. I guess @rhatdan is on point. |
Beta Was this translation helpful? Give feedback.
-
@fredr can you paste the contents of |
Beta Was this translation helpful? Give feedback.
-
I should also mention that podman works just fine outside of the sandbox |
Beta Was this translation helpful? Give feedback.
-
Can linux-sandbox be changed to expose / as mount-rshared? BTW What is linux-sandbox? |
Beta Was this translation helpful? Give feedback.
-
In the meantime, I am going to have a look how we can prevent the segfault. Podman should error out or perform other counter measures. |
Beta Was this translation helpful? Give feedback.
-
@fredr do you have a simple reproducer? |
Beta Was this translation helpful? Give feedback.
-
Could you also rerun |
Beta Was this translation helpful? Give feedback.
-
Not in any way that I have been able to figure out unfortunately
it is part of the build tool bazel, https://docs.bazel.build/versions/main/sandboxing.html
Since it relies on bazel, it wont be super simple, but in this gist: https://gist.github.com/fredr/dd0e5c3639fa109df82471292d6bc8c3 If you put BUILD and WORKSPACE in a directory and run:
Here I executed
|
Beta Was this translation helpful? Give feedback.
-
Thanks!
That seems to be it: Podman is not configuring the store if it's lacking the cap_sys_admin capability. In that case, Podman just continues but without the image runtime which explains how we run into the segfault. @mheon @giuseppe I am totally undecided on what to do in this case though. Does a Podman without a configured store make sense? |
Beta Was this translation helpful? Give feedback.
-
The store-deactivation code I'm aware of was intended for performance reasons, to not require commands that would never require a store to initialize one; I think we're talking about different code here, though, because run will always need a store. Is this the code that @rhatdan added so that Podman as root could revert to pseudo-rootless functionality if CAP_SYS_ADMIN was not available? I'm not terribly familiar with it, but the concept seemed to make sense. |
Beta Was this translation helpful? Give feedback.
-
I'm referring to the following code: I managed to build |
Beta Was this translation helpful? Give feedback.
-
One very strange thing is that |
Beta Was this translation helpful? Give feedback.
-
Quick update: what works for me is to use |
Beta Was this translation helpful? Give feedback.
-
Interesting! When I try that I get:
|
Beta Was this translation helpful? Give feedback.
-
Yeah, this is the rootless-when-no-sysadmin code I was talking about - 722ea2f |
Beta Was this translation helpful? Give feedback.
-
we switched from "detect rootless" to "detect if we have CAP_SYS_ADMIN" because running with |
Beta Was this translation helpful? Give feedback.
-
Is there a way to avoid the segfault? Should we check CAP_SYS_ADMIN || CAP_SETUID && CAP_SETGID, because without one of those situations, Podman is not going to work. |
Beta Was this translation helpful? Give feedback.
-
What would happen if the condition is not met? Currently, we just don't configure the store and continue but I think we should error if there is no store. |
Beta Was this translation helpful? Give feedback.
-
when we do not have enough privileges, we re-exec and gain these privileges. We should not get that far in the parent Podman process and re-exec from Does the re-exec fail and Podman somehow keeps going without enough privileges? |
Beta Was this translation helpful? Give feedback.
-
Can it be that the bazel sandbox reports having those capabilities, but it actually doesn't? and that causes the panic? |
Beta Was this translation helpful? Give feedback.
-
I don't think so, these are coming from the kernel and we read them from |
Beta Was this translation helpful? Give feedback.
-
I believe this is a discussion and not an issue with Podman transferring. |
Beta Was this translation helpful? Give feedback.
-
opened a PR to address the segfault: #12931 I am not sure Podman is able to run in the limited environment created by |
Beta Was this translation helpful? Give feedback.
-
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Steps to reproduce the issue:
A gist for setting up and reproducing the error
https://gist.github.com/fredr/dd0e5c3639fa109df82471292d6bc8c3
Download BUILD and WORKSPACE to a folder
In that folder, run:
Describe the results you received:
Describe the results you expected:
I'm guessing something in the setup is wrong, and this should trigger an error message telling me what.
Additional information you deem important (e.g. issue happens only occasionally):
Bazel executes within a sandbox, and it is when executing podman from inside that sandbox that this seems to happen. If I run the generated script that fails from my terminal, it works just fine.
Output of
podman version
:Output of
podman info --debug
:Package info (e.g. output of
rpm -q podman
orapt list podman
):Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide? (https://github.com/containers/podman/blob/master/troubleshooting.md)
Yes
Additional environment details (AWS, VirtualBox, physical, etc.):
/usr/bin/docker is symlinked to /usr/bin/podman
Beta Was this translation helpful? Give feedback.
All reactions