Tang-ZW

Untitled

Mar 10th, 2026
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.11 KB | None | 0 0
  1. #define _GNU_SOURCE
  2.  
  3. #include <endian.h>
  4. #include <errno.h>
  5. #include <fcntl.h>
  6. #include <setjmp.h>
  7. #include <stdbool.h>
  8. #include <stddef.h>
  9. #include <stdint.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <string.h>
  13. #include <sys/ioctl.h>
  14. #include <sys/mman.h>
  15. #include <sys/mount.h>
  16. #include <sys/stat.h>
  17. #include <sys/syscall.h>
  18. #include <sys/types.h>
  19. #include <unistd.h>
  20.  
  21. #include <linux/loop.h>
  22.  
  23. #ifndef __NR_memfd_create
  24. #define __NR_memfd_create 319
  25. #endif
  26.  
  27. static unsigned long long procid;
  28.  
  29. //% This code is derived from puff.{c,h}, found in the zlib development. The
  30. //% original files come with the following copyright notice:
  31.  
  32. //% Copyright (C) 2002-2013 Mark Adler, all rights reserved
  33. //% version 2.3, 21 Jan 2013
  34. //% This software is provided 'as-is', without any express or implied
  35. //% warranty. In no event will the author be held liable for any damages
  36. //% arising from the use of this software.
  37. //% Permission is granted to anyone to use this software for any purpose,
  38. //% including commercial applications, and to alter it and redistribute it
  39. //% freely, subject to the following restrictions:
  40. //% 1. The origin of this software must not be misrepresented; you must not
  41. //% claim that you wrote the original software. If you use this software
  42. //% in a product, an acknowledgment in the product documentation would be
  43. //% appreciated but is not required.
  44. //% 2. Altered source versions must be plainly marked as such, and must not be
  45. //% misrepresented as being the original software.
  46. //% 3. This notice may not be removed or altered from any source distribution.
  47. //% Mark Adler [email protected]
  48.  
  49. //% BEGIN CODE DERIVED FROM puff.{c,h}
  50.  
  51. #define MAXBITS 15
  52. #define MAXLCODES 286
  53. #define MAXDCODES 30
  54. #define MAXCODES (MAXLCODES + MAXDCODES)
  55. #define FIXLCODES 288
  56.  
  57. struct puff_state {
  58. unsigned char* out;
  59. unsigned long outlen;
  60. unsigned long outcnt;
  61. const unsigned char* in;
  62. unsigned long inlen;
  63. unsigned long incnt;
  64. int bitbuf;
  65. int bitcnt;
  66. jmp_buf env;
  67. };
  68. static int puff_bits(struct puff_state* s, int need)
  69. {
  70. long val = s->bitbuf;
  71. while (s->bitcnt < need) {
  72. if (s->incnt == s->inlen)
  73. longjmp(s->env, 1);
  74. val |= (long)(s->in[s->incnt++]) << s->bitcnt;
  75. s->bitcnt += 8;
  76. }
  77. s->bitbuf = (int)(val >> need);
  78. s->bitcnt -= need;
  79. return (int)(val & ((1L << need) - 1));
  80. }
  81. static int puff_stored(struct puff_state* s)
  82. {
  83. s->bitbuf = 0;
  84. s->bitcnt = 0;
  85. if (s->incnt + 4 > s->inlen)
  86. return 2;
  87. unsigned len = s->in[s->incnt++];
  88. len |= s->in[s->incnt++] << 8;
  89. if (s->in[s->incnt++] != (~len & 0xff) ||
  90. s->in[s->incnt++] != ((~len >> 8) & 0xff))
  91. return -2;
  92. if (s->incnt + len > s->inlen)
  93. return 2;
  94. if (s->outcnt + len > s->outlen)
  95. return 1;
  96. for (; len--; s->outcnt++, s->incnt++) {
  97. if (s->in[s->incnt])
  98. s->out[s->outcnt] = s->in[s->incnt];
  99. }
  100. return 0;
  101. }
  102. struct puff_huffman {
  103. short* count;
  104. short* symbol;
  105. };
  106. static int puff_decode(struct puff_state* s, const struct puff_huffman* h)
  107. {
  108. int first = 0;
  109. int index = 0;
  110. int bitbuf = s->bitbuf;
  111. int left = s->bitcnt;
  112. int code = first = index = 0;
  113. int len = 1;
  114. short* next = h->count + 1;
  115. while (1) {
  116. while (left--) {
  117. code |= bitbuf & 1;
  118. bitbuf >>= 1;
  119. int count = *next++;
  120. if (code - count < first) {
  121. s->bitbuf = bitbuf;
  122. s->bitcnt = (s->bitcnt - len) & 7;
  123. return h->symbol[index + (code - first)];
  124. }
  125. index += count;
  126. first += count;
  127. first <<= 1;
  128. code <<= 1;
  129. len++;
  130. }
  131. left = (MAXBITS + 1) - len;
  132. if (left == 0)
  133. break;
  134. if (s->incnt == s->inlen)
  135. longjmp(s->env, 1);
  136. bitbuf = s->in[s->incnt++];
  137. if (left > 8)
  138. left = 8;
  139. }
  140. return -10;
  141. }
  142. static int puff_construct(struct puff_huffman* h, const short* length, int n)
  143. {
  144. int len;
  145. for (len = 0; len <= MAXBITS; len++)
  146. h->count[len] = 0;
  147. int symbol;
  148. for (symbol = 0; symbol < n; symbol++)
  149. (h->count[length[symbol]])++;
  150. if (h->count[0] == n)
  151. return 0;
  152. int left = 1;
  153. for (len = 1; len <= MAXBITS; len++) {
  154. left <<= 1;
  155. left -= h->count[len];
  156. if (left < 0)
  157. return left;
  158. }
  159. short offs[MAXBITS + 1];
  160. offs[1] = 0;
  161. for (len = 1; len < MAXBITS; len++)
  162. offs[len + 1] = offs[len] + h->count[len];
  163. for (symbol = 0; symbol < n; symbol++)
  164. if (length[symbol] != 0)
  165. h->symbol[offs[length[symbol]]++] = symbol;
  166. return left;
  167. }
  168. static int puff_codes(struct puff_state* s, const struct puff_huffman* lencode,
  169. const struct puff_huffman* distcode)
  170. {
  171. static const short lens[29] = {3, 4, 5, 6, 7, 8, 9, 10, 11, 13,
  172. 15, 17, 19, 23, 27, 31, 35, 43, 51, 59,
  173. 67, 83, 99, 115, 131, 163, 195, 227, 258};
  174. static const short lext[29] = {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2,
  175. 2, 3, 3, 3, 3, 4, 4, 4, 4, 5, 5, 5, 5, 0};
  176. static const short dists[30] = {
  177. 1, 2, 3, 4, 5, 7, 9, 13, 17, 25,
  178. 33, 49, 65, 97, 129, 193, 257, 385, 513, 769,
  179. 1025, 1537, 2049, 3073, 4097, 6145, 8193, 12289, 16385, 24577};
  180. static const short dext[30] = {0, 0, 0, 0, 1, 1, 2, 2, 3, 3,
  181. 4, 4, 5, 5, 6, 6, 7, 7, 8, 8,
  182. 9, 9, 10, 10, 11, 11, 12, 12, 13, 13};
  183. int symbol;
  184. do {
  185. symbol = puff_decode(s, lencode);
  186. if (symbol < 0)
  187. return symbol;
  188. if (symbol < 256) {
  189. if (s->outcnt == s->outlen)
  190. return 1;
  191. if (symbol)
  192. s->out[s->outcnt] = symbol;
  193. s->outcnt++;
  194. } else if (symbol > 256) {
  195. symbol -= 257;
  196. if (symbol >= 29)
  197. return -10;
  198. int len = lens[symbol] + puff_bits(s, lext[symbol]);
  199. symbol = puff_decode(s, distcode);
  200. if (symbol < 0)
  201. return symbol;
  202. unsigned dist = dists[symbol] + puff_bits(s, dext[symbol]);
  203. if (dist > s->outcnt)
  204. return -11;
  205. if (s->outcnt + len > s->outlen)
  206. return 1;
  207. while (len--) {
  208. if (dist <= s->outcnt && s->out[s->outcnt - dist])
  209. s->out[s->outcnt] = s->out[s->outcnt - dist];
  210. s->outcnt++;
  211. }
  212. }
  213. } while (symbol != 256);
  214. return 0;
  215. }
  216. static int puff_fixed(struct puff_state* s)
  217. {
  218. static int virgin = 1;
  219. static short lencnt[MAXBITS + 1], lensym[FIXLCODES];
  220. static short distcnt[MAXBITS + 1], distsym[MAXDCODES];
  221. static struct puff_huffman lencode, distcode;
  222. if (virgin) {
  223. lencode.count = lencnt;
  224. lencode.symbol = lensym;
  225. distcode.count = distcnt;
  226. distcode.symbol = distsym;
  227. short lengths[FIXLCODES];
  228. int symbol;
  229. for (symbol = 0; symbol < 144; symbol++)
  230. lengths[symbol] = 8;
  231. for (; symbol < 256; symbol++)
  232. lengths[symbol] = 9;
  233. for (; symbol < 280; symbol++)
  234. lengths[symbol] = 7;
  235. for (; symbol < FIXLCODES; symbol++)
  236. lengths[symbol] = 8;
  237. puff_construct(&lencode, lengths, FIXLCODES);
  238. for (symbol = 0; symbol < MAXDCODES; symbol++)
  239. lengths[symbol] = 5;
  240. puff_construct(&distcode, lengths, MAXDCODES);
  241. virgin = 0;
  242. }
  243. return puff_codes(s, &lencode, &distcode);
  244. }
  245. static int puff_dynamic(struct puff_state* s)
  246. {
  247. static const short order[19] = {16, 17, 18, 0, 8, 7, 9, 6, 10, 5,
  248. 11, 4, 12, 3, 13, 2, 14, 1, 15};
  249. int nlen = puff_bits(s, 5) + 257;
  250. int ndist = puff_bits(s, 5) + 1;
  251. int ncode = puff_bits(s, 4) + 4;
  252. if (nlen > MAXLCODES || ndist > MAXDCODES)
  253. return -3;
  254. short lengths[MAXCODES];
  255. int index;
  256. for (index = 0; index < ncode; index++)
  257. lengths[order[index]] = puff_bits(s, 3);
  258. for (; index < 19; index++)
  259. lengths[order[index]] = 0;
  260. short lencnt[MAXBITS + 1], lensym[MAXLCODES];
  261. struct puff_huffman lencode = {lencnt, lensym};
  262. int err = puff_construct(&lencode, lengths, 19);
  263. if (err != 0)
  264. return -4;
  265. index = 0;
  266. while (index < nlen + ndist) {
  267. int symbol;
  268. int len;
  269. symbol = puff_decode(s, &lencode);
  270. if (symbol < 0)
  271. return symbol;
  272. if (symbol < 16)
  273. lengths[index++] = symbol;
  274. else {
  275. len = 0;
  276. if (symbol == 16) {
  277. if (index == 0)
  278. return -5;
  279. len = lengths[index - 1];
  280. symbol = 3 + puff_bits(s, 2);
  281. } else if (symbol == 17)
  282. symbol = 3 + puff_bits(s, 3);
  283. else
  284. symbol = 11 + puff_bits(s, 7);
  285. if (index + symbol > nlen + ndist)
  286. return -6;
  287. while (symbol--)
  288. lengths[index++] = len;
  289. }
  290. }
  291. if (lengths[256] == 0)
  292. return -9;
  293. err = puff_construct(&lencode, lengths, nlen);
  294. if (err && (err < 0 || nlen != lencode.count[0] + lencode.count[1]))
  295. return -7;
  296. short distcnt[MAXBITS + 1], distsym[MAXDCODES];
  297. struct puff_huffman distcode = {distcnt, distsym};
  298. err = puff_construct(&distcode, lengths + nlen, ndist);
  299. if (err && (err < 0 || ndist != distcode.count[0] + distcode.count[1]))
  300. return -8;
  301. return puff_codes(s, &lencode, &distcode);
  302. }
  303. static int puff(unsigned char* dest, unsigned long* destlen,
  304. const unsigned char* source, unsigned long sourcelen)
  305. {
  306. struct puff_state s = {
  307. .out = dest,
  308. .outlen = *destlen,
  309. .outcnt = 0,
  310. .in = source,
  311. .inlen = sourcelen,
  312. .incnt = 0,
  313. .bitbuf = 0,
  314. .bitcnt = 0,
  315. };
  316. int err;
  317. if (setjmp(s.env) != 0)
  318. err = 2;
  319. else {
  320. int last;
  321. do {
  322. last = puff_bits(&s, 1);
  323. int type = puff_bits(&s, 2);
  324. err = type == 0 ? puff_stored(&s)
  325. : (type == 1 ? puff_fixed(&s)
  326. : (type == 2 ? puff_dynamic(&s) : -1));
  327. if (err != 0)
  328. break;
  329. } while (!last);
  330. }
  331. *destlen = s.outcnt;
  332. return err;
  333. }
  334.  
  335. //% END CODE DERIVED FROM puff.{c,h}
  336.  
  337. #define ZLIB_HEADER_WIDTH 2
  338.  
  339. static int puff_zlib_to_file(const unsigned char* source,
  340. unsigned long sourcelen, int dest_fd)
  341. {
  342. if (sourcelen < ZLIB_HEADER_WIDTH)
  343. return 0;
  344. source += ZLIB_HEADER_WIDTH;
  345. sourcelen -= ZLIB_HEADER_WIDTH;
  346. const unsigned long max_destlen = 132 << 20;
  347. void* ret = mmap(0, max_destlen, PROT_WRITE | PROT_READ,
  348. MAP_PRIVATE | MAP_ANON, -1, 0);
  349. if (ret == MAP_FAILED)
  350. return -1;
  351. unsigned char* dest = (unsigned char*)ret;
  352. unsigned long destlen = max_destlen;
  353. int err = puff(dest, &destlen, source, sourcelen);
  354. if (err) {
  355. munmap(dest, max_destlen);
  356. errno = -err;
  357. return -1;
  358. }
  359. if (write(dest_fd, dest, destlen) != (ssize_t)destlen) {
  360. munmap(dest, max_destlen);
  361. return -1;
  362. }
  363. return munmap(dest, max_destlen);
  364. }
  365.  
  366. static int setup_loop_device(unsigned char* data, unsigned long size,
  367. const char* loopname, int* loopfd_p)
  368. {
  369. int err = 0, loopfd = -1;
  370. int memfd = syscall(__NR_memfd_create, "syzkaller", 0);
  371. if (memfd == -1) {
  372. err = errno;
  373. goto error;
  374. }
  375. if (puff_zlib_to_file(data, size, memfd)) {
  376. err = errno;
  377. goto error_close_memfd;
  378. }
  379. loopfd = open(loopname, O_RDWR);
  380. if (loopfd == -1) {
  381. err = errno;
  382. goto error_close_memfd;
  383. }
  384. if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
  385. if (errno != EBUSY) {
  386. err = errno;
  387. goto error_close_loop;
  388. }
  389. ioctl(loopfd, LOOP_CLR_FD, 0);
  390. usleep(1000);
  391. if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
  392. err = errno;
  393. goto error_close_loop;
  394. }
  395. }
  396. close(memfd);
  397. *loopfd_p = loopfd;
  398. return 0;
  399.  
  400. error_close_loop:
  401. close(loopfd);
  402. error_close_memfd:
  403. close(memfd);
  404. error:
  405. errno = err;
  406. return -1;
  407. }
  408.  
  409. static void reset_loop_device(const char* loopname)
  410. {
  411. int loopfd = open(loopname, O_RDWR);
  412. if (loopfd == -1) {
  413. return;
  414. }
  415. if (ioctl(loopfd, LOOP_CLR_FD, 0)) {
  416. }
  417. close(loopfd);
  418. }
  419.  
  420. static long syz_mount_image(volatile long fsarg, volatile long dir,
  421. volatile long flags, volatile long optsarg,
  422. volatile long change_dir,
  423. volatile unsigned long size, volatile long image)
  424. {
  425. unsigned char* data = (unsigned char*)image;
  426. int res = -1, err = 0, need_loop_device = !!size;
  427. char* mount_opts = (char*)optsarg;
  428. char* target = (char*)dir;
  429. char* fs = (char*)fsarg;
  430. char* source = NULL;
  431. char loopname[64];
  432. if (need_loop_device) {
  433. int loopfd;
  434. memset(loopname, 0, sizeof(loopname));
  435. snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
  436. if (setup_loop_device(data, size, loopname, &loopfd) == -1)
  437. return -1;
  438. close(loopfd);
  439. source = loopname;
  440. }
  441. mkdir(target, 0777);
  442. char opts[256];
  443. memset(opts, 0, sizeof(opts));
  444. if (strlen(mount_opts) > (sizeof(opts) - 32)) {
  445. }
  446. strncpy(opts, mount_opts, sizeof(opts) - 32);
  447. if (strcmp(fs, "iso9660") == 0) {
  448. flags |= MS_RDONLY;
  449. } else if (strncmp(fs, "ext", 3) == 0) {
  450. bool has_remount_ro = false;
  451. char* remount_ro_start = strstr(opts, "errors=remount-ro");
  452. if (remount_ro_start != NULL) {
  453. char after = *(remount_ro_start + strlen("errors=remount-ro"));
  454. char before = remount_ro_start == opts ? '\0' : *(remount_ro_start - 1);
  455. has_remount_ro = ((before == '\0' || before == ',') &&
  456. (after == '\0' || after == ','));
  457. }
  458. if (strstr(opts, "errors=panic") || !has_remount_ro)
  459. strcat(opts, ",errors=continue");
  460. } else if (strcmp(fs, "xfs") == 0) {
  461. strcat(opts, ",nouuid");
  462. } else if (strncmp(fs, "gfs2", 4) == 0 &&
  463. (strstr(opts, "errors=panic") || strstr(opts, "debug"))) {
  464. strcat(opts, ",errors=withdraw");
  465. }
  466. res = mount(source, target, fs, flags, opts);
  467. if (res == -1) {
  468. err = errno;
  469. goto error_clear_loop;
  470. }
  471. res = open(target, O_RDONLY | O_DIRECTORY);
  472. if (res == -1) {
  473. err = errno;
  474. goto error_clear_loop;
  475. }
  476. if (change_dir) {
  477. res = chdir(target);
  478. if (res == -1) {
  479. err = errno;
  480. }
  481. }
  482.  
  483. error_clear_loop:
  484. if (need_loop_device)
  485. reset_loop_device(loopname);
  486. errno = err;
  487. return res;
  488. }
  489.  
  490. int main(void)
  491. {
  492. syscall(__NR_mmap, /*addr=*/0x1ffffffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
  493. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  494. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  495. syscall(__NR_mmap, /*addr=*/0x200000000000ul, /*len=*/0x1000000ul,
  496. /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
  497. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  498. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  499. syscall(__NR_mmap, /*addr=*/0x200001000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
  500. /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul,
  501. /*fd=*/(intptr_t)-1, /*offset=*/0ul);
  502. const char* reason;
  503. (void)reason;
  504. if (write(1, "executing program\n", sizeof("executing program\n") - 1)) {
  505. }
  506. // syz_mount_image$ext4 arguments: [
  507. // fs: ptr[in, buffer] {
  508. // buffer: {65 78 74 34 00} (length 0x5)
  509. // }
  510. // dir: ptr[in, buffer] {
  511. // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8)
  512. // }
  513. // flags: mount_flags = 0x0 (8 bytes)
  514. // opts: ptr[in, fs_options[ext4_options]] {
  515. // fs_options[ext4_options] {
  516. // elems: array[fs_opt_elem[ext4_options]] {
  517. // fs_opt_elem[ext4_options] {
  518. // elem: union ext4_options {
  519. // inode_readahead_blks: fs_opt["inode_readahead_blks", fmt[hex,
  520. // flags[ext4_inode_readahead_blks]]] {
  521. // name: buffer: {69 6e 6f 64 65 5f 72 65 61 64 61 68 65 61 64
  522. // 5f 62 6c 6b 73} (length 0x14) eq: const = 0x3d (1 bytes)
  523. // val: ext4_inode_readahead_blks = 0x0 (18 bytes)
  524. // }
  525. // }
  526. // comma: const = 0x2c (1 bytes)
  527. // }
  528. // fs_opt_elem[ext4_options] {
  529. // elem: union ext4_options {
  530. // block_validity: buffer: {62 6c 6f 63 6b 5f 76 61 6c 69 64 69
  531. // 74 79} (length 0xe)
  532. // }
  533. // comma: const = 0x2c (1 bytes)
  534. // }
  535. // fs_opt_elem[ext4_options] {
  536. // elem: union ext4_options {
  537. // debug_want_extra_isize: fs_opt["debug_want_extra_isize",
  538. // fmt[hex, int32]] {
  539. // name: buffer: {64 65 62 75 67 5f 77 61 6e 74 5f 65 78 74 72
  540. // 61 5f 69 73 69 7a 65} (length 0x16) eq: const = 0x3d (1
  541. // bytes) val: int32 = 0x66 (18 bytes)
  542. // }
  543. // }
  544. // comma: const = 0x2c (1 bytes)
  545. // }
  546. // fs_opt_elem[ext4_options] {
  547. // elem: union ext4_options {
  548. // nombcache: buffer: {6e 6f 6d 62 63 61 63 68 65} (length 0x9)
  549. // }
  550. // comma: const = 0x2c (1 bytes)
  551. // }
  552. // fs_opt_elem[ext4_options] {
  553. // elem: union ext4_options {
  554. // max_batch_time: fs_opt["max_batch_time", fmt[hex, int32]] {
  555. // name: buffer: {6d 61 78 5f 62 61 74 63 68 5f 74 69 6d 65}
  556. // (length 0xe) eq: const = 0x3d (1 bytes) val: int32 = 0x8 (18
  557. // bytes)
  558. // }
  559. // }
  560. // comma: const = 0x2c (1 bytes)
  561. // }
  562. // fs_opt_elem[ext4_options] {
  563. // elem: union ext4_options {
  564. // nombcache: buffer: {6e 6f 6d 62 63 61 63 68 65} (length 0x9)
  565. // }
  566. // comma: const = 0x2c (1 bytes)
  567. // }
  568. // }
  569. // common: array[fs_opt_elem[fs_options_common]] {
  570. // }
  571. // null: const = 0x0 (1 bytes)
  572. // }
  573. // }
  574. // chdir: int8 = 0x0 (1 bytes)
  575. // size: len = 0x434 (8 bytes)
  576. // img: ptr[in, buffer] {
  577. // buffer: (compressed buffer with length 0x434)
  578. // }
  579. // ]
  580. // returns fd_dir
  581. memcpy((void*)0x200000000440, "ext4\000", 5);
  582. memcpy((void*)0x200000000100, "./file1\000", 8);
  583. memcpy((void*)0x200000000180, "inode_readahead_blks", 20);
  584. *(uint8_t*)0x200000000194 = 0x3d;
  585. sprintf((char*)0x200000000195, "0x%016llx", (long long)0);
  586. *(uint8_t*)0x2000000001a7 = 0x2c;
  587. memcpy((void*)0x2000000001a8, "block_validity", 14);
  588. *(uint8_t*)0x2000000001b6 = 0x2c;
  589. memcpy((void*)0x2000000001b7, "debug_want_extra_isize", 22);
  590. *(uint8_t*)0x2000000001cd = 0x3d;
  591. sprintf((char*)0x2000000001ce, "0x%016llx", (long long)0x66);
  592. *(uint8_t*)0x2000000001e0 = 0x2c;
  593. memcpy((void*)0x2000000001e1, "nombcache", 9);
  594. *(uint8_t*)0x2000000001ea = 0x2c;
  595. memcpy((void*)0x2000000001eb, "max_batch_time", 14);
  596. *(uint8_t*)0x2000000001f9 = 0x3d;
  597. sprintf((char*)0x2000000001fa, "0x%016llx", (long long)8);
  598. *(uint8_t*)0x20000000020c = 0x2c;
  599. memcpy((void*)0x20000000020d, "nombcache", 9);
  600. *(uint8_t*)0x200000000216 = 0x2c;
  601. *(uint8_t*)0x200000000217 = 0;
  602. memcpy(
  603. (void*)0x200000000d40,
  604. "\x78\x9c\xec\xdb\xcf\x6f\x14\x55\x1c\x00\xf0\xef\xcc\xb6\x80\xfc\xb0\x05"
  605. "\xf1\x07\x88\xba\x8a\xc6\xc6\x1f\x2d\x2d\xa8\x1c\xbc\x68\x34\xf1\xa0\x89"
  606. "\x89\x1e\xea\xb1\xb6\x85\x54\x16\x6a\x68\x4d\x84\x34\x5a\x8c\xe2\xd1\x90"
  607. "\x78\x27\x1e\x4d\xfc\x0b\x3c\xe9\xc5\xa8\x27\x13\xaf\x7a\x37\x24\xc4\xf4"
  608. "\x02\x72\x5a\x33\xbb\xb3\xed\xd2\xee\x96\xfe\xd8\x76\xd1\xf9\x7c\x92\xe9"
  609. "\xbe\x37\xf3\x76\xdf\xfb\xce\xcc\xdb\x7d\xf3\x66\x1a\x40\x61\x95\xb3\x3f"
  610. "\x49\xc4\xde\x88\xf8\x23\x22\xfa\xea\xd9\xdb\x0b\x94\xeb\x2f\x37\x17\xe6"
  611. "\xc6\xff\x59\x98\x1b\x4f\xa2\x5a\x7d\xe7\xef\xa4\x56\xee\xc6\xc2\xdc\x78"
  612. "\xa3\x68\xe3\x7d\x7b\xf2\xcc\x40\x1a\x91\x7e\x9e\x2c\xfb\xc0\xba\x99\x0b"
  613. "\x17\xcf\x8c\x55\x2a\x93\xe7\xf3\xfc\xd0\xec\xd9\x0f\x87\x66\x2e\x5c\x7c"
  614. "\x7e\xea\xec\xd8\xe9\xc9\xd3\x93\xe7\x46\x4e\x9e\x3c\x71\x7c\xf8\xa5\x17"
  615. "\x47\x5e\xe8\x48\x9c\x59\x5c\x37\x0e\x7f\x32\x7d\xe4\xd0\x1b\xef\x5d\x79"
  616. "\x6b\x7c\xf4\xca\xfb\xbf\x7c\x97\x35\x6b\x6f\xbe\xbd\x39\x8e\x4e\x29\x47"
  617. "\xb9\x55\xe8\x35\x4f\x75\xba\xb2\x2e\xdb\xd7\x94\x4e\x7a\xba\xd8\x10\xd6"
  618. "\xa5\x14\x11\xd9\xe1\xea\xad\xf5\xff\xbe\x28\xc5\xd2\xc1\xeb\x8b\xd7\x3f"
  619. "\xeb\x6a\xe3\x80\x2d\x55\xad\x56\xab\x3b\xdb\x6f\x9e\xaf\x02\xff\x63\x49"
  620. "\x74\xbb\x05\x40\x77\x34\x7e\xe8\xb3\xeb\xdf\xc6\xb2\x4d\x43\x8f\xbb\xc2"
  621. "\xf5\x57\xea\x17\x40\x59\xdc\x37\xf3\xa5\xbe\xa5\x27\xd2\xbc\x4c\xef\xb2"
  622. "\xeb\xdb\x4e\x2a\x47\xc4\xe8\xfc\xad\xab\xd9\x12\x6d\xe6\x21\x5c\x4e\x03"
  623. "\x00\x9d\xf4\x43\x36\xfe\x79\xae\xd5\xf8\x2f\x8d\x07\x9a\xca\xdd\x9b\xdf"
  624. "\x43\xe9\x8f\x88\xfd\x11\x71\x20\x22\xee\x8b\x88\x83\x11\x71\x7f\x44\xad"
  625. "\xec\x83\x11\xf1\xd0\x3a\xeb\x2f\xd7\x5f\xbe\xd8\x9f\xe7\x57\x8e\x7f\xd2"
  626. "\x6b\x1b\x8f\xee\xce\xb2\xf1\xdf\xcb\xf9\xbd\xad\xdb\xc7\x7f\x8d\xd1\x5f"
  627. "\xf4\x97\xf2\xdc\xbe\x5a\xfc\xbd\xc9\xa9\xa9\xca\xe4\xb1\x7c\x9f\x0c\x44"
  628. "\xef\xce\x2c\x3f\xbc\x4a\x1d\x3f\xbe\xf6\xfb\x57\xed\xb6\x35\x8f\xff\xb2"
  629. "\x25\xab\x7f\x74\xfe\x56\x75\xe9\xbe\x51\x7a\xad\x67\xd9\x04\xdd\xc4\xd8"
  630. "\xec\xd8\xa6\x82\x6e\x72\xfd\x52\xc4\xe1\x9e\x56\xf1\x27\x8b\xe3\xce\xac"
  631. "\x2d\x87\x22\xe2\xf0\x06\xeb\x98\x7a\xe6\xdb\x23\xed\xb6\xb5\x89\xff\xea"
  632. "\x9a\x3e\xb8\x03\x03\xe3\xea\x37\x11\x4f\xd7\x8f\xff\x7c\x2c\x8b\xbf\x21"
  633. "\x59\xfd\xfe\xe4\xd0\xae\xa8\x4c\x1e\x1b\x6a\x9c\x15\x2b\xfd\xfa\xdb\xe5"
  634. "\xb7\xdb\xd5\xbf\xa9\xf8\x3b\x20\x3b\xfe\xbb\x5b\x9e\xff\x8b\xf1\xf7\x27"
  635. "\xcd\xf7\x6b\x67\xd6\x5f\xc7\xe5\x3f\xbf\x6c\x7b\x4d\x79\xe7\xf8\x5b\x9f"
  636. "\xff\x3b\x92\x77\x6b\xe9\x1d\xf9\xba\x8f\xc7\x66\x67\xcf\x0f\x47\xec\x48"
  637. "\xde\x5c\xb9\x7e\x64\xe9\xbd\x8d\x7c\xa3\x7c\x16\xff\xc0\xd1\xd6\xfd\xff"
  638. "\x40\x2c\xed\x89\x87\x23\x22\x3b\x89\x1f\x89\x88\x47\x23\xe2\xb1\xbc\xed"
  639. "\x8f\x47\xc4\x13\x11\x71\x74\x95\xf8\x7f\x7e\xf5\xc9\x0f\x36\x1e\xff\xd6"
  640. "\xca\xe2\x9f\x58\xd7\xf1\x5f\x7f\xa2\x74\xe6\xa7\xef\xdb\xd5\xbf\xb6\xe3"
  641. "\x7f\xa2\x96\x1a\xc8\xd7\xac\xe5\xfb\x6f\xad\x0d\xdc\xcc\xbe\x03\x00\x00"
  642. "\x80\xff\x8a\xb4\xf6\x0c\x7c\x92\x0e\x2e\xa6\xd3\x74\x70\xb0\xfe\x0c\xff"
  643. "\xc1\xd8\x9d\x56\xa6\x67\x66\x9f\x3d\x35\xfd\xd1\xb9\x89\xfa\xb3\xf2\xfd"
  644. "\xd1\x9b\x36\x66\xba\xfa\x9a\xe6\x43\x87\xf3\xb9\xe1\x46\x7e\x64\x59\xfe"
  645. "\x78\x3e\x6f\xfc\x75\xe9\x9e\x5a\x7e\x70\x7c\xba\x32\xd1\xed\xe0\xa1\xe0"
  646. "\xf6\xb4\xe9\xff\x99\xbf\x4a\xdd\x6e\x1d\xb0\xe5\x3c\x60\x06\xc5\xa5\xff"
  647. "\x43\x71\xe9\xff\x50\x5c\xfa\x3f\x14\x97\xfe\x0f\xc5\xd5\xaa\xff\x7f\xda"
  648. "\x62\xdd\xae\x6d\x68\x0b\xb0\xbd\xfc\xfe\x43\x71\xe9\xff\x50\x5c\xfa\x3f"
  649. "\x14\x97\xfe\x0f\x85\xb4\x99\xff\xeb\x97\x28\x72\x22\xd2\xbb\xa2\x19\x05"
  650. "\x49\x5c\xda\xf6\x4a\xbb\xfd\xcd\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  651. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  652. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  653. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  654. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  655. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  656. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  657. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  658. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  659. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  660. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  661. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  662. "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
  663. "\x00\x00\xd0\x19\xff\x06\x00\x00\xff\xff\xcf\xac\xe7\x78",
  664. 1076);
  665. syz_mount_image(/*fs=*/0x200000000440, /*dir=*/0x200000000100, /*flags=*/0,
  666. /*opts=*/0x200000000180, /*chdir=*/0, /*size=*/0x434,
  667. /*img=*/0x200000000d40);
  668. // lsetxattr$system_posix_acl arguments: [
  669. // path: ptr[in, buffer] {
  670. // buffer: {2e 2f 66 69 6c 65 31 00} (length 0x8)
  671. // }
  672. // name: ptr[in, buffer] {
  673. // buffer: {73 79 73 74 65 6d 2e 70 6f 73 69 78 5f 61 63 6c 5f 61 63 63
  674. // 65 73 73 00} (length 0x18)
  675. // }
  676. // val: ptr[inout, array[ANYUNION]] {
  677. // array[ANYUNION] {
  678. // union ANYUNION {
  679. // ANYBLOB: buffer: {02 00 00 00 01 00 01 00 b0 00 00 00 04 00 00 00
  680. // 00 00 00 00 10 00 00 00 00 00 00 00 20 00 00 00 00} (length 0x21)
  681. // }
  682. // }
  683. // }
  684. // size: len = 0x24 (8 bytes)
  685. // flags: setxattr_flags = 0x0 (8 bytes)
  686. // ]
  687. memcpy((void*)0x200000000780, "./file1\000", 8);
  688. memcpy((void*)0x2000000007c0, "system.posix_acl_access\000", 24);
  689. memcpy((void*)0x2000000002c0,
  690. "\x02\x00\x00\x00\x01\x00\x01\x00\xb0\x00\x00\x00\x04\x00\x00\x00\x00"
  691. "\x00\x00\x00\x10\x00\x00\x00\x00\x00\x00\x00\x20\x00\x00\x00\x00",
  692. 33);
  693. syscall(__NR_lsetxattr, /*path=*/0x200000000780ul, /*name=*/0x2000000007c0ul,
  694. /*val=*/0x2000000002c0ul, /*size=*/0x24ul, /*flags=*/0ul);
  695. return 0;
  696. }
  697.  
Advertisement
Add Comment
Please, Sign In to add comment