diff options
| author | Pimyn Girgis <bemenboshra2001@gmail.com> | 2024-09-09 09:50:36 +0000 |
|---|---|---|
| committer | Aleksandr Nogikh <nogikh@google.com> | 2024-09-09 13:14:54 +0000 |
| commit | 507ed33fbf576d99310b16d07ffc58cab120f162 (patch) | |
| tree | 905350940b3e80f8a668a11f81a169e88f3d284e | |
| parent | eb78580fab6646a3bf394e62bf0b20444bbf207f (diff) | |
pkg/mgrconfig, prog, sys/linux: add automatic_helper attribute
Add automatic_helper attribute and enable it for system calls that are required to properly run automatically generated
descriptions. Enable these system calls when descriptions_mode = `Auto`.
| -rw-r--r-- | pkg/mgrconfig/load.go | 3 | ||||
| -rw-r--r-- | prog/types.go | 19 | ||||
| -rw-r--r-- | sys/linux/auto-manual.txt | 4 | ||||
| -rw-r--r-- | sys/linux/namespaces.txt | 6 | ||||
| -rw-r--r-- | sys/linux/socket.txt | 4 | ||||
| -rw-r--r-- | sys/linux/socket_netlink_generic.txt | 2 | ||||
| -rw-r--r-- | sys/linux/sys.txt | 4 |
7 files changed, 20 insertions, 22 deletions
diff --git a/pkg/mgrconfig/load.go b/pkg/mgrconfig/load.go index 76a0bcf14..b5e171973 100644 --- a/pkg/mgrconfig/load.go +++ b/pkg/mgrconfig/load.go @@ -364,7 +364,8 @@ func ParseEnabledSyscalls(target *prog.Target, enabled, disabled []string, for call := range syscalls { if target.Syscalls[call].Attrs.Disabled || descriptionsMode == ManualDescriptions && target.Syscalls[call].Attrs.Automatic || - descriptionsMode == AutoDescriptions && !target.Syscalls[call].Attrs.Automatic { + descriptionsMode == AutoDescriptions && + !target.Syscalls[call].Attrs.Automatic && !target.Syscalls[call].Attrs.AutomaticHelper { delete(syscalls, call) } } diff --git a/prog/types.go b/prog/types.go index dcf838528..d04b901ac 100644 --- a/prog/types.go +++ b/prog/types.go @@ -37,15 +37,16 @@ type Syscall struct { // // See docs/syscall_descriptions_syntax.md for description of individual attributes. type SyscallAttrs struct { - Disabled bool - Timeout uint64 - ProgTimeout uint64 - IgnoreReturn bool - BreaksReturns bool - NoGenerate bool - NoMinimize bool - RemoteCover bool - Automatic bool + Disabled bool + Timeout uint64 + ProgTimeout uint64 + IgnoreReturn bool + BreaksReturns bool + NoGenerate bool + NoMinimize bool + RemoteCover bool + Automatic bool + AutomaticHelper bool } // MaxArgs is maximum number of syscall arguments. diff --git a/sys/linux/auto-manual.txt b/sys/linux/auto-manual.txt deleted file mode 100644 index 1fd5fa8bd..000000000 --- a/sys/linux/auto-manual.txt +++ /dev/null @@ -1,4 +0,0 @@ -# Copyright 2024 syzkaller project authors. All rights reserved. -# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. - -socket$auto_nl(domain const[AF_NETLINK], type const[SOCK_RAW], proto const[NETLINK_GENERIC]) sock_nl_generic (automatic) diff --git a/sys/linux/namespaces.txt b/sys/linux/namespaces.txt index 63ded0e2c..52bc768ff 100644 --- a/sys/linux/namespaces.txt +++ b/sys/linux/namespaces.txt @@ -8,13 +8,13 @@ resource fd_namespace[fd] resource fd_userns[fd_namespace] unshare(flags flags[unshare_flags]) -setns(fd fd_namespace, type flags[ns_type]) +setns(fd fd_namespace, type flags[ns_type]) (automatic_helper) -syz_open_procfs$namespace(pid pid, file ptr[in, string[procfs_namespace_file]]) fd_namespace +syz_open_procfs$namespace(pid pid, file ptr[in, string[procfs_namespace_file]]) fd_namespace (automatic_helper) syz_open_procfs$userns(pid pid, file ptr[in, string["ns/user"]]) fd_userns ioctl$NS_GET_USERNS(fd fd_namespace, cmd const[NS_GET_USERNS], arg const[0]) -ioctl$NS_GET_PARENT(fd fd_namespace, cmd const[NS_GET_PARENT], arg const[0]) fd_namespace +ioctl$NS_GET_PARENT(fd fd_namespace, cmd const[NS_GET_PARENT], arg const[0]) fd_namespace (automatic_helper) ioctl$NS_GET_NSTYPE(fd fd_namespace, cmd const[NS_GET_NSTYPE], arg const[0]) ioctl$NS_GET_OWNER_UID(fd fd_namespace, cmd const[NS_GET_OWNER_UID], arg ptr[out, uid]) diff --git a/sys/linux/socket.txt b/sys/linux/socket.txt index e5fbc52c3..e8994fb4e 100644 --- a/sys/linux/socket.txt +++ b/sys/linux/socket.txt @@ -19,7 +19,7 @@ type sock_port int16be[20000:20004] # TODO: describe socketcall syscall -socket(domain flags[socket_domain], type flags[socket_type], proto int32) sock +socket(domain flags[socket_domain], type flags[socket_type], proto int32) sock (automatic_helper) socketpair(domain flags[socket_domain], type flags[socket_type], proto int32, fds ptr[out, sock_pair]) bind(fd sock, addr ptr[in, sockaddr_storage], addrlen len[addr]) connect(fd sock, addr ptr[in, sockaddr_storage], addrlen len[addr]) @@ -283,7 +283,7 @@ ifreq_ioctls = SIOCGIFNAME, SIOCSIFLINK, SIOCGIFFLAGS, SIOCSIFFLAGS, SIOCGIFADDR ioctl$sock_ifreq(fd sock, cmd flags[ifreq_ioctls], arg ptr[inout, ifreq]) -ioctl$sock_SIOCGIFINDEX(fd sock, cmd const[SIOCGIFINDEX], arg ptr[out, ifreq_t[ifindex]]) +ioctl$sock_SIOCGIFINDEX(fd sock, cmd const[SIOCGIFINDEX], arg ptr[out, ifreq_t[ifindex]]) (automatic_helper) ioctl$sock_SIOCGIFBR(fd sock, cmd const[SIOCGIFBR], arg ptr[inout, brctl_arg]) ioctl$sock_SIOCSIFBR(fd sock, cmd const[SIOCSIFBR], arg ptr[inout, brctl_arg]) diff --git a/sys/linux/socket_netlink_generic.txt b/sys/linux/socket_netlink_generic.txt index 2f925733b..a0a83f0f5 100644 --- a/sys/linux/socket_netlink_generic.txt +++ b/sys/linux/socket_netlink_generic.txt @@ -11,7 +11,7 @@ include <uapi/linux/genetlink.h> resource sock_nl_generic[sock_netlink] -socket$nl_generic(domain const[AF_NETLINK], type const[SOCK_RAW], proto const[NETLINK_GENERIC]) sock_nl_generic +socket$nl_generic(domain const[AF_NETLINK], type const[SOCK_RAW], proto const[NETLINK_GENERIC]) sock_nl_generic (automatic_helper) # This is NETLINK_GENERIC created in init_net namespace. Use with extreme care. # It's very dangerous to use as it allows the fuzzer to bring down network connectivity diff --git a/sys/linux/sys.txt b/sys/linux/sys.txt index 7b03e851e..75286af02 100644 --- a/sys/linux/sys.txt +++ b/sys/linux/sys.txt @@ -112,7 +112,7 @@ syz_execute_func(text ptr[in, text[target]]) (disabled) # Exclude /sys/power/state as reported in https://lkml.org/lkml/2021/5/27/653 openat$sysfs(fd const[AT_FDCWD], dir ptr[in, glob["/sys/**/*:-/sys/power/state"]], flags flags[open_flags], mode flags[open_mode]) fd -open(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd +open(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd (automatic_helper) # Just so that we have something that creates fd_dir resources. open$dir(file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd_dir openat$dir(fd const[AT_FDCWD], file ptr[in, filename], flags flags[open_flags], mode flags[open_mode]) fd_dir @@ -400,7 +400,7 @@ geteuid() uid setpgid(pid pid, pgid pid) getpgid(pid pid) pid getpgrp(pid pid) pid -getpid() pid +getpid() pid (automatic_helper) gettid() pid setreuid(ruid uid, euid uid) setregid(rgid gid, egid gid) |
