Skip to content

Commit 652323c

Browse files
committed
improve seccomp format to be more expressive
Signed-off-by: grantseltzer <[email protected]>
1 parent 5398f4e commit 652323c

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
@@ -710,12 +710,17 @@ Here is a full example `config.json` for reference.
710710
"seccomp": {
711711
"defaultAction": "SCMP_ACT_ALLOW",
712712
"architectures": [
713-
"SCMP_ARCH_X86"
713+
"SCMP_ARCH_X86",
714+
"SCMP_ARCH_X32"
714715
],
715716
"syscalls": [
716717
{
717-
"name": "getcwd",
718-
"action": "SCMP_ACT_ERRNO"
718+
"names": [
719+
"getcwd",
720+
"chmod"
721+
],
722+
"action": "SCMP_ACT_ERRNO",
723+
"comment": "stop exploit x"
719724
}
720725
]
721726
},

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
@@ -365,13 +365,6 @@ type LinuxDeviceCgroup struct {
365365
Access string `json:"access,omitempty"`
366366
}
367367

368-
// LinuxSeccomp represents syscall restrictions
369-
type LinuxSeccomp struct {
370-
DefaultAction LinuxSeccompAction `json:"defaultAction"`
371-
Architectures []Arch `json:"architectures"`
372-
Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
373-
}
374-
375368
// Solaris contains platform specific configuration for Solaris application containers.
376369
type Solaris struct {
377370
// SMF FMRI which should go "online" before we start the container process.
@@ -469,6 +462,13 @@ type WindowsNetworkResources struct {
469462
EgressBandwidth *uint64 `json:"egressBandwidth,omitempty"`
470463
}
471464

465+
// LinuxSeccomp represents syscall restrictions
466+
type LinuxSeccomp struct {
467+
DefaultAction LinuxSeccompAction `json:"defaultAction"`
468+
Architectures []Arch `json:"architectures,omitempty"`
469+
Syscalls []LinuxSyscall `json:"syscalls"`
470+
}
471+
472472
// Arch used for additional architectures
473473
type Arch string
474474

@@ -529,7 +529,8 @@ type LinuxSeccompArg struct {
529529

530530
// LinuxSyscall is used to match a syscall in Seccomp
531531
type LinuxSyscall struct {
532-
Name string `json:"name"`
533-
Action LinuxSeccompAction `json:"action"`
534-
Args []LinuxSeccompArg `json:"args,omitempty"`
532+
Names []string `json:"names"`
533+
Action LinuxSeccompAction `json:"action"`
534+
Args []LinuxSeccompArg `json:"args"`
535+
Comment string `json:"comment"`
535536
}

0 commit comments

Comments
 (0)