Hi,  

I am trying to load a kernel module into UML.  I've built the module using the same source tree that built the UML kernel.  But when I tried to load (insmod) the module, the kernel panic happened. 

The kernel version: 2.6.27 

The module init code is trying to create a directory under /proc: 

static int __init isan_proc_init(void)
{
    printk("in %s\n", __FUNCTION__);

    proc_test = proc_mkdir("test1", NULL);   // insmod OK if removed this line

    return 0;
}

The kernel panic does _not_ happen if I removed the call of proc_mkdir.  But I don't understand why.  Here is the kernel panic log:

#insmod ./klm_procfs_init.klm 
in isan_proc_init

EIP: 0023:[<080da984>] CPU: 0 Not tainted ESP: 002b:10a38e78 EFLAGS: 00010206
    Not tainted
EAX: 00004000 EBX: 10893ed0 ECX: 10a38e7c EDX: 08217b28
ESI: 75ff5750 EDI: 08056278 EBP: 10a38e8c DS: 002b ES: 002b
081f8af0:  [<08069b53>] show_regs+0xb4/0xb9
081f8b1c:  [<080591b2>] segv+0x222/0x23a
081f8bbc:  [<0805925a>] segv_handler+0x90/0x9a
081f8c68:  [<08064968>] sig_handler_common+0x63/0x72
081f8ce0:  [<08064c5c>] sig_handler+0x31/0x3d
081f8cec:  [<08064bbb>] handle_signal+0x4c/0x7a
081f8d0c:  [<080662d7>] hard_handler+0xf/0x14
081f8d1c:  [<ffffe500>] _etext+0xf7e68408/0x0

Kernel panic - not syncing: Kernel mode fault at addr 0x75ff5758, ip 0x80da984

EIP: 0023:[<400ed59e>] CPU: 0 Not tainted ESP: 002b:ff507d90 EFLAGS: 00000246
    Not tainted
EAX: ffffffda EBX: 0804b018 ECX: 0000d361 EDX: 0804b008
ESI: 08048760 EDI: 4000e380 EBP: ff507de8 DS: 002b ES: 002b
081f8a5c:  [<08069b53>] show_regs+0xb4/0xb9
081f8a88:  [<08059426>] panic_exit+0x25/0x3b
081f8a9c:  [<080836d6>] notifier_call_chain+0x27/0x4c
081f8ac4:  [<08083712>] __atomic_notifier_call_chain+0x17/0x19
081f8ad4:  [<08083729>] atomic_notifier_call_chain+0x15/0x17
081f8af0:  [<0806fea3>] panic+0x52/0xd8
081f8b10:  [<080591c0>] segv+0x230/0x23a
081f8bbc:  [<0805925a>] segv_handler+0x90/0x9a
081f8c68:  [<08064968>] sig_handler_common+0x63/0x72
081f8ce0:  [<08064c5c>] sig_handler+0x31/0x3d
081f8cec:  [<08064bbb>] handle_signal+0x4c/0x7a
081f8d0c:  [<080662d7>] hard_handler+0xf/0x14
081f8d1c:  [<ffffe500>] _etext+0xf7e68408/0x0

Segmentation fault (core dumped)

And for some reason, the core was not complete: 

(gdb) target core core.20687
BFD: Warning: /nobackup/hxu2/uml/linux-2.6.27/core.20687 is truncated: expected core file size >= 134807552, found: 104960000.

[New Thread 20687]
[New Thread 20695]
[New Thread 20694]
[New Thread 20693]
warning: Can't read pathname for load map: Input/output error.
Cannot access memory at address 0xf7fd30f0
(gdb) bt
#0  0x007a7821 in ?? ()
#1  0x00000006 in ?? ()
#2  0x081f8960 in cpu0_irqstack ()
#3  0x00000000 in ?? ()
(gdb) 

What could be possible reason for proc_mkdir to cause kernel panic? 

thanks
Han