Skip to content

Conversation

@dongsupark
Copy link

Fix several nil dereference errors in validation tests for cpu & blkio cgroups, such as:

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

goroutine 1 [running]:
github.com/opencontainers/runtime-tools/validation/util.ValidateLinuxResourcesBlockIO(0xc420264070,
0xc420248a50, 0x5, 0xc42027e540)
        /home/vagrant/go/src/github.com/opencontainers/runtime-tools/validation/util/linux_resources_blkio.go:37 +0x2bb
github.com/opencontainers/runtime-tools/validation/util.RuntimeOutsideValidate(0xc4200102b0, 0x7c1c00, 0x0, 0x0)
        /home/vagrant/go/src/github.com/opencontainers/runtime-tools/validation/util/test.go:279 +0x397
main.testEmptyBlkio(0x0, 0x0)
        /home/vagrant/go/src/github.com/opencontainers/runtime-tools/validation/linux_cgroups_blkio.go:68 +0x19e
main.main()
        /home/vagrant/go/src/github.com/opencontainers/runtime-tools/validation/linux_cgroups_blkio.go:88 +0x8c

Note that this PR fixes only a part of potential nil dereferences in validation tests. It only touches cpu and blkio, which were discovered during testing the PR #637.

/cc @Mashimiao
Signed-off-by: Dongsu Park [email protected]

Fix several nil dereference errors in validation tests for cpu & blkio
cgroups, such as:

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

goroutine 1 [running]:
github.com/opencontainers/runtime-tools/validation/util.ValidateLinuxResourcesBlockIO(0xc420264070,
0xc420248a50, 0x5, 0xc42027e540)
        /home/vagrant/go/src/github.com/opencontainers/runtime-tools/validation/util/linux_resources_blkio.go:37 +0x2bb
github.com/opencontainers/runtime-tools/validation/util.RuntimeOutsideValidate(0xc4200102b0, 0x7c1c00, 0x0, 0x0)
        /home/vagrant/go/src/github.com/opencontainers/runtime-tools/validation/util/test.go:279 +0x397
main.testEmptyBlkio(0x0, 0x0)
        /home/vagrant/go/src/github.com/opencontainers/runtime-tools/validation/linux_cgroups_blkio.go:68 +0x19e
main.main()
        /home/vagrant/go/src/github.com/opencontainers/runtime-tools/validation/linux_cgroups_blkio.go:88 +0x8c
```

Note that this PR fixes only a part of potential nil dereferences in
validation tests. It only touches cpu and blkio, which were discovered
during testing the PR
opencontainers#637.

Signed-off-by: Dongsu Park <[email protected]>
@liangchenye
Copy link
Member

liangchenye commented May 21, 2018

LGTM

Approved with PullApprove

@liangchenye liangchenye merged commit f0f65a4 into opencontainers:master May 21, 2018
@dongsupark dongsupark deleted the dongsu/fix-panic-cgroups branch May 22, 2018 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants