Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

validate: add hard and soft limit check for rlimit #223

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

f175fae looks fine to me vs. the current spec.

I'd rather not refer to array entries by a property of their value (resource Type). I've filed opencontainers/runtime-spec#583, and if/when that lands referencing a particular entry by the resource will be more justified. If the runtime-spec PR is rejected, I can file a follow-up PR here so we report errors by index. Either way, I'm fine with this PR landing as it stands now, since checking with some ambiguity around the error message is better than no checking at all ;).

}
}

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