Skip to content

Commit 3411954

Browse files
Ma Shimiaowking
authored andcommitted
validate: add hard and soft limit check for rlimit
Signed-off-by: Ma Shimiao <mashimiao.fnst@cn.fujitsu.com> Backported to v1.0.0.rc1 from f175fae #223 (cherry-pick applied cleanly). Signed-off-by: W. Trevor King <wking@tremily.us>
1 parent ff838a3 commit 3411954

1 file changed

Lines changed: 3 additions & 0 deletions

File tree

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)