File tree Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Expand file tree Collapse file tree 2 files changed +48
-0
lines changed Original file line number Diff line number Diff line change @@ -576,6 +576,30 @@ 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 _ , name := range sys .Names {
587+ if name == "getcwd" {
588+ _ , err := os .Getwd ()
589+ if err == nil {
590+ t .Diagnostic ("getcwd did not return an error" )
591+ }
592+ } else {
593+ t .Skip (1 , fmt .Sprintf ("%s syscall returns errno" , name ))
594+ }
595+ }
596+ } else {
597+ t .Skip (1 , fmt .Sprintf ("syscall action %s" , sys .Action ))
598+ }
599+ }
600+ return nil
601+ }
602+
579603func validateROPaths (spec * rspec.Spec ) error {
580604 if spec .Linux == nil {
581605 return nil
@@ -864,6 +888,10 @@ func run(context *cli.Context) error {
864888 test : validateOOMScoreAdj ,
865889 description : "oom score adj" ,
866890 },
891+ {
892+ test : validateSeccomp ,
893+ description : "seccomp" ,
894+ },
867895 {
868896 test : validateROPaths ,
869897 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