Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define _GNU_SOURCE
- #include <endian.h>
- #include <stdint.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
- #include <sys/syscall.h>
- #include <sys/types.h>
- #include <unistd.h>
- uint64_t r[1] = {0xffffffffffffffff};
- int main(void)
- {
- syscall(__NR_mmap, /*addr=*/0x1ffff000ul, /*len=*/0x1000ul, /*prot=*/0ul,
- /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
- /*offset=*/0ul);
- syscall(__NR_mmap, /*addr=*/0x20000000ul, /*len=*/0x1000000ul,
- /*prot=PROT_WRITE|PROT_READ|PROT_EXEC*/ 7ul,
- /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
- /*offset=*/0ul);
- syscall(__NR_mmap, /*addr=*/0x21000000ul, /*len=*/0x1000ul, /*prot=*/0ul,
- /*flags=MAP_FIXED|MAP_ANONYMOUS|MAP_PRIVATE*/ 0x32ul, /*fd=*/-1,
- /*offset=*/0ul);
- intptr_t res = 0;
- memcpy((void*)0x20000380, "/dev/kvm\000", 9);
- res = syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000380ul,
- /*flags=*/0ul, /*mode=*/0ul);
- {
- int i;
- for (i = 0; i < 64; i++) {
- syscall(__NR_openat, /*fd=*/0xffffffffffffff9cul, /*file=*/0x20000380ul,
- /*flags=*/0ul, /*mode=*/0ul);
- }
- }
- if (res != -1)
- r[0] = res;
- syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xae01, /*type=*/0ul);
- {
- int i;
- for (i = 0; i < 32; i++) {
- syscall(__NR_ioctl, /*fd=*/r[0], /*cmd=*/0xae01, /*type=*/0ul);
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment