Linux module for causing a system hard lock-up

limp johnkyr83 at hotmail.com
Wed Jun 8 15:27:45 EDT 2011


Hi all,

I am trying to hard lockup my Linux system (Debian) for evaluating some
crash report mechanism.
Basically, what I want to do is to load a module that will cause a
non-interruptible hang.

I found the following code on this website
(http://oslearn.blogspot.com/2011/04/use-nmi-watchdog.html), but the module
fails to hard lockup my system:


#include <linux/module.h>
#include <linux/kernel.h>   /* printk() */

int init_module(void)
{
    unsigned long flags;
    static spinlock_t lock;
    spin_lock_init(&lock);
    spin_lock_irqsave(&lock, flags);
    printk(KERN_INFO "Hello, world\n");
    spin_lock_irqsave(&lock, flags);
    //spin_lock(&lock);
    printk(KERN_INFO "Hello, world\n");
    return 0;
}

void cleanup_module(void)
{
    printk(KERN_INFO "Goodbye cruel world\n");
}


Could anyone please let me know how can I achieve this?

Thanks in advance.

John K.




More information about the Kernelnewbies mailing list