Linux module for causing a system hard lock-up

Jeff Haran jharan at bytemobile.com
Wed Jun 8 18:53:24 EDT 2011


> -----Original Message-----
> From: kernelnewbies-bounces at kernelnewbies.org [mailto:kernelnewbies-
> bounces at kernelnewbies.org] On Behalf Of limp
> Sent: Wednesday, June 08, 2011 3:24 PM
> To: kernelnewbies at kernelnewbies.org
> Cc: 'Daniel Baluta'
> Subject: RE: Linux module for causing a system hard lock-up
> 
> >Hello,
> >
> >> Could anyone please let me know how can I achieve this?
> >
> >Is hard lockup detector enabled in your system? Could you
> >post your .config.
> 
> Hi there,
> 
> At the moment I haven't enabled a hard lockup detector (I guess you're
> talking about NMI watchdog, right?) but I am just trying to hard
lockup
> Linux using a kernel module. I was expecting the posted module to do
that
> but apparently it doesn't (Linux still works great after loading it).
> 
> Thanks,
> 
> John K.
> 

Looking at your original code, I would expect it to lock up a single
processor system but not an SMP system.

On SMP spinlock_irq_save() will disable interrupts on the local CPU, but
they are still enabled on the others.

You might want to try replacing the calls to spinlock_irq_save() with
calls to cli(), which if I am not mistaken will disable interrupts on
all CPUs.

Something like this perhaps:

int init_module(void)
{
    cli();
    return 0;
}

Or perhaps this:

int init_module(void)
{
    cli();
    while(1);
    return 0;
}






More information about the Kernelnewbies mailing list