Last active
September 29, 2020 04:18
-
-
Save DamnedFacts/5239593 to your computer and use it in GitHub Desktop.
Fake uname information in order to make tools, such as megacli, work: Gentoo-11 tmp # gcc -Wall -fPIC -c fake-uname.c
Gentoo-11 tmp # gcc -Wall -shared -o libfake-uname.so fake-uname.o Now we get libfake-uname.so, use LD_PRELOAD=./libfake-uname.so to preload it, over uname from glibc: Gentoo-11 tmp # LD_PRELOAD=./libfake-uname.so LD_LIBRARY_PATH…
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define _GNU_SOURCE | |
#include <unistd.h> | |
#include <sys/syscall.h> | |
#include <sys/types.h> | |
#include <sys/utsname.h> | |
#include <stdio.h> | |
#include <string.h> | |
int uname(struct utsname *buf) | |
{ | |
int ret; | |
ret = syscall(SYS_uname, buf); | |
printf("uname release: \"%s\"\n", buf->release); | |
strcpy(buf->release, "2.6.40"); | |
printf("uname release set to: \"%s\"\n", buf->release); | |
printf("uname version: \"%s\"\n", buf->version); | |
return ret; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment