Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在某些内核版本下加载驱动,会造成系统挂掉 #5

Closed
zj1244 opened this issue Nov 14, 2018 · 1 comment
Closed

在某些内核版本下加载驱动,会造成系统挂掉 #5

zj1244 opened this issue Nov 14, 2018 · 1 comment

Comments

@zj1244
Copy link
Owner

zj1244 commented Nov 14, 2018

在3.10.0-862.14.4.el7.x86_64 下,因没有驱动所以自行编译驱动并加载后,系统自动重启。编译过程中没有报错
[root@localhost test]# uname -a
Linux localhost 3.10.0-862.14.4.el7.x86_64 #1 SMP Wed Sep 26 15:12:11 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# gcc -v
使用内建 specs。
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/local/libexec/gcc/x86_64-pc-linux-gnu/7.3.0/lto-wrapper
目标:x86_64-pc-linux-gnu
配置为:../configure --enable-checking=release --enable-languages=c,c++ --disable-multilib
线程模型:posix
gcc 版本 7.3.0 (GCC)

日志:
Nov 6 16:12:59 localhost kernel: syshook_execve: loading out-of-tree module taints kernel.
Nov 6 16:12:59 localhost kernel: syshook_execve: module verification failed: signature and/or required key missing - tainting kernel
Nov 6 16:12:59 localhost kernel: Start found sys_call_table.
Nov 6 16:12:59 localhost kernel: Found the sys_call_table!!! __NR_close[3] sys_close[ffffffffa7e1e240] ysrc#12 __NR_execve[59] sct[__NR_execve][0xffffffffa8325ce0]
Nov 6 16:12:59 localhost kernel: syshook: create netlink success.
Nov 6 16:12:59 localhost kernel: Loading module monitor_execve, sys_call_table at ffffffffa8403300

@zj1244
Copy link
Owner Author

zj1244 commented Nov 14, 2018

后来发现使用cat /boot/config-$(uname -r)| grep CONFIG_RETPOLINE命令,如果返回CONFIG_RETPOLINE=y的话,那么使用sys_call_table方法hook sys_execve函数是行不通的,需要使用jprobe方法来进行hook
解决方法是在3.10.0-862.14.4.el7.x86_64版本下,使用jprobe方法重新编译驱动

@zj1244 zj1244 closed this as completed Nov 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant