Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to panic kernel from user land

Tags:

c

kernel

I need to panic kernel after some operations are done and verify what operation did

Can some one help me to know if there is any way? I searched a lot but no luck

I am looking for some generic call

thanks in Advance!

like image 584
Abhishek Dave Avatar asked Mar 27 '26 10:03

Abhishek Dave


2 Answers

You can try a sysrq trigger:

echo c > /proc/sysrq-trigger

'c' - Will perform a system crash by a NULL pointer dereference. A crashdump will be taken if configured.

like image 144
cnicutar Avatar answered Mar 30 '26 00:03

cnicutar


Higher address range is mapped to the kernel. This if you write something there e.g. Say 0xFFFFFF7 kernel exits your process with a segmentation fault complaining that illegal memory location was accessed. In user land your process is more like a sand box and any illegal access of memory outside your process is fined with kernel killing your process with a segmentation fault violation.

To panic a kernel you can try to set some wrong hardware registers typically with invocation of a syscntl sys call.

like image 40
Jay D Avatar answered Mar 30 '26 00:03

Jay D



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!