Skip to content
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

Return error in podman system service if URI scheme is not unix/tcp #16070

Merged

Conversation

boaz0
Copy link
Collaborator

@boaz0 boaz0 commented Oct 6, 2022

If tcp or unix are missing from the URI podman panics:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0x13fe9a1]

goroutine 1 [running]:
github.com/containers/podman/v4/pkg/api/server.newServer(0xc000296540, {0x0, 0x0}, {{0x0, 0x0}, {0x0, 0x0}, 0x0, {0x7ffca77de322, 0xe}})
	/home/b0/go/src/github.com/boaz0/podman/pkg/api/server/server.go:65 +0x41
github.com/containers/podman/v4/pkg/api/server.NewServerWithSettings(...)
	/home/b0/go/src/github.com/boaz0/podman/pkg/api/server/server.go:61
github.com/containers/podman/v4/cmd/podman/system.restService(0x7ffca77de322?, 0xe?, {{0x0, 0x0}, {0x0, 0x0}, 0x0, {0x7ffca77de322, 0xe}})
	/home/b0/go/src/github.com/boaz0/podman/cmd/podman/system/service_abi.go:115 +0x865
github.com/containers/podman/v4/cmd/podman/system.service(0x2410ee0?, {0xc0002c48a0?, 0x1?, 0x3?})
	/home/b0/go/src/github.com/boaz0/podman/cmd/podman/system/service.go:103 +0x26a
github.com/spf13/cobra.(*Command).execute(0x2410ee0, {0xc0001a6150, 0x3, 0x3})
	/home/b0/go/src/github.com/boaz0/podman/vendor/github.com/spf13/cobra/command.go:872 +0x694
github.com/spf13/cobra.(*Command).ExecuteC(0x2414fe0)
	/home/b0/go/src/github.com/boaz0/podman/vendor/github.com/spf13/cobra/command.go:990 +0x3bd
github.com/spf13/cobra.(*Command).Execute(...)
	/home/b0/go/src/github.com/boaz0/podman/vendor/github.com/spf13/cobra/command.go:918
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/home/b0/go/src/github.com/boaz0/podman/vendor/github.com/spf13/cobra/command.go:911
main.Execute()
	/home/b0/go/src/github.com/boaz0/podman/cmd/podman/root.go:105 +0xc5
main.main()
	/home/b0/go/src/github.com/boaz0/podman/cmd/podman/main.go:40 +0x7c

The reason for that is because if the schema is not unix or tcp the listener is nil and at server/server.go:65 listener.Addr() is being called but listener is nil

Does this PR introduce a user-facing change?

None

Copy link
Member

@edsantiago edsantiago left a comment

Choose a reason for hiding this comment

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

LGTM but I'm wondering how many (if any) cases there are where this has somehow been working, and will now error out.

@boaz0
Copy link
Collaborator Author

boaz0 commented Oct 6, 2022

@edsantiago - that's what I thought too but I couldn't find any explanation/use-cases where other scheme/protocols are used. Would like to come up with a better solution, though.

@mheon
Copy link
Member

mheon commented Oct 6, 2022

Hm. I think this is OK, but someone more familiar with remote should take a look. @baude PTAL

@Luap99
Copy link
Member

Luap99 commented Oct 6, 2022

This never worked since the listener var would be nil in this case -> therefore no socket/server

@edsantiago
Copy link
Member

Tests green, LGTM.

Copy link
Member

@Luap99 Luap99 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 6, 2022
@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 6, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: boaz0, Luap99

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

The pull request process is described 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

@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 6, 2022
@openshift-merge-robot openshift-merge-robot merged commit eb85012 into containers:main Oct 6, 2022
@boaz0 boaz0 deleted the fix_system_service_uri branch October 6, 2022 17:35
@github-actions github-actions bot added the locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. label Sep 20, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments. release-note-none
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants