Работает без использования машины времени. /* * $ gcc hack.c -o hack * # ./hack <смещение в секундах> * например # ./hack 86400 добавит одни сутки */ #include <stdio.h> #include <unistd.h> #include <fcntl.h> #include <sys/mman.h> #include <string.h> #include <stdio.h> #include <stdlib.h> #include <sys/time.h> int main(int argc, char *argv[]) { if(argc < 2) { printf("Usage: %s <change in seconds>\n", argv[0]); return 1; } int off = atoi(argv[1]); size_t address; char line[256]; FILE* ksyms = fopen("/proc/kallsyms", "r"); while(fgets(line, sizeof(line), ksyms)) if(strstr(line, " wall_to_monotonic")) { sscanf(line, "%zx", &address); break; } fclose(ksyms); if(!address) { fprintf(stderr, "[-] wall_to_monotonic not found\n"); exit(1); } printf("[+] wall_to_monotonic: %lx\n", address); int hndl = open("/dev/kmem", O_RDWR); if(hndl == -1) { perror("[-] open"); return 1; } printf("[+] open\n"); void *ptr = mmap(NULL, 0x2000, PROT_READ | PROT_WRITE, MAP_SHARED, hndl, address & ~0x0FFF); if(ptr == MAP_FAILED) { perror("[-] mmap"); return 1; } printf("[+] mmap\n"); struct timespec *ts = (ptr + (address & 0xFFF)); ts->tv_sec += off; printf("[+] patch\n"); munmap(ptr, 0x2000); close(hndl); }