diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2024-09-27 16:02:43 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2024-09-27 14:18:05 +0000 |
| commit | 440b26ec58c1da582a1b614a476a4b5f3abf43d0 (patch) | |
| tree | ebda3164cb8e2d168e0c029faf27942bf9203fdd | |
| parent | 2fd13b4d7c0a65ab26933e97ffad53e6c27fa739 (diff) | |
sys/linux/test: add ELF binary seed
Add a seed that creates and execs something that resembles an ELF binary.
| -rw-r--r-- | sys/linux/binfmt.txt | 4 | ||||
| -rw-r--r-- | sys/linux/test/execve_elf | 5 |
2 files changed, 7 insertions, 2 deletions
diff --git a/sys/linux/binfmt.txt b/sys/linux/binfmt.txt index 98a67336f..08938298c 100644 --- a/sys/linux/binfmt.txt +++ b/sys/linux/binfmt.txt @@ -105,7 +105,7 @@ type binfmt_elf64 binfmt_elf[int64, elf64_phdr, ELF64_PHDR_SIZE] type binfmt_elf[ADDR, PHDR, PHENTSIZE] { hdr elf_hdr[ADDR, PHENTSIZE] - phdr array[PHDR, 1:2] + phdr array[PHDR, 1:4] data array[int8] # Just to make the file of a non-trivial size. pad array[array[const[0, int64], 32], 0:10] @@ -130,7 +130,7 @@ type elf_hdr[ADDR, PHENTSIZE] { e_flags int32 e_ehsize int16 e_phentsize const[PHENTSIZE, int16] - e_phnum int16[1:2] + e_phnum len[binfmt_elf:phdr, int16] e_shentsize int16 e_shnum int16 e_shstrndx int16 diff --git a/sys/linux/test/execve_elf b/sys/linux/test/execve_elf new file mode 100644 index 000000000..71607fb23 --- /dev/null +++ b/sys/linux/test/execve_elf @@ -0,0 +1,5 @@ +r0 = syz_create_resource$binfmt(&AUTO='./file0\x00') +r1 = openat$binfmt(0xffffffffffffff9c, r0, 0x42, 0x1ff) +write$binfmt_elf64(r1, &AUTO={{AUTO, AUTO, AUTO, AUTO, 0x2, 0x1, 0x1, 0x3, 0x0, 0x2, 0x3e, 0x1, 0x100, 0x40, 0x200, 0x0, 0x40, AUTO, AUTO, 0x40, 0x2, 0x1}, [{0x1, 0x0, 0x0, 0x10000, 0x150, 0x10, 0x1000, 0x0}, {0x1, 0x0, 0x0, 0x20000, 0x200, 0x0, 0x2000, 0x10}, {0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}], ""/0x1000, ["", "", ""]}, AUTO) +close(r1) +execveat$binfmt(0xffffffffffffff9c, r0, &AUTO={[], 0x0}, &AUTO={[], 0x0}, 0x0) |
