Skip to content

Commit 43e4633

Browse files
author
Mrunal Patel
authored
Merge pull request #1087 from giuseppe/default-errno-ret
seccomp: allow to override default errno return code
2 parents d7a6d08 + f7ef278 commit 43e4633

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

config-linux.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -594,6 +594,10 @@ The actions, architectures, and operators are strings that match the definitions
594594
The following parameters can be specified to set up seccomp:
595595

596596
* **`defaultAction`** *(string, REQUIRED)* - the default action for seccomp. Allowed values are the same as `syscalls[].action`.
597+
* **`defaultErrnoRet`** *(uint, OPTIONAL)* - the errno return code to use.
598+
Some actions like `SCMP_ACT_ERRNO` and `SCMP_ACT_TRACE` allow to specify the errno code to return.
599+
When the action doesn't support an errno, the runtime MUST print and error and fail.
600+
If not specified then its default value is `EPERM`.
597601
* **`architectures`** *(array of strings, OPTIONAL)* - the architecture used for system calls.
598602
A valid list of constants as of libseccomp v2.5.0 is shown below.
599603

@@ -645,8 +649,9 @@ The following parameters can be specified to set up seccomp:
645649
* `SCMP_ACT_LOG`
646650

647651
* **`errnoRet`** *(uint, OPTIONAL)* - the errno return code to use.
648-
Some actions like `SCMP_ACT_ERRNO` and `SCMP_ACT_TRACE` allow to specify the errno
649-
code to return. If not specified its default value is `EPERM`.
652+
Some actions like `SCMP_ACT_ERRNO` and `SCMP_ACT_TRACE` allow to specify the errno code to return.
653+
When the action doesn't support an errno, the runtime MUST print and error and fail.
654+
If not specified its default value is `EPERM`.
650655

651656
* **`args`** *(array of objects, OPTIONAL)* - the specific syscall in seccomp.
652657
Each entry has the following structure:

schema/config-linux.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,9 @@
203203
"defaultAction": {
204204
"$ref": "defs-linux.json#/definitions/SeccompAction"
205205
},
206+
"defaultErrnoRet": {
207+
"$ref": "defs.json#/definitions/uint32"
208+
},
206209
"flags": {
207210
"type": "array",
208211
"items": {

specs-go/config.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,10 +598,11 @@ type VMImage struct {
598598

599599
// LinuxSeccomp represents syscall restrictions
600600
type LinuxSeccomp struct {
601-
DefaultAction LinuxSeccompAction `json:"defaultAction"`
602-
Architectures []Arch `json:"architectures,omitempty"`
603-
Flags []LinuxSeccompFlag `json:"flags,omitempty"`
604-
Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
601+
DefaultAction LinuxSeccompAction `json:"defaultAction"`
602+
DefaultErrnoRet *uint `json:"defaultErrnoRet,omitempty"`
603+
Architectures []Arch `json:"architectures,omitempty"`
604+
Flags []LinuxSeccompFlag `json:"flags,omitempty"`
605+
Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
605606
}
606607

607608
// Arch used for additional architectures

0 commit comments

Comments
 (0)