File tree 2 files changed +48
-0
lines changed 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 {
576
576
return nil
577
577
}
578
578
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
+
579
603
func validateROPaths (spec * rspec.Spec ) error {
580
604
if spec .Linux == nil {
581
605
return nil
@@ -864,6 +888,10 @@ func run(context *cli.Context) error {
864
888
test : validateOOMScoreAdj ,
865
889
description : "oom score adj" ,
866
890
},
891
+ {
892
+ test : validateSeccomp ,
893
+ description : "seccomp" ,
894
+ },
867
895
{
868
896
test : validateROPaths ,
869
897
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