map[SimplifiedCRepro:// autogenerated by syzkaller (https://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <endian.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>
#ifndef __NR_memfd_create
#define __NR_memfd_create 319
#endif
uint64_t r[2] = {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)) {}
// openat$udambuf arguments: [
// fd: const = 0xffffffffffffff9c (8 bytes)
// file: ptr[in, buffer] {
// buffer: {2f 64 65 76 2f 75 64 6d 61 62 75 66 00} (length 0xd)
// }
// flags: const = 0x2 (4 bytes)
// ]
// returns fd_udambuf
memcpy((void*)0x200000000040, "/dev/udmabuf\000", 13);
res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x200000000040ul, /*flags=*/2, 0);
if (res != -1)
r[0] = res;
// memfd_create arguments: [
// name: ptr[in, buffer] {
// buffer: {79 10 35 fb f7 75 83 25 3a 72 c2 b9 78 a4 71 c1 ea 5f 8c 5a 37 cd 61 9b 11 58 0e a1 cf 1a 98 53 37 c9 00 00 00 00 00 00 00 00 00 00 00 00 00} (length 0x2f)
// }
// flags: memfd_flags = 0x7 (8 bytes)
// ]
// returns fd_memfd
memcpy((void*)0x200000000140, "... [truncated large byte array] ...", 47);
res = syscall(__NR_memfd_create, /*name=*/0x200000000140ul, /*flags=MFD_HUGETLB|MFD_ALLOW_SEALING|MFD_CLOEXEC*/7ul);
if (res != -1)
r[1] = res;
// fcntl$addseals arguments: [
// fd: fd (resource)
// cmd: const = 0x409 (8 bytes)
// seals: seal_types = 0x7 (8 bytes)
// ]
syscall(__NR_fcntl, /*fd=*/r[1], /*cmd=*/0x409ul, /*seals=F_SEAL_GROW|F_SEAL_SHRINK|F_SEAL_SEAL*/7ul);
// ioctl$UDMABUF_CREATE arguments: [
// fd: fd_udambuf (resource)
// cmd: const = 0x40187542 (4 bytes)
// arg: ptr[in, udmabuf_create] {
// udmabuf_create {
// memfd: fd_memfd (resource)
// flags: int32 = 0x0 (4 bytes)
// offset: udmabuf_offset_size = 0x0 (8 bytes)
// size: udmabuf_offset_size = 0x8000 (8 bytes)
// }
// }
// ]
// returns fd_dma_buf
*(uint32_t*)0x200000000000 = r[1];
*(uint32_t*)0x200000000004 = 0;
*(uint64_t*)0x200000000008 = 0;
*(uint64_t*)0x200000000010 = 0x8000;
syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40187542, /*arg=*/0x200000000000ul);
return 0;
}
]