m0nad / Diamorphine

LKM rootkit for Linux Kernels 2.6.x/3.x/4.x/5.x/6.x (x86/x86_64 and ARM64)
Other
1.82k stars 431 forks source link

Unable to execute it on Ubuntu 18 #20

Closed securigeek closed 3 years ago

securigeek commented 4 years ago

Hello

Whenn I try to make the file it gives me the following error

`root@lubusecusimup1:~/Diamorphine# make clean make -C /lib/modules/4.15.0-117-generic/build M=/root/Diamorphine clean make[1]: Entering directory '/usr/src/linux-headers-4.15.0-117-generic' CLEAN /root/Diamorphine/.tmp_versions make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-117-generic' root@lubusecusimup1:~/Diamorphine# make make -C /lib/modules/4.15.0-117-generic/build M=/root/Diamorphine modules make[1]: Entering directory '/usr/src/linux-headers-4.15.0-117-generic' CC [M] /root/Diamorphine/diamorphine.o In file included from /root/Diamorphine/diamorphine.c:1:0: ./arch/x86/include/asm/uaccess.h:30:27: error: unknown type name ‘mm_segment_t’; did you mean ‘apm_event_t’? static inline void set_fs(mm_segment_t fs) ^~~~ apm_event_t In file included from ./arch/x86/include/asm/uaccess.h:7:0, from /root/Diamorphine/diamorphine.c:1: ./arch/x86/include/asm/uaccess.h: In function ‘user_access_begin’: ./arch/x86/include/asm/uaccess.h:39:26: error: ‘current’ undeclared (first use in this function)

define user_addr_max() (current->thread.addr_limit.seg)

                      ^

./include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’

define unlikely(x) __builtin_expect(!!(x), 0)

                                      ^

./arch/x86/include/asm/uaccess.h:101:2: note: in expansion of macro ‘likely’ likely(!range_not_ok(addr, size, user_addr_max())); \ ^~ ./arch/x86/include/asm/uaccess.h:101:10: note: in expansion of macro ‘range_not_ok’ likely(!range_not_ok(addr, size, user_addr_max())); \ ^~~~~~ ./arch/x86/include/asm/uaccess.h:101:37: note: in expansion of macro ‘user_addr_max’ likely(!range_not_ok(addr, size, user_addr_max())); \ ^~~~~ ./arch/x86/include/asm/uaccess.h:718:16: note: in expansion of macro ‘access_ok’ if (unlikely(!access_ok(type, ptr, len))) ^~~~~ ./arch/x86/include/asm/uaccess.h:39:26: note: each undeclared identifier is reported only once for each function it appears in

define user_addr_max() (current->thread.addr_limit.seg)

                      ^

./include/linux/compiler.h:77:42: note: in definition of macro ‘unlikely’

define unlikely(x) __builtin_expect(!!(x), 0)

                                      ^

./arch/x86/include/asm/uaccess.h:101:2: note: in expansion of macro ‘likely’ likely(!range_not_ok(addr, size, user_addr_max())); \ ^~ ./arch/x86/include/asm/uaccess.h:101:10: note: in expansion of macro ‘range_not_ok’ likely(!range_not_ok(addr, size, user_addr_max())); \ ^~~~~~ ./arch/x86/include/asm/uaccess.h:101:37: note: in expansion of macro ‘user_addr_max’ likely(!range_not_ok(addr, size, user_addr_max())); \ ^~~~~ ./arch/x86/include/asm/uaccess.h:718:16: note: in expansion of macro ‘access_ok’ if (unlikely(!access_ok(type, ptr, len))) ^~~~~ scripts/Makefile.build:337: recipe for target '/root/Diamorphine/diamorphine.o' failed make[2]: [/root/Diamorphine/diamorphine.o] Error 1 Makefile:1585: recipe for target 'module/root/Diamorphine' failed make[1]: [module/root/Diamorphine] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-4.15.0-117-generic' Makefile:7: recipe for target 'all' failed make: *** [all] Error 2 root@lubusecusimup1:~/Diamorphine#`

m0nad commented 4 years ago

I tested in the following and everything worked as expected: Ubuntu 18.04 Kernel 4.15.0-20-generic Ubuntu 18.04.1 Kernel 4.15.0-29-generic Ubuntu 18.04.2 Kernel 4.18.0-15-generic Ubuntu 18.04.3 Kernel 5.0.0-23-generic Ubuntu 18.04.4 Kernel 5.3.0-28-generic Ubuntu 18.04.5 Kernel 5.4.0-42-generic

Make sure you run: sudo apt install git gcc make linux-headers-$(uname -r)

I didn't test in your specific version (4.15.0-117-generic) but It seems unlikely that would not work. Can you confirm the exact ubuntu and kernel versions, and if you have all the packages needed?