You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
validate: Soften unrecognized rlimit types to SHOULD violations
The spec isn't particuarly clear on this, saying [1]:
* Linux: valid values are defined in the
[`getrlimit(2)`][getrlimit.2] man page, such as `RLIMIT_MSGQUEUE`.
* Solaris: valid values are defined in the
[`getrlimit(3)`][getrlimit.3] man page, such as `RLIMIT_CORE`.
and [2]:
For each entry in `rlimits`, a [`getrlimit(3)`][getrlimit.3] on
`type` MUST succeed.
It doesn't say:
Linux: The value MUST be listed in the getrlimit(2) man page...
and it doesn't require the runtime to support the values listed in the
man page [3,4]. So there are three sets:
* Values listed in the man page
* Values supported by the host kernel
* Values supported by the runtime
And as the spec stands, these sets are only weakly coupled, and any of
them could be a sub- or superset of any other. In practice, I expect
the sets to all coincide, with the kernel occasionally adding or
removing values, and the man page and runtimes trailing along behind.
To address that, this commit weakens the previous hard error to a
SHOULD-level error. The PosixProcRlimitsTypeValueError constant is
new to this commit, because the spec contains neither a MUST nor a
SHOULD for this condition, although I expect a SHOULD-level suggestion
was implied by [1].
Also make CheckRlimits a no-op on Windows, because the spec does not
define process.rlimits for that OS [5].
[1]: https://github.com/opencontainers/runtime-spec/blame/v1.0.0/config.md#L168-L169
[2]: https://github.com/opencontainers/runtime-spec/blame/v1.0.0/config.md#L168-L169
[3]: opencontainers/runtime-spec#813
[4]: https://github.com/opencontainers/runtime-spec/blame/v1.0.0/config.md#L463
[5]: https://github.com/opencontainers/runtime-spec/blob/v1.0.0/config.md#posix-process
Signed-off-by: W. Trevor King <[email protected]>
Copy file name to clipboardExpand all lines: specerror/config.go
+3Lines changed: 3 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,8 @@ const (
46
46
PosixProcRlimitsTypeGeneError="The runtime MUST [generate an error](runtime.md#errors) for any values which cannot be mapped to a relevant kernel interface."
47
47
// PosixProcRlimitsTypeGet represents "For each entry in `rlimits`, a [`getrlimit(3)`][getrlimit.3] on `type` MUST succeed."
48
48
PosixProcRlimitsTypeGet="For each entry in `rlimits`, a [`getrlimit(3)`][getrlimit.3] on `type` MUST succeed."
49
+
// PosixProcRlimitsTypeValueError represents "valid values are defined in the ... man page"
50
+
PosixProcRlimitsTypeValueError="valid values are defined in the ... man page"
49
51
// PosixProcRlimitsSoftMatchCur represents "`rlim.rlim_cur` MUST match the configured value."
50
52
PosixProcRlimitsSoftMatchCur="`rlim.rlim_cur` MUST match the configured value."
51
53
// PosixProcRlimitsHardMatchMax represents "`rlim.rlim_max` MUST match the configured value."
errs=multierror.Append(errs, fmt.Errorf("rlimit type %q is invalid", rlimit.Type))
877
+
errs=multierror.Append(errs, specerror.NewError(specerror.PosixProcRlimitsTypeValueError, fmt.Errorf("rlimit type %q may not be valid", rlimit.Type), v.spec.Version))
874
878
} elseifv.platform=="solaris" {
875
879
for_, val:=rangeposixRlimits {
876
880
ifval==rlimit.Type {
877
881
return
878
882
}
879
883
}
880
-
errs=multierror.Append(errs, fmt.Errorf("rlimit type %q is invalid", rlimit.Type))
884
+
errs=multierror.Append(errs, specerror.NewError(specerror.PosixProcRlimitsTypeValueError, fmt.Errorf("rlimit type %q may not be valid", rlimit.Type), v.spec.Version))
881
885
} else {
882
886
logrus.Warnf("process.rlimits validation not yet implemented for platform %q", v.platform)
0 commit comments