Linux module for causing a system hard lock-up

João Eduardo Luís jecluis at gmail.com
Tue Jun 14 17:36:38 EDT 2011


On Jun 14, 2011, at 9:23 PM, limp wrote:

> Thanks very much for that, it worked great! Would it be possible to give me
> a brief explanation on how this achieves the hard lockup (i.e. what does it
> actually do that leads to a lockup)?

If you look at 'stop_machine' method in kernel/stop_machine.c, as provided in [1], and check it further down the call chain, you'll see it basically calls 'stop_cpus', which will then run your 'func' method on each online cpu.

From the description of 'stop_cpus',

>  * Execute @fn(@arg) on online cpus in @cpumask.  On each target cpu,
>  * @fn is run in a process context with the highest priority
>  * preempting any task on the cpu and monopolizing it.  This function
>  * returns after all executions are complete.

If I understood it correctly, each cpu will be running your method 'func', which is an infinite loop that never sleeps, with the highest priority possible and, quoting, "monopolizing it". Hanging the machine with it seems only logical.

I hope this helps.


Cheers.

[1] - http://lxr.linux.no/#linux+v2.6.37.3/kernel/stop_machine.c#L476
[2] - http://lxr.linux.no/#linux+v2.6.37.3/kernel/stop_machine.c#L170

---
João Eduardo Luís
gpg key: 477C26E5 from pool.keyserver.eu 





-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 495 bytes
Desc: This is a digitally signed message part
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110614/3a5b6e7a/attachment-0001.bin 


More information about the Kernelnewbies mailing list