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

segfault when running with memory limit but without swap limit #9429

Closed
afbjorklund opened this issue Feb 18, 2021 · 0 comments · Fixed by #9430
Closed

segfault when running with memory limit but without swap limit #9429

afbjorklund opened this issue Feb 18, 2021 · 0 comments · Fixed by #9430
Assignees
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.

Comments

@afbjorklund
Copy link
Contributor

afbjorklund commented Feb 18, 2021

Is this a BUG REPORT or FEATURE REQUEST? (leave only one on its own line)

/kind bug

Description

Explicitly removing swap limit causes a segmentation fault.

Steps to reproduce the issue:

  1. sudo podman run --memory 256m --memory-swap -1 busybox true

Describe the results you received:

panic: runtime error: invalid memory address or nil pointer dereference

Describe the results you expected:

Additional information you deem important (e.g. issue happens only occasionally):

Output of podman version:

podman version 3.0.0

Output of podman info --debug:

(paste your output here)

Package info (e.g. output of rpm -q podman or apt list podman):

(paste your output here)

Have you tested with the latest version of Podman and have you checked the Podman Troubleshooting Guide?

No

Additional environment details (AWS, VirtualBox, physical, etc.):

Ubuntu 20.04


These are supposed to be equivalent:

$ sudo podman run --memory 256m busybox true
Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap.
$ sudo podman run --memory 256m --memory-swap -1 busybox true
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x15ee61e]

goroutine 1 [running]:
github.com/containers/podman/v2/cmd/podman/common.getMemoryLimits(0xc00034ec00, 0x27d8da0, 0x1b05550, 0x17, 0xc0005bc508)
	cmd/podman/common/specgen.go:153 +0x33e
github.com/containers/podman/v2/cmd/podman/common.FillOutSpecGen(0xc00034ec00, 0x27d8da0, 0xc000139600, 0x4, 0x8, 0x0, 0x18ab660)
	cmd/podman/common/specgen.go:430 +0xda6
github.com/containers/podman/v2/cmd/podman/containers.run(0x2748b80, 0xc000139600, 0x4, 0x8, 0x0, 0x0)
	cmd/podman/containers/run.go:171 +0x46f
github.com/spf13/cobra.(*Command).execute(0x2748b80, 0xc00003c0c0, 0x8, 0x8, 0x2748b80, 0xc00003c0c0)
	vendor/github.com/spf13/cobra/command.go:850 +0x47c
github.com/spf13/cobra.(*Command).ExecuteC(0x275c140, 0xc000044088, 0x18d6c80, 0x280b340)
	vendor/github.com/spf13/cobra/command.go:958 +0x375
github.com/spf13/cobra.(*Command).Execute(...)
	vendor/github.com/spf13/cobra/command.go:895
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	vendor/github.com/spf13/cobra/command.go:888
main.Execute()
	cmd/podman/root.go:92 +0xec
main.main()
	cmd/podman/main.go:36 +0x92

System doesn't have "cgroup_enable=memory swapaccount=1" cmdline

@openshift-ci-robot openshift-ci-robot added the kind/bug Categorizes issue or PR as related to a bug. label Feb 18, 2021
@baude baude self-assigned this Feb 18, 2021
baude added a commit to baude/podman that referenced this issue Feb 19, 2021
when unlimited (-1) was being passed to memory-swap, podman threw a
segfault.

Fixes containers#9429

Signed-off-by: baude <[email protected]>
@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 22, 2023
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Sep 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Categorizes issue or PR as related to a bug. locked - please file new issue/PR Assist humans wanting to comment on an old issue or PR with locked comments.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants