specconv: fix null spec.Process making runc panic#1826
Merged
mrunalp merged 1 commit intoopencontainers:masterfrom Mar 24, 2020
Merged
specconv: fix null spec.Process making runc panic#1826mrunalp merged 1 commit intoopencontainers:masterfrom
mrunalp merged 1 commit intoopencontainers:masterfrom
Conversation
Contributor
Author
|
@dongsupark many thanks for your comments~ #1726 does more checking, but it seems the author quits on the PR. Should we continue on this PR? |
Contributor
What did I quit on? I'm not aware of any outstanding change requests short of this thread, where I'm waiting on maintainer follow-up. |
Contributor
Author
|
@wking sorry for that~ so let's wait for your pr~ |
Member
|
needs rebase |
aad422f to
60473a5
Compare
60473a5 to
30b301b
Compare
Contributor
Author
|
Thanks for remainding~ @AkihiroSuda The part of spec_linux.go is already fix by 16d55f1, but the test in spec_linux_test.go may still has its value. Merge it if you think it is valuable 😄 |
Member
Signed-off-by: l00397676 <lujingxiao@huawei.com>
30b301b to
62cfad9
Compare
Member
Member
|
ping @opencontainers/runc-maintainers |
Contributor
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.
ProcessofSpec structis a pointer:When calling
CreateLibcontainerConfig()withopts.Spec.Process: nil, runc will panic.I added a new test case
TestNullProcessinlibcontainer/specconv, it will failed with:=== RUN TestNullProcess --- FAIL: TestNullProcess (0.00s) panic: runtime error: invalid memory address or nil pointer dereference [recovered] panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0xc8 pc=0x540029] goroutine 20 [running]: testing.tRunner.func1(0xc42007e9c0) /usr/lib/golang/src/testing/testing.go:622 +0x29d panic(0x57c280, 0x861a20) /usr/lib/golang/src/runtime/panic.go:489 +0x2cf github.com/opencontainers/runc/libcontainer/specconv.CreateLibcontainerConfig(0xc42003af70, 0x3, 0xc42007ad00, 0xc42007c040) /home/workspace/src/github.com/opencontainers/runc/libcontainer/specconv/spec_linux.go:244 +0x7b9 github.com/opencontainers/runc/libcontainer/specconv.TestNullProcess(0xc42007e9c0) /home/workspace/src/github.com/opencontainers/runc/libcontainer/specconv/spec_linux_test.go:456 +0xa8 testing.tRunner(0xc42007e9c0, 0x5b9440) /usr/lib/golang/src/testing/testing.go:657 +0x96 created by testing.(*T).Run /usr/lib/golang/src/testing/testing.go:697 +0x2ca FAIL github.com/opencontainers/runc/libcontainer/specconv 0.009sSo I wrote this PR.
Please help to review and share your comments.
Signed-off-by: Jingxiao Lu lujingxiao@huawei.com