File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -576,6 +576,28 @@ func validateMaskedPaths(spec *rspec.Spec) error {
576576 return nil
577577}
578578
579+ func validateSeccomp (spec * rspec.Spec ) error {
580+ if spec .Linux == nil || spec .Linux .Seccomp == nil {
581+ return nil
582+ }
583+ t := tap .New ()
584+ for _ , sys := range spec .Linux .Seccomp .Syscalls {
585+ if sys .Action == "SCMP_ACT_ERRNO" {
586+ for i , name := range sys .Names {
587+ if name == "getcwd" {
588+ _ , err := os .Getwd ()
589+ if err == nil {
590+ t .Diagnostic ("Syscall action ERRNO can not be properly applied in the runtime" )
591+ }
592+ } else {
593+ t .Skip (i , fmt .Sprintf ("%s syscall returns errno" , name ))
594+ }
595+ }
596+ }
597+ }
598+ return nil
599+ }
600+
579601func validateROPaths (spec * rspec.Spec ) error {
580602 if spec .Linux == nil {
581603 return nil
@@ -864,6 +886,10 @@ func run(context *cli.Context) error {
864886 test : validateOOMScoreAdj ,
865887 description : "oom score adj" ,
866888 },
889+ {
890+ test : validateSeccomp ,
891+ description : "seccomp" ,
892+ },
867893 {
868894 test : validateROPaths ,
869895 description : "read only paths" ,
Original file line number Diff line number Diff line change 1+ package main
2+
3+ import (
4+ "github.com/opencontainers/runtime-tools/generate/seccomp"
5+ "github.com/opencontainers/runtime-tools/validation/util"
6+ )
7+
8+ func main () {
9+ g := util .GetDefaultGenerator ()
10+ syscallArgs := seccomp.SyscallOpts {
11+ Action : "errno" ,
12+ Syscall : "getcwd" ,
13+ }
14+ g .SetDefaultSeccompAction ("allow" )
15+ g .SetSyscallAction (syscallArgs )
16+ err := util .RuntimeInsideValidate (g , nil )
17+ if err != nil {
18+ util .Fatal (err )
19+ }
20+ }
You can’t perform that action at this time.
0 commit comments