Skip to content

Commit

Permalink
Merge pull request #1087 from giuseppe/default-errno-ret
Browse files Browse the repository at this point in the history
seccomp: allow to override default errno return code
  • Loading branch information
Mrunal Patel committed Mar 3, 2021
2 parents d7a6d08 + f7ef278 commit 43e4633
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 7 additions & 2 deletions config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,6 +594,10 @@ The actions, architectures, and operators are strings that match the definitions
The following parameters can be specified to set up seccomp:

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

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

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

* **`args`** *(array of objects, OPTIONAL)* - the specific syscall in seccomp.
Each entry has the following structure:
Expand Down
3 changes: 3 additions & 0 deletions schema/config-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,9 @@
"defaultAction": {
"$ref": "defs-linux.json#/definitions/SeccompAction"
},
"defaultErrnoRet": {
"$ref": "defs.json#/definitions/uint32"
},
"flags": {
"type": "array",
"items": {
Expand Down
9 changes: 5 additions & 4 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -598,10 +598,11 @@ type VMImage struct {

// LinuxSeccomp represents syscall restrictions
type LinuxSeccomp struct {
DefaultAction LinuxSeccompAction `json:"defaultAction"`
Architectures []Arch `json:"architectures,omitempty"`
Flags []LinuxSeccompFlag `json:"flags,omitempty"`
Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
DefaultAction LinuxSeccompAction `json:"defaultAction"`
DefaultErrnoRet *uint `json:"defaultErrnoRet,omitempty"`
Architectures []Arch `json:"architectures,omitempty"`
Flags []LinuxSeccompFlag `json:"flags,omitempty"`
Syscalls []LinuxSyscall `json:"syscalls,omitempty"`
}

// Arch used for additional architectures
Expand Down

0 comments on commit 43e4633

Please sign in to comment.