Skip to content

Commit

Permalink
runner: allow coredump collection (#931)
Browse files Browse the repository at this point in the history
Fixes #784 

I didn't find a way to set ulimit globally, as our init system doesn't
call `/etc/initscript`

---------

Signed-off-by: Oleg Vasilev <[email protected]>
  • Loading branch information
Omrigan authored May 10, 2024
1 parent 3b08db3 commit 9fbb531
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
7 changes: 5 additions & 2 deletions neonvm/runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -676,11 +676,14 @@ func run(logger *zap.Logger) error {
}

// create iso9660 disk with runtime options (command, args, envs, mounts)
sysctl := []string{}
sysctl := []string{
"kernel.core_pattern=core",
"kernel.core_uses_pid=1",
}
var shmSize *resource.Quantity
var swapInfo *vmv1.SwapInfo
if vmSpec.Guest.Settings != nil {
sysctl = vmSpec.Guest.Settings.Sysctl
sysctl = append(sysctl, vmSpec.Guest.Settings.Sysctl...)
swapInfo, err = vmSpec.Guest.Settings.GetSwapInfo()
if err != nil {
return fmt.Errorf("failed to get SwapInfo from VirtualMachine object: %w", err)
Expand Down
2 changes: 2 additions & 0 deletions neonvm/tools/vm-builder/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,8 @@ func main() {
tmplArgs.ShutdownHook = strings.ReplaceAll(spec.ShutdownHook, "\n", "\n\t")

for _, c := range spec.Commands {
// Allow core dumps for all inittab targets
c.Shell = fmt.Sprintf("ulimit -c unlimited; %s", c.Shell)
tmplArgs.InittabCommands = append(tmplArgs.InittabCommands, inittabCommand{
SysvInitAction: c.SysvInitAction,
CommandUser: c.User,
Expand Down

0 comments on commit 9fbb531

Please sign in to comment.