From ad046c12115d3ff3c911da28abcdd47399dd9126 Mon Sep 17 00:00:00 2001 From: Giuseppe Scrivano Date: Wed, 20 May 2020 10:02:17 +0200 Subject: [PATCH] spec: allow to specify errnoRet since it is supported in the OCI runtime specs. Signed-off-by: Giuseppe Scrivano --- seccomp_linux.go | 11 ++++++----- types.go | 1 + 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/seccomp_linux.go b/seccomp_linux.go index a5dee9b..44dcd90 100644 --- a/seccomp_linux.go +++ b/seccomp_linux.go @@ -146,21 +146,22 @@ Loop: } if call.Name != "" { - newConfig.Syscalls = append(newConfig.Syscalls, createSpecsSyscall([]string{call.Name}, call.Action, call.Args)) + newConfig.Syscalls = append(newConfig.Syscalls, createSpecsSyscall([]string{call.Name}, call.Action, call.Args, call.ErrnoRet)) } if len(call.Names) > 0 { - newConfig.Syscalls = append(newConfig.Syscalls, createSpecsSyscall(call.Names, call.Action, call.Args)) + newConfig.Syscalls = append(newConfig.Syscalls, createSpecsSyscall(call.Names, call.Action, call.Args, call.ErrnoRet)) } } return newConfig, nil } -func createSpecsSyscall(names []string, action Action, args []*Arg) specs.LinuxSyscall { +func createSpecsSyscall(names []string, action Action, args []*Arg, errnoRet *uint) specs.LinuxSyscall { newCall := specs.LinuxSyscall{ - Names: names, - Action: specs.LinuxSeccompAction(action), + Names: names, + Action: specs.LinuxSeccompAction(action), + ErrnoRet: errnoRet, } // Loop through all the arguments of the syscall and convert them diff --git a/types.go b/types.go index ec01c22..6651c42 100644 --- a/types.go +++ b/types.go @@ -94,4 +94,5 @@ type Syscall struct { Comment string `json:"comment"` Includes Filter `json:"includes"` Excludes Filter `json:"excludes"` + ErrnoRet *uint `json:"errnoRet,omitempty"` }