Skip to content

Commit fb79416

Browse files
committed
seccomp: Use explicit DefaultErrnoRet
Since commit "seccomp: Sync fields with runtime-spec fields" (5d24467) we support to specify the DefaultErrnoRet to be used. Before that commit it was not specified and EPERM was used by default. This commit keeps the same behaviour but just makes it explicit that the default is EPERM. Signed-off-by: Rodrigo Campos <rodrigo@kinvolk.io>
1 parent 1f42dd5 commit fb79416

File tree

4 files changed

+8
-2
lines changed

4 files changed

+8
-2
lines changed

profiles/seccomp/default.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"defaultAction": "SCMP_ACT_ERRNO",
3+
"defaultErrnoRet": 1,
34
"archMap": [
45
{
56
"architecture": "SCMP_ARCH_X86_64",

profiles/seccomp/default_linux.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -739,9 +739,11 @@ func DefaultProfile() *Seccomp {
739739
},
740740
}
741741

742+
errnoRet := uint(unix.EPERM)
742743
return &Seccomp{
743744
LinuxSeccomp: specs.LinuxSeccomp{
744-
DefaultAction: specs.ActErrno,
745+
DefaultAction: specs.ActErrno,
746+
DefaultErrnoRet: &errnoRet,
745747
},
746748
ArchMap: arches(),
747749
Syscalls: syscalls,

profiles/seccomp/fixtures/example.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
{
22
"defaultAction": "SCMP_ACT_ERRNO",
3+
"defaultErrnoRet": 1,
34
"syscalls": [
45
{
56
"name": "clone",

profiles/seccomp/seccomp_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ func TestLoadProfile(t *testing.T) {
2323
t.Fatal(err)
2424
}
2525
var expectedErrno uint = 12345
26+
var expectedDefaultErrno uint = 1
2627
expected := specs.LinuxSeccomp{
27-
DefaultAction: specs.ActErrno,
28+
DefaultAction: specs.ActErrno,
29+
DefaultErrnoRet: &expectedDefaultErrno,
2830
Syscalls: []specs.LinuxSyscall{
2931
{
3032
Names: []string{"clone"},

0 commit comments

Comments
 (0)