Fix nil deref in exec command#11487
Merged
copybara-service[bot] merged 1 commit intogoogle:masterfrom May 13, 2025
Merged
Conversation
Contributor
stepancheg
commented
Feb 21, 2025
EtiennePerot
approved these changes
Feb 21, 2025
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.