From 6cc1688b7dcbbfc29192326ed3a7a9d421d9d067 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Thu, 14 Nov 2024 14:32:00 +0100 Subject: sys/linux: ensure that auto descriptions are self-sufficient Test that if we enable only auto descriptions, nothing gets disabled. Currently nothing can create fd_cgroup which is used by the descriptions. --- prog/resources_test.go | 18 ++++++++++++++++++ sys/linux/cgroup.txt | 2 +- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/prog/resources_test.go b/prog/resources_test.go index 334f9bbe5..3804ef494 100644 --- a/prog/resources_test.go +++ b/prog/resources_test.go @@ -103,6 +103,24 @@ func TestTransitivelyEnabledCallsLinux(t *testing.T) { } } +func TestTransitivelyEnabledAutoCalls(t *testing.T) { + t.Parallel() + target, err := GetTarget("linux", "amd64") + if err != nil { + t.Fatal(err) + } + calls := make(map[*Syscall]bool) + for _, c := range target.Syscalls { + if c.Attrs.Automatic || c.Attrs.AutomaticHelper { + calls[c] = true + } + } + _, disabled := target.TransitivelyEnabledCalls(calls) + for c, reason := range disabled { + t.Errorf("disabled call %v: %v", c.Name, reason) + } +} + func TestGetInputResources(t *testing.T) { expectedRequiredResources := map[string]bool{ "required_res1": false, diff --git a/sys/linux/cgroup.txt b/sys/linux/cgroup.txt index 3067ef583..e9782df2d 100644 --- a/sys/linux/cgroup.txt +++ b/sys/linux/cgroup.txt @@ -15,7 +15,7 @@ resource fd_cgroup_pressure[fd] mkdirat$cgroup_root(fd const[AT_FDCWD], path ptr[in, string[cgroup_dirs]], mode const[0x1ff]) mkdirat$cgroup(fd fd_cgroup, path ptr[in, string[cgroup_names]], mode const[0x1ff]) -openat$cgroup_root(fd const[AT_FDCWD], file ptr[in, string[cgroup_dirs]], flags const[CGROUP_OPEN_FLAGS], mode const[0]) fd_cgroup +openat$cgroup_root(fd const[AT_FDCWD], file ptr[in, string[cgroup_dirs]], flags const[CGROUP_OPEN_FLAGS], mode const[0]) fd_cgroup (automatic_helper) openat$cgroup(fd fd_cgroup, file ptr[in, string[cgroup_names]], flags const[CGROUP_OPEN_FLAGS], mode const[0]) fd_cgroup openat$cgroup_ro(fd fd_cgroup, file ptr[in, string[cgroup_ctrl_read]], flags const[O_RDONLY], mode const[0]) fd openat$cgroup_int(fd fd_cgroup, file ptr[in, string[cgroup_ctrl_int]], flags const[O_RDWR], mode const[0]) fd_cgroup_int -- cgit mrf-deployment