Skip to content

Commit

Permalink
Merge pull request #76 from Mashimiao/runtime-test-readonly-path-vali…
Browse files Browse the repository at this point in the history
…dation

runtimetest: add readonly path validation
  • Loading branch information
Mrunal Patel committed Jun 2, 2016
2 parents 5e5e247 + 447a73b commit 89907b6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmd/runtimetest/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,17 @@ func validateMaskedPaths(spec *rspec.Spec) error {
return nil
}

func validateROPaths(spec *rspec.Spec) error {
fmt.Println("validating readonlyPaths")
for _, v := range spec.Linux.ReadonlyPaths {
err := testWriteAccess(v)
if err == nil {
return fmt.Errorf("%v should be readonly", v)
}
}
return nil
}

func main() {
spec, err := loadSpecConfig()
if err != nil {
Expand All @@ -247,6 +258,7 @@ func main() {
validateRlimits,
validateSysctls,
validateMaskedPaths,
validateROPaths,
}

for _, v := range validations {
Expand Down

0 comments on commit 89907b6

Please sign in to comment.