@@ -31,6 +31,13 @@ const PR_GET_NO_NEW_PRIVS = 39
3131const specConfig = "config.json"
3232
3333var (
34+ defaultFS = map [string ]string {
35+ "/proc" : "proc" ,
36+ "/sys" : "sysfs" ,
37+ "/dev/pts" : "devpts" ,
38+ "/dev/shm" : "tmpfs" ,
39+ }
40+
3441 defaultSymlinks = map [string ]string {
3542 "/dev/fd" : "/proc/self/fd" ,
3643 "/dev/stdin" : "/proc/self/fd/0" ,
@@ -266,6 +273,28 @@ func validateRootFS(spec *rspec.Spec) error {
266273 return nil
267274}
268275
276+ func validateDefaultFS (spec * rspec.Spec ) error {
277+ logrus .Debugf ("validating linux default filesystem" )
278+
279+ mountInfos , err := mount .GetMounts ()
280+ if err != nil {
281+ return ociErr .NewOCIError (ociErr .DefaultFilesystems , err .Error ())
282+ }
283+
284+ mountsMap := make (map [string ]string )
285+ for _ , mountInfo := range mountInfos {
286+ mountsMap [mountInfo .Mountpoint ] = mountInfo .Fstype
287+ }
288+
289+ for fs , fstype := range defaultFS {
290+ if ! (mountsMap [fs ] == fstype ) {
291+ return ociErr .NewOCIError (ociErr .DefaultFilesystems , fmt .Sprintf ("%v must exist and expected type is %v" , fs , fstype ))
292+ }
293+ }
294+
295+ return nil
296+ }
297+
269298func validateLinuxDevices (spec * rspec.Spec ) error {
270299 logrus .Debugf ("validating linux devices" )
271300
@@ -585,6 +614,10 @@ func validate(context *cli.Context) error {
585614 test : validateDefaultSymlinks ,
586615 description : "default symlinks" ,
587616 },
617+ {
618+ test : validateDefaultFS ,
619+ description : "default file system" ,
620+ },
588621 {
589622 test : validateDefaultDevices ,
590623 description : "default devices" ,
0 commit comments