-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Nil pointer dereference on FreeBSD if pf is not enabled #16333
Comments
A friendly reminder that this issue had no activity for 30 days. |
Hi @dfr , I think following patch should fix this, but I don't have a diff --git a/libpod/container_internal_freebsd.go b/libpod/container_internal_freebsd.go
index 32e1f1a8d..1c5a90b19 100644
--- a/libpod/container_internal_freebsd.go
+++ b/libpod/container_internal_freebsd.go
@@ -164,10 +164,10 @@ func (c *Container) reloadNetwork() error {
// Add an existing container's network jail
func (c *Container) addNetworkContainer(g *generate.Generator, ctr string) error {
nsCtr, err := c.runtime.state.Container(ctr)
- c.runtime.state.UpdateContainer(nsCtr)
if err != nil {
return fmt.Errorf("retrieving dependency %s of container %s from state: %w", ctr, c.ID(), err)
}
+ c.runtime.state.UpdateContainer(nsCtr)
g.AddAnnotation("org.freebsd.parentJail", nsCtr.state.NetNS.Name)
return nil
} |
I had forgotten I created this issue - I think I orginally wanted to assign it to myself as a reminder but couldn't figure out how, possible because I'm not a member of containers. I think this was fixed in #16554 - testing against a recent podman build gives this:
Testing with a build just prior to the merge of #16554 reproduces the original issue but unfortunately your change doesn't help - the nil pointer dereference is in the statement calling g.AddAnnotation. I like your suggestion though - it makes sense to propagate the error immediately. I'll make a PR with that and add a check for nsCtr.state.NetNS being non-nil. |
…fails This addresses containers#16333 although that issue was also avoided by changes in PR containers#16554. [NO NEW TESTS NEEDED] Signed-off-by: Doug Rabson <[email protected]>
Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)
/kind bug
Description
Attempting to run a container on a FreeBSD host where the pf kernel module is not loaded causes a nil pointer reference. The CNI setup fails with an appropriate error but later podman segfaults in (*Container).addNetworkNamespace. Looks like some error handling is missing, either in networking_freebsd.go or container_internal_freebsd.go
Steps to reproduce the issue:
service pf stop && kldunload pf
podman run quay.io/dougrabson/hello
Describe the results you received:
Segfault as decribed above
Describe the results you expected:
Podman should report the error
Additional information you deem important (e.g. issue happens only occasionally):
Only affects FreeBSD
The text was updated successfully, but these errors were encountered: