-
Notifications
You must be signed in to change notification settings - Fork 125
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
panic in systemd-nspawn container #144
Comments
Hey 👋 thanks for reporting this Are you able to reproduce this issue outside of the container? What's the container image that's being used? |
I am not.
The reporter in the Telegraf issue reported using Ubuntu 20.04. I am not sure if that is the host, the container, or both. @thomasmyn? I reproduced using an arch container running on arch. |
Both, Security Updates from September 13, 2022 |
This also happens when running in a freebsd jail, but not when running on freebsd outside a jail. I can reproduce it using the example above. Freebsd 13.1-RELEASE-p3 |
Cloning the repo and running go test also fails in a freebsd jail but not outside it
|
I found a solution for freebsd jail - you need to add allow.mlock to the jail when starting it. I imagine its something similar for docker containers on linux - possibly adding IPC_LOCK capability to the container when starting it - see https://medium.com/@thejasongerard/resource-limits-mlock-and-containers-oh-my-cca1e5d1f259 |
I use systemd-nspawn containers to build software packages. I ran into this exact issue while building telegraf. I was able to solve the issue by adding |
Adding the It might be useful to document the requirement of the capability on Linux systems. I'm not sure how this would apply to BSDs or other UNIX systems. I don't believe anything is required on the Windows end. I could be wrong though. |
@eljef |
Hi @awnumar, Sounds like the folks above discovered the necessary change in a nspawn. In terms of errors, is checking for this capability, versus causing a panic, something you would consider changing? Thanks! |
I'm unsure of the preferred implementation, but it does appear that there is a native capabilities package for Golang that exposes the capabilities for a process and allows for checking if https://pkg.go.dev/kernel.org/pub/linux/libs/security/libcap/cap#GetProc
|
I also get this panic when trying to debug my process. It runs fine with |
@firelizzard18 for Delve specifically it looks like the issue was resolved @powersj looks like an interesting approach, but it's probably not portable between platforms. |
Describe the bug
Importing
github.com/awnumar/memguard
causes a panic when run in a systemd-nspawn container.To Reproduce
go.mod:
main.go:
Run:
Expected behaviour
The command should complete with no panic.
Screenshots
System (please complete the following information):
Additional context
We recently started using this project in telegraf in our new secret store implementation. A user reported this issue in influxdata/telegraf#12403 and I was able to reproduce it outside of telegraf with the above steps.
The text was updated successfully, but these errors were encountered: