Skip to content

Commit

Permalink
Merge pull request #398 from crosbymichael/seccomp-trace
Browse files Browse the repository at this point in the history
Add seccomp trace support
  • Loading branch information
LK4D4 committed Nov 13, 2015
2 parents bda4ca2 + caca840 commit 48fdc50
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
5 changes: 3 additions & 2 deletions libcontainer/configs/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,18 @@ type Seccomp struct {
type Action int

const (
Kill Action = iota - 4
Kill Action = iota + 1
Errno
Trap
Allow
Trace
)

// A comparison operator to be used when matching syscall arguments in Seccomp
type Operator int

const (
EqualTo Operator = iota
EqualTo Operator = iota + 1
NotEqualTo
GreaterThan
GreaterThanOrEqualTo
Expand Down
1 change: 1 addition & 0 deletions libcontainer/seccomp/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ var actions = map[string]configs.Action{
"SCMP_ACT_ERRNO": configs.Errno,
"SCMP_ACT_TRAP": configs.Trap,
"SCMP_ACT_ALLOW": configs.Allow,
"SCMP_ACT_TRACE": configs.Trace,
}

var archs = map[string]string{
Expand Down
3 changes: 3 additions & 0 deletions libcontainer/seccomp/seccomp_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ var (
actAllow = libseccomp.ActAllow
actTrap = libseccomp.ActTrap
actKill = libseccomp.ActKill
actTrace = libseccomp.ActTrace.SetReturnCode(int16(syscall.EPERM))
actErrno = libseccomp.ActErrno.SetReturnCode(int16(syscall.EPERM))
)

Expand Down Expand Up @@ -83,6 +84,8 @@ func getAction(act configs.Action) (libseccomp.ScmpAction, error) {
return actTrap, nil
case configs.Allow:
return actAllow, nil
case configs.Trace:
return actTrace, nil
default:
return libseccomp.ActInvalid, fmt.Errorf("invalid action, cannot use in rule")
}
Expand Down

0 comments on commit 48fdc50

Please sign in to comment.