Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // autogenerated by syzkaller (https://github.com/google/syzkaller)
- #define _GNU_SOURCE
- #include <endian.h>
- #include <errno.h>
- #include <fcntl.h>
- #include <stddef.h>
- #include <stdint.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/ioctl.h>
- #include <sys/mount.h>
- #include <sys/stat.h>
- #include <sys/syscall.h>
- #include <sys/types.h>
- #include <unistd.h>
- #include <usbg/function/hid.h>
- #include <usbg/function/loopback.h>
- #include <usbg/function/midi.h>
- #include <usbg/function/ms.h>
- #include <usbg/function/net.h>
- #include <usbg/function/printer.h>
- #include <usbg/usbg.h>
- #include <linux/loop.h>
- #include <linux/usb/ch9.h>
- #ifndef __NR_memfd_create
- #define __NR_memfd_create 319
- #endif
- static unsigned long long procid;
- #define BITMASK(bf_off, bf_len) (((1ull << (bf_len)) - 1) << (bf_off))
- #define STORE_BY_BITMASK(type, htobe, addr, val, bf_off, bf_len) \
- *(type*)(addr) = \
- htobe((htobe(*(type*)(addr)) & ~BITMASK((bf_off), (bf_len))) | \
- (((type)(val) << (bf_off)) & BITMASK((bf_off), (bf_len))))
- #define MAX_FUNC_NUM 2
- #define MAX_DEVICE_NUM 8
- union usbg_function_attr {
- int default_attr;
- struct usbg_f_midi_attrs midi_attr;
- struct usbg_f_ms_attrs ms_attr;
- struct usbg_f_net_attrs net_attr;
- struct usbg_f_printer_attrs printer_attr;
- struct usbg_f_loopback_attrs loopback_attr;
- struct usbg_f_hid_attrs hid_attr;
- };
- struct usbg_func_config {
- usbg_function_type f_type;
- union usbg_function_attr f_attrs;
- };
- struct usb_gadget_device {
- struct usbg_gadget_attrs* g_attrs;
- struct usbg_config_attrs* c_attrs;
- int func_num;
- struct usbg_func_config func_conf[MAX_FUNC_NUM];
- };
- struct usb_gadget_device usb_device[MAX_DEVICE_NUM];
- struct usbg_gadget_strs g_strs = {.manufacturer = (char*)"Foo Inc.",
- .product = (char*)"Bar Gadget",
- .serial = (char*)"12345678"};
- struct usbg_config_strs c_strs = {.configuration = (char*)"1xMIDI"};
- static int remove_gadget(usbg_gadget* g)
- {
- int usbg_ret;
- usbg_udc* u;
- /* Check if gadget is enabled */
- u = usbg_get_gadget_udc(g);
- /* If gadget is enable we have to disable it first */
- if (u) {
- usbg_ret = usbg_disable_gadget(g);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on disable gadget udc\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- goto out;
- }
- }
- /* Remove gadget with USBG_RM_RECURSE flag to remove
- * also its configurations, functions and strings */
- usbg_ret = usbg_rm_gadget(g, USBG_RM_RECURSE);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on gadget remove\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- }
- out:
- return usbg_ret;
- }
- static volatile long syz_detach_gadget_impl(int uid)
- {
- int usbg_ret;
- int ret = -1;
- usbg_state* s;
- usbg_gadget* g;
- const char* g_name;
- char g_name_target[10];
- sprintf(g_name_target, "g%d", uid);
- usbg_ret = usbg_init("/sys/kernel/config", &s);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on USB state init\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- goto out1;
- }
- g = usbg_get_first_gadget(s);
- while (g != NULL) {
- /* Get current gadget attrs to be compared */
- g_name = usbg_get_gadget_name(g);
- /* Compare name with given values and remove if suitable */
- if (strcmp(g_name, g_name_target) == 0) {
- usbg_gadget* g_next = usbg_get_next_gadget(g);
- usbg_ret = remove_gadget(g);
- if (usbg_ret != USBG_SUCCESS)
- goto out2;
- g = g_next;
- } else {
- g = usbg_get_next_gadget(g);
- }
- }
- usleep(500000);
- ret = 0;
- out2:
- usbg_cleanup(s);
- out1:
- return ret;
- }
- static volatile long syz_attach_gadget_impl(struct usb_gadget_device* dev,
- int uid)
- {
- syz_detach_gadget_impl(uid);
- usbg_state* s;
- usbg_gadget* g;
- usbg_config* c;
- usbg_function* f[MAX_FUNC_NUM];
- usbg_udc* u;
- int ret = -1;
- int usbg_ret;
- char g_name[10];
- sprintf(g_name, "g%d", uid);
- usbg_ret = usbg_init("/sys/kernel/config", &s);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on usbg init\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- goto out1;
- }
- usbg_ret = usbg_create_gadget(s, g_name, dev->g_attrs, &g_strs, &g);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on creating gadget\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- goto out2;
- }
- for (int i = 0; i < dev->func_num; i++) {
- char f_name[10];
- sprintf(f_name, "func%d", i);
- if (dev->func_conf[i].f_attrs.default_attr == 0xffff)
- usbg_ret = usbg_create_function(g, dev->func_conf[i].f_type,
- (char*)f_name, NULL, &f[i]);
- else
- usbg_ret =
- usbg_create_function(g, dev->func_conf[i].f_type, (char*)f_name,
- &(dev->func_conf[i].f_attrs), &f[i]);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on creating gadget func\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- goto out2;
- }
- }
- usbg_ret = usbg_create_config(g, 1, "The only one config", dev->c_attrs,
- &c_strs, &c);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on creating gadget config\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- goto out2;
- }
- for (int i = 0; i < dev->func_num; i++) {
- char f_name[10];
- sprintf(f_name, "f_name.%d", i);
- usbg_ret = usbg_add_config_function(c, (char*)f_name, f[i]);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on adding func to config\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- goto out2;
- }
- }
- u = usbg_get_first_udc(s);
- if (uid > 0) {
- for (int i = 0; i < uid; i++) {
- u = usbg_get_next_udc(u);
- }
- }
- usbg_ret = usbg_enable_gadget(g, u);
- if (usbg_ret != USBG_SUCCESS) {
- fprintf(stderr, "Error on enabling udc\n");
- fprintf(stderr, "Error: %s : %s\n", usbg_error_name((usbg_error)usbg_ret),
- usbg_strerror((usbg_error)usbg_ret));
- goto out2;
- }
- ret = 0;
- out2:
- usbg_cleanup(s);
- out1:
- return ret;
- }
- static void parse_dev_descriptors(const char* buffer,
- struct usb_gadget_device* dev)
- {
- memset(dev, 0, sizeof(*dev));
- dev->g_attrs = (struct usbg_gadget_attrs*)buffer;
- dev->c_attrs =
- (struct usbg_config_attrs*)(buffer + sizeof(struct usbg_gadget_attrs));
- dev->func_num = *(int*)(buffer + sizeof(struct usbg_gadget_attrs) +
- sizeof(struct usbg_config_attrs) + sizeof(int16_t));
- int start_attr = sizeof(struct usbg_gadget_attrs) +
- sizeof(struct usbg_config_attrs) + sizeof(int16_t) +
- 2 * sizeof(int32_t);
- int conf_size = 40;
- for (int i = 0; i < dev->func_num; i++) {
- dev->func_conf[i] =
- *(struct usbg_func_config*)(buffer + start_attr + i * conf_size);
- if (dev->func_conf[i].f_type == USBG_F_HID) {
- struct usbg_f_hid_attrs* hid_attr = &(dev->func_conf[i].f_attrs.hid_attr);
- struct usbg_f_hid_report_desc* report_desc = &(hid_attr->report_desc);
- report_desc->len = strlen(report_desc->desc);
- conf_size = 48;
- }
- }
- }
- static volatile long syz_attach_gadget(volatile long a0, volatile long a1)
- {
- const char* dev = (const char*)a0;
- uint64_t uid = a1;
- parse_dev_descriptors(dev, &usb_device[uid]);
- return syz_attach_gadget_impl(&usb_device[uid], uid);
- }
- static long syz_open_dev(volatile long a0, volatile long a1, volatile long a2)
- {
- if (a0 == 0xc || a0 == 0xb) {
- char buf[128];
- sprintf(buf, "/dev/%s/%d:%d", a0 == 0xc ? "char" : "block", (uint8_t)a1,
- (uint8_t)a2);
- return open(buf, O_RDWR, 0);
- } else {
- char buf[1024];
- char* hash;
- strncpy(buf, (char*)a0, sizeof(buf) - 1);
- buf[sizeof(buf) - 1] = 0;
- while ((hash = strchr(buf, '#'))) {
- *hash = '0' + (char)(a1 % 10);
- a1 /= 10;
- }
- return open(buf, a2, 0);
- }
- }
- struct fs_image_segment {
- void* data;
- uintptr_t size;
- uintptr_t offset;
- };
- #define IMAGE_MAX_SEGMENTS 4096
- #define IMAGE_MAX_SIZE (129 << 20)
- static unsigned long fs_image_segment_check(unsigned long size,
- unsigned long nsegs,
- struct fs_image_segment* segs)
- {
- if (nsegs > IMAGE_MAX_SEGMENTS)
- nsegs = IMAGE_MAX_SEGMENTS;
- for (size_t i = 0; i < nsegs; i++) {
- if (segs[i].size > IMAGE_MAX_SIZE)
- segs[i].size = IMAGE_MAX_SIZE;
- segs[i].offset %= IMAGE_MAX_SIZE;
- if (segs[i].offset > IMAGE_MAX_SIZE - segs[i].size)
- segs[i].offset = IMAGE_MAX_SIZE - segs[i].size;
- if (size < segs[i].offset + segs[i].offset)
- size = segs[i].offset + segs[i].offset;
- }
- if (size > IMAGE_MAX_SIZE)
- size = IMAGE_MAX_SIZE;
- return size;
- }
- static int setup_loop_device(long unsigned size, long unsigned nsegs,
- struct fs_image_segment* segs,
- const char* loopname, int* memfd_p, int* loopfd_p)
- {
- int err = 0, loopfd = -1;
- size = fs_image_segment_check(size, nsegs, segs);
- int memfd = syscall(__NR_memfd_create, "syzkaller", 0);
- if (memfd == -1) {
- err = errno;
- goto error;
- }
- if (ftruncate(memfd, size)) {
- err = errno;
- goto error_close_memfd;
- }
- for (size_t i = 0; i < nsegs; i++) {
- if (pwrite(memfd, segs[i].data, segs[i].size, segs[i].offset) < 0) {
- }
- }
- loopfd = open(loopname, O_RDWR);
- if (loopfd == -1) {
- err = errno;
- goto error_close_memfd;
- }
- if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
- if (errno != EBUSY) {
- err = errno;
- goto error_close_loop;
- }
- ioctl(loopfd, LOOP_CLR_FD, 0);
- usleep(1000);
- if (ioctl(loopfd, LOOP_SET_FD, memfd)) {
- err = errno;
- goto error_close_loop;
- }
- }
- *memfd_p = memfd;
- *loopfd_p = loopfd;
- return 0;
- error_close_loop:
- close(loopfd);
- error_close_memfd:
- close(memfd);
- error:
- errno = err;
- return -1;
- }
- static long syz_mount_image(volatile long fsarg, volatile long dir,
- volatile unsigned long size,
- volatile unsigned long nsegs,
- volatile long segments, volatile long flags,
- volatile long optsarg)
- {
- struct fs_image_segment* segs = (struct fs_image_segment*)segments;
- int res = -1, err = 0, loopfd = -1, memfd = -1, need_loop_device = !!segs;
- char* mount_opts = (char*)optsarg;
- char* target = (char*)dir;
- char* fs = (char*)fsarg;
- char* source = NULL;
- char loopname[64];
- if (need_loop_device) {
- memset(loopname, 0, sizeof(loopname));
- snprintf(loopname, sizeof(loopname), "/dev/loop%llu", procid);
- if (setup_loop_device(size, nsegs, segs, loopname, &memfd, &loopfd) == -1)
- return -1;
- source = loopname;
- }
- mkdir(target, 0777);
- char opts[256];
- memset(opts, 0, sizeof(opts));
- if (strlen(mount_opts) > (sizeof(opts) - 32)) {
- }
- strncpy(opts, mount_opts, sizeof(opts) - 32);
- if (strcmp(fs, "iso9660") == 0) {
- flags |= MS_RDONLY;
- } else if (strncmp(fs, "ext", 3) == 0) {
- if (strstr(opts, "errors=panic") || strstr(opts, "errors=remount-ro") == 0)
- strcat(opts, ",errors=continue");
- } else if (strcmp(fs, "xfs") == 0) {
- strcat(opts, ",nouuid");
- }
- res = mount(source, target, fs, flags, opts);
- if (res == -1) {
- err = errno;
- goto error_clear_loop;
- }
- res = open(target, O_RDONLY | O_DIRECTORY);
- if (res == -1) {
- err = errno;
- }
- error_clear_loop:
- if (need_loop_device) {
- ioctl(loopfd, LOOP_CLR_FD, 0);
- close(loopfd);
- close(memfd);
- }
- errno = err;
- return res;
- }
- uint64_t r[7] = {0xffffffffffffffff,
- 0xffffffffffffffff,
- 0xffffffffffffffff,
- 0xffffffffffffffff,
- 0xffffffffffffffff,
- 0xffffffffffffffff,
- 0x0};
- int main(void)
- {
- syscall(__NR_mmap, 0x1ffff000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
- syscall(__NR_mmap, 0x20000000ul, 0x1000000ul, 7ul, 0x32ul, -1, 0ul);
- syscall(__NR_mmap, 0x21000000ul, 0x1000ul, 0ul, 0x32ul, -1, 0ul);
- intptr_t res = 0;
- *(uint16_t*)0x20000080 = 0x320;
- *(uint8_t*)0x20000082 = 0xfe;
- *(uint8_t*)0x20000083 = 7;
- *(uint8_t*)0x20000084 = 2;
- *(uint8_t*)0x20000085 = 0;
- *(uint16_t*)0x20000086 = 0x5ac;
- *(uint16_t*)0x20000088 = 0x30a;
- *(uint16_t*)0x2000008a = 3;
- *(uint8_t*)0x2000008c = 0x80;
- *(uint8_t*)0x2000008d = 0xe2;
- *(uint32_t*)0x20000090 = 2;
- *(uint8_t*)0x20000098 = 0xd;
- *(uint64_t*)0x200000a0 = 9;
- *(uint32_t*)0x200000a8 = 0;
- *(uint64_t*)0x200000b0 = 0x20000000;
- STORE_BY_BITMASK(uint8_t, , 0x20000000, 3, 0, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000000, 1, 2, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000000, 8, 4, 4);
- memcpy((void*)0x20000001, "\x73\xd5\x36\xa4", 4);
- STORE_BY_BITMASK(uint8_t, , 0x20000005, 3, 0, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000005, 0, 2, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000005, 0xb, 4, 4);
- memcpy((void*)0x20000006, "\x01\xf3\x5c\xe4", 4);
- STORE_BY_BITMASK(uint8_t, , 0x2000000a, 3, 0, 2);
- STORE_BY_BITMASK(uint8_t, , 0x2000000a, 2, 2, 2);
- STORE_BY_BITMASK(uint8_t, , 0x2000000a, 0xa, 4, 4);
- memcpy((void*)0x2000000b, "\x29\xf2\x5a\x42", 4);
- *(uint32_t*)0x200000b8 = 0;
- *(uint32_t*)0x200000c0 = 0x10;
- *(uint32_t*)0x200000c4 = 0;
- *(uint8_t*)0x200000c8 = 0xd;
- *(uint64_t*)0x200000d0 = 4;
- *(uint32_t*)0x200000d8 = 0;
- *(uint64_t*)0x200000e0 = 0x20000040;
- STORE_BY_BITMASK(uint8_t, , 0x20000040, 0, 0, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000040, 1, 2, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000040, 1, 4, 4);
- STORE_BY_BITMASK(uint8_t, , 0x20000041, 1, 0, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000041, 0, 2, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000041, 9, 4, 4);
- memset((void*)0x20000042, 99, 1);
- STORE_BY_BITMASK(uint8_t, , 0x20000043, 1, 0, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000043, 1, 2, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000043, 4, 4, 4);
- memset((void*)0x20000044, 120, 1);
- STORE_BY_BITMASK(uint8_t, , 0x20000045, 1, 0, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000045, 0, 2, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000045, 8, 4, 4);
- memset((void*)0x20000046, 148, 1);
- STORE_BY_BITMASK(uint8_t, , 0x20000047, 1, 0, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000047, 2, 2, 2);
- STORE_BY_BITMASK(uint8_t, , 0x20000047, 0, 4, 4);
- memset((void*)0x20000048, 84, 1);
- *(uint32_t*)0x200000e8 = 0;
- *(uint32_t*)0x200000f0 = 0x10;
- *(uint32_t*)0x200000f4 = 1;
- syz_attach_gadget(0x20000080, 2);
- memcpy((void*)0x20000000, "/dev/bsg\000", 9);
- res =
- syscall(__NR_openat, 0xffffffffffffff9cul, 0x20000000ul, 0x404000ul, 0ul);
- if (res != -1)
- r[0] = res;
- memcpy((void*)0x20000080, "/dev/hidg0", 10);
- res = syscall(__NR_openat, -1, 0x20000080ul, 0x8240ul, 0x30ul);
- if (res != -1)
- r[1] = res;
- memcpy((void*)0x200000c0, "/dev/vcsa#\000", 11);
- res = -1;
- res = syz_open_dev(0x200000c0, 0xc489, 0x4800);
- if (res != -1)
- r[2] = res;
- memcpy((void*)0x20000100, "/dev/hidraw#\000", 13);
- res = -1;
- res = syz_open_dev(0x20000100, 9, 1);
- if (res != -1)
- r[3] = res;
- *(uint32_t*)0x20000140 = 0x10000;
- syscall(__NR_ioctl, r[2], 0x40086602, 0x20000140ul);
- syscall(__NR_ioctl, r[2], 0x540b, 1ul);
- *(uint8_t*)0x20000200 = 0;
- *(uint8_t*)0x20000201 = 0x30;
- *(uint16_t*)0x20000202 = 0x1000;
- *(uint16_t*)0x20000204 = 8;
- *(uint16_t*)0x20000206 = 0x73;
- *(uint32_t*)0x20000208 = 2;
- *(uint64_t*)0x20000210 = 0x20000180;
- memcpy((void*)0x20000180,
- "\x51\x8d\xad\x54\x64\xdd\xb1\xbd\xc4\x17\x80\x02\x43\x07\xb1\xb2\xc8"
- "\x16\xc7\x0b\x40\x7b\x77\x9b\x7d\x2e\x33\x37\xf7\xf9\xa0\x2a\x24\x9a"
- "\x3d\x17\xf2\x24\x4e\x06\x6c\x9a\x04\xc1\x8b\x64\x0f\x0d\x9b\x00\xd2"
- "\xb7\x04\xf3\x6d\x4a\xb4\x2f\x3a\x97\x1e\xfc\x19\xa8\x66\xd3\x01\xb8"
- "\x6c\x0e\xf2\xba\xa7\x01\x26\x92\x5a\x35\xbb\xad\x97\x15\x1a\x6c\x97"
- "\x99\x60\x14\xf4\x65\x0e\x69\x16\x18\x52\xc1\x9f\x27\x52\x67\x7d\x6e"
- "\xaf\xb0\xfd\x67\xec\x6a\x19\x69\xbd\x51\x9d\x0b\x21",
- 115);
- syscall(__NR_ioctl, r[1], 0xc0185500, 0x20000200ul);
- *(uint64_t*)0x20000240 = 0x7fffffff;
- res = syscall(__NR_signalfd4, r[3], 0x20000240ul, 8ul, 0x80800ul);
- if (res != -1)
- r[4] = res;
- *(uint32_t*)0x20000280 = 1;
- syscall(__NR_ioctl, r[4], 0x80045510, 0x20000280ul);
- syscall(__NR_ioctl, r[4], 0x40046629, 0x200002c0ul);
- *(uint32_t*)0x20000300 = 0x7ff;
- *(uint64_t*)0x20000308 = 4;
- *(uint64_t*)0x20000310 = 0x9954;
- *(uint64_t*)0x20000318 = 0x8000000000000001;
- *(uint32_t*)0x20000320 = 1;
- *(uint16_t*)0x20000324 = 0xfffb;
- *(uint16_t*)0x20000326 = 0;
- syscall(__NR_ioctl, r[3], 0x40286608, 0x20000300ul);
- *(uint32_t*)0x20000340 = 0x10;
- syscall(__NR_ioctl, r[1], 0x40047211, 0x20000340ul);
- *(uint16_t*)0x20000380 = 0x310;
- *(uint8_t*)0x20000382 = 0;
- *(uint8_t*)0x20000383 = 0;
- *(uint8_t*)0x20000384 = 0;
- *(uint8_t*)0x20000385 = 0x48;
- *(uint16_t*)0x20000386 = 0x8dd;
- *(uint16_t*)0x20000388 = 0x988;
- *(uint16_t*)0x2000038a = 0;
- *(uint8_t*)0x2000038c = 0xc0;
- *(uint8_t*)0x2000038d = 0x50;
- *(uint32_t*)0x20000390 = 1;
- *(uint8_t*)0x20000398 = 8;
- *(uint32_t*)0x200003a0 = 0xffff;
- syz_attach_gadget(0x20000380, 2);
- *(uint32_t*)0x200003c0 = 0x40;
- syscall(__NR_ioctl, r[1], 0xc0044d13, 0x200003c0ul);
- syscall(__NR_ioctl, r[0], 0x5514, 0);
- res = -1;
- res = syz_open_dev(0xc, 4, 0x14);
- if (res != -1)
- r[5] = res;
- *(uint64_t*)0x20000400 = 0;
- syscall(__NR_ioctl, r[5], 0x4008941a, 0x20000400ul);
- res = syscall(__NR_read, r[1], 0x20000a00ul, 0x2020ul);
- if (res != -1)
- r[6] = *(uint32_t*)0x20000a10;
- memcpy((void*)0x20000440, "tmpfs\000", 6);
- memcpy((void*)0x20000480, "./file0\000", 8);
- *(uint64_t*)0x20000940 = 0x200004c0;
- memcpy(
- (void*)0x200004c0,
- "\x31\x20\xad\x0c\x9e\x40\xc5\xc6\x2b\xf8\xcf\xde\x7a\x2c\x65\x9c\x33\x26"
- "\xa6\x9b\xf6\xa1\xbf\x57\x8e\x93\x49\x44\x5b\x8d\x35\xd2\x94\x45\x35\x29"
- "\xa9\x0a\x48\xcb\xb6\xb4\x65\x35\x5a\x0a\x3a\xf9\x5e\xca\x1c\x1b\x3d\x51"
- "\xec\x52\xee\xe7\x94\xaa\x80\x34\x95\xc9\xe1\x80\x84\x22\x47\x73\x56\xeb"
- "\xa0\x30\xfc\x1d\xc5\x7c\xe2\x94\x8c\x0d\xc7\xfb\x5d\x27\xcc\x08\x24\xec"
- "\x4a\x54\xd6\x0a\x7f\x43\xd3\x36\x93\x6e\x7a\x14\x59\xf4\x07\x9f\xee\x7f"
- "\x0b\x6e\x1c\x5c\xc8\x62\x77\x37\x8b\x01\x43\x13\xf3\xce\x32\xf2\x45\x22"
- "\x05\x66\xe2\xcc\x63\x55\xd2\x4a\x26\x39\x91\x46\x96\x46\x0c\xf2\xfa\x75"
- "\x42\xfa\x5a\xc9\x8f\x5f\x8d\xfa\x2f\xe7\x61\x2b\x6a\xc0\x00\x9d\xd5\x5d"
- "\xd8\xc7\x2a\x35\x04\x4b\xb5\x32\xe1\x6f\x7a\x79\x10\x1c\x4b\xee\x76\xfc"
- "\x0b\x9e\x01\x36\xb3\xd8\x08\x24\x92\x11\x91\x79\xaf\xfd\x8f\x7a\x55\xf6"
- "\x06\xbe\xd0\xc6\x34\x0c\xc3\x66\x90\x2b\x38\xd6\x86\x42\x23\x92\x82\xd9"
- "\x29\xc0\xd3\x6d\x8e\x2a\xd8\x9f\x8e\x50\xc8\x49\x76\x0e\xb8\xcb\xe6\x94"
- "\xf7\x23\x10\x6a\x1e\x08\x16\x3a\x78\x76",
- 244);
- *(uint64_t*)0x20000948 = 0xf4;
- *(uint64_t*)0x20000950 = 6;
- *(uint64_t*)0x20000958 = 0x200005c0;
- memcpy((void*)0x200005c0,
- "\x9b\xa7\x9b\x2b\xba\x19\xec\x4e\xf6\xe5\x17\x04\x86\x78\x99\xb0\xfd"
- "\xcb\xfc\x80\x03\xb8\x49\xa1\xb0\x50\xa6\xf2\x77\x8e\x41\xbf\xdb\x1f"
- "\xf6\xa4\x01\x1a\x62\x59\xdd\x92\xf0\x42\xe9\x7b\x29\xd0\x60\x36\x7f"
- "\xdc\x3b\x3e\x2e\x49\xf7\xb4\x0d\x1a\x56\x66\xb7\x87\x1d\x39\x4d\x78"
- "\x84\xad\x8e\x04\xb3\x39\x3a\x6b\x95\xb9\xc2\xe8\x4c\x17\x8f\x27\x4f"
- "\x71\xe2\xa6\x16\x7d\x7c\x2e\x04\x83\xb6\x4a\x69\xb5\x5e\xdd\xf7\x88"
- "\xf1\x1b\x31\x11\x75\x7a\x8e\xa8\x4c\x3e\xb1\xd1\x45\xb9\x30\x41\x3b"
- "\x22\xfe\x87\xe3\xd2\xaa\x92\x12\xc0\x1f\x09\x25\x5c\x1d\x67\xc2\x57"
- "\x9b\xb5\x6f\x85\x8b\xd6\x25\xe9\x2e\x4c\x06\x5f\xf2\x85\x07\xa2",
- 152);
- *(uint64_t*)0x20000960 = 0x98;
- *(uint64_t*)0x20000968 = 0xb682;
- *(uint64_t*)0x20000970 = 0x20000680;
- memcpy((void*)0x20000680,
- "\x28\xf8\xb7\x4f\x14\xf2\x95\x89\xba\x1b\x54\x02\xf7\x7b\x21\x12\x7d"
- "\x40\xc1\x72\x87\xfa\x53\xe2\x43\x76\x0a\x2a\x64\xf2\x91\x31\xa6\x28"
- "\x8e\x53\xcb\x9d\x87\xe2\x4c\xb0\x4c\x22\x8e\xe5\xdb\x15\x3d\x82\x02"
- "\x0b\x6d\x08\xbd\x9d\x2a\x75\x05\x4a\xf4\x13\xea\x5f\xe7\xec\x4c\x71"
- "\x40\xef\x27\xe6\x4d\x2d\xc5\x4d\xaa",
- 77);
- *(uint64_t*)0x20000978 = 0x4d;
- *(uint64_t*)0x20000980 = 0x11c3;
- *(uint64_t*)0x20000988 = 0x20000700;
- memcpy(
- (void*)0x20000700,
- "\x57\x20\x35\x9f\x65\x49\x7a\x53\x0b\x99\x42\xaa\xba\x1a\xf4\xcf\x66\x06"
- "\xd4\xa9\xc7\xfc\xa8\xd5\xf2\xbb\xa2\x20\xbf\x32\x26\x9c\xd6\x55\x44\xf4"
- "\x70\x9c\x7b\xb5\x11\xfb\x70\xf0\xf6\xeb\xe9\xde\x29\xb1\x27\xdf\x62\xb0"
- "\xa9\xf0\x23\x99\xf5\x3e\xc4\x4a\xa6\x61\xfa\xeb\x35\x57\xe4\x9d\xeb\xfe"
- "\xdb\xcf\x26\xc2\x9a\x66\xcc\xa5\x13\x9e\x0b\x03\xab\xb6\xb9\x3b\xa5\xe1"
- "\xc9\x0d\x92\xf5\xca\x4c\x60\x77\x98\x62\x29\x07\x1b\x5d\x83\x58\x70\x1e"
- "\xef\x45\x57\x43\x42\x5a\xfc\x53\x94\xc5\x96\x1a\xfb\x10\x1d\x2e\x8c\x12"
- "\xd3\xd0\xcc\x08\x21\xf2\x91\x9a\x3f\x07\x17\x4e\x75\x76\x65\xcb\x09\xd0"
- "\xae\x88\x5f\xf7\x47\x1b\x2a\x43\x1e\xbb\xe7\x83\xdd\x94\xec\xa2\xc2\x73"
- "\x72\x6a\xd0\x69\x62\xe1\xd0\x41\x73\x09\x2a\xe9\xb6\xcc\xe1\x4a\x9f\xe0"
- "\x6e\x2d\x42\x63\xe1\xb4\x05\x7e\x4a\x71\x19\x61\x92\xdf\x08\x9e\x57\xce"
- "\x85\xa0\x56\x51\x76\x55\xe0\x02\x0f\xac\xd7\x4b\x16\xf9\xaa",
- 213);
- *(uint64_t*)0x20000990 = 0xd5;
- *(uint64_t*)0x20000998 = 1;
- *(uint64_t*)0x200009a0 = 0x20000800;
- memcpy((void*)0x20000800, "\x8a\x57\x9f\xca\xf5", 5);
- *(uint64_t*)0x200009a8 = 5;
- *(uint64_t*)0x200009b0 = 7;
- *(uint64_t*)0x200009b8 = 0x20000840;
- memcpy(
- (void*)0x20000840,
- "\x7c\x1f\x4e\x66\x61\x3f\x53\xe4\xd6\xbc\xbb\x9c\x90\x00\x05\xe4\xd5\x29"
- "\xe7\xa6\x3b\xd0\x4f\xb4\xe0\x7c\x15\x26\x78\x14\xbb\x00\x1e\x61\xce\x64"
- "\x9e\x83\xe3\x4e\x21\x0c\x53\x16\x0f\xe0\xc3\x8a\x6f\x56\x88\xb8\xa7\xc5"
- "\xb9\xf6\x06\x1a\xdf\xdc\xce\x59\x0e\x39\x4e\xa1\xb9\x31\x9a\x14\x29\x2c"
- "\x5b\xa6\x1b\x79\x00\x33\x02\x0b\xe1\x49\xd1\xf7\x32\x1a\x7d\x6b\xb7\x52"
- "\x72\xfa\x4c\xf0\xda\x81\x8f\xb2\xe9\xbe\x87\x3a\x59\x5e\x2c\xe0\x7f\x2d"
- "\x7b\xf4\x07\x09\x06\xf1\x0a\x9f\x38\xec\x1f\xe9\x55\x78\xfe\xa4\x9e\x53"
- "\x51\xe4\xf5\xbf\xce\x17\x04\x77\x0d\xcf\xd3\xd9\x11\x49\x5f\xf5\x03\x9c"
- "\x61\x3b\xa1\x12\xce\x3f\xec\x49\xba\xd0\x9c\xbb\x2e\xb3\xbb\x3a\x1c\x15"
- "\x73\x76\x0c\x1f\x02\x16\xba\x48\x31\xf2\x52\xc7\x1a\x1b\x43\x56\x7d\xbf"
- "\x6d\x1a\xd9\x23\x26\x15\x40\xe6\x14\x81\x69\xa3\xc8\xcb\x49\xec\x37\x17"
- "\xcf\x57\x37\x7b\x35\x5b\xb6\xe8\xf9\x89\x30\x41\x23\x19\x20\xa8\x65\xe5"
- "\xd0\x64\x01\xe9\x49\x24\x8c\x20\x5b",
- 225);
- *(uint64_t*)0x200009c0 = 0xe1;
- *(uint64_t*)0x200009c8 = 0x18000000000;
- memcpy((void*)0x20004a80, "gid", 3);
- *(uint8_t*)0x20004a83 = 0x3d;
- sprintf((char*)0x20004a84, "0x%016llx", (long long)-1);
- *(uint8_t*)0x20004a96 = 0x2c;
- memcpy((void*)0x20004a97, "huge=advise", 11);
- *(uint8_t*)0x20004aa2 = 0x2c;
- memcpy((void*)0x20004aa3, "nr_inodes", 9);
- *(uint8_t*)0x20004aac = 0x3d;
- *(uint8_t*)0x20004aad = 0x34;
- *(uint8_t*)0x20004aae = 0x32;
- *(uint8_t*)0x20004aaf = 0x12;
- *(uint8_t*)0x20004ab0 = 0x38;
- *(uint8_t*)0x20004ab1 = 0x34;
- *(uint8_t*)0x20004ab2 = 0x78;
- *(uint8_t*)0x20004ab3 = 0x74;
- *(uint8_t*)0x20004ab4 = 0x30;
- *(uint8_t*)0x20004ab5 = 0x2c;
- memcpy((void*)0x20004ab6, "mpol", 4);
- *(uint8_t*)0x20004aba = 0x3d;
- memcpy((void*)0x20004abb, "default", 7);
- memcpy((void*)0x20004ac2, "=static", 7);
- *(uint8_t*)0x20004ac9 = 0x3a;
- *(uint8_t*)0x20004aca = 0x39;
- *(uint8_t*)0x20004acb = 0x34;
- *(uint8_t*)0x20004acc = 0x32;
- *(uint8_t*)0x20004acd = 0x2c;
- memcpy((void*)0x20004ace, "euid<", 5);
- sprintf((char*)0x20004ad3, "%020llu", (long long)r[6]);
- *(uint8_t*)0x20004ae7 = 0x2c;
- memcpy((void*)0x20004ae8, "smackfsdef", 10);
- *(uint8_t*)0x20004af2 = 0x3d;
- memcpy((void*)0x20004af3, "/dev/amidi.", 11);
- *(uint8_t*)0x20004afe = 0x2c;
- memcpy((void*)0x20004aff, "fscontext", 9);
- *(uint8_t*)0x20004b08 = 0x3d;
- memcpy((void*)0x20004b09, "user_u", 6);
- *(uint8_t*)0x20004b0f = 0x2c;
- memcpy((void*)0x20004b10, "fscontext", 9);
- *(uint8_t*)0x20004b19 = 0x3d;
- memcpy((void*)0x20004b1a, "user_u", 6);
- *(uint8_t*)0x20004b20 = 0x2c;
- memcpy((void*)0x20004b21, "euid<", 5);
- sprintf((char*)0x20004b26, "%020llu", (long long)0);
- *(uint8_t*)0x20004b3a = 0x2c;
- memcpy((void*)0x20004b3b, "appraise", 8);
- *(uint8_t*)0x20004b43 = 0x2c;
- memcpy((void*)0x20004b44, "obj_type", 8);
- *(uint8_t*)0x20004b4c = 0x3d;
- memcpy((void*)0x20004b4d, "/dev/hidg1", 10);
- *(uint8_t*)0x20004b57 = 0x2c;
- memcpy((void*)0x20004b58, "obj_role", 8);
- *(uint8_t*)0x20004b60 = 0x3d;
- memcpy((void*)0x20004b61, "/dev/bus/usb/003/002", 20);
- *(uint8_t*)0x20004b75 = 0x2c;
- memcpy((void*)0x20004b76, "smackfstransmute", 16);
- *(uint8_t*)0x20004b86 = 0x3d;
- memcpy((void*)0x20004b87, "/dev/hidraw0", 12);
- *(uint8_t*)0x20004b93 = 0x2c;
- *(uint8_t*)0x20004b94 = 0;
- syz_mount_image(0x20000440, 0x20000480, 5, 6, 0x20000940, 0x11001,
- 0x20004a80);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement