tkb*_*kbx 2 linux kernel kernel-panic
有什么办法可以在Linux下引起内核恐慌?我听说过
echo c > /proc/sysrq-trigger
但它似乎只是冻结,我不确定这是内核恐慌。有没有我可以以 root 身份运行的 C 程序来导致内核崩溃?
我认为您可以尝试以下操作:
$ kill -6 1
Run Code Online (Sandbox Code Playgroud)
这会将信号 #6 发送到进程 #1(init 进程)。如果您在信号手册页中阅读:“man 7 信号”:
Signal Value Action Comment
-------------------------------------------------------------------------
SIGHUP 1 Term Hangup detected on controlling terminal
or death of controlling process
SIGINT 2 Term Interrupt from keyboard
SIGQUIT 3 Core Quit from keyboard
SIGILL 4 Core Illegal Instruction
SIGABRT 6 Core Abort signal from abort(3)
Run Code Online (Sandbox Code Playgroud)
您可以了解进程希望如何处理各种信号 ( cat /proc/$PID/status
)。有关更多信息,请参阅此 U&L 问答:如何检查进程正在侦听哪些信号?.
另一种方法是溢出内存以引起内核恐慌。首先,您需要禁用交换。
$ swapon -s
Filename Type Size Used Priority
/dev/mapper/VolGroup00-LogVol01 partition 14352376 3177812 -1
$ swapoff /dev/mapper/VolGroup00-LogVol01
Run Code Online (Sandbox Code Playgroud)
现在消耗所有内存:
$ for r in /dev/ram*; do cat /dev/zero > $r; done
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
7981 次 |
最近记录: |