Skip to content

Commit f7ef278

Browse files
committed
seccomp: allow to override default errno return code
the specs already support overriding the errno code for the syscalls but the default value is hardcoded to EPERM. Add a new attribute to override the default value. Signed-off-by: Giuseppe Scrivano <[email protected]>
1 parent ec964df commit f7ef278

File tree

3 files changed

+12
-4
lines changed

3 files changed

+12
-4
lines changed

config-linux.md

Lines changed: 4 additions & 0 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

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)