Skip to content

Commit ae7a541

Browse files
author
Mrunal Patel
authored
Merge pull request opencontainers#657 from GrantSeltzer/improve-seccomp-spec
config: Improve seccomp format to be more expressive
2 parents 3f5078d + 652323c commit ae7a541

File tree

4 files changed

+31
-18
lines changed

4 files changed

+31
-18
lines changed

config-linux.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -538,12 +538,17 @@ Operator Constants:
538538
"seccomp": {
539539
"defaultAction": "SCMP_ACT_ALLOW",
540540
"architectures": [
541-
"SCMP_ARCH_X86"
541+
"SCMP_ARCH_X86",
542+
"SCMP_ARCH_X32"
542543
],
543544
"syscalls": [
544545
{
545-
"name": "getcwd",
546-
"action": "SCMP_ACT_ERRNO"
546+
"names": [
547+
"getcwd",
548+
"chmod"
549+
],
550+
"action": "SCMP_ACT_ERRNO",
551+
"comment": "stop exploit x"
547552
}
548553
]
549554
}

config.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -762,12 +762,17 @@ Here is a full example `config.json` for reference.
762762
"seccomp": {
763763
"defaultAction": "SCMP_ACT_ALLOW",
764764
"architectures": [
765-
"SCMP_ARCH_X86"
765+
"SCMP_ARCH_X86",
766+
"SCMP_ARCH_X32"
766767
],
767768
"syscalls": [
768769
{
769-
"name": "getcwd",
770-
"action": "SCMP_ACT_ERRNO"
770+
"names": [
771+
"getcwd",
772+
"chmod"
773+
],
774+
"action": "SCMP_ACT_ERRNO",
775+
"comment": "stop exploit x"
771776
}
772777
]
773778
},

schema/defs-linux.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,10 @@
6363
"Syscall": {
6464
"type": "object",
6565
"properties": {
66-
"name": {
67-
"type": "string"
66+
"names": {
67+
"type": [
68+
"string"
69+
]
6870
},
6971
"action": {
7072
"$ref": "#/definitions/SeccompAction"

specs-go/config.go

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -380,13 +380,6 @@ type LinuxDeviceCgroup struct {
380380
Access string `json:"access,omitempty"`
381381
}
382382

383-
// LinuxSeccomp represents syscall restrictions
384-
type LinuxSeccomp struct {
385-
DefaultAction LinuxSeccompAction `json:"defaultAction"`
386-
Architectures []Arch `json:"architectures"`
387-
Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
388-
}
389-
390383
// Solaris contains platform specific configuration for Solaris application containers.
391384
type Solaris struct {
392385
// SMF FMRI which should go "online" before we start the container process.
@@ -484,6 +477,13 @@ type WindowsNetworkResources struct {
484477
EgressBandwidth *uint64 `json:"egressBandwidth,omitempty"`
485478
}
486479

480+
// LinuxSeccomp represents syscall restrictions
481+
type LinuxSeccomp struct {
482+
DefaultAction LinuxSeccompAction `json:"defaultAction"`
483+
Architectures []Arch `json:"architectures,omitempty"`
484+
Syscalls []LinuxSyscall `json:"syscalls"`
485+
}
486+
487487
// Arch used for additional architectures
488488
type Arch string
489489

@@ -544,7 +544,8 @@ type LinuxSeccompArg struct {
544544

545545
// LinuxSyscall is used to match a syscall in Seccomp
546546
type LinuxSyscall struct {
547-
Name string `json:"name"`
548-
Action LinuxSeccompAction `json:"action"`
549-
Args []LinuxSeccompArg `json:"args,omitempty"`
547+
Names []string `json:"names"`
548+
Action LinuxSeccompAction `json:"action"`
549+
Args []LinuxSeccompArg `json:"args"`
550+
Comment string `json:"comment"`
550551
}

0 commit comments

Comments
 (0)