Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion seccomp/default.json
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@
"fadvise64",
"fadvise64_64",
"fallocate",
"fanotify_init",
"fanotify_mark",
"fchdir",
"fchmod",
Expand Down Expand Up @@ -635,7 +636,6 @@
"bpf",
"clone",
"clone3",
"fanotify_init",
"fsconfig",
"fsmount",
"fsopen",
Expand Down
2 changes: 1 addition & 1 deletion seccomp/default_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ func DefaultProfile() *Seccomp {
"fadvise64",
"fadvise64_64",
"fallocate",
"fanotify_init",
"fanotify_mark",
"fchdir",
"fchmod",
Expand Down Expand Up @@ -643,7 +644,6 @@ func DefaultProfile() *Seccomp {
"bpf",
"clone",
"clone3",
"fanotify_init",
"fsconfig",
"fsmount",
"fsopen",
Expand Down
19 changes: 19 additions & 0 deletions seccomp/seccomp_linux_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"encoding/json"
"os"
"reflect"
"slices"
"strings"
"testing"

Expand Down Expand Up @@ -195,6 +196,24 @@ func TestLoadDefaultProfile(t *testing.T) {
}
}

func TestDefaultProfileAllowsFanotifyInitWithoutSysAdmin(t *testing.T) {
spec := createSpec()
profile, err := GetDefaultProfile(&spec)
if err != nil {
t.Fatal(err)
}

for _, syscall := range profile.Syscalls {
if slices.Contains(syscall.Names, "fanotify_init") {
if syscall.Action != specs.ActAllow {
t.Fatalf("expected fanotify_init action %s, got %s", specs.ActAllow, syscall.Action)
}
return
}
}
t.Fatal("fanotify_init is not allowed without CAP_SYS_ADMIN")
}

func TestUnmarshalDefaultProfile(t *testing.T) {
expected := DefaultProfile()
if expected == nil {
Expand Down