From 28bd3e371b1f31cb243f0df56b9c7720971a89db Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 10 Dec 2018 15:49:04 +0100 Subject: prog: support AUTO args in programs AUTO arguments can be used for: - consts - lens - pointers For const's and len's AUTO is replaced with the natural value, addresses for AUTO pointers are allocated linearly. This greatly simplifies writing test programs by hand as most of the time we want these natural values. Update tests to use AUTO. --- sys/linux/test/binfmt | 20 ++++++++++---------- sys/linux/test/cgroup | 16 ++++++++-------- sys/linux/test/file_immutable | 10 +++++----- sys/linux/test/fuse_deadlock | 16 ++++++++-------- sys/linux/test/vnet_tun | 4 ++-- 5 files changed, 33 insertions(+), 33 deletions(-) (limited to 'sys/linux/test') diff --git a/sys/linux/test/binfmt b/sys/linux/test/binfmt index 9ab905824..8998c6226 100644 --- a/sys/linux/test/binfmt +++ b/sys/linux/test/binfmt @@ -1,16 +1,16 @@ # Tests for binfmt_misc. # Executor setups binfmt_misc with ./file0 interpreter for files with byte 0x01 at offset 0. -execveat(0xffffffffffffff9c, &(0x7f0000000000)='./file1\x00', &(0x7f0000000100)=[0x0], &(0x7f0000000200)=[0x0], 0x0) # ENOENT -r0 = openat(0xffffffffffffff9c, &(0x7f0000000000)='./file1\x00', 0x42, 0x1ff) +execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # ENOENT +r0 = openat(0xffffffffffffff9c, &AUTO='./file1\x00', 0x42, 0x1ff) close(r0) -execveat(0xffffffffffffff9c, &(0x7f0000000000)='./file1\x00', &(0x7f0000000100)=[0x0], &(0x7f0000000200)=[0x0], 0x0) # ENOEXEC -r1 = openat(0xffffffffffffff9c, &(0x7f0000000000)='./file1\x00', 0x2, 0x0) -write(r1, &(0x7f0000000300)="01010101", 0x4) +execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # ENOEXEC +r1 = openat(0xffffffffffffff9c, &AUTO='./file1\x00', 0x2, 0x0) +write(r1, &AUTO="01010101", 0x4) close(r1) -execveat(0xffffffffffffff9c, &(0x7f0000000000)='./file1\x00', &(0x7f0000000100)=[0x0], &(0x7f0000000200)=[0x0], 0x0) # ENOENT -r2 = openat(0xffffffffffffff9c, &(0x7f0000000000)='./file0\x00', 0x42, 0x0) +execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # ENOENT +r2 = openat(0xffffffffffffff9c, &AUTO='./file0\x00', 0x42, 0x0) close(r2) -execveat(0xffffffffffffff9c, &(0x7f0000000000)='./file1\x00', &(0x7f0000000100)=[0x0], &(0x7f0000000200)=[0x0], 0x0) # EACCES -fchmodat(0xffffffffffffff9c, &(0x7f0000000000)='./file0\x00', 0x1ff) -execveat(0xffffffffffffff9c, &(0x7f0000000000)='./file1\x00', &(0x7f0000000100)=[0x0], &(0x7f0000000200)=[0x0], 0x0) # ENOEXEC +execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # EACCES +fchmodat(0xffffffffffffff9c, &AUTO='./file0\x00', 0x1ff) +execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # ENOEXEC diff --git a/sys/linux/test/cgroup b/sys/linux/test/cgroup index db6fb7317..f06d87ac8 100644 --- a/sys/linux/test/cgroup +++ b/sys/linux/test/cgroup @@ -4,12 +4,12 @@ # requires: -sandbox= -sandbox=setuid -C,norepeat r0 = getpid() -r1 = openat(0xffffffffffffff9c, &(0x7f0000000000)='./cgroup/cgroup.procs\x00', 0x2, 0x0) -read(r1, &(0x7f0000000100)="00", 0x1) -write$cgroup_pid(r1, &(0x7f0000000100)=r0, 0x12) +r1 = openat(0xffffffffffffff9c, &AUTO='./cgroup/cgroup.procs\x00', 0x2, 0x0) +read(r1, &AUTO="00", AUTO) +write$cgroup_pid(r1, &AUTO=r0, AUTO) close(r1) -openat(0xffffffffffffff9c, &(0x7f0000000000)='./cgroup/pids.max\x00', 0x2, 0x0) -openat(0xffffffffffffff9c, &(0x7f0000000000)='./cgroup.cpu/cgroup.procs\x00', 0x2, 0x0) -openat(0xffffffffffffff9c, &(0x7f0000000000)='./cgroup.cpu/cpuset.cpus\x00', 0x2, 0x0) -openat(0xffffffffffffff9c, &(0x7f0000000000)='./cgroup.net/cgroup.procs\x00', 0x2, 0x0) -openat(0xffffffffffffff9c, &(0x7f0000000000)='./cgroup.net/devices.allow\x00', 0x1, 0x0) +openat(0xffffffffffffff9c, &AUTO='./cgroup/pids.max\x00', 0x2, 0x0) +openat(0xffffffffffffff9c, &AUTO='./cgroup.cpu/cgroup.procs\x00', 0x2, 0x0) +openat(0xffffffffffffff9c, &AUTO='./cgroup.cpu/cpuset.cpus\x00', 0x2, 0x0) +openat(0xffffffffffffff9c, &AUTO='./cgroup.net/cgroup.procs\x00', 0x2, 0x0) +openat(0xffffffffffffff9c, &AUTO='./cgroup.net/devices.allow\x00', 0x1, 0x0) diff --git a/sys/linux/test/file_immutable b/sys/linux/test/file_immutable index e6a18240b..61ad6b36a 100644 --- a/sys/linux/test/file_immutable +++ b/sys/linux/test/file_immutable @@ -3,8 +3,8 @@ # It also requires root, so will fail with setuid. # requires: -sandbox=namespace -sandbox=setuid -r0 = openat(0xffffffffffffff9c, &(0x7f0000000000)='./file0\x00', 0x26e1, 0x0) -ioctl$FS_IOC_FSSETXATTR(r0, 0x40086602, &(0x7f0000000100)={0x17e}) -mkdirat(0xffffffffffffff9c, &(0x7f0000000200)='./file1\x00', 0x1ff) -r1 = openat(0xffffffffffffff9c, &(0x7f0000000300)='./file1\x00', 0x0, 0x0) -ioctl$FS_IOC_FSSETXATTR(r1, 0x40086602, &(0x7f0000000100)={0x17e}) +r0 = openat(0xffffffffffffff9c, &AUTO='./file0\x00', 0x26e1, 0x0) +ioctl$FS_IOC_FSSETXATTR(r0, 0x40086602, &AUTO={0x17e, 0x0, 0x0, 0x0, 0x0, 0x0}) +mkdirat(0xffffffffffffff9c, &AUTO='./file1\x00', 0x1ff) +r1 = openat(0xffffffffffffff9c, &AUTO='./file1\x00', 0x0, 0x0) +ioctl$FS_IOC_FSSETXATTR(r1, 0x40086602, &AUTO={0x17e, 0x0, 0x0, 0x0, 0x0, 0x0}) diff --git a/sys/linux/test/fuse_deadlock b/sys/linux/test/fuse_deadlock index 844bfe701..897977fb3 100644 --- a/sys/linux/test/fuse_deadlock +++ b/sys/linux/test/fuse_deadlock @@ -1,11 +1,11 @@ # Test how we avoid fuse deadlocks in kill_and_wait. # requires: threaded -sandbox= -C,norepeat -mkdirat(0xffffffffffffff9c, &(0x7f0000000000)='./file0\x00', 0x0) -r0 = openat$fuse(0xffffffffffffff9c, &(0x7f0000000640)='/dev/fuse\x00', 0x2, 0x0) -mount$fuse(0x0, &(0x7f0000000200)='./file0\x00', &(0x7f0000000300)='fuse\x00', 0x0, &(0x7f0000000400)={{'fd', 0x3d, r0}, 0x2c, {'rootmode', 0x3d, 0x4000}, 0x2c, {'user_id', 0x3d}, 0x2c, {'group_id', 0x3d}, 0x2c}) -read$FUSE(r0, &(0x7f0000002000), 0x1000) -pread64(r0, &(0x7f0000000540)=""/236, 0xec, 0x0) # blocked -write$FUSE_INIT(r0, &(0x7f0000000100)={0x50, 0x0, 0x1, {0x7, 0x1b}}, 0x50) -mkdirat(0xffffffffffffff9c, &(0x7f0000000500)='./file0/file0\x00', 0x0) # unfinished -write$FUSE_NOTIFY_INVAL_ENTRY(r0, &(0x7f00000000c0)={0x29, 0x3, 0x0, {0x1, 0x8, 0x0, 'group_id'}}, 0x29) # unfinished +mkdirat(0xffffffffffffff9c, &AUTO='./file0\x00', 0x0) +r0 = openat$fuse(0xffffffffffffff9c, &AUTO='/dev/fuse\x00', 0x2, 0x0) +mount$fuse(0x0, &AUTO='./file0\x00', &AUTO='fuse\x00', 0x0, &AUTO={{'fd', 0x3d, r0}, 0x2c, {'rootmode', 0x3d, 0x4000}, 0x2c, {'user_id', 0x3d, 0x0}, 0x2c, {'group_id', 0x3d, 0x0}, 0x2c, {[], [], 0x0}}) +read$FUSE(r0, &AUTO=""/4096, AUTO) +pread64(r0, &AUTO=""/236, AUTO, 0x0) # blocked +write$FUSE_INIT(r0, &AUTO={AUTO, 0x0, 0x1, {AUTO, AUTO, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, [0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0]}}, AUTO) +mkdirat(0xffffffffffffff9c, &AUTO='./file0/file0\x00', 0x0) # unfinished +write$FUSE_NOTIFY_INVAL_ENTRY(r0, &AUTO={AUTO, 0x3, 0x0, {0x1, AUTO, 0x0, 'group_id', 0x0}}, AUTO) # unfinished diff --git a/sys/linux/test/vnet_tun b/sys/linux/test/vnet_tun index bb88fc9d6..c1b08e695 100644 --- a/sys/linux/test/vnet_tun +++ b/sys/linux/test/vnet_tun @@ -1,2 +1,2 @@ -syz_emit_ethernet() -syz_emit_ethernet() +syz_emit_ethernet(0x0, 0x0, 0x0) +syz_emit_ethernet(0x0, 0x0, 0x0) -- cgit mrf-deployment