Tang-ZW

Untitled

Feb 3rd, 2026
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 19.29 KB | None | 0 0
  1. // autogenerated by syzkaller (https://github.com/google/syzkaller)
  2.  
  3. #define _GNU_SOURCE
  4.  
  5. #include <dirent.h>
  6. #include <endian.h>
  7. #include <errno.h>
  8. #include <fcntl.h>
  9. #include <pthread.h>
  10. #include <signal.h>
  11. #include <stdarg.h>
  12. #include <stdbool.h>
  13. #include <stdint.h>
  14. #include <stdio.h>
  15. #include <stdlib.h>
  16. #include <string.h>
  17. #include <sys/mman.h>
  18. #include <sys/prctl.h>
  19. #include <sys/stat.h>
  20. #include <sys/syscall.h>
  21. #include <sys/types.h>
  22. #include <sys/wait.h>
  23. #include <time.h>
  24. #include <unistd.h>
  25.  
  26. #include <linux/futex.h>
  27.  
  28. #ifndef __NR_io_uring_enter
  29. #define __NR_io_uring_enter 426
  30. #endif
  31. #ifndef __NR_io_uring_setup
  32. #define __NR_io_uring_setup 425
  33. #endif
  34.  
  35. static void sleep_ms(uint64_t ms)
  36. {
  37. usleep(ms * 1000);
  38. }
  39.  
  40. static uint64_t current_time_ms(void)
  41. {
  42. struct timespec ts;
  43. if (clock_gettime(CLOCK_MONOTONIC, &ts))
  44. exit(1);
  45. return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
  46. }
  47.  
  48. static void thread_start(void* (*fn)(void*), void* arg)
  49. {
  50. pthread_t th;
  51. pthread_attr_t attr;
  52. pthread_attr_init(&attr);
  53. pthread_attr_setstacksize(&attr, 128 << 10);
  54. int i = 0;
  55. for (; i < 100; i++) {
  56. if (pthread_create(&th, &attr, fn, arg) == 0) {
  57. pthread_attr_destroy(&attr);
  58. return;
  59. }
  60. if (errno == EAGAIN) {
  61. usleep(50);
  62. continue;
  63. }
  64. break;
  65. }
  66. exit(1);
  67. }
  68.  
  69. #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off))
  70. #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \
  71. *(type*)(addr) = \
  72. htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \
  73. (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len))))
  74.  
  75. typedef struct {
  76. int state;
  77. } event_t;
  78.  
  79. static void event_init(event_t* ev)
  80. {
  81. ev->state = 0;
  82. }
  83.  
  84. static void event_reset(event_t* ev)
  85. {
  86. ev->state = 0;
  87. }
  88.  
  89. static void event_set(event_t* ev)
  90. {
  91. if (ev->state)
  92. exit(1);
  93. __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE);
  94. syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000);
  95. }
  96.  
  97. static void event_wait(event_t* ev)
  98. {
  99. while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
  100. syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0);
  101. }
  102.  
  103. static int event_isset(event_t* ev)
  104. {
  105. return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE);
  106. }
  107.  
  108. static int event_timedwait(event_t* ev, uint64_t timeout)
  109. {
  110. uint64_t start = current_time_ms();
  111. uint64_t now = start;
  112. for (;;) {
  113. uint64_t remain = timeout - (now - start);
  114. struct timespec ts;
  115. ts.tv_sec = remain / 1000;
  116. ts.tv_nsec = (remain % 1000) * 1000 * 1000;
  117. syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts);
  118. if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
  119. return 1;
  120. now = current_time_ms();
  121. if (now - start > timeout)
  122. return 0;
  123. }
  124. }
  125.  
  126. static bool write_file(const char* file, const char* what, ...)
  127. {
  128. char buf[1024];
  129. va_list args;
  130. va_start(args, what);
  131. vsnprintf(buf, sizeof(buf), what, args);
  132. va_end(args);
  133. buf[sizeof(buf) - 1] = 0;
  134. int len = strlen(buf);
  135. int fd = open(file, O_WRONLY | O_CLOEXEC);
  136. if (fd == -1)
  137. return false;
  138. if (write(fd, buf, len) != len) {
  139. int err = errno;
  140. close(fd);
  141. errno = err;
  142. return false;
  143. }
  144. close(fd);
  145. return true;
  146. }
  147.  
  148. #define SIZEOF_IO_URING_SQE 64
  149. #define SIZEOF_IO_URING_CQE 16
  150. #define SQ_HEAD_OFFSET 0
  151. #define SQ_TAIL_OFFSET 64
  152. #define SQ_RING_MASK_OFFSET 256
  153. #define SQ_RING_ENTRIES_OFFSET 264
  154. #define SQ_FLAGS_OFFSET 276
  155. #define SQ_DROPPED_OFFSET 272
  156. #define CQ_HEAD_OFFSET 128
  157. #define CQ_TAIL_OFFSET 192
  158. #define CQ_RING_MASK_OFFSET 260
  159. #define CQ_RING_ENTRIES_OFFSET 268
  160. #define CQ_RING_OVERFLOW_OFFSET 284
  161. #define CQ_FLAGS_OFFSET 280
  162. #define CQ_CQES_OFFSET 320
  163.  
  164. struct io_sqring_offsets {
  165. uint32_t head;
  166. uint32_t tail;
  167. uint32_t ring_mask;
  168. uint32_t ring_entries;
  169. uint32_t flags;
  170. uint32_t dropped;
  171. uint32_t array;
  172. uint32_t resv1;
  173. uint64_t resv2;
  174. };
  175.  
  176. struct io_cqring_offsets {
  177. uint32_t head;
  178. uint32_t tail;
  179. uint32_t ring_mask;
  180. uint32_t ring_entries;
  181. uint32_t overflow;
  182. uint32_t cqes;
  183. uint64_t resv[2];
  184. };
  185.  
  186. struct io_uring_params {
  187. uint32_t sq_entries;
  188. uint32_t cq_entries;
  189. uint32_t flags;
  190. uint32_t sq_thread_cpu;
  191. uint32_t sq_thread_idle;
  192. uint32_t features;
  193. uint32_t resv[4];
  194. struct io_sqring_offsets sq_off;
  195. struct io_cqring_offsets cq_off;
  196. };
  197.  
  198. #define IORING_OFF_SQ_RING 0
  199. #define IORING_OFF_SQES 0x10000000ULL
  200. #define IORING_SETUP_SQE128 (1U << 10)
  201. #define IORING_SETUP_CQE32 (1U << 11)
  202.  
  203. static long syz_io_uring_setup(volatile long a0, volatile long a1,
  204. volatile long a2, volatile long a3)
  205. {
  206. uint32_t entries = (uint32_t)a0;
  207. struct io_uring_params* setup_params = (struct io_uring_params*)a1;
  208. void** ring_ptr_out = (void**)a2;
  209. void** sqes_ptr_out = (void**)a3;
  210. setup_params->flags &= ~(IORING_SETUP_CQE32 | IORING_SETUP_SQE128);
  211. uint32_t fd_io_uring = syscall(__NR_io_uring_setup, entries, setup_params);
  212. uint32_t sq_ring_sz =
  213. setup_params->sq_off.array + setup_params->sq_entries * sizeof(uint32_t);
  214. uint32_t cq_ring_sz = setup_params->cq_off.cqes +
  215. setup_params->cq_entries * SIZEOF_IO_URING_CQE;
  216. uint32_t ring_sz = sq_ring_sz > cq_ring_sz ? sq_ring_sz : cq_ring_sz;
  217. *ring_ptr_out =
  218. mmap(0, ring_sz, PROT_READ | PROT_WRITE, MAP_SHARED | MAP_POPULATE,
  219. fd_io_uring, IORING_OFF_SQ_RING);
  220. uint32_t sqes_sz = setup_params->sq_entries * SIZEOF_IO_URING_SQE;
  221. *sqes_ptr_out = mmap(0, sqes_sz, PROT_READ | PROT_WRITE,
  222. MAP_SHARED | MAP_POPULATE, fd_io_uring, IORING_OFF_SQES);
  223. uint32_t* array =
  224. (uint32_t*)((uintptr_t)*ring_ptr_out + setup_params->sq_off.array);
  225. for (uint32_t index = 0; index < entries; index++)
  226. array[index] = index;
  227. return fd_io_uring;
  228. }
  229.  
  230. static void kill_and_wait(int pid, int* status)
  231. {
  232. kill(-pid, SIGKILL);
  233. kill(pid, SIGKILL);
  234. for (int i = 0; i < 100; i++) {
  235. if (waitpid(-1, status, WNOHANG | __WALL) == pid)
  236. return;
  237. usleep(1000);
  238. }
  239. DIR* dir = opendir("/sys/fs/fuse/connections");
  240. if (dir) {
  241. for (;;) {
  242. struct dirent* ent = readdir(dir);
  243. if (!ent)
  244. break;
  245. if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
  246. continue;
  247. char abort[300];
  248. snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort",
  249. ent->d_name);
  250. int fd = open(abort, O_WRONLY);
  251. if (fd == -1) {
  252. continue;
  253. }
  254. if (write(fd, abort, 1) < 0) {
  255. }
  256. close(fd);
  257. }
  258. closedir(dir);
  259. } else {
  260. }
  261. while (waitpid(-1, status, __WALL) != pid) {
  262. }
  263. }
  264.  
  265. static void setup_test()
  266. {
  267. prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  268. setpgrp();
  269. write_file("/proc/self/oom_score_adj", "1000");
  270. }
  271.  
  272. struct thread_t {
  273. int created, call;
  274. event_t ready, done;
  275. };
  276.  
  277. static struct thread_t threads[16];
  278. static void execute_call(int call);
  279. static int running;
  280.  
  281. static void* thr(void* arg)
  282. {
  283. struct thread_t* th = (struct thread_t*)arg;
  284. for (;;) {
  285. event_wait(&th->ready);
  286. event_reset(&th->ready);
  287. execute_call(th->call);
  288. __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED);
  289. event_set(&th->done);
  290. }
  291. return 0;
  292. }
  293.  
  294. static void execute_one(void)
  295. {
  296. if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {
  297. }
  298. int i, call, thread;
  299. for (call = 0; call < 3; call++) {
  300. for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0]));
  301. thread++) {
  302. struct thread_t* th = &threads[thread];
  303. if (!th->created) {
  304. th->created = 1;
  305. event_init(&th->ready);
  306. event_init(&th->done);
  307. event_set(&th->done);
  308. thread_start(thr, th);
  309. }
  310. if (!event_isset(&th->done))
  311. continue;
  312. event_reset(&th->done);
  313. th->call = call;
  314. __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED);
  315. event_set(&th->ready);
  316. event_timedwait(&th->done, 50);
  317. break;
  318. }
  319. }
  320. for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
  321. sleep_ms(1);
  322. }
  323.  
  324. static void execute_one(void);
  325.  
  326. #define WAIT_FLAGS __WALL
  327.  
  328. static void loop(void)
  329. {
  330. int iter = 0;
  331. for (;; iter++) {
  332. int pid = fork();
  333. if (pid < 0)
  334. exit(1);
  335. if (pid == 0) {
  336. setup_test();
  337. execute_one();
  338. exit(0);
  339. }
  340. int status = 0;
  341. uint64_t start = current_time_ms();
  342. for (;;) {
  343. sleep_ms(10);
  344. if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
  345. break;
  346. if (current_time_ms() - start < 5000)
  347. continue;
  348. kill_and_wait(pid, &status);
  349. break;
  350. }
  351. }
  352. }
  353.  
  354. uint64_t r[1] = {0xffffffffffffffff};
  355.  
  356. void execute_call(int call)
  357. {
  358. intptr_t res = 0;
  359. switch (call) {
  360. case 0:
  361. // syz_io_uring_setup arguments: [
  362. // entries: int32 = 0xf00 (4 bytes)
  363. // params: ptr[inout, io_uring_params] {
  364. // io_uring_params {
  365. // sq_entries: int32 = 0x0 (4 bytes)
  366. // cq_entries: int32 = 0x0 (4 bytes)
  367. // flags: io_uring_setup_flags = 0x10000 (4 bytes)
  368. // sq_thread_cpu: int32 = 0x0 (4 bytes)
  369. // sq_thread_idle: int32 = 0x30a (4 bytes)
  370. // features: int32 = 0x0 (4 bytes)
  371. // wq_fd: fd_io_uring (resource)
  372. // resv: buffer: {00 00 00 00 00 00 00 00 00 00 00 00} (length 0xc)
  373. // sq_off: array[int32] {
  374. // int32 = 0x0 (4 bytes)
  375. // int32 = 0x0 (4 bytes)
  376. // int32 = 0x0 (4 bytes)
  377. // int32 = 0x0 (4 bytes)
  378. // int32 = 0x0 (4 bytes)
  379. // int32 = 0x0 (4 bytes)
  380. // int32 = 0x0 (4 bytes)
  381. // int32 = 0x0 (4 bytes)
  382. // int32 = 0x0 (4 bytes)
  383. // int32 = 0x0 (4 bytes)
  384. // }
  385. // cq_off: array[int32] {
  386. // int32 = 0x0 (4 bytes)
  387. // int32 = 0x0 (4 bytes)
  388. // int32 = 0x0 (4 bytes)
  389. // int32 = 0x0 (4 bytes)
  390. // int32 = 0x0 (4 bytes)
  391. // int32 = 0x0 (4 bytes)
  392. // int32 = 0x0 (4 bytes)
  393. // int32 = 0x0 (4 bytes)
  394. // int32 = 0x0 (4 bytes)
  395. // int32 = 0x0 (4 bytes)
  396. // }
  397. // }
  398. // }
  399. // ring_ptr: ptr[out, ring_ptr] {
  400. // ring_ptr (resource)
  401. // }
  402. // sqes_ptr: ptr[out, sqes_ptr] {
  403. // sqes_ptr (resource)
  404. // }
  405. // ]
  406. // returns fd_io_uring
  407. *(uint32_t*)0x200000000084 = 0;
  408. *(uint32_t*)0x200000000088 = 0x10000;
  409. *(uint32_t*)0x20000000008c = 0;
  410. *(uint32_t*)0x200000000090 = 0x30a;
  411. *(uint32_t*)0x200000000098 = 0;
  412. memset((void*)0x20000000009c, 0, 12);
  413. res = -1;
  414. res = syz_io_uring_setup(/*entries=*/0xf00, /*params=*/0x200000000080,
  415. /*ring_ptr=*/0x2000000004c0,
  416. /*sqes_ptr=*/0x200000000500);
  417. if (res != -1)
  418. r[0] = res;
  419. break;
  420. case 1:
  421. // io_uring_enter arguments: [
  422. // fd: fd_io_uring (resource)
  423. // to_submit: int32 = 0x1 (4 bytes)
  424. // min_complete: int32 = 0xffffffff (4 bytes)
  425. // flags: io_uring_enter_flags = 0x61 (8 bytes)
  426. // sigmask: nil
  427. // size: len = 0xe (8 bytes)
  428. // ]
  429. syscall(
  430. __NR_io_uring_enter, /*fd=*/r[0], /*to_submit=*/1,
  431. /*min_complete=*/(intptr_t)-1,
  432. /*flags=IORING_ENTER_EXT_ARG_REG|IORING_ENTER_ABS_TIMER|IORING_ENTER_GETEVENTS*/
  433. 0x61ul, /*sigmask=*/0ul, /*size=*/0xeul);
  434. break;
  435. case 2:
  436. // perf_event_open$cgroup arguments: [
  437. // attr: ptr[in, perf_event_attr] {
  438. // perf_event_attr {
  439. // type: perf_event_type = 0x8 (4 bytes)
  440. // size: len = 0x80 (4 bytes)
  441. // config0: int8 = 0x4 (1 bytes)
  442. // config1: int8 = 0x0 (1 bytes)
  443. // config2: int8 = 0x0 (1 bytes)
  444. // config3: int8 = 0x0 (1 bytes)
  445. // config4: const = 0x0 (4 bytes)
  446. // sample_freq: int64 = 0x0 (8 bytes)
  447. // sample_type: perf_sample_type = 0x0 (8 bytes)
  448. // read_format: perf_read_format = 0x0 (8 bytes)
  449. // disabled: int64 = 0x0 (0 bytes)
  450. // inherit: int64 = 0x0 (0 bytes)
  451. // pinned: int64 = 0x0 (0 bytes)
  452. // exclusive: int64 = 0x0 (0 bytes)
  453. // exclude_user: int64 = 0x0 (0 bytes)
  454. // exclude_kernel: int64 = 0x0 (0 bytes)
  455. // exclude_hv: int64 = 0x0 (0 bytes)
  456. // exclude_idle: int64 = 0x0 (0 bytes)
  457. // mmap: int64 = 0x0 (0 bytes)
  458. // comm: int64 = 0x0 (0 bytes)
  459. // freq: int64 = 0x0 (0 bytes)
  460. // inherit_stat: int64 = 0x0 (0 bytes)
  461. // enable_on_exec: int64 = 0x0 (0 bytes)
  462. // task: int64 = 0x0 (0 bytes)
  463. // watermark: int64 = 0x0 (0 bytes)
  464. // precise_ip: int64 = 0x0 (0 bytes)
  465. // mmap_data: int64 = 0x0 (0 bytes)
  466. // sample_id_all: int64 = 0x0 (0 bytes)
  467. // exclude_host: int64 = 0x0 (0 bytes)
  468. // exclude_guest: int64 = 0x0 (0 bytes)
  469. // exclude_callchain_kernel: int64 = 0x0 (0 bytes)
  470. // exclude_callchain_user: int64 = 0x0 (0 bytes)
  471. // mmap2: int64 = 0x0 (0 bytes)
  472. // comm_exec: int64 = 0x0 (0 bytes)
  473. // use_clockid: int64 = 0x0 (0 bytes)
  474. // context_switch: int64 = 0x0 (0 bytes)
  475. // write_backward: int64 = 0x0 (0 bytes)
  476. // namespaces: int64 = 0x0 (0 bytes)
  477. // ksymbol: int64 = 0x0 (0 bytes)
  478. // bpf_event: int64 = 0x0 (0 bytes)
  479. // aux_output: int64 = 0x0 (0 bytes)
  480. // cgroup: int64 = 0x0 (0 bytes)
  481. // text_poke: int64 = 0x0 (0 bytes)
  482. // build_id: int64 = 0x0 (0 bytes)
  483. // inherit_thread: int64 = 0x0 (0 bytes)
  484. // remove_on_exec: int64 = 0x0 (0 bytes)
  485. // sigtrap: int64 = 0x0 (0 bytes)
  486. // __reserved_1: const = 0x0 (8 bytes)
  487. // wakeup_events: int32 = 0x7 (4 bytes)
  488. // bp_type: perf_bp_type = 0x0 (4 bytes)
  489. // bp_config: union perf_bp_config {
  490. // perf_bp: perf_bp {
  491. // bp_addr: nil
  492. // bp_len: perf_bp_lens = 0xffffffff83f30a50 (8 bytes)
  493. // }
  494. // }
  495. // branch_sample_type: perf_branch_sample_type = 0x0 (8 bytes)
  496. // sample_regs_user: int64 = 0x800 (8 bytes)
  497. // sample_stack_user: int32 = 0x7 (4 bytes)
  498. // clockid: clock_type = 0x6 (4 bytes)
  499. // sample_regs_intr: int64 = 0x0 (8 bytes)
  500. // aux_watermark: int32 = 0x101 (4 bytes)
  501. // sample_max_stack: int16 = 0x0 (2 bytes)
  502. // __reserved_2: const = 0x0 (2 bytes)
  503. // aux_sample_size: int32 = 0x0 (4 bytes)
  504. // __reserved_3: const = 0x0 (4 bytes)
  505. // sig_data: int64 = 0x5 (8 bytes)
  506. // }
  507. // }
  508. // fd: fd_cgroup (resource)
  509. // cpu: intptr = 0x0 (8 bytes)
  510. // group: fd_perf (resource)
  511. // flags: perf_flags_cgroup = 0x0 (8 bytes)
  512. // ]
  513. // returns fd_perf
  514. *(uint32_t*)0x200000000000 = 8;
  515. *(uint32_t*)0x200000000004 = 0x80;
  516. *(uint8_t*)0x200000000008 = 4;
  517. *(uint8_t*)0x200000000009 = 0;
  518. *(uint8_t*)0x20000000000a = 0;
  519. *(uint8_t*)0x20000000000b = 0;
  520. *(uint32_t*)0x20000000000c = 0;
  521. *(uint64_t*)0x200000000010 = 0;
  522. *(uint64_t*)0x200000000018 = 0;
  523. *(uint64_t*)0x200000000020 = 0;
  524. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 0, 1);
  525. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 1, 1);
  526. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 2, 1);
  527. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 3, 1);
  528. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 4, 1);
  529. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 5, 1);
  530. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 6, 1);
  531. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 7, 1);
  532. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 8, 1);
  533. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 9, 1);
  534. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 10, 1);
  535. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 11, 1);
  536. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 12, 1);
  537. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 13, 1);
  538. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 14, 1);
  539. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 15, 2);
  540. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 17, 1);
  541. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 18, 1);
  542. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 19, 1);
  543. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 20, 1);
  544. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 21, 1);
  545. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 22, 1);
  546. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 23, 1);
  547. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 24, 1);
  548. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 25, 1);
  549. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 26, 1);
  550. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 27, 1);
  551. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 28, 1);
  552. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 29, 1);
  553. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 30, 1);
  554. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 31, 1);
  555. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 32, 1);
  556. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 33, 1);
  557. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 34, 1);
  558. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 35, 1);
  559. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 36, 1);
  560. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 37, 1);
  561. STORE_BY_BITMASK(uint64_t, , 0x200000000028, 0, 38, 26);
  562. *(uint32_t*)0x200000000030 = 7;
  563. *(uint32_t*)0x200000000034 = 0;
  564. *(uint64_t*)0x200000000038 = 0;
  565. *(uint64_t*)0x200000000040 = 0xffffffff83f30a50;
  566. *(uint64_t*)0x200000000048 = 0;
  567. *(uint64_t*)0x200000000050 = 0x800;
  568. *(uint32_t*)0x200000000058 = 7;
  569. *(uint32_t*)0x20000000005c = 6;
  570. *(uint64_t*)0x200000000060 = 0;
  571. *(uint32_t*)0x200000000068 = 0x101;
  572. *(uint16_t*)0x20000000006c = 0;
  573. *(uint16_t*)0x20000000006e = 0;
  574. *(uint32_t*)0x200000000070 = 0;
  575. *(uint32_t*)0x200000000074 = 0;
  576. *(uint64_t*)0x200000000078 = 5;
  577. syscall(__NR_perf_event_open, /*attr=*/0x200000000000ul,
  578. /*fd=*/(intptr_t)-1, /*cpu=*/0ul, /*group=*/(intptr_t)-1,
  579. /*flags=*/0ul);
  580. break;
  581. }
  582. }
  583. int main(void)
  584. {
  585. syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
  586. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  587. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  588. syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul,
  589. /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
  590. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  591. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  592. syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
  593. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  594. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  595. const char* reason;
  596. (void)reason;
  597. loop();
  598. return 0;
  599. }
  600.  
Advertisement
Add Comment
Please, Sign In to add comment