Skip to content

Commit b3fc8fe

Browse files
author
zhouhao
committed
validate: add the validation of rlimit.type when platform is solaris
Signed-off-by: zhouhao <[email protected]>
1 parent 06bd267 commit b3fc8fe

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

validate/validate.go

+17
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,16 @@ const specConfig = "config.json"
3030

3131
var (
3232
defaultRlimits = []string{
33+
"RLIMIT_AS",
34+
"RLIMIT_CORE",
35+
"RLIMIT_CPU",
36+
"RLIMIT_DATA",
37+
"RLIMIT_FSIZE",
38+
"RLIMIT_NOFILE",
39+
"RLIMIT_STACK",
40+
}
41+
42+
defaultLinuxRlimits = []string{
3343
"RLIMIT_AS",
3444
"RLIMIT_CORE",
3545
"RLIMIT_CPU",
@@ -821,6 +831,13 @@ func (v *Validator) rlimitValid(rlimit rspec.POSIXRlimit) (errs error) {
821831
}
822832

823833
if v.platform == "linux" {
834+
for _, val := range defaultLinuxRlimits {
835+
if val == rlimit.Type {
836+
return
837+
}
838+
}
839+
errs = multierror.Append(errs, fmt.Errorf("rlimit type %q is invalid", rlimit.Type))
840+
} else if v.platform == "solaris" {
824841
for _, val := range defaultRlimits {
825842
if val == rlimit.Type {
826843
return

0 commit comments

Comments
 (0)