Skip to content

Commit

Permalink
validate: add hard and soft limit check for rlimit
Browse files Browse the repository at this point in the history
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>

Backported to v1.0.0.rc1 from f175fae opencontainers#223 (cherry-pick applied
cleanly).

Signed-off-by: W. Trevor King <wking@tremily.us>
  • Loading branch information
Ma Shimiao authored and wking committed Oct 13, 2016
1 parent ff838a3 commit 3411954
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cmd/oci-runtime-tool/validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ func checkProcess(spec rspec.Spec, rootfs string, hostCheck bool) (msgs []string
if !rlimitValid(process.Rlimits[index].Type) {
msgs = append(msgs, fmt.Sprintf("rlimit type %q is invalid.", process.Rlimits[index].Type))
}
if process.Rlimits[index].Hard < process.Rlimits[index].Soft {
msgs = append(msgs, fmt.Sprintf("hard limit of rlimit %s should not be less than soft limit.", process.Rlimits[index].Type))
}
}

if len(process.ApparmorProfile) > 0 {
Expand Down

0 comments on commit 3411954

Please sign in to comment.