// https://syzkaller.appspot.com/bug?id=603252f12de84a24d7822410c9aae68945cc4837 // autogenerated by syzkaller (http://github.com/google/syzkaller) #define _GNU_SOURCE #include #include #include #include #include #define BITMASK_LEN(type, bf_len) (type)((1ull << (bf_len)) - 1) #define BITMASK_LEN_OFF(type, bf_off, bf_len) \ (type)(BITMASK_LEN(type, (bf_len)) << (bf_off)) #define STORE_BY_BITMASK(type, addr, val, bf_off, bf_len) \ if ((bf_off) == 0 && (bf_len) == 0) { \ *(type*)(addr) = (type)(val); \ } else { \ type new_val = *(type*)(addr); \ new_val &= ~BITMASK_LEN_OFF(type, (bf_off), (bf_len)); \ new_val |= ((type)(val)&BITMASK_LEN(type, (bf_len))) << (bf_off); \ *(type*)(addr) = new_val; \ } void loop() { *(uint32_t*)0x20000000 = 0x8eb; *(uint32_t*)0x20000004 = 0; *(uint32_t*)0x20000008 = 0; STORE_BY_BITMASK(uint32_t, 0x2000000c, 0, 0, 1); STORE_BY_BITMASK(uint32_t, 0x2000000c, 0, 1, 2); STORE_BY_BITMASK(uint32_t, 0x2000000c, 0, 3, 1); STORE_BY_BITMASK(uint32_t, 0x2000000c, 0, 4, 1); STORE_BY_BITMASK(uint32_t, 0x2000000c, 0, 5, 1); STORE_BY_BITMASK(uint32_t, 0x2000000c, 0, 6, 1); STORE_BY_BITMASK(uint32_t, 0x2000000c, 0, 7, 1); syscall(__NR_modify_ldt, 1, 0x20000000, 0x10); syscall(__NR_modify_ldt, 0, 0x20000140, 0x1000001a6); } int main() { syscall(__NR_mmap, 0x20000000, 0x1000000, 3, 0x32, -1, 0); loop(); return 0; }