Skip to content

Commit

Permalink
seccomp: allow to override errno return code
Browse files Browse the repository at this point in the history
some seccomp actions allow to specify the errno code returned for the
syscall.

Add a new attribute to the seccomp syscall so the default EPERM can be
overriden.

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
  • Loading branch information
giuseppe committed May 7, 2020
1 parent 2a06026 commit 3bfcde2
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions config-linux.md
Original file line number Diff line number Diff line change
Expand Up @@ -616,6 +616,10 @@ The following parameters can be specified to set up seccomp:
* `SCMP_ACT_ALLOW`
* `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`.

* **`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/defs-linux.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@
"action": {
"$ref": "#/definitions/SeccompAction"
},
"errnoRet": {
"$ref": "defs.json#/definitions/uint32"
},
"args": {
"type": "array",
"items": {
Expand Down
7 changes: 4 additions & 3 deletions specs-go/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,9 +667,10 @@ type LinuxSeccompArg struct {

// LinuxSyscall is used to match a syscall in Seccomp
type LinuxSyscall struct {
Names []string `json:"names"`
Action LinuxSeccompAction `json:"action"`
Args []LinuxSeccompArg `json:"args,omitempty"`
Names []string `json:"names"`
Action LinuxSeccompAction `json:"action"`
ErrnoRet uint `json:"errno"`
Args []LinuxSeccompArg `json:"args,omitempty"`
}

// LinuxIntelRdt has container runtime resource constraints for Intel RDT
Expand Down

0 comments on commit 3bfcde2

Please sign in to comment.