milabs / khook

Linux Kernel hooking engine (x86)
GNU General Public License v2.0
327 stars 50 forks source link

Support Ubuntu 24.04 LTS #18

Closed geekjy closed 5 months ago

geekjy commented 5 months ago

root@ubuntu-s-1vcpu-2gb-70gb-intel-sgp1-01:~/khook/khook_demo# make make -C /lib/modules/6.8.0-31-generic/build M=$PWD modules make[1]: Entering directory '/usr/src/linux-headers-6.8.0-31-generic' warning: the compiler differs from the one used to build the kernel The kernel was built by: x86_64-linux-gnu-gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0 You are using: gcc-13 (Ubuntu 13.2.0-23ubuntu4) 13.2.0 AS [M] /root/khook/khook_demo/../khook/x86/stub.o /root/khook/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0x67: indirect call found in RETPOLINE build /root/khook/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0x74: 'naked' return found in RETHUNK build /root/khook/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0x75: 'naked' return found in RETHUNK build /root/khook/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0xd6: indirect call found in RETPOLINE build /root/khook/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0xdc: 'naked' return found in RETHUNK build /root/khook/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0xdd: 'naked' return found in RETHUNK build make[3]: [scripts/Makefile.build:361: /root/khook/khook_demo/../khook/x86/stub.o] Error 250 make[3]: Deleting file '/root/khook/khook_demo/../khook/x86/stub.o' make[2]: [/usr/src/linux-headers-6.8.0-31-generic/Makefile:1926: /root/khook/khook_demo] Error 2 make[1]: [Makefile:240: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-31-generic' make: *** [Makefile:4: all] Error 2

geekjy commented 5 months ago

AS [M] /home/test/hidenetwork/khook_demo/../khook/x86/stub.o

gcc-13 -Wp,-MMD,/home/test/hidenetwork/khook_demo/../khook/x86/.stub.o.d -nostdinc -I./arch/x86/include -I./arch/x86/include/generated -I./include -I./arch/x86/include/uapi -I./arch/x86/include/generated/uapi -I./include/uapi -I./include/generated/uapi -include ./include/linux/compiler-version.h -include ./include/linux/kconfig.h -I./ubuntu/include -DKERNEL -fmacro-prefix-map=./= -DASSEMBLY -fno-PIE -m64 -DCC_USING_FENTRY -g -gdwarf-5 -DMODULE -c -o /home/test/hidenetwork/khook_demo/../khook/x86/stub.o /home/test/hidenetwork/khook_demo/../khook/x86/stub.S ; ./tools/objtool/objtool --hacks=jump_label --hacks=noinstr --hacks=skylake --retpoline --rethunk --sls --stackval --static-call --uaccess --prefix=16 --module /home/test/hidenetwork/khook_demo/../khook/x86/stub.o /home/test/hidenetwork/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0x67: indirect call found in RETPOLINE build /home/test/hidenetwork/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0x74: 'naked' return found in RETHUNK build /home/test/hidenetwork/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0x75: 'naked' return found in RETHUNK build /home/test/hidenetwork/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0xd6: indirect call found in RETPOLINE build /home/test/hidenetwork/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0xdc: 'naked' return found in RETHUNK build /home/test/hidenetwork/khook_demo/../khook/x86/stub.o: warning: objtool: .text+0xdd: 'naked' return found in RETHUNK build make[3]: [scripts/Makefile.build:361: /home/test/hidenetwork/khook_demo/../khook/x86/stub.o] Error 250 make[3]: Deleting file '/home/test/hidenetwork/khook_demo/../khook/x86/stub.o' make[2]: [/usr/src/linux-headers-6.8.0-31-generic/Makefile:1926: /home/test/hidenetwork/khook_demo] Error 2 make[1]: [Makefile:240: __sub-make] Error 2 make[1]: Leaving directory '/usr/src/linux-headers-6.8.0-31-generic' make: *** [Makefile:4: all] Error 2

milabs commented 5 months ago

@geekjy please, check the fix

geekjy commented 5 months ago

@geekjy please, check the fix

Build ok!but insmod crash

222
milabs commented 5 months ago

@geekjy remove your code and check again, khook_demo works for me on the same kernel, so closing