kernel BUG at mm/slub.c:1149 while allocating memory.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello everyone,

I am running into a crash while allocating memory using kmalloc with GFP_KERNEL flag. As per my requirement, I need to allocate memory sizes of 12 bytes and 105 bytes in loop N times, which will be freed later on. Currently I run into crash during kmalloc in exactly the 5th iteration. So, four times it allocates the memory successfully, but after that it crashes.

This kernel function is invoked using IOCTL from a user mode application. So, after crash some times the application terminates saying segmentation fault and sometimes I run into kernel panic. But both crash happen in the same scenario and at same location.

Here is the system & gcc information which I am using.

uname -a
Linux Sensex 2.6.26.8-devker #1 SMP Thu Apr 2 18:23:36 IST 2009 i686 i686 i386 GNU/Linux

gcc --version
gcc (GCC) 4.3.0 20080428 (Red Hat 4.3.0-8)


Here is the Log from Dmesg:


Serving 10 Requests...
Allocating Memory..
Allocated address CFAFE850 of size 12 at line: 124
Allocated address CFAFE980 of size 104 at line: 130
Writing Pattern 66 at sector 0

Allocating Memory..
Allocated address CFAFEAB0 of size 12 at line: 124
Allocated address CFAFEBE0 of size 104 at line: 130
Writing Pattern 65 at sector 0

Allocating Memory..
Allocated address CFAFED10 of size 12 at line: 124
Allocated address CFAFEE40 of size 104 at line: 130
Writing Pattern 66 at sector 0

Allocating Memory..
Allocated address CF823D10 of size 12 at line: 124
Allocated address CF823E40 of size 104 at line: 130
Writing Pattern 65 at sector 0

Allocating Memory..

------------[ cut here ]------------
kernel BUG at mm/slub.c:1149!
invalid opcode: 0000 [#1]
Modules linked in:

Pid: 996, comm: raid_mgt Not tainted (2.6.26.8-test #41)
EIP: 0060:[<c014b957>] EFLAGS: 00010002 CPU: 0
EIP is at __slab_alloc+0xc2/0x3d5
EAX: 00000000 EBX: 00000000 ECX: c11f5fd8 EDX: 0000000c
ESI: c030fe80 EDI: c030fe80 EBP: cfa0dc18 ESP: cfa0dbe8
 DS: 007b ES: 007b FS: 0000 GS: 0033 SS: 0068
Process raid_mgt (pid: 996, ti=cfa0c000 task=cfaa2da0 task.ti=cfa0c000)
Stack: 00000060 00000246 ffffffff 0000000c 00000000 cf823e40 cf823d10 c11f0460
       cfa0dc18 00000286 0000000c c030fe80 cfa0dc38 c014c055 c0201b3c c030fefc
       00000100 cf823e40 cf823d10 cf823ea8 cfa0dc58 c0201b3c c02d8fdc 00000001
Call Trace:
 [<c014c055>] ? kmem_cache_alloc+0x55/0x94
 [<c0201b3c>] ? allocate_issue_io_on_chunk+0x7e/0x126
 [<c0201b3c>] ? allocate_issue_io_on_chunk+0x7e/0x126
 [<c0201c6f>] ? run_io_session_layer_test+0x8b/0x95
 [<c01ffef6>] ? run_test_case_main+0x17/0x1d
 [<c020095a>] ? raidmgt_ioctl+0x3e/0x244
 [<c013a7b2>] ? __alloc_pages+0xa/0xc
 [<c0140b2e>] ? handle_mm_fault+0x1e7/0x79a
 [<c01360e9>] ? find_lock_page+0x25/0x7c
 [<c01366a2>] ? filemap_fault+0x188/0x2bd
 [<c0136005>] ? unlock_page+0x4a/0x4d
 [<c013fd65>] ? __do_fault+0x29c/0x2d4
 [<c01b0b6c>] ? string+0x2b/0x74
 [<c01b0ef5>] ? vsnprintf+0x340/0x56e
 [<c01289c7>] ? update_wall_time+0x56f/0x70b
 [<c012812f>] ? getnstimeofday+0x37/0xc2
 [<c0126585>] ? hrtimer_run_pending+0xcd/0xd2
 [<c011be10>] ? run_timer_softirq+0x14/0x194
 [<c01193fa>] ? __do_softirq+0x8a/0x8f
 [<c0119516>] ? irq_exit+0x3f/0x57
 [<c010a0a1>] ? smp_apic_timer_interrupt+0x5c/0x67
 [<c0103e40>] ? apic_timer_interrupt+0x28/0x30
 [<c0115fef>] ? vprintk+0x282/0x294
 [<c01c72bf>] ? read_chan+0x4fc/0x5a5
 [<c01c6dc3>] ? read_chan+0x0/0x5a5
 [<c010f6ae>] ? __wake_up+0x29/0x3e
 [<c02004dd>] ? raidmgt_chardev_ioctl+0x0/0x24
 [<c02004dd>] ? raidmgt_chardev_ioctl+0x0/0x24
 [<c02004fc>] ? raidmgt_chardev_ioctl+0x1f/0x24
 [<c0157bbe>] ? vfs_ioctl+0x3e/0x51
 [<c0157dc2>] ? do_vfs_ioctl+0x1f1/0x208
 [<c0157e05>] ? sys_ioctl+0x2c/0x47
 [<c01033e7>] ? sysenter_past_esp+0x78/0xb1
 =======================
Code: 89 5f 04 e9 7b ff ff ff 8b 55 dc 8b 45 dc 80 e6 7f 83 e0 10 89 45 e0 74 0a fb 0f 1f 84 00 00 00 00 00 90 f7 c2 06 00 e0 ff 74 04 <0f> 0b eb fe 8b 4e 38 81 e2 f0 1e 07 00 8b 7e 10 09 ca 89 d0 89
EIP: [<c014b957>] __slab_alloc+0xc2/0x3d5 SS:ESP 0068:cfa0dbe8
---[ end trace af6209741eaae8f7 ]---



I searched for problems involving kmem_cache_alloc but couldn't find anything concrete. So, expecting to find my answer here.

Thanking you in anticipation.

Regards,
Vikash Kumar
http://VikashKumar.com/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux