Tang-ZW

Untitled

Jun 29th, 2026
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 63.44 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 <sched.h>
  11. #include <setjmp.h>
  12. #include <signal.h>
  13. #include <stdarg.h>
  14. #include <stdbool.h>
  15. #include <stddef.h>
  16. #include <stdint.h>
  17. #include <stdio.h>
  18. #include <stdlib.h>
  19. #include <string.h>
  20. #include <sys/ioctl.h>
  21. #include <sys/mman.h>
  22. #include <sys/mount.h>
  23. #include <sys/prctl.h>
  24. #include <sys/resource.h>
  25. #include <sys/stat.h>
  26. #include <sys/syscall.h>
  27. #include <sys/time.h>
  28. #include <sys/types.h>
  29. #include <sys/wait.h>
  30. #include <time.h>
  31. #include <unistd.h>
  32.  
  33. #include <linux/capability.h>
  34. #include <linux/futex.h>
  35. #include <linux/loop.h>
  36.  
  37. #ifndef __NR_memfd_create
  38. #define __NR_memfd_create 319
  39. #endif
  40.  
  41. static unsigned long long procid;
  42.  
  43. static void sleep_ms(uint64_t ms)
  44. {
  45. usleep(ms * 1000);
  46. }
  47.  
  48. static uint64_t current_time_ms(void)
  49. {
  50. struct timespec ts;
  51. if (clock_gettime(CLOCK_MONOTONIC, &ts))
  52. exit(1);
  53. return (uint64_t)ts.tv_sec * 1000 + (uint64_t)ts.tv_nsec / 1000000;
  54. }
  55.  
  56. static void use_temporary_dir(void)
  57. {
  58. char tmpdir_template[] = "./syzkaller.XXXXXX";
  59. char* tmpdir = mkdtemp(tmpdir_template);
  60. if (!tmpdir)
  61. exit(1);
  62. if (chmod(tmpdir, 0777))
  63. exit(1);
  64. if (chdir(tmpdir))
  65. exit(1);
  66. }
  67.  
  68. static void thread_start(void* (*fn)(void*), void* arg)
  69. {
  70. pthread_t th;
  71. pthread_attr_t attr;
  72. pthread_attr_init(&attr);
  73. pthread_attr_setstacksize(&attr, 128 << 10);
  74. int i = 0;
  75. for (; i < 100; i++) {
  76. if (pthread_create(&th, &attr, fn, arg) == 0) {
  77. pthread_attr_destroy(&attr);
  78. return;
  79. }
  80. if (errno == EAGAIN) {
  81. usleep(50);
  82. continue;
  83. }
  84. break;
  85. }
  86. exit(1);
  87. }
  88.  
  89. typedef struct {
  90. int state;
  91. } event_t;
  92.  
  93. static void event_init(event_t* ev)
  94. {
  95. ev->state = 0;
  96. }
  97.  
  98. static void event_reset(event_t* ev)
  99. {
  100. ev->state = 0;
  101. }
  102.  
  103. static void event_set(event_t* ev)
  104. {
  105. if (ev->state)
  106. exit(1);
  107. __atomic_store_n(&ev->state, 1, __ATOMIC_RELEASE);
  108. syscall(SYS_futex, &ev->state, FUTEX_WAKE | FUTEX_PRIVATE_FLAG, 1000000);
  109. }
  110.  
  111. static void event_wait(event_t* ev)
  112. {
  113. while (!__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
  114. syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, 0);
  115. }
  116.  
  117. static int event_isset(event_t* ev)
  118. {
  119. return __atomic_load_n(&ev->state, __ATOMIC_ACQUIRE);
  120. }
  121.  
  122. static int event_timedwait(event_t* ev, uint64_t timeout)
  123. {
  124. uint64_t start = current_time_ms();
  125. uint64_t now = start;
  126. for (;;) {
  127. uint64_t remain = timeout - (now - start);
  128. struct timespec ts;
  129. ts.tv_sec = remain / 1000;
  130. ts.tv_nsec = (remain % 1000) * 1000 * 1000;
  131. syscall(SYS_futex, &ev->state, FUTEX_WAIT | FUTEX_PRIVATE_FLAG, 0, &ts);
  132. if (__atomic_load_n(&ev->state, __ATOMIC_ACQUIRE))
  133. return 1;
  134. now = current_time_ms();
  135. if (now - start > timeout)
  136. return 0;
  137. }
  138. }
  139.  
  140. static bool write_file(const char* file, const char* what, ...)
  141. {
  142. char buf[1024];
  143. va_list args;
  144. va_start(args, what);
  145. vsnprintf(buf, sizeof(buf), what, args);
  146. va_end(args);
  147. buf[sizeof(buf) - 1] = 0;
  148. int len = strlen(buf);
  149. int fd = open(file, O_WRONLY | O_CLOEXEC);
  150. if (fd == -1)
  151. return false;
  152. if (write(fd, buf, len) != len) {
  153. int err = errno;
  154. close(fd);
  155. errno = err;
  156. return false;
  157. }
  158. close(fd);
  159. return true;
  160. }
  161.  
  162. //% This code is derived from puff.{c,h}, found in the zlib development. The
  163. //% original files come with the following copyright notice:
  164.  
  165. //% Copyright (C) 2002-2013 Mark Adler, all rights reserved
  166. //% version 2.3, 21 Jan 2013
  167. //% This software is provided 'as-is', without any express or implied
  168. //% warranty. In no event will the author be held liable for any damages
  169. //% arising from the use of this software.
  170. //% Permission is granted to anyone to use this software for any purpose,
  171. //% including commercial applications, and to alter it and redistribute it
  172. //% freely, subject to the following restrictions:
  173. //% 1. The origin of this software must not be misrepresented; you must not
  174. //% claim that you wrote the original software. If you use this software
  175. //% in a product, an acknowledgment in the product documentation would be
  176. //% appreciated but is not required.
  177. //% 2. Altered source versions must be plainly marked as such, and must not be
  178. //% misrepresented as being the original software.
  179. //% 3. This notice may not be removed or altered from any source distribution.
  180. //% Mark Adler [email protected]
  181.  
  182. //% BEGIN CODE DERIVED FROM puff.{c,h}
  183.  
  184. #define MAXBITS 15
  185. #define MAXLCODES 286
  186. #define MAXDCODES 30
  187. #define MAXCODES (MAXLCODES + MAXDCODES)
  188. #define FIXLCODES 288
  189.  
  190. struct puff_state {
  191. unsigned char* out;
  192. unsigned long outlen;
  193. unsigned long outcnt;
  194. const unsigned char* in;
  195. unsigned long inlen;
  196. unsigned long incnt;
  197. int bitbuf;
  198. int bitcnt;
  199. jmp_buf env;
  200. };
  201. static int puff_bits(struct puff_state* s, int need)
  202. {
  203. long val = s->bitbuf;
  204. while (s->bitcnt < need) {
  205. if (s->incnt == s->inlen)
  206. longjmp(s->env, 1);
  207. val |= (long)(s->in[s->incnt++]) << s->bitcnt;
  208. s->bitcnt += 8;
  209. }
  210. s->bitbuf = (int)(val >> need);
  211. s->bitcnt -= need;
  212. return (int)(val & ((1L << need) - 1));
  213. }
  214. static int puff_stored(struct puff_state* s)
  215. {
  216. s->bitbuf = 0;
  217. s->bitcnt = 0;
  218. if (s->incnt + 4 > s->inlen)
  219. return 2;
  220. unsigned len = s->in[s->incnt++];
  221. len |= s->in[s->incnt++] << 8;
  222. if (s->in[s->incnt++] != (~len & 0xff) ||
  223. s->in[s->incnt++] != ((~len >> 8) & 0xff))
  224. return -2;
  225. if (s->incnt + len > s->inlen)
  226. return 2;
  227. if (s->outcnt + len > s->outlen)
  228. return 1;
  229. for (; len--; s->outcnt++, s->incnt++) {
  230. if (s->in[s->incnt])
  231. s->out[s->outcnt] = s->in[s->incnt];
  232. }
  233. return 0;
  234. }
  235. struct puff_huffman {
  236. short* count;
  237. short* symbol;
  238. };
  239. static int puff_decode(struct puff_state* s, const struct puff_huffman* h)
  240. {
  241. int first = 0;
  242. int index = 0;
  243. int bitbuf = s->bitbuf;
  244. int left = s->bitcnt;
  245. int code = first = index = 0;
  246. int len = 1;
  247. short* next = h->count + 1;
  248. while (1) {
  249. while (left--) {
  250. code |= bitbuf & 1;
  251. bitbuf >>= 1;
  252. int count = *next++;
  253. if (code - count < first) {
  254. s->bitbuf = bitbuf;
  255. s->bitcnt = (s->bitcnt - len) & 7;
  256. return h->symbol[index + (code - first)];
  257. }
  258. index += count;
  259. first += count;
  260. first <<= 1;
  261. code <<= 1;
  262. len++;
  263. }
  264. left = (MAXBITS + 1) - len;
  265. if (left == 0)
  266. break;
  267. if (s->incnt == s->inlen)
  268. longjmp(s->env, 1);
  269. bitbuf = s->in[s->incnt++];
  270. if (left > 8)
  271. left = 8;
  272. }
  273. return -10;
  274. }
  275. static int puff_construct(struct puff_huffman* h, const short* length, int n)
  276. {
  277. int len;
  278. for (len = 0; len <= MAXBITS; len++)
  279. h->count[len] = 0;
  280. int symbol;
  281. for (symbol = 0; symbol < n; symbol++)
  282. (h->count[length[symbol]])++;
  283. if (h->count[0] == n)
  284. return 0;
  285. int left = 1;
  286. for (len = 1; len <= MAXBITS; len++) {
  287. left <<= 1;
  288. left -= h->count[len];
  289. if (left < 0)
  290. return left;
  291. }
  292. short offs[MAXBITS + 1];
  293. offs[1] = 0;
  294. for (len = 1; len < MAXBITS; len++)
  295. offs[len + 1] = offs[len] + h->count[len];
  296. for (symbol = 0; symbol < n; symbol++)
  297. if (length[symbol] != 0)
  298. h->symbol[offs[length[symbol]]++] = symbol;
  299. return left;
  300. }
  301. static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode,
  302. const struct puff_huffman* distcode)
  303. {
  304. static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
  305. 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
  306. 67, 83, 99, 115, 131, 163, 195, 227, 258};
  307. static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2,
  308. 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
  309. static const short dists[30] = {
  310. 1, 2, 3, 4, 5, 7, 9, 13, 17, 25,
  311. 33, 49, 65, 97, 129, 193, 257, 385, 513, 769,
  312. 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577};
  313. static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3,
  314. 4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
  315. 9, 9, 10, 10, 11, 11, 12, 12, 13, 13};
  316. int symbol;
  317. do {
  318. symbol = puff_decode(s, lencode);
  319. if (symbol < 0)
  320. return symbol;
  321. if (symbol < 256) {
  322. if (s->outcnt == s->outlen)
  323. return 1;
  324. if (symbol)
  325. s->out[s->outcnt] = symbol;
  326. s->outcnt++;
  327. } else if (symbol > 256) {
  328. symbol -= 257;
  329. if (symbol >= 29)
  330. return -10;
  331. int len = lens[symbol] + puff_bits(s, lext[symbol]);
  332. symbol = puff_decode(s, distcode);
  333. if (symbol < 0)
  334. return symbol;
  335. unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]);
  336. if (dist > s->outcnt)
  337. return -11;
  338. if (s->outcnt + len > s->outlen)
  339. return 1;
  340. while (len--) {
  341. if (dist <= s->outcnt && s->out[s->outcnt - dist])
  342. s->out[s->outcnt] = s->out[s->outcnt - dist];
  343. s->outcnt++;
  344. }
  345. }
  346. } while (symbol != 256);
  347. return 0;
  348. }
  349. static int puff_fixed(struct puff_state* s)
  350. {
  351. static int virgin = 1;
  352. static short lencnt[MAXBITS + 1], lensym[FIXLCODES];
  353. static short distcnt[MAXBITS + 1], distsym[MAXDCODES];
  354. static struct puff_huffman lencode, distcode;
  355. if (virgin) {
  356. lencode.count = lencnt;
  357. lencode.symbol = lensym;
  358. distcode.count = distcnt;
  359. distcode.symbol = distsym;
  360. short lengths[FIXLCODES];
  361. int symbol;
  362. for (symbol = 0; symbol < 144; symbol++)
  363. lengths[symbol] = 8;
  364. for (; symbol < 256; symbol++)
  365. lengths[symbol] = 9;
  366. for (; symbol < 280; symbol++)
  367. lengths[symbol] = 7;
  368. for (; symbol < FIXLCODES; symbol++)
  369. lengths[symbol] = 8;
  370. puff_construct(&lencode, lengths, FIXLCODES);
  371. for (symbol = 0; symbol < MAXDCODES; symbol++)
  372. lengths[symbol] = 5;
  373. puff_construct(&distcode, lengths, MAXDCODES);
  374. virgin = 0;
  375. }
  376. return puff_codes(s, &lencode, &distcode);
  377. }
  378. static int puff_dynamic(struct puff_state* s)
  379. {
  380. static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
  381. 11, 4, 12, 3, 13, 2, 14, 1, 15};
  382. int nlen = puff_bits(s, 5) + 257;
  383. int ndist = puff_bits(s, 5) + 1;
  384. int ncode = puff_bits(s, 4) + 4;
  385. if (nlen > MAXLCODES || ndist > MAXDCODES)
  386. return -3;
  387. short lengths[MAXCODES];
  388. int index;
  389. for (index = 0; index < ncode; index++)
  390. lengths[order[index]] = puff_bits(s, 3);
  391. for (; index < 19; index++)
  392. lengths[order[index]] = 0;
  393. short lencnt[MAXBITS + 1], lensym[MAXLCODES];
  394. struct puff_huffman lencode = {lencnt, lensym};
  395. int err = puff_construct(&lencode, lengths, 19);
  396. if (err != 0)
  397. return -4;
  398. index = 0;
  399. while (index < nlen + ndist) {
  400. int symbol;
  401. int len;
  402. symbol = puff_decode(s, &lencode);
  403. if (symbol < 0)
  404. return symbol;
  405. if (symbol < 16)
  406. lengths[index++] = symbol;
  407. else {
  408. len = 0;
  409. if (symbol == 16) {
  410. if (index == 0)
  411. return -5;
  412. len = lengths[index - 1];
  413. symbol = 3 + puff_bits(s, 2);
  414. } else if (symbol == 17)
  415. symbol = 3 + puff_bits(s, 3);
  416. else
  417. symbol = 11 + puff_bits(s, 7);
  418. if (index + symbol > nlen + ndist)
  419. return -6;
  420. while (symbol--)
  421. lengths[index++] = len;
  422. }
  423. }
  424. if (lengths[256] == 0)
  425. return -9;
  426. err = puff_construct(&lencode, lengths, nlen);
  427. if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
  428. return -7;
  429. short distcnt[MAXBITS + 1], distsym[MAXDCODES];
  430. struct puff_huffman distcode = {distcnt, distsym};
  431. err = puff_construct(&distcode, lengths + nlen, ndist);
  432. if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
  433. return -8;
  434. return puff_codes(s, &lencode, &distcode);
  435. }
  436. static int puff(unsigned char* dest, unsigned long* destlen,
  437. const unsigned char* source, unsigned long sourcelen)
  438. {
  439. struct puff_state s = {
  440. .out = dest,
  441. .outlen = *destlen,
  442. .outcnt = 0,
  443. .in = source,
  444. .inlen = sourcelen,
  445. .incnt = 0,
  446. .bitbuf = 0,
  447. .bitcnt = 0,
  448. };
  449. int err;
  450. if (setjmp(s.env) != 0)
  451. err = 2;
  452. else {
  453. int last;
  454. do {
  455. last = puff_bits(&s, 1);
  456. int type = puff_bits(&s, 2);
  457. err = type == 0 ? puff_stored(&s)
  458. : (type == 1 ? puff_fixed(&s)
  459. : (type == 2 ? puff_dynamic(&s) : -1));
  460. if (err != 0)
  461. break;
  462. } while (!last);
  463. }
  464. *destlen = s.outcnt;
  465. return err;
  466. }
  467.  
  468. //% END CODE DERIVED FROM puff.{c,h}
  469.  
  470. #define ZLIB_HEADER_WIDTH 2
  471.  
  472. static int puff_zlib_to_file(const unsigned char* source,
  473. unsigned long sourcelen, int dest_fd)
  474. {
  475. if (sourcelen < ZLIB_HEADER_WIDTH)
  476. return 0;
  477. source += ZLIB_HEADER_WIDTH;
  478. sourcelen -= ZLIB_HEADER_WIDTH;
  479. const unsigned long max_destlen = 132 << 20;
  480. void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ,
  481. MAP_PRIVATE | MAP_ANON, -1, 0);
  482. if (ret == MAP_FAILED)
  483. return -1;
  484. unsigned char* dest = (unsigned char*)ret;
  485. unsigned long destlen = max_destlen;
  486. int err = puff(dest, &destlen, source, sourcelen);
  487. if (err) {
  488. munmap(dest, max_destlen);
  489. errno = -err;
  490. return -1;
  491. }
  492. if (write(dest_fd, dest, destlen) != (ssize_t)destlen) {
  493. munmap(dest, max_destlen);
  494. return -1;
  495. }
  496. return munmap(dest, max_destlen);
  497. }
  498.  
  499. static int setup_loop_device(unsigned char* data, unsigned long size,
  500. const char* loopname, int* loopfd_p)
  501. {
  502. int err = 0, loopfd = -1;
  503. int memfd = syscall(__NR_memfd_create, "syzkaller", 0);
  504. if (memfd == -1) {
  505. err = errno;
  506. goto error;
  507. }
  508. if (puff_zlib_to_file(data, size, memfd)) {
  509. err = errno;
  510. goto error_close_memfd;
  511. }
  512. loopfd = open(loopname, O_RDWR);
  513. if (loopfd == -1) {
  514. err = errno;
  515. goto error_close_memfd;
  516. }
  517. if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
  518. if (errno != EBUSY) {
  519. err = errno;
  520. goto error_close_loop;
  521. }
  522. ioctl(loopfd, LOOP_CLR_FD, 0);
  523. usleep(1000);
  524. if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
  525. err = errno;
  526. goto error_close_loop;
  527. }
  528. }
  529. close(memfd);
  530. *loopfd_p = loopfd;
  531. return 0;
  532.  
  533. error_close_loop:
  534. close(loopfd);
  535. error_close_memfd:
  536. close(memfd);
  537. error:
  538. errno = err;
  539. return -1;
  540. }
  541.  
  542. static void reset_loop_device(const char* loopname)
  543. {
  544. int loopfd = open(loopname, O_RDWR);
  545. if (loopfd == -1) {
  546. return;
  547. }
  548. if (ioctl(loopfd, LOOP_CLR_FD, 0)) {
  549. }
  550. close(loopfd);
  551. }
  552.  
  553. static long syz_mount_image(volatile long fsarg, volatile long dir,
  554. volatile long flags, volatile long optsarg,
  555. volatile long change_dir,
  556. volatile unsigned long size, volatile long image)
  557. {
  558. unsigned char* data = (unsigned char*)image;
  559. int res = -1, err = 0, need_loop_device = !!size;
  560. char* mount_opts = (char*)optsarg;
  561. char* target = (char*)dir;
  562. char* fs = (char*)fsarg;
  563. char* source = NULL;
  564. char loopname[64];
  565. if (need_loop_device) {
  566. int loopfd;
  567. memset(loopname, 0, sizeof(loopname));
  568. snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
  569. if (setup_loop_device(data, size, loopname, &loopfd) == -1)
  570. return -1;
  571. close(loopfd);
  572. source = loopname;
  573. }
  574. mkdir(target, 0777);
  575. char opts[256];
  576. memset(opts, 0, sizeof(opts));
  577. if (strlen(mount_opts) > (sizeof(opts) - 32)) {
  578. }
  579. strncpy(opts, mount_opts, sizeof(opts) - 32);
  580. if (strcmp(fs, "iso9660") == 0) {
  581. flags |= MS_RDONLY;
  582. } else if (strncmp(fs, "ext", 3) == 0) {
  583. bool has_remount_ro = false;
  584. char* remount_ro_start = strstr(opts, "errors=remount-ro");
  585. if (remount_ro_start != NULL) {
  586. char after = *(remount_ro_start + strlen("errors=remount-ro"));
  587. char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1);
  588. has_remount_ro = ((before == '\0' || before == ',') &&
  589. (after == '\0' || after == ','));
  590. }
  591. if (strstr(opts, "errors=panic") || !has_remount_ro)
  592. strcat(opts, ",errors=continue");
  593. } else if (strcmp(fs, "xfs") == 0) {
  594. strcat(opts, ",nouuid");
  595. } else if (strncmp(fs, "gfs2", 4) == 0 &&
  596. (strstr(opts, "errors=panic") || strstr(opts, "debug"))) {
  597. strcat(opts, ",errors=withdraw");
  598. }
  599. res = mount(source, target, fs, flags, opts);
  600. if (res == -1) {
  601. err = errno;
  602. goto error_clear_loop;
  603. }
  604. res = open(target, O_RDONLY | O_DIRECTORY);
  605. if (res == -1) {
  606. err = errno;
  607. goto error_clear_loop;
  608. }
  609. if (change_dir) {
  610. res = chdir(target);
  611. if (res == -1) {
  612. err = errno;
  613. }
  614. }
  615.  
  616. error_clear_loop:
  617. if (need_loop_device)
  618. reset_loop_device(loopname);
  619. errno = err;
  620. return res;
  621. }
  622.  
  623. static void setup_gadgetfs();
  624. static void setup_binderfs();
  625. static void setup_fusectl();
  626. static void sandbox_common_mount_tmpfs(void)
  627. {
  628. write_file("/proc/sys/fs/mount-max", "100000");
  629. if (mkdir("./syz-tmp", 0777))
  630. exit(1);
  631. if (mount("", "./syz-tmp", "tmpfs", 0, NULL))
  632. exit(1);
  633. if (mkdir("./syz-tmp/newroot", 0777))
  634. exit(1);
  635. if (mkdir("./syz-tmp/newroot/dev", 0700))
  636. exit(1);
  637. unsigned bind_mount_flags = MS_BIND | MS_REC | MS_PRIVATE;
  638. if (mount("/dev", "./syz-tmp/newroot/dev", NULL, bind_mount_flags, NULL))
  639. exit(1);
  640. if (mkdir("./syz-tmp/newroot/proc", 0700))
  641. exit(1);
  642. if (mount("syz-proc", "./syz-tmp/newroot/proc", "proc", 0, NULL))
  643. exit(1);
  644. if (mkdir("./syz-tmp/newroot/selinux", 0700))
  645. exit(1);
  646. const char* selinux_path = "./syz-tmp/newroot/selinux";
  647. if (mount("/selinux", selinux_path, NULL, bind_mount_flags, NULL)) {
  648. if (errno != ENOENT)
  649. exit(1);
  650. if (mount("/sys/fs/selinux", selinux_path, NULL, bind_mount_flags, NULL) &&
  651. errno != ENOENT)
  652. exit(1);
  653. }
  654. if (mkdir("./syz-tmp/newroot/sys", 0700))
  655. exit(1);
  656. if (mount("/sys", "./syz-tmp/newroot/sys", 0, bind_mount_flags, NULL))
  657. exit(1);
  658. if (mount("/sys/kernel/debug", "./syz-tmp/newroot/sys/kernel/debug", NULL,
  659. bind_mount_flags, NULL) &&
  660. errno != ENOENT)
  661. exit(1);
  662. if (mount("/sys/fs/smackfs", "./syz-tmp/newroot/sys/fs/smackfs", NULL,
  663. bind_mount_flags, NULL) &&
  664. errno != ENOENT)
  665. exit(1);
  666. if (mount("/proc/sys/fs/binfmt_misc",
  667. "./syz-tmp/newroot/proc/sys/fs/binfmt_misc", NULL, bind_mount_flags,
  668. NULL) &&
  669. errno != ENOENT)
  670. exit(1);
  671. if (mkdir("./syz-tmp/newroot/syz-inputs", 0700))
  672. exit(1);
  673. if (mount("/syz-inputs", "./syz-tmp/newroot/syz-inputs", NULL,
  674. bind_mount_flags | MS_RDONLY, NULL) &&
  675. errno != ENOENT)
  676. exit(1);
  677. if (mkdir("./syz-tmp/pivot", 0777))
  678. exit(1);
  679. if (syscall(SYS_pivot_root, "./syz-tmp", "./syz-tmp/pivot")) {
  680. if (chdir("./syz-tmp"))
  681. exit(1);
  682. } else {
  683. if (chdir("/"))
  684. exit(1);
  685. if (umount2("./pivot", MNT_DETACH))
  686. exit(1);
  687. }
  688. if (chroot("./newroot"))
  689. exit(1);
  690. if (chdir("/"))
  691. exit(1);
  692. setup_gadgetfs();
  693. setup_binderfs();
  694. setup_fusectl();
  695. }
  696.  
  697. static void setup_gadgetfs()
  698. {
  699. if (mkdir("/dev/gadgetfs", 0777)) {
  700. }
  701. if (mount("gadgetfs", "/dev/gadgetfs", "gadgetfs", 0, NULL)) {
  702. }
  703. }
  704.  
  705. static void setup_fusectl()
  706. {
  707. if (mount(0, "/sys/fs/fuse/connections", "fusectl", 0, 0)) {
  708. }
  709. }
  710.  
  711. static void setup_binderfs()
  712. {
  713. if (mkdir("/dev/binderfs", 0777)) {
  714. }
  715. if (mount("binder", "/dev/binderfs", "binder", 0, NULL)) {
  716. }
  717. }
  718.  
  719. static void loop();
  720.  
  721. static void sandbox_common()
  722. {
  723. prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  724. if (getppid() == 1)
  725. exit(1);
  726. struct rlimit rlim;
  727. rlim.rlim_cur = rlim.rlim_max = (200 << 20);
  728. setrlimit(RLIMIT_AS, &rlim);
  729. rlim.rlim_cur = rlim.rlim_max = 32 << 20;
  730. setrlimit(RLIMIT_MEMLOCK, &rlim);
  731. rlim.rlim_cur = rlim.rlim_max = 136 << 20;
  732. setrlimit(RLIMIT_FSIZE, &rlim);
  733. rlim.rlim_cur = rlim.rlim_max = 1 << 20;
  734. setrlimit(RLIMIT_STACK, &rlim);
  735. rlim.rlim_cur = rlim.rlim_max = 128 << 20;
  736. setrlimit(RLIMIT_CORE, &rlim);
  737. rlim.rlim_cur = rlim.rlim_max = 256;
  738. setrlimit(RLIMIT_NOFILE, &rlim);
  739. if (unshare(CLONE_NEWNS)) {
  740. }
  741. if (mount(NULL, "/", NULL, MS_REC | MS_PRIVATE, NULL)) {
  742. }
  743. if (unshare(CLONE_NEWIPC)) {
  744. }
  745. if (unshare(0x02000000)) {
  746. }
  747. if (unshare(CLONE_NEWUTS)) {
  748. }
  749. if (unshare(CLONE_SYSVSEM)) {
  750. }
  751. typedef struct {
  752. const char* name;
  753. const char* value;
  754. } sysctl_t;
  755. static const sysctl_t sysctls[] = {
  756. {"/proc/sys/kernel/shmmax", "16777216"},
  757. {"/proc/sys/kernel/shmall", "536870912"},
  758. {"/proc/sys/kernel/shmmni", "1024"},
  759. {"/proc/sys/kernel/msgmax", "8192"},
  760. {"/proc/sys/kernel/msgmni", "1024"},
  761. {"/proc/sys/kernel/msgmnb", "1024"},
  762. {"/proc/sys/kernel/sem", "1024 1048576 500 1024"},
  763. };
  764. unsigned i;
  765. for (i = 0; i < sizeof(sysctls) / sizeof(sysctls[0]); i++)
  766. write_file(sysctls[i].name, sysctls[i].value);
  767. }
  768.  
  769. static int wait_for_loop(int pid)
  770. {
  771. if (pid < 0)
  772. exit(1);
  773. int status = 0;
  774. while (waitpid(-1, &status, __WALL) != pid) {
  775. }
  776. return WEXITSTATUS(status);
  777. }
  778.  
  779. static void drop_caps(void)
  780. {
  781. struct __user_cap_header_struct cap_hdr = {};
  782. struct __user_cap_data_struct cap_data[2] = {};
  783. cap_hdr.version = _LINUX_CAPABILITY_VERSION_3;
  784. cap_hdr.pid = getpid();
  785. if (syscall(SYS_capget, &cap_hdr, &cap_data))
  786. exit(1);
  787. const int drop = (1 << CAP_SYS_PTRACE) | (1 << CAP_SYS_NICE);
  788. cap_data[0].effective &= ~drop;
  789. cap_data[0].permitted &= ~drop;
  790. cap_data[0].inheritable &= ~drop;
  791. if (syscall(SYS_capset, &cap_hdr, &cap_data))
  792. exit(1);
  793. }
  794.  
  795. static int real_uid;
  796. static int real_gid;
  797. __attribute__((aligned(64 << 10))) static char sandbox_stack[1 << 20];
  798.  
  799. static int namespace_sandbox_proc(void* arg)
  800. {
  801. sandbox_common();
  802. write_file("/proc/self/setgroups", "deny");
  803. if (!write_file("/proc/self/uid_map", "0 %d 1\n", real_uid))
  804. exit(1);
  805. if (!write_file("/proc/self/gid_map", "0 %d 1\n", real_gid))
  806. exit(1);
  807. if (unshare(CLONE_NEWNET))
  808. exit(1);
  809. write_file("/proc/sys/net/ipv4/ping_group_range", "0 65535");
  810. sandbox_common_mount_tmpfs();
  811. drop_caps();
  812. loop();
  813. exit(1);
  814. }
  815.  
  816. static int do_sandbox_namespace(void)
  817. {
  818. real_uid = getuid();
  819. real_gid = getgid();
  820. mprotect(sandbox_stack, 4096, PROT_NONE);
  821. int pid =
  822. clone(namespace_sandbox_proc, &sandbox_stack[sizeof(sandbox_stack) - 64],
  823. CLONE_NEWUSER | CLONE_NEWPID, 0);
  824. return wait_for_loop(pid);
  825. }
  826.  
  827. #define FS_IOC_SETFLAGS _IOW('f', 2, long)
  828. static void remove_dir(const char* dir)
  829. {
  830. int iter = 0;
  831. DIR* dp = 0;
  832. const int umount_flags = MNT_FORCE | UMOUNT_NOFOLLOW;
  833.  
  834. retry:
  835. while (umount2(dir, umount_flags) == 0) {
  836. }
  837. dp = opendir(dir);
  838. if (dp == NULL) {
  839. if (errno == EMFILE) {
  840. exit(1);
  841. }
  842. exit(1);
  843. }
  844. struct dirent* ep = 0;
  845. while ((ep = readdir(dp))) {
  846. if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0)
  847. continue;
  848. char filename[FILENAME_MAX];
  849. snprintf(filename, sizeof(filename), "%s/%s", dir, ep->d_name);
  850. while (umount2(filename, umount_flags) == 0) {
  851. }
  852. struct stat st;
  853. if (lstat(filename, &st))
  854. exit(1);
  855. if (S_ISDIR(st.st_mode)) {
  856. remove_dir(filename);
  857. continue;
  858. }
  859. int i;
  860. for (i = 0;; i++) {
  861. if (unlink(filename) == 0)
  862. break;
  863. if (errno == EPERM) {
  864. int fd = open(filename, O_RDONLY);
  865. if (fd != -1) {
  866. long flags = 0;
  867. if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) {
  868. }
  869. close(fd);
  870. continue;
  871. }
  872. }
  873. if (errno == EROFS) {
  874. break;
  875. }
  876. if (errno != EBUSY || i > 100)
  877. exit(1);
  878. if (umount2(filename, umount_flags))
  879. exit(1);
  880. }
  881. }
  882. closedir(dp);
  883. for (int i = 0;; i++) {
  884. if (rmdir(dir) == 0)
  885. break;
  886. if (i < 100) {
  887. if (errno == EPERM) {
  888. int fd = open(dir, O_RDONLY);
  889. if (fd != -1) {
  890. long flags = 0;
  891. if (ioctl(fd, FS_IOC_SETFLAGS, &flags) == 0) {
  892. }
  893. close(fd);
  894. continue;
  895. }
  896. }
  897. if (errno == EROFS) {
  898. break;
  899. }
  900. if (errno == EBUSY) {
  901. if (umount2(dir, umount_flags))
  902. exit(1);
  903. continue;
  904. }
  905. if (errno == ENOTEMPTY) {
  906. if (iter < 100) {
  907. iter++;
  908. goto retry;
  909. }
  910. }
  911. }
  912. exit(1);
  913. }
  914. }
  915.  
  916. static void kill_and_wait(int pid, int* status)
  917. {
  918. kill(-pid, SIGKILL);
  919. kill(pid, SIGKILL);
  920. for (int i = 0; i < 100; i++) {
  921. if (waitpid(-1, status, WNOHANG | __WALL) == pid)
  922. return;
  923. usleep(1000);
  924. }
  925. DIR* dir = opendir("/sys/fs/fuse/connections");
  926. if (dir) {
  927. for (;;) {
  928. struct dirent* ent = readdir(dir);
  929. if (!ent)
  930. break;
  931. if (strcmp(ent->d_name, ".") == 0 || strcmp(ent->d_name, "..") == 0)
  932. continue;
  933. char abort[300];
  934. snprintf(abort, sizeof(abort), "/sys/fs/fuse/connections/%s/abort",
  935. ent->d_name);
  936. int fd = open(abort, O_WRONLY);
  937. if (fd == -1) {
  938. continue;
  939. }
  940. if (write(fd, abort, 1) < 0) {
  941. }
  942. close(fd);
  943. }
  944. closedir(dir);
  945. } else {
  946. }
  947. while (waitpid(-1, status, __WALL) != pid) {
  948. }
  949. }
  950.  
  951. static void reset_loop()
  952. {
  953. char buf[64];
  954. snprintf(buf, sizeof(buf), "/dev/loop%llu", procid);
  955. int loopfd = open(buf, O_RDWR);
  956. if (loopfd != -1) {
  957. ioctl(loopfd, LOOP_CLR_FD, 0);
  958. close(loopfd);
  959. }
  960. }
  961.  
  962. static void setup_test()
  963. {
  964. prctl(PR_SET_PDEATHSIG, SIGKILL, 0, 0, 0);
  965. setpgrp();
  966. write_file("/proc/self/oom_score_adj", "1000");
  967. if (symlink("/dev/binderfs", "./binderfs")) {
  968. }
  969. }
  970.  
  971. struct thread_t {
  972. int created, call;
  973. event_t ready, done;
  974. };
  975.  
  976. static struct thread_t threads[16];
  977. static void execute_call(int call);
  978. static int running;
  979.  
  980. static void* thr(void* arg)
  981. {
  982. struct thread_t* th = (struct thread_t*)arg;
  983. for (;;) {
  984. event_wait(&th->ready);
  985. event_reset(&th->ready);
  986. execute_call(th->call);
  987. __atomic_fetch_sub(&running, 1, __ATOMIC_RELAXED);
  988. event_set(&th->done);
  989. }
  990. return 0;
  991. }
  992.  
  993. static void execute_one(void)
  994. {
  995. if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {
  996. }
  997. int i, call, thread;
  998. for (call = 0; call < 16; call++) {
  999. for (thread = 0; thread < (int)(sizeof(threads) / sizeof(threads[0]));
  1000. thread++) {
  1001. struct thread_t* th = &threads[thread];
  1002. if (!th->created) {
  1003. th->created = 1;
  1004. event_init(&th->ready);
  1005. event_init(&th->done);
  1006. event_set(&th->done);
  1007. thread_start(thr, th);
  1008. }
  1009. if (!event_isset(&th->done))
  1010. continue;
  1011. event_reset(&th->done);
  1012. th->call = call;
  1013. __atomic_fetch_add(&running, 1, __ATOMIC_RELAXED);
  1014. event_set(&th->ready);
  1015. if (call == 14 || call == 15)
  1016. break;
  1017. event_timedwait(&th->done, 50 + (call == 2 ? 4000 : 0) +
  1018. (call == 6 ? 4000 : 0) +
  1019. (call == 15 ? 4000 : 0));
  1020. break;
  1021. }
  1022. }
  1023. for (i = 0; i < 100 && __atomic_load_n(&running, __ATOMIC_RELAXED); i++)
  1024. sleep_ms(1);
  1025. }
  1026.  
  1027. static void execute_one(void);
  1028.  
  1029. #define WAIT_FLAGS __WALL
  1030.  
  1031. static void loop(void)
  1032. {
  1033. int iter = 0;
  1034. for (;; iter++) {
  1035. char cwdbuf[32];
  1036. sprintf(cwdbuf, "./%d", iter);
  1037. if (mkdir(cwdbuf, 0777))
  1038. exit(1);
  1039. reset_loop();
  1040. int pid = fork();
  1041. if (pid < 0)
  1042. exit(1);
  1043. if (pid == 0) {
  1044. if (chdir(cwdbuf))
  1045. exit(1);
  1046. setup_test();
  1047. execute_one();
  1048. exit(0);
  1049. }
  1050. int status = 0;
  1051. uint64_t start = current_time_ms();
  1052. for (;;) {
  1053. sleep_ms(10);
  1054. if (waitpid(-1, &status, WNOHANG | WAIT_FLAGS) == pid)
  1055. break;
  1056. if (current_time_ms() - start < 5000)
  1057. continue;
  1058. kill_and_wait(pid, &status);
  1059. break;
  1060. }
  1061. remove_dir(cwdbuf);
  1062. }
  1063. }
  1064.  
  1065. uint64_t r[4] = {0xffffffffffffffff, 0xffffffffffffffff, 0xffffffffffffffff,
  1066. 0xffffffffffffffff};
  1067.  
  1068. void execute_call(int call)
  1069. {
  1070. intptr_t res = 0;
  1071. switch (call) {
  1072. case 0:
  1073. // perf_event_open arguments: [
  1074. // attr: nil
  1075. // pid: pid (resource)
  1076. // cpu: intptr = 0xffffffffffffffff (8 bytes)
  1077. // group: fd_perf (resource)
  1078. // flags: perf_flags = 0x0 (8 bytes)
  1079. // ]
  1080. // returns fd_perf
  1081. res = syscall(__NR_perf_event_open, /*attr=*/0ul, /*pid=*/0,
  1082. /*cpu=*/(intptr_t)-1, /*group=*/(intptr_t)-1, /*flags=*/0ul);
  1083. if (res != -1)
  1084. r[0] = res;
  1085. break;
  1086. case 1:
  1087. // getitimer arguments: [
  1088. // which: getitimer_which = 0x0 (8 bytes)
  1089. // cur: nil
  1090. // ]
  1091. syscall(__NR_getitimer, /*which=*/0ul, /*cur=*/0ul);
  1092. break;
  1093. case 2:
  1094. // syz_mount_image$ext4 arguments: [
  1095. // fs: ptr[in, buffer] {
  1096. // buffer: {65 78 74 34 00} (length 0x5)
  1097. // }
  1098. // dir: ptr[in, buffer] {
  1099. // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8)
  1100. // }
  1101. // flags: mount_flags = 0x0 (8 bytes)
  1102. // opts: ptr[in, fs_options[ext4_options]] {
  1103. // fs_options[ext4_options] {
  1104. // elems: array[fs_opt_elem[ext4_options]] {
  1105. // }
  1106. // common: array[fs_opt_elem[fs_options_common]] {
  1107. // }
  1108. // null: const = 0x0 (1 bytes)
  1109. // }
  1110. // }
  1111. // chdir: int8 = 0x1 (1 bytes)
  1112. // size: len = 0x77f (8 bytes)
  1113. // img: ptr[in, buffer] {
  1114. // buffer: (compressed buffer with length 0x77f)
  1115. // }
  1116. // ]
  1117. // returns fd_dir
  1118. memcpy((void*)0x200000000780, "ext4\000", 5);
  1119. memcpy((void*)0x200000000240, "./file0\000", 8);
  1120. *(uint8_t*)0x200000000000 = 0;
  1121. memcpy(
  1122. (void*)0x200000000f40,
  1123. "\x78\x9c\xec\xdd\xdd\x6b\x5b\xe5\x1f\x00\xf0\xef\x49\xdf\xd6\x6e\xbf"
  1124. "\x5f\x2b\x08\x3a\xaf\x0a\x82\x16\xc6\x52\x3b\xeb\xa6\xe0\xc5\xc4\x0b"
  1125. "\x11\x1c\x0c\xf4\xda\xad\xa4\x59\x99\x4d\x9b\xd1\xa4\x63\x2d\x05\x37"
  1126. "\x44\xf0\x46\x50\xf1\x42\xd0\x9b\x5d\xfb\x32\xef\xbc\xf5\xe5\x56\xff"
  1127. "\x0b\x2f\x64\x63\x6a\x37\x9c\x78\x21\x95\x93\x9e\x74\xd9\x9a\x64\xe9"
  1128. "\xd6\x97\x8d\x7c\x3e\x70\x9a\xe7\xc9\x39\xe9\xf7\xf9\xe6\x39\x2f\xcf"
  1129. "\xc9\x39\x24\x01\x74\xad\xd1\xf4\x4f\x2e\xe2\x60\x44\x7c\x94\x44\x0c"
  1130. "\x67\xcf\x27\x11\xd1\x57\x2b\xf5\x46\x1c\x5f\x5f\xee\xd6\xea\x4a\x21"
  1131. "\x9d\x92\x58\x5b\x7b\xf3\x8f\xa4\xb6\xcc\xcd\xd5\x95\x42\x34\xbc\x26"
  1132. "\xb5\x3f\xab\x3c\x19\x11\x3f\xbe\x1f\x71\x28\xb7\x39\x6e\x65\x69\x79"
  1133. "\x76\xaa\x54\x2a\x2e\x64\xf5\xf1\xea\xdc\xb9\xf1\xca\xd2\xf2\xe1\xb3"
  1134. "\x73\x53\x33\xc5\x99\xe2\xfc\xd1\x89\xc9\xc9\x23\xc7\x5e\x38\x76\x74"
  1135. "\xfb\x72\xfd\xeb\x97\xe5\x03\xd7\x3e\x7e\xed\xd9\x6f\x8e\xff\xf3\xde"
  1136. "\x13\x57\x3e\xfc\x29\x89\xe3\x71\x20\x9b\xd7\x98\xc7\x76\x19\x8d\xd1"
  1137. "\xec\x3d\xe9\x4b\xdf\xc2\x3b\xbc\xba\xdd\xc1\xf6\x58\xb2\xd7\x0d\xe0"
  1138. "\xbe\xa4\x9b\x66\xcf\xfa\x56\x1e\x07\x63\x38\x7a\x6a\xa5\x16\x06\x77"
  1139. "\xb3\x65\x00\xc0\x4e\x79\x37\x22\xd6\x00\x80\x2e\x93\x38\xfe\x03\x40"
  1140. "\x97\xa9\x7f\x0e\x70\x73\x75\xa5\x50\x9f\xda\x7c\x5c\xd0\xe6\xe2\xc0"
  1141. "\xa3\xe9\xfa\x2b\x11\xb1\x6f\x3d\xff\xfa\xf5\xcd\xf5\x39\xbd\xd9\x35"
  1142. "\xbb\x7d\xb5\xeb\xa0\x43\x37\x93\x3b\x92\x4f\x22\x62\x64\x1b\xe2\x8f"
  1143. "\x46\xc4\x17\xdf\xbd\xfd\x55\x3a\xc5\x0e\x5d\x87\x04\x68\xe6\xe2\xa5"
  1144. "\x88\x38\x3d\x32\xba\x79\xff\x9f\x6c\xba\x67\x61\xab\x9e\xeb\x60\x99"
  1145. "\xd1\xbb\xea\x0d\xfb\xbf\xfe\x07\x0c\x0f\xdc\xc3\xf7\xe9\xf8\xe7\xc5"
  1146. "\x66\xe3\xbf\xdc\xc6\xf8\x27\x9a\x8c\x7f\x06\x9a\x6c\xbb\xf7\xa3\xcd"
  1147. "\xf6\x9f\xc9\x5d\xdd\x86\x30\x2d\xa5\xe3\xbf\x97\x1b\xee\x6d\xbb\xd5"
  1148. "\x90\x7f\x66\xa4\x27\xab\xfd\xaf\x36\xe6\xeb\x4b\xce\x9c\x2d\x15\xd3"
  1149. "\x7d\xdb\xff\x23\x62\x2c\xfa\x06\xd2\xfa\x44\x9b\x18\x63\x37\xfe\xbd"
  1150. "\xd1\x6a\x5e\xe3\xf8\xef\xcf\x4f\xde\xf9\x32\x8d\x9f\x3e\xde\x5e\x22"
  1151. "\x77\xb5\x77\xe0\xce\xd7\x4c\x4f\x55\xa7\x1e\x24\xe7\x46\xd7\x2f\x45"
  1152. "\x3c\xd5\xdb\x2c\xff\x64\xa3\xff\x93\x16\xe3\xdf\x93\x1d\xc6\x78\xfd"
  1153. "\xa5\x0f\x3e\x6f\x35\x2f\xcd\x3f\xcd\xb7\x3e\x6d\xce\x7f\x67\xad\x5d"
  1154. "\x8e\x78\xa6\x69\xff\xdf\xbe\xa3\x2d\x69\x7b\x7f\xe2\x78\x6d\x75\x18"
  1155. "\xaf\xaf\x14\x4d\x7c\xfb\xeb\x67\x43\xad\xe2\x37\xf6\x7f\x3a\xa5\xf1"
  1156. "\xeb\xe7\x02\xbb\x21\xed\xff\xa1\xf6\xf9\x8f\x24\x8d\xf7\x6b\x56\xb6"
  1157. "\x1e\xe3\xe7\xcb\xc3\x3f\xb4\x9a\x77\xef\xfc\x9b\xaf\xff\xfd\xc9\x5b"
  1158. "\xb5\x72\x7d\x90\x70\x61\xaa\x5a\x5d\x98\x88\xe8\x4f\xde\xd8\xfc\xfc"
  1159. "\x91\xdb\xaf\xad\xd7\xeb\xcb\xa7\xf9\x8f\x3d\xdd\xdf\x74\xfb\x6f\xb7"
  1160. "\xfe\xa7\xe7\x84\xa7\x3b\xcc\xbf\xf7\xda\xef\x5f\x6f\x54\xee\x3a\xf1"
  1161. "\x7e\x18\xfa\x7f\x7a\x4b\xfd\xbf\xf5\xc2\x95\x5b\xb3\x3d\xad\xe2\x77"
  1162. "\xd6\xff\x93\xb5\xd2\x58\xf6\x4c\x27\xfb\xbf\x4e\x1b\xf8\x20\xef\x1d"
  1163. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1164. "\x00\x00\x74\x2a\x17\x11\x07\x22\xc9\xe5\x37\xca\xb9\x5c\x3e\xbf\xfe"
  1165. "\x1b\xde\x8f\xc7\x50\xae\x54\xae\x54\x0f\x9d\x29\x2f\xce\x4f\x47\xed"
  1166. "\xb7\xb2\x47\xa2\x2f\x57\xff\xaa\xcb\xe1\x86\xef\x43\x9d\xc8\xbe\x0f"
  1167. "\xbf\x5e\x3f\x72\x57\xfd\xf9\x88\x78\x2c\x22\x3e\x1d\x18\xac\xd5\xf3"
  1168. "\x85\x72\x69\x7a\xaf\x93\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1169. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1170. "\x00\x00\x00\x80\xcc\xfe\x16\xbf\xff\x9f\xfa\x6d\x60\xaf\x5b\x07\x00"
  1171. "\xec\x98\x7d\x7b\xdd\x00\x00\x60\xd7\x39\xfe\x03\x40\xf7\xd9\xda\xf1"
  1172. "\x7f\x70\xc7\xda\x01\x00\xec\x1e\xe7\xff\x00\xd0\x7d\x1c\xff\x01\xa0"
  1173. "\xfb\x38\xfe\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1174. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1175. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1176. "\x00\x00\x00\xb0\xc3\x4e\x9e\x38\x91\x4e\x6b\x7f\xaf\xae\x14\xd2\xfa"
  1177. "\xf4\xf9\xa5\xc5\xd9\xf2\xf9\xc3\xd3\xc5\xca\x6c\x7e\x6e\xb1\x90\x2f"
  1178. "\x94\x17\xce\xe5\x67\xca\xe5\x99\x52\x31\x5f\x28\xcf\xb5\xfc\x47\x17"
  1179. "\xd7\x1f\x4a\xe5\xf2\xb9\xc9\x98\x5f\xbc\x30\x5e\x2d\x56\xaa\xe3\x95"
  1180. "\xa5\xe5\x53\x73\xe5\xc5\xf9\xea\xa9\xb3\x73\x53\x33\xc5\x53\xc5\xbe"
  1181. "\x5d\xcb\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1182. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1183. "\x3a\x57\x59\x5a\x9e\x9d\x2a\x95\x8a\x0b\x0a\xdd\x57\xe8\xc9\x56\x82"
  1184. "\x87\xa5\x3d\x0a\x0f\x51\xa1\x71\x2f\x31\xb8\x37\x3b\x27\x00\x00\x00"
  1185. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1186. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1187. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1188. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1189. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1190. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1191. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1192. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1193. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1194. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1195. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1196. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1197. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1198. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1199. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1200. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1201. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1202. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1203. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1204. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1205. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1206. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1207. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1208. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1209. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1210. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1211. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1212. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1213. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1214. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1215. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1216. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1217. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1218. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1219. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1220. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1221. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1222. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1223. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1224. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1225. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1226. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1227. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1228. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1229. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1230. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1231. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1232. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1233. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1234. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1235. "\x00\x00\x80\x47\xc0\x7f\x01\x00\x00\xff\xff\x51\xe3\x2f\x55",
  1236. 1919);
  1237. syz_mount_image(/*fs=*/0x200000000780, /*dir=*/0x200000000240, /*flags=*/0,
  1238. /*opts=*/0x200000000000, /*chdir=*/1, /*size=*/0x77f,
  1239. /*img=*/0x200000000f40);
  1240. break;
  1241. case 3:
  1242. // open arguments: [
  1243. // file: ptr[in, buffer] {
  1244. // buffer: {2e 2f 62 75 73 00} (length 0x6)
  1245. // }
  1246. // flags: open_flags = 0x60142 (8 bytes)
  1247. // mode: open_mode = 0x0 (8 bytes)
  1248. // ]
  1249. // returns fd
  1250. memcpy((void*)0x200000000000, "./bus\000", 6);
  1251. res = syscall(
  1252. __NR_open, /*file=*/0x200000000000ul,
  1253. /*flags=O_NOFOLLOW|O_NOCTTY|O_NOATIME|O_CREAT|O_RDWR*/ 0x60142ul,
  1254. /*mode=*/0ul);
  1255. if (res != -1)
  1256. r[1] = res;
  1257. break;
  1258. case 4:
  1259. // open arguments: [
  1260. // file: ptr[in, buffer] {
  1261. // buffer: {2e 2f 62 75 73 00} (length 0x6)
  1262. // }
  1263. // flags: open_flags = 0x145142 (8 bytes)
  1264. // mode: open_mode = 0x0 (8 bytes)
  1265. // ]
  1266. // returns fd
  1267. memcpy((void*)0x200000007f80, "./bus\000", 6);
  1268. res = syscall(
  1269. __NR_open, /*file=*/0x200000007f80ul,
  1270. /*flags=O_SYNC|O_NOCTTY|O_NOATIME|O_DIRECT|O_CREAT|0x2*/ 0x145142ul,
  1271. /*mode=*/0ul);
  1272. if (res != -1)
  1273. r[2] = res;
  1274. break;
  1275. case 5:
  1276. // ftruncate arguments: [
  1277. // fd: fd (resource)
  1278. // len: intptr = 0x2007ffb (8 bytes)
  1279. // ]
  1280. syscall(__NR_ftruncate, /*fd=*/r[2], /*len=*/0x2007ffbul);
  1281. break;
  1282. case 6:
  1283. // syz_mount_image$ext4 arguments: [
  1284. // fs: ptr[in, buffer] {
  1285. // buffer: {65 78 74 34 00} (length 0x5)
  1286. // }
  1287. // dir: ptr[in, buffer] {
  1288. // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8)
  1289. // }
  1290. // flags: mount_flags = 0x23000012 (8 bytes)
  1291. // opts: ptr[in, fs_options[ext4_options]] {
  1292. // fs_options[ext4_options] {
  1293. // elems: array[fs_opt_elem[ext4_options]] {
  1294. // fs_opt_elem[ext4_options] {
  1295. // elem: union ext4_options {
  1296. // usrjquota: buffer: {75 73 72 6a 71 75 6f 74 61 3d} (length
  1297. // 0xa)
  1298. // }
  1299. // comma: const = 0x2c (1 bytes)
  1300. // }
  1301. // fs_opt_elem[ext4_options] {
  1302. // elem: union ext4_options {
  1303. // nogrpid: buffer: {6e 6f 67 72 70 69 64} (length 0x7)
  1304. // }
  1305. // comma: const = 0x2c (1 bytes)
  1306. // }
  1307. // fs_opt_elem[ext4_options] {
  1308. // elem: union ext4_options {
  1309. // nomblk_io_submit: buffer: {6e 6f 6d 62 6c 6b 5f 69 6f 5f 73
  1310. // 75 62 6d 69 74} (length 0x10)
  1311. // }
  1312. // comma: const = 0x2c (1 bytes)
  1313. // }
  1314. // fs_opt_elem[ext4_options] {
  1315. // elem: union ext4_options {
  1316. // noauto_da_alloc: buffer: {6e 6f 61 75 74 6f 5f 64 61 5f 61
  1317. // 6c 6c 6f 63} (length 0xf)
  1318. // }
  1319. // comma: const = 0x2c (1 bytes)
  1320. // }
  1321. // fs_opt_elem[ext4_options] {
  1322. // elem: union ext4_options {
  1323. // sysvgroups: buffer: {73 79 73 76 67 72 6f 75 70 73} (length
  1324. // 0xa)
  1325. // }
  1326. // comma: const = 0x2c (1 bytes)
  1327. // }
  1328. // fs_opt_elem[ext4_options] {
  1329. // elem: union ext4_options {
  1330. // mblk_io_submit: buffer: {6d 62 6c 6b 5f 69 6f 5f 73 75 62 6d
  1331. // 69 74} (length 0xe)
  1332. // }
  1333. // comma: const = 0x2c (1 bytes)
  1334. // }
  1335. // fs_opt_elem[ext4_options] {
  1336. // elem: union ext4_options {
  1337. // errors_remount: buffer: {65 72 72 6f 72 73 3d 72 65 6d 6f 75
  1338. // 6e 74 2d 72 6f} (length 0x11)
  1339. // }
  1340. // comma: const = 0x2c (1 bytes)
  1341. // }
  1342. // }
  1343. // common: array[fs_opt_elem[fs_options_common]] {
  1344. // }
  1345. // null: const = 0x0 (1 bytes)
  1346. // }
  1347. // }
  1348. // chdir: int8 = 0x1 (1 bytes)
  1349. // size: len = 0x459 (8 bytes)
  1350. // img: ptr[in, buffer] {
  1351. // buffer: (compressed buffer with length 0x459)
  1352. // }
  1353. // ]
  1354. // returns fd_dir
  1355. memcpy((void*)0x200000000180, "ext4\000", 5);
  1356. memcpy((void*)0x200000000080, "./file0\000", 8);
  1357. memcpy((void*)0x200000000640, "usrjquota=", 10);
  1358. *(uint8_t*)0x20000000064a = 0x2c;
  1359. memcpy((void*)0x20000000064b, "nogrpid", 7);
  1360. *(uint8_t*)0x200000000652 = 0x2c;
  1361. memcpy((void*)0x200000000653, "nomblk_io_submit", 16);
  1362. *(uint8_t*)0x200000000663 = 0x2c;
  1363. memcpy((void*)0x200000000664, "noauto_da_alloc", 15);
  1364. *(uint8_t*)0x200000000673 = 0x2c;
  1365. memcpy((void*)0x200000000674, "sysvgroups", 10);
  1366. *(uint8_t*)0x20000000067e = 0x2c;
  1367. memcpy((void*)0x20000000067f, "mblk_io_submit", 14);
  1368. *(uint8_t*)0x20000000068d = 0x2c;
  1369. memcpy((void*)0x20000000068e, "errors=remount-ro", 17);
  1370. *(uint8_t*)0x20000000069f = 0x2c;
  1371. *(uint8_t*)0x2000000006a0 = 0;
  1372. memcpy(
  1373. (void*)0x2000000001c0,
  1374. "\x78\x9c\xec\xdb\xcd\x6f\x14\xe5\x1f\x00\xf0\xef\xcc\x6e\x81\x1f\x6f"
  1375. "\xed\x0f\xf1\x05\x44\xa9\xa2\xb1\x51\x69\x69\x41\xe5\xe0\x45\xa3\x89"
  1376. "\x07\x4d\x4c\xf4\x80\xc7\xda\x16\x82\x2c\xd4\xd0\x9a\x08\x21\x5a\x8d"
  1377. "\xc1\xa3\x21\xf1\x6e\x3c\x9a\xf8\x17\x78\xd2\x8b\x51\x4f\x26\x5e\xf5"
  1378. "\x6e\x48\x88\x72\x01\xbd\x38\x66\x76\x67\xca\xb2\xec\x16\x96\x6e\xd9"
  1379. "\xe2\x7e\x3e\xc9\xc0\xf3\xec\x3c\xb3\xf3\x7c\xe7\x99\x67\xfb\xcc\xf3"
  1380. "\xec\x06\x30\xb0\x46\xf3\x7f\x92\x88\xad\x11\xf1\x6b\x44\x0c\x37\xb2"
  1381. "\xd7\x17\x18\x6d\xfc\x77\xf5\xf2\xb9\x99\xbf\x2e\x9f\x9b\x49\x22\xcb"
  1382. "\xde\xf8\x23\xa9\x97\xbb\x72\xf9\xdc\x4c\x59\xb4\x3c\x6e\x4b\x91\x19"
  1383. "\x4b\x23\xd2\x4f\x92\x96\x37\x6c\x58\x38\x73\xf6\xc4\x74\xad\x36\x77"
  1384. "\xba\xc8\x4f\x2c\x9e\x7c\x77\x62\xe1\xcc\xd9\xfd\xc7\x4f\x4e\x1f\x9b"
  1385. "\x3b\x36\x77\x6a\xea\xf0\xe1\x43\x07\x27\x9f\x7b\x76\xea\x99\xe5\x63"
  1386. "\x36\xad\x22\xce\x3c\xae\x2b\xbb\x3f\x98\xdf\xb3\xeb\x95\xb7\x2e\xbc"
  1387. "\x36\x73\xe4\xc2\xdb\x3f\x7e\x9d\x57\x6b\x6b\xb1\xbf\x39\x8e\x5e\x19"
  1388. "\xcd\xaf\xda\x9f\x59\xd6\x26\xfc\x78\xbc\xd7\x27\xeb\xb3\x6d\x4d\xe9"
  1389. "\xa4\xda\xc7\x8a\xd0\x95\x4a\x44\xe4\xcd\x35\x54\xef\xff\xc3\x51\x89"
  1390. "\x6b\x8d\x37\x1c\x2f\x7f\xdc\xd7\xca\x01\x6b\x2a\xcb\xb2\x6c\x63\xe7"
  1391. "\xdd\x4b\x19\xf0\x1f\x96\x44\xbf\x6b\x00\xf4\x47\xf9\x87\x3e\x7f\xfe"
  1392. "\x2d\xb7\x3b\x34\xf4\x58\x17\x2e\xbd\xd0\x78\x00\xca\xe3\xbe\x5a\x6c"
  1393. "\x8d\x3d\xd5\x48\x8b\x32\x43\x2d\xcf\xb7\xbd\x34\x1a\x11\x47\x96\xfe"
  1394. "\xfe\x22\xdf\x62\x8d\xe6\x21\x00\x00\x9a\x7d\x9b\x8f\x7f\x9e\x6e\x37"
  1395. "\xfe\x4b\xe3\xbe\xa6\x72\xdb\x8b\x35\x94\x91\x88\xf8\x7f\x44\xec\x88"
  1396. "\x88\x7b\x22\x62\x67\x44\xdc\x1b\x51\x2f\x7b\x7f\x44\x3c\xd0\xe5\xf9"
  1397. "\x47\x5b\xf2\x37\x8e\x7f\xd2\x8b\xb7\x15\xd8\x2d\xca\xc7\x7f\xcf\x17"
  1398. "\x6b\x5b\xd7\x8f\xff\xca\xd1\x5f\x8c\x54\x8a\xdc\xb6\x7a\xfc\x43\xc9"
  1399. "\xd1\xe3\xb5\xb9\x03\xc5\x35\x19\x8b\xa1\x8d\x79\x7e\x72\x85\x73\x7c"
  1400. "\xf7\xd2\x2f\x9f\x75\xda\xd7\x3c\xfe\xcb\xb7\xfc\xfc\xe5\x58\xb0\xa8"
  1401. "\xc7\xc5\x6a\xcb\x04\xdd\xec\xf4\x62\xcf\x56\x58\x2e\x7d\x14\xb1\xbb"
  1402. "\xda\x2e\xfe\x64\x79\x25\x20\x89\x88\x5d\x11\xb1\xbb\xbb\xb7\xde\x5e"
  1403. "\x26\x8e\x3f\xf9\xd5\x9e\x4e\x85\x6e\x1e\xff\x0a\x7a\x70\x15\xb2\x2f"
  1404. "\x23\x9e\x68\xb4\xff\x52\xb4\xc4\x5f\x4a\x56\x5e\x9f\x9c\xd8\x14\xb5"
  1405. "\xb9\x03\x13\xe5\x5d\x71\xa3\x9f\x7e\x3e\xff\x7a\xa7\xf3\xaf\x2a\xfe"
  1406. "\x1e\xc8\xdb\x7f\xf3\xf5\xf7\x7f\x6b\x91\x91\xa4\x79\xbd\x76\xa1\xfb"
  1407. "\x73\x9c\xff\xed\xd3\x8e\xcf\x34\xb7\x79\xff\x4f\x6f\x48\xde\xac\x7f"
  1408. "\x06\xfd\x93\x65\xd9\xfe\x88\x78\x7f\x7a\x71\xf1\xf4\x64\xc4\x86\xe4"
  1409. "\xd5\x7a\x99\x0d\x45\xd9\xfa\xeb\x53\xd7\x8e\x2d\xf3\x65\xf9\x3c\xfe"
  1410. "\xb1\x7d\xed\xfb\xff\x8e\xe2\x98\x3c\xfe\x07\x23\x22\xbf\x89\x1f\x8a"
  1411. "\x88\x87\x23\x62\x6f\x51\xf7\x47\x22\xe2\xd1\x88\xd8\xb7\x42\xfc\x3f"
  1412. "\xbc\xf8\xd8\x3b\xb7\x1f\xff\xda\xca\xe3\x9f\x6d\xfb\xf9\xb7\x7c\xff"
  1413. "\xb7\xb4\x7f\xf7\x89\xca\x89\xef\xbf\x69\x7b\xf2\xea\xad\xb6\xff\xa1"
  1414. "\x7a\x6a\xac\x78\x25\x6f\xff\x9b\xc5\xb5\x42\x75\xf6\x36\xbf\xb2\xca"
  1415. "\xcb\x07\x00\x00\x00\x77\x85\xb4\xfe\x1d\xf8\x24\x1d\x5f\x4e\xa7\xe9"
  1416. "\xf8\x78\xe3\x3b\xfc\x3b\x63\x73\x5a\x9b\x5f\x58\x7c\xea\xe8\xfc\x7b"
  1417. "\xa7\x66\x1b\xdf\x95\x1f\x89\xa1\xb4\x9c\xe9\x1a\x6e\x9a\x0f\x9d\x4c"
  1418. "\x96\x8a\x77\x6c\xe4\xa7\x8a\xb9\xe2\x72\xff\xc1\x62\xde\xf8\xf3\xca"
  1419. "\xff\xea\xf9\xf1\x99\xf9\xda\x6c\x9f\x63\x87\x41\xb7\xa5\x43\xff\xcf"
  1420. "\xfd\x5e\xe9\x77\xed\x80\x35\xd7\xf5\x3a\xda\x99\x76\x3f\x69\x03\xee"
  1421. "\x46\xad\xfd\x3f\xed\x53\x3d\x80\x3b\xcf\xef\xb5\x61\x70\xe9\xff\x30"
  1422. "\xb8\xf4\x7f\x18\x5c\xed\xfa\xff\x87\x2d\xf9\x1b\xd6\x02\x4c\x12\xc0"
  1423. "\x5d\x4f\x37\x86\xc1\x66\xfc\x0f\x83\x4b\xff\x87\xc1\xa5\xff\xc3\x40"
  1424. "\x5a\xcd\xef\xfa\x25\x06\x39\x11\xe9\xba\xa8\xc6\xea\x13\xd5\xf5\x51"
  1425. "\x8d\xf5\x96\xe8\xf7\x27\x13\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1426. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1427. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1428. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1429. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1430. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1431. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1432. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1433. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1434. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1435. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1436. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1437. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1438. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x40\x6f\xfc\x1b"
  1439. "\x00\x00\xff\xff\x01\x90\xed\x0d",
  1440. 1113);
  1441. syz_mount_image(
  1442. /*fs=*/0x200000000180, /*dir=*/0x200000000080,
  1443. /*flags=MS_LAZYTIME|MS_SYNCHRONOUS|MS_STRICTATIME|MS_NOSUID|0x20000000*/
  1444. 0x23000012, /*opts=*/0x200000000640, /*chdir=*/1, /*size=*/0x459,
  1445. /*img=*/0x2000000001c0);
  1446. break;
  1447. case 7:
  1448. // socket arguments: [
  1449. // domain: socket_domain = 0x10 (8 bytes)
  1450. // type: socket_type = 0x3 (8 bytes)
  1451. // proto: int32 = 0x0 (4 bytes)
  1452. // ]
  1453. // returns sock
  1454. syscall(__NR_socket, /*domain=AF_NETLINK*/ 0x10ul, /*type=SOCK_RAW*/ 3ul,
  1455. /*proto=*/0);
  1456. break;
  1457. case 8:
  1458. // sendfile arguments: [
  1459. // fdout: fd (resource)
  1460. // fdin: fd (resource)
  1461. // off: nil
  1462. // count: intptr = 0x4 (8 bytes)
  1463. // ]
  1464. syscall(__NR_sendfile, /*fdout=*/r[1], /*fdin=*/r[2], /*off=*/0ul,
  1465. /*count=*/4ul);
  1466. break;
  1467. case 9:
  1468. // mmap arguments: [
  1469. // addr: VMA[0xb36000]
  1470. // len: len = 0xb36000 (8 bytes)
  1471. // prot: mmap_prot = 0x2 (8 bytes)
  1472. // flags: mmap_flags = 0x28011 (8 bytes)
  1473. // fd: fd (resource)
  1474. // offset: intptr = 0x2000 (8 bytes)
  1475. // ]
  1476. syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0xb36000ul,
  1477. /*prot=PROT_WRITE*/ 2ul,
  1478. /*flags=MAP_STACK|MAP_POPULATE|MAP_FIXED|MAP_SHARED*/ 0x28011ul,
  1479. /*fd=*/r[2], /*offset=*/0x2000ul);
  1480. break;
  1481. case 10:
  1482. // connect$inet6 arguments: [
  1483. // fd: sock_in6 (resource)
  1484. // addr: nil
  1485. // addrlen: len = 0x0 (8 bytes)
  1486. // ]
  1487. syscall(__NR_connect, /*fd=*/(intptr_t)-1, /*addr=*/0ul, /*addrlen=*/0ul);
  1488. break;
  1489. case 11:
  1490. // ioctl$BTRFS_IOC_QGROUP_ASSIGN arguments: [
  1491. // fd: fd (resource)
  1492. // cmd: const = 0x40189429 (4 bytes)
  1493. // arg: ptr[in, btrfs_ioctl_qgroup_assign_args] {
  1494. // btrfs_ioctl_qgroup_assign_args {
  1495. // assign: int64 = 0x1 (8 bytes)
  1496. // src: int64 = 0xf (8 bytes)
  1497. // dst: int64 = 0xf (8 bytes)
  1498. // }
  1499. // }
  1500. // ]
  1501. *(uint64_t*)0x200000000040 = 1;
  1502. *(uint64_t*)0x200000000048 = 0xf;
  1503. *(uint64_t*)0x200000000050 = 0xf;
  1504. syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0x40189429,
  1505. /*arg=*/0x200000000040ul);
  1506. break;
  1507. case 12:
  1508. // openat$cgroup_ro arguments: [
  1509. // fd: fd_cgroup (resource)
  1510. // file: nil
  1511. // flags: const = 0x275a (4 bytes)
  1512. // mode: const = 0x0 (2 bytes)
  1513. // ]
  1514. // returns fd
  1515. res = syscall(__NR_openat, /*fd=*/0xffffff9c, /*file=*/0ul,
  1516. /*flags=*/0x275a, /*mode=*/0);
  1517. if (res != -1)
  1518. r[3] = res;
  1519. break;
  1520. case 13:
  1521. // writev arguments: [
  1522. // fd: fd (resource)
  1523. // vec: nil
  1524. // vlen: len = 0x0 (8 bytes)
  1525. // ]
  1526. syscall(__NR_writev, /*fd=*/r[3], /*vec=*/0ul, /*vlen=*/0ul);
  1527. break;
  1528. case 14:
  1529. // getitimer arguments: [
  1530. // which: getitimer_which = 0x0 (8 bytes)
  1531. // cur: ptr[out, itimerval] {
  1532. // itimerval {
  1533. // interv: timeval {
  1534. // sec: time_sec (resource)
  1535. // usec: time_usec (resource)
  1536. // }
  1537. // value: timeval {
  1538. // sec: time_sec (resource)
  1539. // usec: time_usec (resource)
  1540. // }
  1541. // }
  1542. // }
  1543. // ]
  1544. syscall(__NR_getitimer, /*which=*/0ul, /*cur=*/0x200000000000ul);
  1545. break;
  1546. case 15:
  1547. // syz_mount_image$ext4 arguments: [
  1548. // fs: ptr[in, buffer] {
  1549. // buffer: {65 78 74 34 00} (length 0x5)
  1550. // }
  1551. // dir: ptr[in, buffer] {
  1552. // buffer: {2e 2f 66 69 6c 65 30 00} (length 0x8)
  1553. // }
  1554. // flags: mount_flags = 0x0 (8 bytes)
  1555. // opts: ptr[in, fs_options[ext4_options]] {
  1556. // fs_options[ext4_options] {
  1557. // elems: array[fs_opt_elem[ext4_options]] {
  1558. // }
  1559. // common: array[fs_opt_elem[fs_options_common]] {
  1560. // }
  1561. // null: const = 0x0 (1 bytes)
  1562. // }
  1563. // }
  1564. // chdir: int8 = 0x1 (1 bytes)
  1565. // size: len = 0x77f (8 bytes)
  1566. // img: ptr[in, buffer] {
  1567. // buffer: (compressed buffer with length 0x77f)
  1568. // }
  1569. // ]
  1570. // returns fd_dir
  1571. memcpy((void*)0x200000000780, "ext4\000", 5);
  1572. memcpy((void*)0x200000000240, "./file0\000", 8);
  1573. *(uint8_t*)0x200000000000 = 0;
  1574. memcpy(
  1575. (void*)0x200000000f40,
  1576. "\x78\x9c\xec\xdd\xdd\x6b\x5b\xe5\x1f\x00\xf0\xef\x49\xdf\xd6\x6e\xbf"
  1577. "\x5f\x2b\x08\x3a\xaf\x0a\x82\x16\xc6\x52\x3b\xeb\xa6\xe0\xc5\xc4\x0b"
  1578. "\x11\x1c\x0c\xf4\xda\xad\xa4\x59\x99\x4d\x9b\xd1\xa4\x63\x2d\x05\x37"
  1579. "\x44\xf0\x46\x50\xf1\x42\xd0\x9b\x5d\xfb\x32\xef\xbc\xf5\xe5\x56\xff"
  1580. "\x0b\x2f\x64\x63\x6a\x37\x9c\x78\x21\x95\x93\x9e\x74\xd9\x9a\x64\xe9"
  1581. "\xd6\x97\x8d\x7c\x3e\x70\x9a\xe7\xc9\x39\xe9\xf7\xf9\xe6\x39\x2f\xcf"
  1582. "\xc9\x39\x24\x01\x74\xad\xd1\xf4\x4f\x2e\xe2\x60\x44\x7c\x94\x44\x0c"
  1583. "\x67\xcf\x27\x11\xd1\x57\x2b\xf5\x46\x1c\x5f\x5f\xee\xd6\xea\x4a\x21"
  1584. "\x9d\x92\x58\x5b\x7b\xf3\x8f\xa4\xb6\xcc\xcd\xd5\x95\x42\x34\xbc\x26"
  1585. "\xb5\x3f\xab\x3c\x19\x11\x3f\xbe\x1f\x71\x28\xb7\x39\x6e\x65\x69\x79"
  1586. "\x76\xaa\x54\x2a\x2e\x64\xf5\xf1\xea\xdc\xb9\xf1\xca\xd2\xf2\xe1\xb3"
  1587. "\x73\x53\x33\xc5\x99\xe2\xfc\xd1\x89\xc9\xc9\x23\xc7\x5e\x38\x76\x74"
  1588. "\xfb\x72\xfd\xeb\x97\xe5\x03\xd7\x3e\x7e\xed\xd9\x6f\x8e\xff\xf3\xde"
  1589. "\x13\x57\x3e\xfc\x29\x89\xe3\x71\x20\x9b\xd7\x98\xc7\x76\x19\x8d\xd1"
  1590. "\xec\x3d\xe9\x4b\xdf\xc2\x3b\xbc\xba\xdd\xc1\xf6\x58\xb2\xd7\x0d\xe0"
  1591. "\xbe\xa4\x9b\x66\xcf\xfa\x56\x1e\x07\x63\x38\x7a\x6a\xa5\x16\x06\x77"
  1592. "\xb3\x65\x00\xc0\x4e\x79\x37\x22\xd6\x00\x80\x2e\x93\x38\xfe\x03\x40"
  1593. "\x97\xa9\x7f\x0e\x70\x73\x75\xa5\x50\x9f\xda\x7c\x5c\xd0\xe6\xe2\xc0"
  1594. "\xa3\xe9\xfa\x2b\x11\xb1\x6f\x3d\xff\xfa\xf5\xcd\xf5\x39\xbd\xd9\x35"
  1595. "\xbb\x7d\xb5\xeb\xa0\x43\x37\x93\x3b\x92\x4f\x22\x62\x64\x1b\xe2\x8f"
  1596. "\x46\xc4\x17\xdf\xbd\xfd\x55\x3a\xc5\x0e\x5d\x87\x04\x68\xe6\xe2\xa5"
  1597. "\x88\x38\x3d\x32\xba\x79\xff\x9f\x6c\xba\x67\x61\xab\x9e\xeb\x60\x99"
  1598. "\xd1\xbb\xea\x0d\xfb\xbf\xfe\x07\x0c\x0f\xdc\xc3\xf7\xe9\xf8\xe7\xc5"
  1599. "\x66\xe3\xbf\xdc\xc6\xf8\x27\x9a\x8c\x7f\x06\x9a\x6c\xbb\xf7\xa3\xcd"
  1600. "\xf6\x9f\xc9\x5d\xdd\x86\x30\x2d\xa5\xe3\xbf\x97\x1b\xee\x6d\xbb\xd5"
  1601. "\x90\x7f\x66\xa4\x27\xab\xfd\xaf\x36\xe6\xeb\x4b\xce\x9c\x2d\x15\xd3"
  1602. "\x7d\xdb\xff\x23\x62\x2c\xfa\x06\xd2\xfa\x44\x9b\x18\x63\x37\xfe\xbd"
  1603. "\xd1\x6a\x5e\xe3\xf8\xef\xcf\x4f\xde\xf9\x32\x8d\x9f\x3e\xde\x5e\x22"
  1604. "\x77\xb5\x77\xe0\xce\xd7\x4c\x4f\x55\xa7\x1e\x24\xe7\x46\xd7\x2f\x45"
  1605. "\x3c\xd5\xdb\x2c\xff\x64\xa3\xff\x93\x16\xe3\xdf\x93\x1d\xc6\x78\xfd"
  1606. "\xa5\x0f\x3e\x6f\x35\x2f\xcd\x3f\xcd\xb7\x3e\x6d\xce\x7f\x67\xad\x5d"
  1607. "\x8e\x78\xa6\x69\xff\xdf\xbe\xa3\x2d\x69\x7b\x7f\xe2\x78\x6d\x75\x18"
  1608. "\xaf\xaf\x14\x4d\x7c\xfb\xeb\x67\x43\xad\xe2\x37\xf6\x7f\x3a\xa5\xf1"
  1609. "\xeb\xe7\x02\xbb\x21\xed\xff\xa1\xf6\xf9\x8f\x24\x8d\xf7\x6b\x56\xb6"
  1610. "\x1e\xe3\xe7\xcb\xc3\x3f\xb4\x9a\x77\xef\xfc\x9b\xaf\xff\xfd\xc9\x5b"
  1611. "\xb5\x72\x7d\x90\x70\x61\xaa\x5a\x5d\x98\x88\xe8\x4f\xde\xd8\xfc\xfc"
  1612. "\x91\xdb\xaf\xad\xd7\xeb\xcb\xa7\xf9\x8f\x3d\xdd\xdf\x74\xfb\x6f\xb7"
  1613. "\xfe\xa7\xe7\x84\xa7\x3b\xcc\xbf\xf7\xda\xef\x5f\x6f\x54\xee\x3a\xf1"
  1614. "\x7e\x18\xfa\x7f\x7a\x4b\xfd\xbf\xf5\xc2\x95\x5b\xb3\x3d\xad\xe2\x77"
  1615. "\xd6\xff\x93\xb5\xd2\x58\xf6\x4c\x27\xfb\xbf\x4e\x1b\xf8\x20\xef\x1d"
  1616. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1617. "\x00\x00\x74\x2a\x17\x11\x07\x22\xc9\xe5\x37\xca\xb9\x5c\x3e\xbf\xfe"
  1618. "\x1b\xde\x8f\xc7\x50\xae\x54\xae\x54\x0f\x9d\x29\x2f\xce\x4f\x47\xed"
  1619. "\xb7\xb2\x47\xa2\x2f\x57\xff\xaa\xcb\xe1\x86\xef\x43\x9d\xc8\xbe\x0f"
  1620. "\xbf\x5e\x3f\x72\x57\xfd\xf9\x88\x78\x2c\x22\x3e\x1d\x18\xac\xd5\xf3"
  1621. "\x85\x72\x69\x7a\xaf\x93\x07\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1622. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1623. "\x00\x00\x00\x80\xcc\xfe\x16\xbf\xff\x9f\xfa\x6d\x60\xaf\x5b\x07\x00"
  1624. "\xec\x98\x7d\x7b\xdd\x00\x00\x60\xd7\x39\xfe\x03\x40\xf7\xd9\xda\xf1"
  1625. "\x7f\x70\xc7\xda\x01\x00\xec\x1e\xe7\xff\x00\xd0\x7d\x1c\xff\x01\xa0"
  1626. "\xfb\x38\xfe\x03\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1627. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1628. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1629. "\x00\x00\x00\xb0\xc3\x4e\x9e\x38\x91\x4e\x6b\x7f\xaf\xae\x14\xd2\xfa"
  1630. "\xf4\xf9\xa5\xc5\xd9\xf2\xf9\xc3\xd3\xc5\xca\x6c\x7e\x6e\xb1\x90\x2f"
  1631. "\x94\x17\xce\xe5\x67\xca\xe5\x99\x52\x31\x5f\x28\xcf\xb5\xfc\x47\x17"
  1632. "\xd7\x1f\x4a\xe5\xf2\xb9\xc9\x98\x5f\xbc\x30\x5e\x2d\x56\xaa\xe3\x95"
  1633. "\xa5\xe5\x53\x73\xe5\xc5\xf9\xea\xa9\xb3\x73\x53\x33\xc5\x53\xc5\xbe"
  1634. "\x5d\xcb\x0c\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1635. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1636. "\x3a\x57\x59\x5a\x9e\x9d\x2a\x95\x8a\x0b\x0a\xdd\x57\xe8\xc9\x56\x82"
  1637. "\x87\xa5\x3d\x0a\x0f\x51\xa1\x71\x2f\x31\xb8\x37\x3b\x27\x00\x00\x00"
  1638. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1639. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1640. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1641. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1642. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1643. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1644. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1645. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1646. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1647. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1648. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1649. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1650. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1651. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1652. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1653. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1654. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1655. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1656. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1657. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1658. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1659. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1660. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1661. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1662. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1663. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1664. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1665. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1666. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1667. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1668. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1669. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1670. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1671. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1672. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1673. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1674. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1675. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1676. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1677. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1678. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1679. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1680. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1681. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1682. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1683. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1684. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1685. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1686. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1687. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  1688. "\x00\x00\x80\x47\xc0\x7f\x01\x00\x00\xff\xff\x51\xe3\x2f\x55",
  1689. 1919);
  1690. syz_mount_image(/*fs=*/0x200000000780, /*dir=*/0x200000000240, /*flags=*/0,
  1691. /*opts=*/0x200000000000, /*chdir=*/1, /*size=*/0x77f,
  1692. /*img=*/0x200000000f40);
  1693. break;
  1694. }
  1695. }
  1696. int main(void)
  1697. {
  1698. syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
  1699. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  1700. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  1701. syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul,
  1702. /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
  1703. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  1704. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  1705. syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
  1706. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  1707. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  1708. const char* reason;
  1709. (void)reason;
  1710. for (procid = 0; procid < 4; procid++) {
  1711. if (fork() == 0) {
  1712. use_temporary_dir();
  1713. do_sandbox_namespace();
  1714. }
  1715. }
  1716. sleep(1000000);
  1717. return 0;
  1718. }
  1719.  
Advertisement
Add Comment
Please, Sign In to add comment