Skip to content

Commit f175fae

Browse files
author
Ma Shimiao
committed
validate: add hard and soft limit check for rlimit
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com>
1 parent 96609ba commit f175fae

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

cmd/oci-runtime-tool/validate.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,9 @@ func checkProcess(spec rspec.Spec, rootfs string, hostCheck bool) (msgs []string
234234
if !rlimitValid(process.Rlimits[index].Type) {
235235
msgs = append(msgs, fmt.Sprintf("rlimit type %q is invalid.", process.Rlimits[index].Type))
236236
}
237+
if process.Rlimits[index].Hard < process.Rlimits[index].Soft {
238+
msgs = append(msgs, fmt.Sprintf("hard limit of rlimit %s should not be less than soft limit.", process.Rlimits[index].Type))
239+
}
237240
}
238241

239242
if len(process.ApparmorProfile) > 0 {

0 commit comments

Comments
 (0)