blob: fd2f6a62576c6c3e67168baa2457c23f4f3ebef3 [file] [log] [blame]
// WARNING in idr_replace
// https://syzkaller.appspot.com/bug?id=0e8afad8624ff5aedfac63f5562f96baf934ea2b
// status:fixed
// autogenerated by syzkaller (http://github.com/google/syzkaller)
#define _GNU_SOURCE
#include <fcntl.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/syscall.h>
#include <unistd.h>
static uintptr_t syz_open_dev(uintptr_t a0, uintptr_t a1, uintptr_t 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));
buf[sizeof(buf) - 1] = 0;
while ((hash = strchr(buf, '#'))) {
*hash = '0' + (char)(a1 % 10);
a1 /= 10;
}
return open(buf, a2, 0);
}
}
long r[11];
void loop()
{
memset(r, -1, sizeof(r));
r[0] = syscall(__NR_mmap, 0x20000000ul, 0x9000ul, 0x3ul, 0x32ul,
0xfffffffffffffffful, 0x0ul);
memcpy((void*)0x20003ff1,
"\x2f\x64\x65\x76\x2f\x64\x72\x69\x2f\x63\x61\x72\x64\x23\x00",
15);
r[2] = syz_open_dev(0x20003ff1ul, 0x0ul, 0x0ul);
*(uint32_t*)0x20008000 = (uint32_t)0x0;
*(uint32_t*)0x20008004 = (uint32_t)0x0;
*(uint32_t*)0x20008008 = r[2];
r[6] = syscall(__NR_ioctl, r[2], 0xc00c642dul, 0x20008000ul);
if (r[6] != -1)
r[7] = *(uint32_t*)0x20008000;
*(uint32_t*)0x20001000 = r[7];
*(uint32_t*)0x20001004 = (uint32_t)0x0;
r[10] = syscall(__NR_ioctl, r[2], 0x40086409ul, 0x20001000ul);
}
int main()
{
loop();
return 0;
}