From 52c1f8045c38bcce0229b2cc3c69b1cbe21eb629 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Wed, 18 Sep 2024 17:38:12 +0200 Subject: sys/linux: add syz_create_resource syz_create_resource allows to turn any value into a resource. Improve binfmt descriptions using syz_create_resource: we need to pass the same file name to write syscalls and execve. Use syz_create_resource to improve binfmt descriptions. --- sys/linux/test/binfmt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'sys/linux/test') diff --git a/sys/linux/test/binfmt b/sys/linux/test/binfmt index 8998c6226..617d75cfe 100644 --- a/sys/linux/test/binfmt +++ b/sys/linux/test/binfmt @@ -1,16 +1,17 @@ # Tests for binfmt_misc. # Executor setups binfmt_misc with ./file0 interpreter for files with byte 0x01 at offset 0. -execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # ENOENT -r0 = openat(0xffffffffffffff9c, &AUTO='./file1\x00', 0x42, 0x1ff) +r3 = syz_create_resource$binfmt(&AUTO='./file1\x00') +execveat$binfmt(0xffffffffffffff9c, r3, &AUTO={[], 0x0}, &AUTO={[], 0x0}, 0x0) # ENOENT +r0 = openat$binfmt(0xffffffffffffff9c, r3, 0x42, 0x1ff) close(r0) -execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # ENOEXEC -r1 = openat(0xffffffffffffff9c, &AUTO='./file1\x00', 0x2, 0x0) +execveat$binfmt(0xffffffffffffff9c, r3, &AUTO={[], 0x0}, &AUTO={[], 0x0}, 0x0) # ENOEXEC +r1 = openat$binfmt(0xffffffffffffff9c, r3, 0x2, 0x0) write(r1, &AUTO="01010101", 0x4) close(r1) -execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # ENOENT +execveat$binfmt(0xffffffffffffff9c, r3, &AUTO={[], 0x0}, &AUTO={[], 0x0}, 0x0) # ENOENT r2 = openat(0xffffffffffffff9c, &AUTO='./file0\x00', 0x42, 0x0) close(r2) -execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # EACCES +execveat$binfmt(0xffffffffffffff9c, r3, &AUTO={[], 0x0}, &AUTO={[], 0x0}, 0x0) # EACCES fchmodat(0xffffffffffffff9c, &AUTO='./file0\x00', 0x1ff) -execveat(0xffffffffffffff9c, &AUTO='./file1\x00', &AUTO=[0x0], &AUTO=[0x0], 0x0) # ENOEXEC +execveat$binfmt(0xffffffffffffff9c, r3, &AUTO={[], 0x0}, &AUTO={[], 0x0}, 0x0) # ENOEXEC -- cgit mrf-deployment