Skip to content
This repository has been archived by the owner on Feb 24, 2020. It is now read-only.

Commit

Permalink
Merge pull request #3804 from glevand/for-merge-seccomp
Browse files Browse the repository at this point in the history
rkt_seccomp_test: Fix arm64 stat tests
  • Loading branch information
lucab committed Sep 21, 2017
2 parents 0051bc1 + 22bc4ba commit cee9119
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions tests/rkt_seccomp_test.go
Expand Up @@ -22,13 +22,27 @@ import (
"strings"
"testing"

"github.com/rkt/rkt/common"
"github.com/rkt/rkt/tests/testutils"
)

const (
baseApp = `--exec=/inspect -file-name / -stat-file`
)

// Returns the syscall used by syscall.Stat()
func getStatCall() string {
m := map[string]string{
"default": "stat",
"aarch64": "newfstatat",
}

if v, ok := m[common.GetArch()]; ok {
return v
}
return m["default"]
}

var seccompTestCases = []struct {
name string
aciBuildArgs []string
Expand Down Expand Up @@ -73,7 +87,7 @@ var seccompTestCases = []struct {
},
{
`remove-set blacklist stat with custom error`,
[]string{baseApp, "--seccomp-mode=remove,errno=EXFULL", "--seccomp-set=stat"},
[]string{baseApp, "--seccomp-mode=remove,errno=EXFULL", "--seccomp-set=" + getStatCall()},
nil,
"exchange full",
true,
Expand Down Expand Up @@ -108,35 +122,35 @@ var seccompTestCases = []struct {
},
{
`CLI override whitelist all`,
[]string{baseApp, "--seccomp-mode=remove,errno=EXFULL", "--seccomp-set=stat"},
[]string{baseApp, "--seccomp-mode=remove,errno=EXFULL", "--seccomp-set=" + getStatCall()},
[]string{"--seccomp=mode=retain,@appc.io/all"},
`/: mode: d`,
false,
},
{
`CLI override blacklist stat with custom error`,
[]string{baseApp},
[]string{"--seccomp=mode=remove,errno=EXFULL,stat"},
[]string{"--seccomp=mode=remove,errno=EXFULL," + getStatCall()},
"exchange full",
true,
},
{
`insecure-options fake override: remove-set blacklist stat with custom error`,
[]string{baseApp, "--seccomp-mode=remove,errno=EMULTIHOP", "--seccomp-set=stat"},
[]string{baseApp, "--seccomp-mode=remove,errno=EMULTIHOP", "--seccomp-set=" + getStatCall()},
[]string{"--insecure-options=image,ondisk,capabilities,paths"},
"multihop attempted",
true,
},
{
`insecure-options simple override: remove-set blacklist stat with custom error`,
[]string{baseApp, "--seccomp-mode=remove,errno=EMULTIHOP", "--seccomp-set=stat"},
[]string{baseApp, "--seccomp-mode=remove,errno=EMULTIHOP", "--seccomp-set=" + getStatCall()},
[]string{"--insecure-options=image,seccomp"},
`/: mode: d`,
false,
},
{
`insecure-options complete override: remove-set blacklist stat with custom error`,
[]string{baseApp, "--seccomp-mode=remove,errno=EMULTIHOP", "--seccomp-set=stat"},
[]string{baseApp, "--seccomp-mode=remove,errno=EMULTIHOP", "--seccomp-set=" + getStatCall()},
[]string{"--insecure-options=image,all-run"},
`/: mode: d`,
false,
Expand Down

0 comments on commit cee9119

Please sign in to comment.