map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.h>
#include <sched.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mount.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#include <linux/sched.h>
#ifndef __NR_clone3
#define __NR_clone3 435
#endif
#define USLEEP_FORKED_CHILD (3 * 50 *1000)
static long handle_clone_ret(long ret)
{
if (ret != 0) {
return ret;
}
usleep(USLEEP_FORKED_CHILD);
syscall(__NR_exit, 0);
while (1) {
}
}
#define MAX_CLONE_ARGS_BYTES 256
static long syz_clone3(volatile long a0, volatile long a1)
{
unsigned long copy_size = a1;
if (copy_size < sizeof(uint64_t) || copy_size > MAX_CLONE_ARGS_BYTES)
return -1;
char clone_args[MAX_CLONE_ARGS_BYTES];
memcpy(&clone_args, (void*)a0, copy_size);
uint64_t* flags = (uint64_t*)&clone_args;
*flags &= ~CLONE_VM;
return handle_clone_ret((long)syscall(__NR_clone3, &clone_args, copy_size));
}
uint64_t r[8] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0x0, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul, /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/7ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul, /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/0x32ul, /*fd=*/(intptr_t)-1, /*offset=*/0ul);
const char* reason;
(void)reason;
intptr_t res = 0;
if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {}
// mmap$auto arguments: [
// addr: intptr = 0x0 (8 bytes)
// len: intptr = 0x4020009 (8 bytes)
// prot: intptr = 0xdb (8 bytes)
// flags: intptr = 0xeb1 (8 bytes)
// fd: fd (resource)
// off: intptr = 0x8000 (8 bytes)
// ]
syscall(__NR_mmap, /*addr=*/0ul, /*len=*/0x4020009ul, /*prot=*/0xdbul, /*flags=*/0xeb1ul, /*fd=*/0x401, /*off=*/0x8000ul);
// openat$auto_proc_iter_file_ops_compat_inode arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 70 72 6f 63 2f 63 6f 6e 73 6f 6c 65 73 00} (length 0xf)
// }
// flags: open_flags = 0x800 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_proc_iter_file_ops_compat_inode
memcpy((void*)0x200000000180, "/proc/consoles\000", 15);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000180ul, /*flags=O_NONBLOCK*/0x800, /*mode=*/0);
if (res != -1)
r[0] = res;
// mmap$auto arguments: [
// addr: intptr = 0x9 (8 bytes)
// len: intptr = 0xffffffffffffffff (8 bytes)
// prot: intptr = 0x8 (8 bytes)
// flags: intptr = 0xeb1 (8 bytes)
// fd: fd (resource)
// off: intptr = 0x8000 (8 bytes)
// ]
syscall(__NR_mmap, /*addr=*/9ul, /*len=*/(intptr_t)-1, /*prot=*/8ul, /*flags=*/0xeb1ul, /*fd=*/r[0], /*off=*/0x8000ul);
// pread64$auto arguments: [
// fd: fd (resource)
// buf: nil
// count: intptr = 0xd00 (8 bytes)
// pos: intptr = 0x2 (8 bytes)
// ]
syscall(__NR_pread64, /*fd=*/r[0], /*buf=*/0ul, /*count=*/0xd00ul, /*pos=*/2ul);
// socketpair$auto arguments: [
// family: int32 = 0x1 (4 bytes)
// type: int32 = 0x2 (4 bytes)
// protocol: int32 = 0x8000000000000000 (4 bytes)
// usockvec: nil
// ]
// returns fd
syscall(__NR_socketpair, /*family=*/1, /*type=*/2, /*protocol=*/0, /*usockvec=*/0ul);
for (int i = 0; i < 64; i++) {
syscall(__NR_socketpair, /*family=*/1, /*type=*/2, /*protocol=*/0, /*usockvec=*/0ul);
}
// fcntl$auto arguments: [
// fd: fd (resource)
// cmd: int32 = 0x4 (4 bytes)
// arg: pid (resource)
// ]
// returns fd
res = syscall(__NR_fcntl, /*fd=*/3, /*cmd=*/4, /*arg=*/0xa553);
if (res != -1)
r[1] = res;
// sendmmsg$auto arguments: [
// fd: fd (resource)
// mmsg: nil
// vlen: int32 = 0x9a6 (4 bytes)
// flags: int32 = 0x1a3 (4 bytes)
// ]
syscall(__NR_sendmmsg, /*fd=*/3, /*mmsg=*/0ul, /*vlen=*/0x9a6, /*flags=*/0x1a3);
// socket arguments: [
// domain: socket_domain = 0x1a (8 bytes)
// type: socket_type = 0x800 (8 bytes)
// proto: int32 = 0x1 (4 bytes)
// ]
// returns sock
syscall(__NR_socket, /*domain=AF_LLC*/0x1aul, /*type=SOCK_NONBLOCK*/0x800ul, /*proto=*/1);
// openat$auto_kernfs_file_fops_kernfs_internal arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 73 79 73 2f 64 65 76 69 63 65 73 2f 70 63 69 30 30 30 30 3a 30 30 2f 30 30 30 30 3a 30 30 3a 30 34 2e 30 2f 72 65 73 6f 75 72 63 65 30 00} (length 0x2f)
// }
// flags: open_flags = 0xc0082 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_kernfs_file_fops_kernfs_internal
memcpy((void*)0x2000000000c0, "/sys/devices/pci0000:00/0000:00:04.0/resource0\000", 47);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x2000000000c0ul, /*flags=O_NOATIME|O_EXCL|O_CLOEXEC|O_RDWR*/0xc0082, /*mode=*/0);
if (res != -1)
r[2] = res;
// write$auto arguments: [
// fd: fd (resource)
// buf: ptr[in, buffer] {
// buffer: {2f 64 65 76 2f 69 32 63 2d 30 00} (length 0xb)
// }
// count: intptr = 0x1 (8 bytes)
// ]
memcpy((void*)0x200000000080, "/dev/i2c-0\000", 11);
syscall(__NR_write, /*fd=*/r[2], /*buf=*/0x200000000080ul, /*count=*/1ul);
for (int i = 0; i < 32; i++) {
syscall(__NR_write, /*fd=*/r[2], /*buf=*/0x200000000080ul, /*count=*/1ul);
}
// syz_clone3 arguments: [
// args: ptr[in, clone_args] {
// clone_args {
// flags: clone3_flags = 0x200 (8 bytes)
// pidfd: ptr[out, fd_pidfd] {
// fd_pidfd (resource)
// }
// child_tid: ptr[out, pid] {
// pid (resource)
// }
// parent_tid: ptr[out, pid] {
// pid (resource)
// }
// exit_signal: align64[signalno] {
// v: int32 = 0x9 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// stack: ptr[out, buffer] {
// buffer: (DirOut)
// }
// stack_size: bytesize = 0xcf (8 bytes)
// tls: ptr[out, buffer] {
// buffer: (DirOut)
// }
// set_tid: ptr[in, array[pid]] {
// array[pid] {
// pid (resource)
// pid (resource)
// pid (resource)
// pid (resource)
// pid (resource)
// pid (resource)
// }
// }
// set_tid_size: len = 0x6 (8 bytes)
// cgroup: align64[fd_cgroup] {
// v: fd_cgroup (resource)
// pad = 0x0 (4 bytes)
// }
// }
// }
// size: bytesize = 0x58 (8 bytes)
// ]
// returns pid
*(uint64_t*)0x2000000013c0 = 0x200;
*(uint64_t*)0x2000000013c8 = 0x200000000000;
*(uint64_t*)0x2000000013d0 = 0x200000000140;
*(uint64_t*)0x2000000013d8 = 0x2000000001c0;
*(uint32_t*)0x2000000013e0 = 9;
*(uint64_t*)0x2000000013e8 = 0x200000000200;
*(uint64_t*)0x2000000013f0 = 0xcf;
*(uint64_t*)0x2000000013f8 = 0x200000000380;
*(uint64_t*)0x200000001400 = 0x200000001380;
*(uint32_t*)0x200000001380 = -1;
*(uint32_t*)0x200000001384 = -1;
*(uint32_t*)0x200000001388 = -1;
*(uint32_t*)0x20000000138c = -1;
*(uint32_t*)0x200000001390 = 0;
*(uint32_t*)0x200000001394 = -1;
*(uint64_t*)0x200000001408 = 6;
*(uint32_t*)0x200000001410 = r[1];
res = -1;
res = syz_clone3(/*args=*/0x2000000013c0, /*size=*/0x58);
if (res != -1)
r[3] = *(uint32_t*)0x200000000140;
// mmap$auto arguments: [
// addr: intptr = 0x0 (8 bytes)
// len: intptr = 0x2020006 (8 bytes)
// prot: intptr = 0x3 (8 bytes)
// flags: intptr = 0xeb1 (8 bytes)
// fd: fd (resource)
// off: intptr = 0x8000 (8 bytes)
// ]
syscall(__NR_mmap, /*addr=*/0ul, /*len=*/0x2020006ul, /*prot=*/3ul, /*flags=*/0xeb1ul, /*fd=*/0xfffffffa, /*off=*/0x8000ul);
// socket arguments: [
// domain: socket_domain = 0x29 (8 bytes)
// type: socket_type = 0x0 (8 bytes)
// proto: int32 = 0x3ff (4 bytes)
// ]
// returns sock
res = syscall(__NR_socket, /*domain=AF_KCM*/0x29ul, /*type=*/0ul, /*proto=*/0x3ff);
if (res != -1)
r[4] = res;
// socket arguments: [
// domain: socket_domain = 0x10 (8 bytes)
// type: socket_type = 0x2 (8 bytes)
// proto: int32 = 0x0 (4 bytes)
// ]
// returns sock
res = syscall(__NR_socket, /*domain=AF_NETLINK*/0x10ul, /*type=SOCK_DGRAM*/2ul, /*proto=*/0);
if (res != -1)
r[5] = res;
// sendmsg$auto_NL80211_CMD_GET_REG arguments: [
// fd: sock_nl_generic (resource)
// msg: ptr[in, msghdr_netlink[netlink_msg_t[genl_nl80211_family_id$auto, genlmsghdr_t[NL80211_CMD_GET_REG], nl80211_policy_nl80211$auto]]] {
// msghdr_netlink[netlink_msg_t[genl_nl80211_family_id$auto, genlmsghdr_t[NL80211_CMD_GET_REG], nl80211_policy_nl80211$auto]] {
// addr: nil
// addrlen: len = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// vec: nil
// vlen: const = 0x1 (8 bytes)
// ctrl: const = 0x0 (8 bytes)
// ctrllen: const = 0x0 (8 bytes)
// f: send_flags = 0x0 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// }
// f: send_flags = 0x40000 (8 bytes)
// ]
*(uint64_t*)0x200000000240 = 0;
*(uint32_t*)0x200000000248 = 0;
*(uint64_t*)0x200000000250 = 0;
*(uint64_t*)0x200000000258 = 1;
*(uint64_t*)0x200000000260 = 0;
*(uint64_t*)0x200000000268 = 0;
*(uint32_t*)0x200000000270 = 0;
syscall(__NR_sendmsg, /*fd=*/r[5], /*msg=*/0x200000000240ul, /*f=MSG_BATCH*/0x40000ul);
// sendmmsg$auto arguments: [
// fd: fd (resource)
// mmsg: ptr[inout, mmsghdr$auto] {
// mmsghdr$auto {
// msg_hdr: user_msghdr$auto {
// msg_name: nil
// msg_namelen: int32 = 0x1c03 (4 bytes)
// pad = 0x0 (4 bytes)
// msg_iov: ptr[inout, iovec$auto] {
// iovec$auto {
// iov_base: nil
// iov_len: intptr = 0xc4 (8 bytes)
// }
// }
// msg_iovlen: intptr = 0x1 (8 bytes)
// msg_control: nil
// msg_controllen: intptr = 0x0 (8 bytes)
// msg_flags: int32 = 0x9 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// msg_len: int32 = 0x7 (4 bytes)
// pad = 0x0 (4 bytes)
// }
// }
// vlen: int32 = 0x3 (4 bytes)
// flags: int32 = 0x0 (4 bytes)
// ]
*(uint64_t*)0x200000000080 = 0;
*(uint32_t*)0x200000000088 = 0x1c03;
*(uint64_t*)0x200000000090 = 0x2000000002c0;
*(uint64_t*)0x2000000002c0 = 0;
*(uint64_t*)0x2000000002c8 = 0xc4;
*(uint64_t*)0x200000000098 = 1;
*(uint64_t*)0x2000000000a0 = 0;
*(uint64_t*)0x2000000000a8 = 0;
*(uint32_t*)0x2000000000b0 = 9;
*(uint32_t*)0x2000000000b8 = 7;
syscall(__NR_sendmmsg, /*fd=*/3, /*mmsg=*/0x200000000080ul, /*vlen=*/3, /*flags=*/0);
// ioctl$auto arguments: [
// fd: fd (resource)
// cmd: int32 = 0x891d (4 bytes)
// arg: fd (resource)
// ]
syscall(__NR_ioctl, /*fd=*/r[4], /*cmd=*/0x891d, /*arg=*/0x24);
// socket arguments: [
// domain: socket_domain = 0x29 (8 bytes)
// type: socket_type = 0x2 (8 bytes)
// proto: int32 = 0x0 (4 bytes)
// ]
// returns sock
res = syscall(__NR_socket, /*domain=AF_KCM*/0x29ul, /*type=SOCK_DGRAM*/2ul, /*proto=*/0);
if (res != -1)
r[6] = res;
// ioctl$auto arguments: [
// fd: fd (resource)
// cmd: int32 = 0x89f2 (4 bytes)
// arg: fd (resource)
// ]
syscall(__NR_ioctl, /*fd=*/r[6], /*cmd=*/0x89f2, /*arg=*/r[4]);
// prctl$auto arguments: [
// option: int32 = 0x203d (4 bytes)
// arg2: intptr = 0x5 (8 bytes)
// arg3: pid (resource)
// arg4: intptr = 0x0 (8 bytes)
// arg5: intptr = 0x80 (8 bytes)
// ]
// returns fd
syscall(__NR_prctl, /*option=*/0x203d, /*arg2=*/5ul, /*arg3=*/r[3], /*arg4=*/0ul, /*arg5=*/0x80ul);
for (int i = 0; i < 64; i++) {
syscall(__NR_prctl, /*option=*/0x203d, /*arg2=*/5ul, /*arg3=*/r[3], /*arg4=*/0ul, /*arg5=*/0x80ul);
}
// recvmmsg$auto arguments: [
// fd: fd (resource)
// mmsg: nil
// vlen: int32 = 0x10000 (4 bytes)
// flags: int32 = 0x0 (4 bytes)
// timeout: nil
// ]
syscall(__NR_recvmmsg, /*fd=*/3, /*mmsg=*/0ul, /*vlen=*/0x10000, /*flags=*/0, /*timeout=*/0ul);
for (int i = 0; i < 64; i++) {
syscall(__NR_recvmmsg, /*fd=*/3, /*mmsg=*/0ul, /*vlen=*/0x10000, /*flags=*/0, /*timeout=*/0ul);
}
// mmap$auto arguments: [
// addr: intptr = 0x0 (8 bytes)
// len: intptr = 0x20004 (8 bytes)
// prot: intptr = 0x1ff (8 bytes)
// flags: intptr = 0xeb1 (8 bytes)
// fd: fd (resource)
// off: intptr = 0x8000 (8 bytes)
// ]
syscall(__NR_mmap, /*addr=*/0ul, /*len=*/0x20004ul, /*prot=*/0x1fful, /*flags=*/0xeb1ul, /*fd=*/(intptr_t)-1, /*off=*/0x8000ul);
// ioctl$auto arguments: [
// fd: fd (resource)
// cmd: int32 = 0xc0405626 (4 bytes)
// arg: fd (resource)
// ]
syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0xc0405626, /*arg=*/(intptr_t)-1);
for (int i = 0; i < 64; i++) {
syscall(__NR_ioctl, /*fd=*/(intptr_t)-1, /*cmd=*/0xc0405626, /*arg=*/(intptr_t)-1);
}
// openat$auto_msr_fops_msr arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 64 65 76 2f 63 70 75 2f 30 2f 6d 73 72 00} (length 0xf)
// }
// flags: open_flags = 0x181f82 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_msr_fops_msr
memcpy((void*)0x200000000040, "/dev/cpu/0/msr\000", 15);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000040ul, /*flags=O_TRUNC|O_SYNC|O_NONBLOCK|O_NOCTTY|O_EXCL|O_CLOEXEC|0x402*/0x181f82, /*mode=*/0);
if (res != -1)
r[7] = res;
// readv$auto arguments: [
// fd: fd (resource)
// vec: ptr[in, iovec$auto] {
// iovec$auto {
// iov_base: nil
// iov_len: intptr = 0x101d0 (8 bytes)
// }
// }
// vlen: intptr = 0x400 (8 bytes)
// ]
*(uint64_t*)0x2000000000c0 = 0;
*(uint64_t*)0x2000000000c8 = 0x101d0;
syscall(__NR_readv, /*fd=*/r[7], /*vec=*/0x2000000000c0ul, /*vlen=*/0x400ul);
// openat$auto_hsr_node_table_fops_ arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 73 79 73 2f 6b 65 72 6e 65 6c 2f 64 65 62 75 67 2f 68 73 72 2f 68 73 72 30 2f 6e 6f 64 65 5f 74 61 62 6c 65 00} (length 0x26)
// }
// flags: open_flags = 0x100 (4 bytes)
// mode: const = 0x0 (2 bytes)
// ]
// returns fd_hsr_node_table_fops_
memcpy((void*)0x200000000100, "/sys/kernel/debug/hsr/hsr0/node_table\000", 38);
syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000100ul, /*flags=O_NOCTTY*/0x100, /*mode=*/0);
for (int i = 0; i < 32; i++) {
syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000100ul, /*flags=O_NOCTTY*/0x100, /*mode=*/0);
}
return 0;
}
]