From f175fae04ac39c69be6f12f900129f06a62898d1 Mon Sep 17 00:00:00 2001 From: Ma Shimiao Date: Tue, 27 Sep 2016 11:15:01 +0800 Subject: [PATCH] validate: add hard and soft limit check for rlimit Signed-off-by: Ma Shimiao --- cmd/oci-runtime-tool/validate.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/oci-runtime-tool/validate.go b/cmd/oci-runtime-tool/validate.go index b99144488..e1f61e213 100644 --- a/cmd/oci-runtime-tool/validate.go +++ b/cmd/oci-runtime-tool/validate.go @@ -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 {