File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed
Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change @@ -576,6 +576,25 @@ 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+ for _ , sys := range spec .Linux .Seccomp .Syscalls {
584+ if sys .Action == "SCMP_ACT_ERRON" {
585+ for _ , name := range sys .Names {
586+ if name == "getcwd" {
587+ _ , err := os .Getwd ()
588+ if err == nil {
589+ logrus .Warnf ("Syscall action %v can not be properly applied in the runtime" , sys .Action )
590+ }
591+ }
592+ }
593+ }
594+ }
595+ return nil
596+ }
597+
579598func validateROPaths (spec * rspec.Spec ) error {
580599 if spec .Linux == nil {
581600 return nil
@@ -864,6 +883,10 @@ func run(context *cli.Context) error {
864883 test : validateOOMScoreAdj ,
865884 description : "oom score adj" ,
866885 },
886+ {
887+ test : validateSeccomp ,
888+ description : "seccomp" ,
889+ },
867890 {
868891 test : validateROPaths ,
869892 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