blob: a070a22e881b1f8b9b7fc7661744f67cf85b525f [file] [log] [blame]
// possible deadlock in process_measurement
// https://syzkaller.appspot.com/bug?id=aad04cfa9fddcc5588f8b28ddf739f9a3ebf5874
// status:invalid
// 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/syscall.h>
#include <sys/types.h>
#include <unistd.h>
#ifndef __NR_pkey_mprotect
#define __NR_pkey_mprotect 329
#endif
uint64_t r[2] = {0xffffffffffffffff, 0xffffffffffffffff};
int main(void)
{
syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0);
intptr_t res = 0;
memcpy((void*)0x200000c0, "memory.events\000", 14);
syscall(__NR_openat, 0xffffff9c, 0x200000c0, 0x26e1, 0);
memcpy((void*)0x200002c0, "memory.events\000", 14);
res = syscall(__NR_openat, 0xffffff9c, 0x200002c0, 0x7a05, 0x1700);
if (res != -1)
r[0] = res;
sprintf((char*)0x20000000, "0x%016llx", (long long)0);
syscall(__NR_write, r[0], 0x20000000, 0xfffffea6);
memcpy((void*)0x2000fffa, "./bus\000", 6);
res = syscall(__NR_open, 0x2000fffa, 0x141042, 0);
if (res != -1)
r[1] = res;
syscall(__NR_mmap, 0x20001000, 0xa000, 0, 0x11, r[1], 0);
syscall(__NR_pkey_mprotect, 0x20008000, 0x2000, 4, -1);
syscall(__NR_remap_file_pages, 0x20007000, 0x4000, 0, 0, 0);
return 0;
}