Tang-ZW

Untitled

Mar 8th, 2026
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 33.84 KB | None | 0 0
  1. // autogenerated by syzkaller (https://github.com/google/syzkaller)
  2.  
  3. #define _GNU_SOURCE
  4.  
  5. #include <endian.h>
  6. #include <errno.h>
  7. #include <fcntl.h>
  8. #include <pthread.h>
  9. #include <setjmp.h>
  10. #include <stdbool.h>
  11. #include <stddef.h>
  12. #include <stdint.h>
  13. #include <stdio.h>
  14. #include <stdlib.h>
  15. #include <string.h>
  16. #include <sys/ioctl.h>
  17. #include <sys/mman.h>
  18. #include <sys/mount.h>
  19. #include <sys/stat.h>
  20. #include <sys/syscall.h>
  21. #include <sys/types.h>
  22. #include <time.h>
  23. #include <unistd.h>
  24.  
  25. #include <linux/futex.h>
  26. #include <linux/loop.h>
  27.  
  28. #ifndef __NR_memfd_create
  29. #define __NR_memfd_create 319
  30. #endif
  31.  
  32. static unsigned long long procid;
  33.  
  34. static void sleep_ms(uint64_t ms)
  35. {
  36. usleep(ms * 1000);
  37. }
  38.  
  39. static uint64_t current_time_ms(void)
  40. {
  41. struct timespec ts;
  42. if (clock_gettime(CLOCK_MONOTONIC, &ts))
  43. exit(1);
  44. return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
  45. }
  46.  
  47. static void thread_start(void* (*fn)(void*), void* arg)
  48. {
  49. pthread_t th;
  50. pthread_attr_t attr;
  51. pthread_attr_init(&attr);
  52. pthread_attr_setstacksize(&attr, 128 << 10);
  53. int i = 0;
  54. for (; i < 100; i++) {
  55. if (pthread_create(&th, &attr, fn, arg) == 0) {
  56. pthread_attr_destroy(&attr);
  57. return;
  58. }
  59. if (errno == EAGAIN) {
  60. usleep(50);
  61. continue;
  62. }
  63. break;
  64. }
  65. exit(1);
  66. }
  67.  
  68. typedef struct {
  69. int state;
  70. } event_t;
  71.  
  72. static void event_init(event_t* ev)
  73. {
  74. ev->state = 0;
  75. }
  76.  
  77. static void event_reset(event_t* ev)
  78. {
  79. ev->state = 0;
  80. }
  81.  
  82. static void event_set(event_t* ev)
  83. {
  84. if (ev->state)
  85. exit(1);
  86. __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE);
  87. syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000);
  88. }
  89.  
  90. static void event_wait(event_t* ev)
  91. {
  92. while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
  93. syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0);
  94. }
  95.  
  96. static int event_isset(event_t* ev)
  97. {
  98. return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE);
  99. }
  100.  
  101. static int event_timedwait(event_t* ev, uint64_t timeout)
  102. {
  103. uint64_t start = current_time_ms();
  104. uint64_t now = start;
  105. for (;;) {
  106. uint64_t remain = timeout - (now - start);
  107. struct timespec ts;
  108. ts.tv_sec = remain / 1000;
  109. ts.tv_nsec = (remain % 1000) * 1000 * 1000;
  110. syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts);
  111. if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
  112. return 1;
  113. now = current_time_ms();
  114. if (now - start > timeout)
  115. return 0;
  116. }
  117. }
  118.  
  119. //% This code is derived from puff.{c,h}, found in the zlib development. The
  120. //% original files come with the following copyright notice:
  121.  
  122. //% Copyright (C) 2002-2013 Mark Adler, all rights reserved
  123. //% version 2.3, 21 Jan 2013
  124. //% This software is provided 'as-is', without any express or implied
  125. //% warranty. In no event will the author be held liable for any damages
  126. //% arising from the use of this software.
  127. //% Permission is granted to anyone to use this software for any purpose,
  128. //% including commercial applications, and to alter it and redistribute it
  129. //% freely, subject to the following restrictions:
  130. //% 1. The origin of this software must not be misrepresented; you must not
  131. //% claim that you wrote the original software. If you use this software
  132. //% in a product, an acknowledgment in the product documentation would be
  133. //% appreciated but is not required.
  134. //% 2. Altered source versions must be plainly marked as such, and must not be
  135. //% misrepresented as being the original software.
  136. //% 3. This notice may not be removed or altered from any source distribution.
  137. //% Mark Adler [email protected]
  138.  
  139. //% BEGIN CODE DERIVED FROM puff.{c,h}
  140.  
  141. #define MAXBITS 15
  142. #define MAXLCODES 286
  143. #define MAXDCODES 30
  144. #define MAXCODES (MAXLCODES + MAXDCODES)
  145. #define FIXLCODES 288
  146.  
  147. struct puff_state {
  148. unsigned char* out;
  149. unsigned long outlen;
  150. unsigned long outcnt;
  151. const unsigned char* in;
  152. unsigned long inlen;
  153. unsigned long incnt;
  154. int bitbuf;
  155. int bitcnt;
  156. jmp_buf env;
  157. };
  158. static int puff_bits(struct puff_state* s, int need)
  159. {
  160. long val = s->bitbuf;
  161. while (s->bitcnt < need) {
  162. if (s->incnt == s->inlen)
  163. longjmp(s->env, 1);
  164. val |= (long)(s->in[s->incnt++]) << s->bitcnt;
  165. s->bitcnt += 8;
  166. }
  167. s->bitbuf = (int)(val >> need);
  168. s->bitcnt -= need;
  169. return (int)(val & ((1L << need) - 1));
  170. }
  171. static int puff_stored(struct puff_state* s)
  172. {
  173. s->bitbuf = 0;
  174. s->bitcnt = 0;
  175. if (s->incnt + 4 > s->inlen)
  176. return 2;
  177. unsigned len = s->in[s->incnt++];
  178. len |= s->in[s->incnt++] << 8;
  179. if (s->in[s->incnt++] != (~len & 0xff) ||
  180. s->in[s->incnt++] != ((~len >> 8) & 0xff))
  181. return -2;
  182. if (s->incnt + len > s->inlen)
  183. return 2;
  184. if (s->outcnt + len > s->outlen)
  185. return 1;
  186. for (; len--; s->outcnt++, s->incnt++) {
  187. if (s->in[s->incnt])
  188. s->out[s->outcnt] = s->in[s->incnt];
  189. }
  190. return 0;
  191. }
  192. struct puff_huffman {
  193. short* count;
  194. short* symbol;
  195. };
  196. static int puff_decode(struct puff_state* s, const struct puff_huffman* h)
  197. {
  198. int first = 0;
  199. int index = 0;
  200. int bitbuf = s->bitbuf;
  201. int left = s->bitcnt;
  202. int code = first = index = 0;
  203. int len = 1;
  204. short* next = h->count + 1;
  205. while (1) {
  206. while (left--) {
  207. code |= bitbuf & 1;
  208. bitbuf >>= 1;
  209. int count = *next++;
  210. if (code - count < first) {
  211. s->bitbuf = bitbuf;
  212. s->bitcnt = (s->bitcnt - len) & 7;
  213. return h->symbol[index + (code - first)];
  214. }
  215. index += count;
  216. first += count;
  217. first <<= 1;
  218. code <<= 1;
  219. len++;
  220. }
  221. left = (MAXBITS + 1) - len;
  222. if (left == 0)
  223. break;
  224. if (s->incnt == s->inlen)
  225. longjmp(s->env, 1);
  226. bitbuf = s->in[s->incnt++];
  227. if (left > 8)
  228. left = 8;
  229. }
  230. return -10;
  231. }
  232. static int puff_construct(struct puff_huffman* h, const short* length, int n)
  233. {
  234. int len;
  235. for (len = 0; len <= MAXBITS; len++)
  236. h->count[len] = 0;
  237. int symbol;
  238. for (symbol = 0; symbol < n; symbol++)
  239. (h->count[length[symbol]])++;
  240. if (h->count[0] == n)
  241. return 0;
  242. int left = 1;
  243. for (len = 1; len <= MAXBITS; len++) {
  244. left <<= 1;
  245. left -= h->count[len];
  246. if (left < 0)
  247. return left;
  248. }
  249. short offs[MAXBITS + 1];
  250. offs[1] = 0;
  251. for (len = 1; len < MAXBITS; len++)
  252. offs[len + 1] = offs[len] + h->count[len];
  253. for (symbol = 0; symbol < n; symbol++)
  254. if (length[symbol] != 0)
  255. h->symbol[offs[length[symbol]]++] = symbol;
  256. return left;
  257. }
  258. static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode,
  259. const struct puff_huffman* distcode)
  260. {
  261. static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
  262. 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
  263. 67, 83, 99, 115, 131, 163, 195, 227, 258};
  264. static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2,
  265. 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
  266. static const short dists[30] = {
  267. 1, 2, 3, 4, 5, 7, 9, 13, 17, 25,
  268. 33, 49, 65, 97, 129, 193, 257, 385, 513, 769,
  269. 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577};
  270. static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3,
  271. 4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
  272. 9, 9, 10, 10, 11, 11, 12, 12, 13, 13};
  273. int symbol;
  274. do {
  275. symbol = puff_decode(s, lencode);
  276. if (symbol < 0)
  277. return symbol;
  278. if (symbol < 256) {
  279. if (s->outcnt == s->outlen)
  280. return 1;
  281. if (symbol)
  282. s->out[s->outcnt] = symbol;
  283. s->outcnt++;
  284. } else if (symbol > 256) {
  285. symbol -= 257;
  286. if (symbol >= 29)
  287. return -10;
  288. int len = lens[symbol] + puff_bits(s, lext[symbol]);
  289. symbol = puff_decode(s, distcode);
  290. if (symbol < 0)
  291. return symbol;
  292. unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]);
  293. if (dist > s->outcnt)
  294. return -11;
  295. if (s->outcnt + len > s->outlen)
  296. return 1;
  297. while (len--) {
  298. if (dist <= s->outcnt && s->out[s->outcnt - dist])
  299. s->out[s->outcnt] = s->out[s->outcnt - dist];
  300. s->outcnt++;
  301. }
  302. }
  303. } while (symbol != 256);
  304. return 0;
  305. }
  306. static int puff_fixed(struct puff_state* s)
  307. {
  308. static int virgin = 1;
  309. static short lencnt[MAXBITS + 1], lensym[FIXLCODES];
  310. static short distcnt[MAXBITS + 1], distsym[MAXDCODES];
  311. static struct puff_huffman lencode, distcode;
  312. if (virgin) {
  313. lencode.count = lencnt;
  314. lencode.symbol = lensym;
  315. distcode.count = distcnt;
  316. distcode.symbol = distsym;
  317. short lengths[FIXLCODES];
  318. int symbol;
  319. for (symbol = 0; symbol < 144; symbol++)
  320. lengths[symbol] = 8;
  321. for (; symbol < 256; symbol++)
  322. lengths[symbol] = 9;
  323. for (; symbol < 280; symbol++)
  324. lengths[symbol] = 7;
  325. for (; symbol < FIXLCODES; symbol++)
  326. lengths[symbol] = 8;
  327. puff_construct(&lencode, lengths, FIXLCODES);
  328. for (symbol = 0; symbol < MAXDCODES; symbol++)
  329. lengths[symbol] = 5;
  330. puff_construct(&distcode, lengths, MAXDCODES);
  331. virgin = 0;
  332. }
  333. return puff_codes(s, &lencode, &distcode);
  334. }
  335. static int puff_dynamic(struct puff_state* s)
  336. {
  337. static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
  338. 11, 4, 12, 3, 13, 2, 14, 1, 15};
  339. int nlen = puff_bits(s, 5) + 257;
  340. int ndist = puff_bits(s, 5) + 1;
  341. int ncode = puff_bits(s, 4) + 4;
  342. if (nlen > MAXLCODES || ndist > MAXDCODES)
  343. return -3;
  344. short lengths[MAXCODES];
  345. int index;
  346. for (index = 0; index < ncode; index++)
  347. lengths[order[index]] = puff_bits(s, 3);
  348. for (; index < 19; index++)
  349. lengths[order[index]] = 0;
  350. short lencnt[MAXBITS + 1], lensym[MAXLCODES];
  351. struct puff_huffman lencode = {lencnt, lensym};
  352. int err = puff_construct(&lencode, lengths, 19);
  353. if (err != 0)
  354. return -4;
  355. index = 0;
  356. while (index < nlen + ndist) {
  357. int symbol;
  358. int len;
  359. symbol = puff_decode(s, &lencode);
  360. if (symbol < 0)
  361. return symbol;
  362. if (symbol < 16)
  363. lengths[index++] = symbol;
  364. else {
  365. len = 0;
  366. if (symbol == 16) {
  367. if (index == 0)
  368. return -5;
  369. len = lengths[index - 1];
  370. symbol = 3 + puff_bits(s, 2);
  371. } else if (symbol == 17)
  372. symbol = 3 + puff_bits(s, 3);
  373. else
  374. symbol = 11 + puff_bits(s, 7);
  375. if (index + symbol > nlen + ndist)
  376. return -6;
  377. while (symbol--)
  378. lengths[index++] = len;
  379. }
  380. }
  381. if (lengths[256] == 0)
  382. return -9;
  383. err = puff_construct(&lencode, lengths, nlen);
  384. if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
  385. return -7;
  386. short distcnt[MAXBITS + 1], distsym[MAXDCODES];
  387. struct puff_huffman distcode = {distcnt, distsym};
  388. err = puff_construct(&distcode, lengths + nlen, ndist);
  389. if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
  390. return -8;
  391. return puff_codes(s, &lencode, &distcode);
  392. }
  393. static int puff(unsigned char* dest, unsigned long* destlen,
  394. const unsigned char* source, unsigned long sourcelen)
  395. {
  396. struct puff_state s = {
  397. .out = dest,
  398. .outlen = *destlen,
  399. .outcnt = 0,
  400. .in = source,
  401. .inlen = sourcelen,
  402. .incnt = 0,
  403. .bitbuf = 0,
  404. .bitcnt = 0,
  405. };
  406. int err;
  407. if (setjmp(s.env) != 0)
  408. err = 2;
  409. else {
  410. int last;
  411. do {
  412. last = puff_bits(&s, 1);
  413. int type = puff_bits(&s, 2);
  414. err = type == 0 ? puff_stored(&s)
  415. : (type == 1 ? puff_fixed(&s)
  416. : (type == 2 ? puff_dynamic(&s) : -1));
  417. if (err != 0)
  418. break;
  419. } while (!last);
  420. }
  421. *destlen = s.outcnt;
  422. return err;
  423. }
  424.  
  425. //% END CODE DERIVED FROM puff.{c,h}
  426.  
  427. #define ZLIB_HEADER_WIDTH 2
  428.  
  429. static int puff_zlib_to_file(const unsigned char* source,
  430. unsigned long sourcelen, int dest_fd)
  431. {
  432. if (sourcelen < ZLIB_HEADER_WIDTH)
  433. return 0;
  434. source += ZLIB_HEADER_WIDTH;
  435. sourcelen -= ZLIB_HEADER_WIDTH;
  436. const unsigned long max_destlen = 132 << 20;
  437. void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ,
  438. MAP_PRIVATE | MAP_ANON, -1, 0);
  439. if (ret == MAP_FAILED)
  440. return -1;
  441. unsigned char* dest = (unsigned char*)ret;
  442. unsigned long destlen = max_destlen;
  443. int err = puff(dest, &destlen, source, sourcelen);
  444. if (err) {
  445. munmap(dest, max_destlen);
  446. errno = -err;
  447. return -1;
  448. }
  449. if (write(dest_fd, dest, destlen) != (ssize_t)destlen) {
  450. munmap(dest, max_destlen);
  451. return -1;
  452. }
  453. return munmap(dest, max_destlen);
  454. }
  455.  
  456. static int setup_loop_device(unsigned char* data, unsigned long size,
  457. const char* loopname, int* loopfd_p)
  458. {
  459. int err = 0, loopfd = -1;
  460. int memfd = syscall(__NR_memfd_create, "syzkaller", 0);
  461. if (memfd == -1) {
  462. err = errno;
  463. goto error;
  464. }
  465. if (puff_zlib_to_file(data, size, memfd)) {
  466. err = errno;
  467. goto error_close_memfd;
  468. }
  469. loopfd = open(loopname, O_RDWR);
  470. if (loopfd == -1) {
  471. err = errno;
  472. goto error_close_memfd;
  473. }
  474. if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
  475. if (errno != EBUSY) {
  476. err = errno;
  477. goto error_close_loop;
  478. }
  479. ioctl(loopfd, LOOP_CLR_FD, 0);
  480. usleep(1000);
  481. if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
  482. err = errno;
  483. goto error_close_loop;
  484. }
  485. }
  486. close(memfd);
  487. *loopfd_p = loopfd;
  488. return 0;
  489.  
  490. error_close_loop:
  491. close(loopfd);
  492. error_close_memfd:
  493. close(memfd);
  494. error:
  495. errno = err;
  496. return -1;
  497. }
  498.  
  499. static void reset_loop_device(const char* loopname)
  500. {
  501. int loopfd = open(loopname, O_RDWR);
  502. if (loopfd == -1) {
  503. return;
  504. }
  505. if (ioctl(loopfd, LOOP_CLR_FD, 0)) {
  506. }
  507. close(loopfd);
  508. }
  509.  
  510. static long syz_mount_image(volatile long fsarg, volatile long dir,
  511. volatile long flags, volatile long optsarg,
  512. volatile long change_dir,
  513. volatile unsigned long size, volatile long image)
  514. {
  515. unsigned char* data = (unsigned char*)image;
  516. int res = -1, err = 0, need_loop_device = !!size;
  517. char* mount_opts = (char*)optsarg;
  518. char* target = (char*)dir;
  519. char* fs = (char*)fsarg;
  520. char* source = NULL;
  521. char loopname[64];
  522. if (need_loop_device) {
  523. int loopfd;
  524. memset(loopname, 0, sizeof(loopname));
  525. snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
  526. if (setup_loop_device(data, size, loopname, &loopfd) == -1)
  527. return -1;
  528. close(loopfd);
  529. source = loopname;
  530. }
  531. mkdir(target, 0777);
  532. char opts[256];
  533. memset(opts, 0, sizeof(opts));
  534. if (strlen(mount_opts) > (sizeof(opts) - 32)) {
  535. }
  536. strncpy(opts, mount_opts, sizeof(opts) - 32);
  537. if (strcmp(fs, "iso9660") == 0) {
  538. flags |= MS_RDONLY;
  539. } else if (strncmp(fs, "ext", 3) == 0) {
  540. bool has_remount_ro = false;
  541. char* remount_ro_start = strstr(opts, "errors=remount-ro");
  542. if (remount_ro_start != NULL) {
  543. char after = *(remount_ro_start + strlen("errors=remount-ro"));
  544. char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1);
  545. has_remount_ro = ((before == '\0' || before == ',') &&
  546. (after == '\0' || after == ','));
  547. }
  548. if (strstr(opts, "errors=panic") || !has_remount_ro)
  549. strcat(opts, ",errors=continue");
  550. } else if (strcmp(fs, "xfs") == 0) {
  551. strcat(opts, ",nouuid");
  552. } else if (strncmp(fs, "gfs2", 4) == 0 &&
  553. (strstr(opts, "errors=panic") || strstr(opts, "debug"))) {
  554. strcat(opts, ",errors=withdraw");
  555. }
  556. res = mount(source, target, fs, flags, opts);
  557. if (res == -1) {
  558. err = errno;
  559. goto error_clear_loop;
  560. }
  561. res = open(target, O_RDONLY | O_DIRECTORY);
  562. if (res == -1) {
  563. err = errno;
  564. goto error_clear_loop;
  565. }
  566. if (change_dir) {
  567. res = chdir(target);
  568. if (res == -1) {
  569. err = errno;
  570. }
  571. }
  572.  
  573. error_clear_loop:
  574. if (need_loop_device)
  575. reset_loop_device(loopname);
  576. errno = err;
  577. return res;
  578. }
  579.  
  580. struct thread_t {
  581. int created, call;
  582. event_t ready, done;
  583. };
  584.  
  585. static struct thread_t threads[16];
  586. static void execute_call(int call);
  587. static int running;
  588.  
  589. static void* thr(void* arg)
  590. {
  591. struct thread_t* th = (struct thread_t*)arg;
  592. for (;;) {
  593. event_wait(&th->ready);
  594. event_reset(&th->ready);
  595. execute_call(th->call);
  596. __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED);
  597. event_set(&th->done);
  598. }
  599. return 0;
  600. }
  601.  
  602. static void loop(void)
  603. {
  604. if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {
  605. }
  606. int i, call, thread;
  607. for (call = 0; call < 2; call++) {
  608. for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0]));
  609. thread++) {
  610. struct thread_t* th = &threads[thread];
  611. if (!th->created) {
  612. th->created = 1;
  613. event_init(&th->ready);
  614. event_init(&th->done);
  615. event_set(&th->done);
  616. thread_start(thr, th);
  617. }
  618. if (!event_isset(&th->done))
  619. continue;
  620. event_reset(&th->done);
  621. th->call = call;
  622. __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED);
  623. event_set(&th->ready);
  624. if (call == 0)
  625. break;
  626. event_timedwait(&th->done, 50 + (call == 0 ? 4000 : 0));
  627. break;
  628. }
  629. }
  630. for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
  631. sleep_ms(1);
  632. }
  633.  
  634. void execute_call(int call)
  635. {
  636. switch (call) {
  637. case 0:
  638. // syz_mount_image$ext4 arguments: [
  639. // fs: ptr[in, buffer] {
  640. // buffer: {65 78 74 34 00} (length 0x5)
  641. // }
  642. // dir: ptr[in, buffer] {
  643. // buffer: {2e 2f 62 75 73 00} (length 0x6)
  644. // }
  645. // flags: mount_flags = 0x400547 (8 bytes)
  646. // opts: ptr[in, fs_options[ext4_options]] {
  647. // fs_options[ext4_options] {
  648. // elems: array[fs_opt_elem[ext4_options]] {
  649. // fs_opt_elem[ext4_options] {
  650. // elem: union ext4_options {
  651. // nobarrier: buffer: {6e 6f 62 61 72 72 69 65 72} (length 0x9)
  652. // }
  653. // comma: const = 0x2c (1 bytes)
  654. // }
  655. // fs_opt_elem[ext4_options] {
  656. // elem: union ext4_options {
  657. // data_err_ignore: buffer: {64 61 74 61 5f 65 72 72 3d 69 67
  658. // 6e 6f 72 65} (length 0xf)
  659. // }
  660. // comma: const = 0x2c (1 bytes)
  661. // }
  662. // fs_opt_elem[ext4_options] {
  663. // elem: union ext4_options {
  664. // sb: fs_opt["sb", fmt[hex, int32]] {
  665. // name: buffer: {73 62} (length 0x2)
  666. // eq: const = 0x3d (1 bytes)
  667. // val: int32 = 0x1 (18 bytes)
  668. // }
  669. // }
  670. // comma: const = 0x2c (1 bytes)
  671. // }
  672. // fs_opt_elem[ext4_options] {
  673. // elem: union ext4_options {
  674. // barrier_val: fs_opt["barrier", fmt[hex, int32]] {
  675. // name: buffer: {62 61 72 72 69 65 72} (length 0x7)
  676. // eq: const = 0x3d (1 bytes)
  677. // val: int32 = 0x3 (18 bytes)
  678. // }
  679. // }
  680. // comma: const = 0x2c (1 bytes)
  681. // }
  682. // fs_opt_elem[ext4_options] {
  683. // elem: union ext4_options {
  684. // dioread_lock: buffer: {64 69 6f 72 65 61 64 5f 6c 6f 63 6b}
  685. // (length 0xc)
  686. // }
  687. // comma: const = 0x2c (1 bytes)
  688. // }
  689. // fs_opt_elem[ext4_options] {
  690. // elem: union ext4_options {
  691. // resgid: fs_opt["resgid", fmt[hex, gid]] {
  692. // name: buffer: {72 65 73 67 69 64} (length 0x6)
  693. // eq: const = 0x3d (1 bytes)
  694. // val: gid (resource)
  695. // }
  696. // }
  697. // comma: const = 0x2c (1 bytes)
  698. // }
  699. // fs_opt_elem[ext4_options] {
  700. // elem: union ext4_options {
  701. // errors_remount: buffer: {65 72 72 6f 72 73 3d 72 65 6d 6f 75
  702. // 6e 74 2d 72 6f} (length 0x11)
  703. // }
  704. // comma: const = 0x2c (1 bytes)
  705. // }
  706. // fs_opt_elem[ext4_options] {
  707. // elem: union ext4_options {
  708. // sysvgroups: buffer: {73 79 73 76 67 72 6f 75 70 73} (length
  709. // 0xa)
  710. // }
  711. // comma: const = 0x2c (1 bytes)
  712. // }
  713. // fs_opt_elem[ext4_options] {
  714. // elem: union ext4_options {
  715. // journal_dev: fs_opt["journal_dev", fmt[hex, int32]] {
  716. // name: buffer: {6a 6f 75 72 6e 61 6c 5f 64 65 76} (length
  717. // 0xb) eq: const = 0x3d (1 bytes) val: int32 =
  718. // 0x800000000003 (18 bytes)
  719. // }
  720. // }
  721. // comma: const = 0x32 (1 bytes)
  722. // }
  723. // }
  724. // common: array[fs_opt_elem[fs_options_common]] {
  725. // }
  726. // null: const = 0x0 (1 bytes)
  727. // }
  728. // }
  729. // chdir: int8 = 0x1e (1 bytes)
  730. // size: len = 0x500 (8 bytes)
  731. // img: ptr[in, buffer] {
  732. // buffer: (compressed buffer with length 0x500)
  733. // }
  734. // ]
  735. // returns fd_dir
  736. memcpy((void*)0x200000000040, "ext4\000", 5);
  737. memcpy((void*)0x200000000500, "./bus\000", 6);
  738. memcpy((void*)0x200000000140, "nobarrier", 9);
  739. *(uint8_t*)0x200000000149 = 0x2c;
  740. memcpy((void*)0x20000000014a, "data_err=ignore", 15);
  741. *(uint8_t*)0x200000000159 = 0x2c;
  742. memcpy((void*)0x20000000015a, "sb", 2);
  743. *(uint8_t*)0x20000000015c = 0x3d;
  744. sprintf((char*)0x20000000015d, "0x%016llx", (long long)1);
  745. *(uint8_t*)0x20000000016f = 0x2c;
  746. memcpy((void*)0x200000000170, "barrier", 7);
  747. *(uint8_t*)0x200000000177 = 0x3d;
  748. sprintf((char*)0x200000000178, "0x%016llx", (long long)3);
  749. *(uint8_t*)0x20000000018a = 0x2c;
  750. memcpy((void*)0x20000000018b, "dioread_lock", 12);
  751. *(uint8_t*)0x200000000197 = 0x2c;
  752. memcpy((void*)0x200000000198, "resgid", 6);
  753. *(uint8_t*)0x20000000019e = 0x3d;
  754. sprintf((char*)0x20000000019f, "0x%016llx", (long long)0xee01);
  755. *(uint8_t*)0x2000000001b1 = 0x2c;
  756. memcpy((void*)0x2000000001b2, "errors=remount-ro", 17);
  757. *(uint8_t*)0x2000000001c3 = 0x2c;
  758. memcpy((void*)0x2000000001c4, "sysvgroups", 10);
  759. *(uint8_t*)0x2000000001ce = 0x2c;
  760. memcpy((void*)0x2000000001cf, "journal_dev", 11);
  761. *(uint8_t*)0x2000000001da = 0x3d;
  762. sprintf((char*)0x2000000001db, "0x%016llx", (long long)0x800000000003);
  763. *(uint8_t*)0x2000000001ed = 0x32;
  764. *(uint8_t*)0x2000000001ee = 0;
  765. memcpy(
  766. (void*)0x200000000540,
  767. "\x78\x9c\xec\xdd\x41\x6f\x1b\x59\x1d\x00\xf0\xff\x4c\xe2\xdd\xa4\xcd"
  768. "\x92\xac\xe0\xb0\xac\xc4\x6e\x45\x17\x25\x2b\xa8\x9d\x34\x6c\x37\xe2"
  769. "\x50\x40\x42\x70\xaa\x04\x94\x7b\x09\x89\x13\x45\x71\xe2\x28\x76\xda"
  770. "\x26\xaa\x68\x2a\x3e\x00\x12\x42\x80\xc4\x89\x13\x17\x24\x3e\x00\x12"
  771. "\xea\x47\x40\x48\x95\xe0\x8e\x00\x81\x10\xb4\x70\xe0\x00\x35\xf2\xd8"
  772. "\x0e\x69\x62\x3b\x2e\x71\xe2\xe2\xfc\x7e\xd2\xd4\xef\xcd\x3c\xcf\xff"
  773. "\xfd\xdd\x78\x3c\xef\x79\xe4\x09\xe0\xc2\xba\x12\x11\xd7\x23\xe2\x79"
  774. "\xad\x56\xab\xd7\x27\x9b\xeb\xd3\xe6\x12\x49\x44\xec\x37\xda\x3d\x7b"
  775. "\xfa\x60\xa9\xbe\x24\x51\xab\xdd\xfe\x6b\x92\x6d\xaa\xd7\xeb\xcd\x66"
  776. "\x0e\xed\xf3\x72\xe3\x29\x31\x16\x11\x5f\xff\x4a\xc4\xb7\x92\xe3\x71"
  777. "\x2b\xbb\x7b\xeb\x8b\xa5\x52\x71\xbb\x59\x2f\x54\x37\xb6\x0a\x95\xdd"
  778. "\xbd\x6b\x6b\x1b\x8b\xab\xc5\xd5\xe2\xe6\xfc\xfc\xdc\x8d\x85\x0f\x17"
  779. "\x3e\x58\x98\xed\x4b\x9e\x13\x11\x71\xf3\x4b\x7f\xfc\xc1\x77\x7f\xfa"
  780. "\xe5\x9b\xbf\xfc\xcc\xbd\xdf\xdd\xf9\xf3\xcc\xb7\xeb\xdd\xba\xda\xdc"
  781. "\xde\xca\xa3\xdf\x1a\xa9\xe7\xb2\xd7\xa2\x65\x34\x22\xb6\xcf\x22\xd8"
  782. "\x00\x8c\x34\xf3\xc9\x0d\xba\x23\x00\x00\xf4\xa4\x75\x9e\xff\xc9\x88"
  783. "\x78\x3f\x26\x63\x24\x3b\x9b\x03\x00\x00\x00\x86\x49\xed\xf3\x13\xf1"
  784. "\xaf\x24\xa2\x76\xcc\x78\xab\x45\x57\xaf\x77\xdf\x0c\x00\x00\x00\xbc"
  785. "\x02\xd2\xec\xda\xd8\x24\xcd\x37\xaf\x03\x98\x88\x34\xcd\xe7\x1b\xd7"
  786. "\xf0\x7e\x2c\x2e\xa5\xa5\x72\xa5\xfa\xe9\x95\xf2\xce\xe6\x72\xe3\x1a"
  787. "\xda\xa9\xc8\xa5\x2b\x6b\xa5\xe2\x6c\xf3\x5a\xe1\xa9\xc8\x25\xf5\xfa"
  788. "\x5c\x56\xfe\x6f\xfd\xfa\x91\xfa\x7c\x44\xbc\x19\x11\xdf\x9f\x1c\xcf"
  789. "\xea\xf9\xa5\x72\x69\x79\xc0\x73\x1f\x00\x00\x00\x70\x51\x5c\x3e\x32"
  790. "\xfe\xff\xc7\x64\x63\xfc\x0f\x00\x00\x00\x0c\x99\xa9\x41\x77\x00\x00"
  791. "\x00\x00\x38\x73\xc6\xff\x00\x00\x00\x30\xfc\x8c\xff\x01\x00\x00\x60"
  792. "\xa8\x7d\xf5\xd6\xad\xfa\x52\x6b\xdd\xff\x7a\xf9\xee\xee\xce\x7a\xf9"
  793. "\xee\xb5\xe5\x62\x65\x3d\xbf\xb1\xb3\x94\x5f\x2a\x6f\x6f\x3d\x8c\x72"
  794. "\x79\x35\xfb\xcd\xbe\x8d\x93\xf6\x57\x2a\x97\xb7\x3e\x1b\x9b\x3b\xf7"
  795. "\x0b\xd5\x62\xa5\x5a\xa8\xec\xee\xdd\xd9\x28\xef\x6c\x56\xef\xac\xbd"
  796. "\x70\x0b\x6c\x00\x00\x00\xe0\x1c\xbd\xf9\xee\xe3\xdf\x26\x11\xb1\xff"
  797. "\xb9\xf1\x6c\xa9\x7b\x6d\xd0\x9d\x02\xce\xc5\xe8\xb1\x35\x49\xe7\xc6"
  798. "\x7f\x38\xdb\xbe\x00\xe7\x6b\x64\xd0\x1d\x00\x06\xe6\xf8\xe7\x3f\x70"
  799. "\x51\xe4\x7a\x68\xe3\x1c\x01\x86\x5b\x97\x51\x7f\xa6\xe3\xc5\x3b\xbf"
  800. "\xea\x7f\x5f\x00\x00\x80\xb3\x31\xfd\xf1\xf6\xdf\xff\x27\x27\xce\x0d"
  801. "\xec\xa7\xe7\xd4\x45\xe0\x8c\xf4\x32\xff\x07\x0c\x27\x73\xfb\x70\x71"
  802. "\xf9\xfe\x1f\x2e\xae\x5c\x8c\x84\x81\x3c\x5c\x6c\xff\xc3\xf7\xff\x2f"
  803. "\x39\x75\x50\xab\xbd\x5c\x7b\x00\x00\xa0\xdf\x26\xb2\x25\x49\xf3\x11"
  804. "\xd9\x3c\xc0\x44\xa4\x69\x3e\x1f\xf1\x46\x76\x5b\x80\x5c\xb2\xb2\x56"
  805. "\x2a\xce\x46\xc4\x47\x22\xe2\x37\x93\xb9\xd7\xeb\xf5\xb9\xec\x99\xc9"
  806. "\x89\x63\x06\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  807. "\x00\x00\x00\x00\x00\xa0\xa1\x56\x4b\xa2\x06\x00\x00\x00\x0c\xb5\x88"
  808. "\xf4\x4f\x49\xf3\xfe\x5f\xd3\x93\xef\x4d\x1c\x9d\x1f\x78\x2d\xf9\xe7"
  809. "\x64\xf6\x18\x11\xf7\x7e\x7c\xfb\x87\xf7\x17\xab\xd5\xed\xb9\xfa\xfa"
  810. "\xbf\x1d\xac\xaf\xfe\xa8\xb9\xfe\xfa\x20\x66\x30\x00\x00\x00\x80\xa3"
  811. "\x5a\xe3\xf4\xd6\x38\x1e\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  812. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  813. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  814. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xfa\xe9\xd9\xd3\x07\x4b\xad"
  815. "\xe5\x3c\xe3\xfe\xe5\x8b\x11\x31\xd5\x2e\xfe\x68\x8c\x65\x8f\x63\x91"
  816. "\x8b\x88\x4b\x7f\x4f\x62\xf4\xd0\xf3\x92\x88\x18\xe9\x43\xfc\xfd\x47"
  817. "\x11\xf1\x56\xfb\xfc\xa7\xb2\xa5\xd1\x8b\x76\xf1\xc7\xfb\x1b\xbf\xb5"
  818. "\x6a\xa9\x15\xa1\x5b\xfc\x34\x22\x2e\xf7\x21\x3e\x5c\x64\x8f\xeb\xc7"
  819. "\x9f\x2f\xb4\x7b\xff\xa7\x71\x25\x7b\x6c\xff\xfe\xbb\x91\x1d\xa1\x4e"
  820. "\xaf\xe3\xf1\x2f\x69\xb5\x18\xcb\x8e\x73\xed\x8e\x3f\x6f\xf4\x18\xe3"
  821. "\xed\x27\x3f\x2f\x74\x8c\xff\x28\xe2\xed\xd1\x76\xf9\x27\x07\xc7\xdf"
  822. "\xa4\x43\xfc\xab\x3d\xc6\xff\xe6\x37\xf6\xf6\x3a\x6d\xab\xfd\x24\x62"
  823. "\xba\xed\xe7\x4f\xf2\x42\xac\x42\x75\x63\xab\x50\xd9\xdd\xbb\xb6\xb6"
  824. "\xb1\xb8\x5a\x5c\x2d\x6e\xce\xcf\xcf\xdd\x58\xf8\x70\xe1\x83\x85\xd9"
  825. "\xc2\xca\x5a\xa9\xd8\xfc\xf7\xd0\x21\xf9\xca\x41\xe9\x7b\x9f\xf8\xc5"
  826. "\xf3\x6e\xf9\x5f\xea\x10\x7f\xea\x84\xfc\xdf\xeb\x31\xff\x7f\x3f\xb9"
  827. "\xff\xf4\xa3\x8d\x62\xae\x5d\xfc\x99\xab\xed\xff\xfe\xde\xea\x10\x3f"
  828. "\x6d\x7e\xf6\x7d\xaa\x59\xae\x6f\x99\x6e\x95\xf7\xe3\xa0\xdc\xf2\xce"
  829. "\xcf\x7e\xfd\x4e\xb7\xfc\x97\x1b\xf9\x8f\xbe\xec\xff\xff\x4c\x8f\xf9"
  830. "\xbf\xff\xb5\xef\xfc\xbe\xc7\xa6\x00\xc0\x39\xa8\xec\xee\xad\x2f\x96"
  831. "\x4a\xc5\xed\xff\xbb\x42\xeb\x0c\xb1\x6b\xe3\xfd\xde\x76\x78\xaa\x57"
  832. "\xa3\x7e\x5a\x34\xf0\x57\xe3\x14\x85\x34\x5e\x89\x6e\x0c\xa2\xf0\xf0"
  833. "\xac\xf6\xdc\x1c\x3b\xc4\xa0\x13\x3c\xd5\xfb\x0b\x00\x00\x18\x2e\xc7"
  834. "\xc7\xc0\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  835. "\xc0\x79\x3b\xf4\xa3\x5f\xef\x9e\xd5\xcf\x89\x1d\x8d\xb9\x3f\x98\x54"
  836. "\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  837. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  838. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  839. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  840. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  841. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xba\xfa\x4f\x00\x00\x00\xff"
  842. "\xff\xee\x38\xbc\x97",
  843. 1280);
  844. syz_mount_image(
  845. /*fs=*/0x200000000040, /*dir=*/0x200000000500,
  846. /*flags=MS_RDONLY|MS_NOSUID|MS_NODEV|MS_NOATIME|0x400140*/ 0x400547,
  847. /*opts=*/0x200000000140, /*chdir=*/0x1e, /*size=*/0x500,
  848. /*img=*/0x200000000540);
  849. break;
  850. case 1:
  851. // sendmsg arguments: [
  852. // fd: sock (resource)
  853. // msg: ptr[in, send_msghdr] {
  854. // send_msghdr {
  855. // msg_name: nil
  856. // msg_namelen: len = 0x0 (4 bytes)
  857. // pad = 0x0 (4 bytes)
  858. // msg_iov: nil
  859. // msg_iovlen: len = 0x0 (8 bytes)
  860. // msg_control: ptr[inout, array[ANYUNION]] {
  861. // array[ANYUNION] {
  862. // union ANYUNION {
  863. // ANYBLOB: buffer: {18 00 00 00 00 00 00 00 01 00 00 00 01 00
  864. // 00 00 06 00 00 00 03 00 00 00 ee 4e 24 a4 33 ba f6 8a a9 18
  865. // a3 8c 38 89 8d a0 3d b1 41 d5 9c b7 68 11 f1 86 c6 ef bb b9
  866. // de 0d eb 32 0e ae f9 6c 1c 43 29 d8 bb 3d e7 94 82 58 37 c3
  867. // 2a d7 96 92 43 04 43 54 db 02 97 ab 8d 01 15 ef b5 f9 d8 26
  868. // 9c d8 cf ce 9e 86 d2 be cf db ba 29 c3 49 01 ef 01 01 e4 d5
  869. // ba 7d 84 fd fb 3c 44 37 11 cd 68 eb c1 a1 21 52 ee 02 f1 0c
  870. // 37 0c 82 f6 49 73 80 89 a9 3e 27 9d 82 43 7b 64 57 8b bd dc
  871. // b0 ae cb d5 3b 09 be b0 21 e1 35 57 24 52 ee 17 2f c4 db c8
  872. // 48 1e 9d 6b 99 66 d0 be 57 96 3d 23 03 02 52 c6 94 96 a1 47
  873. // 13 65 e0 3f bf 57 ae 9b 28 5d 55 4c 2c 5e 0f 3a 38 02 98 09
  874. // b8 3b 9b e4 12 c7 fe 73 e1 3c 93 ef ff fe 3b 55 2d 3b 36 19
  875. // af 7c 80 5d 0e 77 b4 6d ba 7a cb f0 21 6c a9 3e 09 0f 6a 0b
  876. // e1 53 af 86 9f ff 17 71 c2 9f 5e fd 6a 99 64 83 36 f2 0f 80
  877. // 5a 84 dd 74 e3 3b f6 4b 1b 99 b5 9e 74 a2 b8 ab c4 fe 0c fe
  878. // a0 09 42 52 dd 50 0d a7 e6 d4 42 ea 77 1a f1 2b a9 26 74 a1
  879. // 6c 75 1d 6f 40 63 1f d5 b3 ec 54 73 c4 2e 01 76} (length
  880. // 0x14a)
  881. // }
  882. // }
  883. // }
  884. // msg_controllen: bytesize = 0x18 (8 bytes)
  885. // msg_flags: const = 0x0 (4 bytes)
  886. // pad = 0x0 (4 bytes)
  887. // }
  888. // }
  889. // f: send_flags = 0x0 (8 bytes)
  890. // ]
  891. *(uint64_t*)0x200000000340 = 0;
  892. *(uint32_t*)0x200000000348 = 0;
  893. *(uint64_t*)0x200000000350 = 0;
  894. *(uint64_t*)0x200000000358 = 0;
  895. *(uint64_t*)0x200000000360 = 0x2000000004c0;
  896. memcpy(
  897. (void*)0x2000000004c0,
  898. "\x18\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x01\x00\x00\x00\x06"
  899. "\x00\x00\x00\x03\x00\x00\x00\xee\x4e\x24\xa4\x33\xba\xf6\x8a\xa9\x18"
  900. "\xa3\x8c\x38\x89\x8d\xa0\x3d\xb1\x41\xd5\x9c\xb7\x68\x11\xf1\x86\xc6"
  901. "\xef\xbb\xb9\xde\x0d\xeb\x32\x0e\xae\xf9\x6c\x1c\x43\x29\xd8\xbb\x3d"
  902. "\xe7\x94\x82\x58\x37\xc3\x2a\xd7\x96\x92\x43\x04\x43\x54\xdb\x02\x97"
  903. "\xab\x8d\x01\x15\xef\xb5\xf9\xd8\x26\x9c\xd8\xcf\xce\x9e\x86\xd2\xbe"
  904. "\xcf\xdb\xba\x29\xc3\x49\x01\xef\x01\x01\xe4\xd5\xba\x7d\x84\xfd\xfb"
  905. "\x3c\x44\x37\x11\xcd\x68\xeb\xc1\xa1\x21\x52\xee\x02\xf1\x0c\x37\x0c"
  906. "\x82\xf6\x49\x73\x80\x89\xa9\x3e\x27\x9d\x82\x43\x7b\x64\x57\x8b\xbd"
  907. "\xdc\xb0\xae\xcb\xd5\x3b\x09\xbe\xb0\x21\xe1\x35\x57\x24\x52\xee\x17"
  908. "\x2f\xc4\xdb\xc8\x48\x1e\x9d\x6b\x99\x66\xd0\xbe\x57\x96\x3d\x23\x03"
  909. "\x02\x52\xc6\x94\x96\xa1\x47\x13\x65\xe0\x3f\xbf\x57\xae\x9b\x28\x5d"
  910. "\x55\x4c\x2c\x5e\x0f\x3a\x38\x02\x98\x09\xb8\x3b\x9b\xe4\x12\xc7\xfe"
  911. "\x73\xe1\x3c\x93\xef\xff\xfe\x3b\x55\x2d\x3b\x36\x19\xaf\x7c\x80\x5d"
  912. "\x0e\x77\xb4\x6d\xba\x7a\xcb\xf0\x21\x6c\xa9\x3e\x09\x0f\x6a\x0b\xe1"
  913. "\x53\xaf\x86\x9f\xff\x17\x71\xc2\x9f\x5e\xfd\x6a\x99\x64\x83\x36\xf2"
  914. "\x0f\x80\x5a\x84\xdd\x74\xe3\x3b\xf6\x4b\x1b\x99\xb5\x9e\x74\xa2\xb8"
  915. "\xab\xc4\xfe\x0c\xfe\xa0\x09\x42\x52\xdd\x50\x0d\xa7\xe6\xd4\x42\xea"
  916. "\x77\x1a\xf1\x2b\xa9\x26\x74\xa1\x6c\x75\x1d\x6f\x40\x63\x1f\xd5\xb3"
  917. "\xec\x54\x73\xc4\x2e\x01\x76",
  918. 330);
  919. *(uint64_t*)0x200000000368 = 0x18;
  920. *(uint32_t*)0x200000000370 = 0;
  921. syscall(__NR_sendmsg, /*fd=*/(intptr_t)-1, /*msg=*/0x200000000340ul,
  922. /*f=*/0ul);
  923. break;
  924. }
  925. }
  926. int main(void)
  927. {
  928. syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
  929. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  930. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  931. syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul,
  932. /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
  933. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  934. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  935. syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
  936. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  937. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  938. const char* reason;
  939. (void)reason;
  940. loop();
  941. return 0;
  942. }
  943.  
Advertisement
Add Comment
Please, Sign In to add comment