Skip to content

Fix nil deref in exec command#11487

Merged
copybara-service[bot] merged 1 commit intogoogle:masterfrom
stepancheg:nil-cap
May 13, 2025
Merged

Fix nil deref in exec command#11487
copybara-service[bot] merged 1 commit intogoogle:masterfrom
stepancheg:nil-cap

Conversation

@stepancheg
Copy link
Contributor

$ ./runsc -root runsc-test/var exec k20663363928921 /toybox

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

goroutine 1 [running]:
gvisor.dev/gvisor/runsc/cmd.capabilities(0xc00016b9c8?, {0x0?, 0xc0000b8910?, 0xc00016baf0?}, 0x0)
	runsc/cmd/exec.go:452 +0x31
gvisor.dev/gvisor/runsc/cmd.(*Exec).argsFromCLI(0xc0000d9ba0, 0xc000172870, {0xc0000b61d0, 0x1, 0x1}, 0x0)
	runsc/cmd/exec.go:348 +0x2ce
gvisor.dev/gvisor/runsc/cmd.(*Exec).parseArgs(0x0?, 0x7ffe493e5e6d?, 0xe?, 0xe7?)
	runsc/cmd/exec.go:324 +0x78
gvisor.dev/gvisor/runsc/cmd.(*Exec).Execute(0xc0000d9ba0, {0xc0000b61c0?, 0x114a5c0?}, 0xc00017e620, {0xc0000b4400?, 0x5b6689?, 0x0?})
	runsc/cmd/exec.go:129 +0x1d9
github.com/google/subcommands.(*Commander).Execute(0xc0000fa000, {0x15bcb00, 0x35f2be0}, {0xc0000b4400, 0x2, 0x2})
	external/com_github_google_subcommands/subcommands.go:200 +0x335
github.com/google/subcommands.Execute(...)
	external/com_github_google_subcommands/subcommands.go:481
gvisor.dev/gvisor/runsc/cli.Main()
	runsc/cli/main.go:216 +0x1457
main.main()
	runsc/main.go:31 +0xf
$ /root/.cache/bazel/_bazel_root/71036fa54589963eb2b971859a78cb62/execroot/__main__/bazel-out/k8-opt/bin/runsc/runsc_/runsc -root runsc-test/var exec k20663363928921 /toybox
[ acpi arch ascii ...

@stepancheg
Copy link
Contributor Author

Hello there.

I accidentally created identical PR, with identical code and identical branch name.

copybara-service bot pushed a commit that referenced this pull request May 13, 2025
```
$ ./runsc -root runsc-test/var exec k20663363928921 /toybox

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

goroutine 1 [running]:
gvisor.dev/gvisor/runsc/cmd.capabilities(0xc00016b9c8?, {0x0?, 0xc0000b8910?, 0xc00016baf0?}, 0x0)
	runsc/cmd/exec.go:452 +0x31
gvisor.dev/gvisor/runsc/cmd.(*Exec).argsFromCLI(0xc0000d9ba0, 0xc000172870, {0xc0000b61d0, 0x1, 0x1}, 0x0)
	runsc/cmd/exec.go:348 +0x2ce
gvisor.dev/gvisor/runsc/cmd.(*Exec).parseArgs(0x0?, 0x7ffe493e5e6d?, 0xe?, 0xe7?)
	runsc/cmd/exec.go:324 +0x78
gvisor.dev/gvisor/runsc/cmd.(*Exec).Execute(0xc0000d9ba0, {0xc0000b61c0?, 0x114a5c0?}, 0xc00017e620, {0xc0000b4400?, 0x5b6689?, 0x0?})
	runsc/cmd/exec.go:129 +0x1d9
github.com/google/subcommands.(*Commander).Execute(0xc0000fa000, {0x15bcb00, 0x35f2be0}, {0xc0000b4400, 0x2, 0x2})
	external/com_github_google_subcommands/subcommands.go:200 +0x335
github.com/google/subcommands.Execute(...)
	external/com_github_google_subcommands/subcommands.go:481
gvisor.dev/gvisor/runsc/cli.Main()
	runsc/cli/main.go:216 +0x1457
main.main()
	runsc/main.go:31 +0xf
```

```
$ /root/.cache/bazel/_bazel_root/71036fa54589963eb2b971859a78cb62/execroot/__main__/bazel-out/k8-opt/bin/runsc/runsc_/runsc -root runsc-test/var exec k20663363928921 /toybox
[ acpi arch ascii ...
```

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11487 from stepancheg:nil-cap 6308502
PiperOrigin-RevId: 758232101
copybara-service bot pushed a commit that referenced this pull request May 13, 2025
```
$ ./runsc -root runsc-test/var exec k20663363928921 /toybox

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

goroutine 1 [running]:
gvisor.dev/gvisor/runsc/cmd.capabilities(0xc00016b9c8?, {0x0?, 0xc0000b8910?, 0xc00016baf0?}, 0x0)
	runsc/cmd/exec.go:452 +0x31
gvisor.dev/gvisor/runsc/cmd.(*Exec).argsFromCLI(0xc0000d9ba0, 0xc000172870, {0xc0000b61d0, 0x1, 0x1}, 0x0)
	runsc/cmd/exec.go:348 +0x2ce
gvisor.dev/gvisor/runsc/cmd.(*Exec).parseArgs(0x0?, 0x7ffe493e5e6d?, 0xe?, 0xe7?)
	runsc/cmd/exec.go:324 +0x78
gvisor.dev/gvisor/runsc/cmd.(*Exec).Execute(0xc0000d9ba0, {0xc0000b61c0?, 0x114a5c0?}, 0xc00017e620, {0xc0000b4400?, 0x5b6689?, 0x0?})
	runsc/cmd/exec.go:129 +0x1d9
github.com/google/subcommands.(*Commander).Execute(0xc0000fa000, {0x15bcb00, 0x35f2be0}, {0xc0000b4400, 0x2, 0x2})
	external/com_github_google_subcommands/subcommands.go:200 +0x335
github.com/google/subcommands.Execute(...)
	external/com_github_google_subcommands/subcommands.go:481
gvisor.dev/gvisor/runsc/cli.Main()
	runsc/cli/main.go:216 +0x1457
main.main()
	runsc/main.go:31 +0xf
```

```
$ /root/.cache/bazel/_bazel_root/71036fa54589963eb2b971859a78cb62/execroot/__main__/bazel-out/k8-opt/bin/runsc/runsc_/runsc -root runsc-test/var exec k20663363928921 /toybox
[ acpi arch ascii ...
```

FUTURE_COPYBARA_INTEGRATE_REVIEW=#11487 from stepancheg:nil-cap 6308502
PiperOrigin-RevId: 758232101
@copybara-service copybara-service bot merged commit 48118e8 into google:master May 13, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants