Manual kernel panic

Seeker

Aspiring Daemon

Thanks: 17
Messages: 865

#1
How do I intentionally make kernel into panicing by using some cmd or key combination as a root? :stud
 

crsd

Well-Known Member

Thanks: 94
Messages: 419

#2
Code:
> sysctl -d debug.kdb.panic
debug.kdb.panic: set to panic the kernel
Happy panic'ing. :)
 
OP
OP
Seeker

Seeker

Aspiring Daemon

Thanks: 17
Messages: 865

#4
crsd said:
Code:
> sysctl -d debug.kdb.panic
debug.kdb.panic: set to panic the kernel
Nothing happens, even after reboot.
I have GENERIC kernel.

Is it true, that I have to compile ddb as aragon said?
 

Beastie

Daemon

Thanks: 453
Messages: 2,147

#5
Seeker said:
Nothing happens, even after reboot.
I have GENERIC kernel.

Is it true, that I have to compile ddb as aragon said?
Read ddb(4):
In order to enable kernel debugging facilities include:
options KDB
options DDB
Do you see any of these options in the GENERIC kernel configuration /usr/src/sys/i386/conf/GENERIC?
 

crsd

Well-Known Member

Thanks: 94
Messages: 419

#6
Beastie said:
Read ddb(4):


Do you see any of these options in the GENERIC kernel configuration /usr/src/sys/i386/conf/GENERIC?
Yes, I do, on -CURRENT :) and always forgetting about them, sorry.
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 6,516
Messages: 27,956

#7
AFAIK the ctrl-alt-esc key combination invokes the debugger. This isn't really a panic. If you want a 'real' panic this should probably do:
C:
#include <sys/types.h>
#include <sys/systm.h>

main() {
panic("Danger Will Robinson, danger!");
}
See panic(9).
 
Last edited by a moderator:
OP
OP
Seeker

Seeker

Aspiring Daemon

Thanks: 17
Messages: 865

#8
Hey guys! I just found something. :stud

So... Theory is to do something, at the lowest layer possible and then get rid of all surplus layers.

First we need to do:
Rich (BB code):
# sysctl machdep.enable_panic_key=1
Now we need to create panic keyboard binding, which doesn't exist with default FreeBSD's setup - "us"

To this list:
Code:
kbdmap -p
I need to add panic, which is activated (As I have choosen), by pressing Esc + p

So to the current kbd layout, I need to append just this one panic button

Now, how do I add and where: (I got to run now, so)
Code:
panic 'esc' ( 'p' )
Then panic would be achieved by pressing Esc+p
 
Last edited by a moderator:
Top