GPF in shm_lock ipc

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

 



Hello,

The following program crashes kernel:

// autogenerated by syzkaller (http://github.com/google/syzkaller)
#include <syscall.h>
#include <string.h>
#include <stdint.h>

int main()
{
        long r0 = syscall(SYS_shmget, 0x0ul, 0x2ul, 0x8ul);
        long r1 = syscall(SYS_shmat, r0, 0x20000000ul, 0x0ul);
        long r2 = syscall(SYS_mremap, 0x20000000ul, 0x1000ul,
0x3000ul, 0x3ul, 0x207f9000ul);
        long r19 = syscall(SYS_shmctl, r0, 0x0ul, 0);
        long r20 = syscall(SYS_remap_file_pages, 0x207f9000ul,
0x3000ul, 0x0ul, 0x7ul, 0x0ul);
        return 0;
}

On commit dd36d7393d6310b0c1adefb22fba79c3cf8a577c
(git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git)

------------[ cut here ]------------
WARNING: CPU: 2 PID: 2636 at ipc/shm.c:162 shm_open+0x74/0x80()
Modules linked in:
CPU: 2 PID: 2636 Comm: a.out Not tainted 4.3.0-rc3+ #37
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
 ffffffff81bcb43c ffff88081bf0bd70 ffffffff812fe8d6 0000000000000000
 ffff88081bf0bda8 ffffffff81051ff1 ffffffffffffffea ffff88081b896ca8
 ffff880819b81620 ffff8800bbaa6d00 ffff880819b81600 ffff88081bf0bdb8
Call Trace:
 [<     inline     >] __dump_stack lib/dump_stack.c:15
 [<ffffffff812fe8d6>] dump_stack+0x44/0x5e lib/dump_stack.c:50
 [<ffffffff81051ff1>] warn_slowpath_common+0x81/0xc0 kernel/panic.c:447
 [<ffffffff810520e5>] warn_slowpath_null+0x15/0x20 kernel/panic.c:480
 [<     inline     >] shm_lock ipc/shm.c:162
 [<ffffffff81295c64>] shm_open+0x74/0x80 ipc/shm.c:196
 [<ffffffff81295cbe>] shm_mmap+0x4e/0x80 ipc/shm.c:399 (discriminator 2)
 [<ffffffff81142d14>] mmap_region+0x3c4/0x5e0 mm/mmap.c:1627
 [<ffffffff81143227>] do_mmap+0x2f7/0x3d0 mm/mmap.c:1402
 [<     inline     >] do_mmap_pgoff include/linux/mm.h:1930
 [<     inline     >] SYSC_remap_file_pages mm/mmap.c:2694
 [<ffffffff811434a9>] SyS_remap_file_pages+0x179/0x240 mm/mmap.c:2641
 [<ffffffff81859a97>] entry_SYSCALL_64_fastpath+0x12/0x6a
arch/x86/entry/entry_64.S:185
---[ end trace 0873e743fc645a8c ]---
BUG: unable to handle kernel NULL pointer dereference at 000000000000003a
IP: [<ffffffff81295c25>] shm_open+0x35/0x80 ipc/shm.c:197
PGD 81a08b067 PUD 81a01b067 PMD 0
Oops: 0002 [#1] SMP
Modules linked in:
CPU: 2 PID: 2636 Comm: a.out Tainted: G        W       4.3.0-rc3+ #37
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS Bochs 01/01/2011
task: ffff880819b26800 ti: ffff88081bf08000 task.ti: ffff88081bf08000
RIP: 0010:[<ffffffff81295c25>]  [<ffffffff81295c25>] shm_open+0x35/0x80
RSP: 0018:ffff88081bf0bdc8  EFLAGS: 00010296
RAX: 00000000560d1d13 RBX: ffffffffffffffea RCX: ffffffff8151e710
RDX: 0000000000000001 RSI: 0000000000000000 RDI: 0000000000000009
RBP: ffff88081bf0bdd0 R08: 000000000000000a R09: 0000000000000001
R10: 0000000000000000 R11: 00000000000001bc R12: ffff88081b896ca8
R13: ffff880819b81620 R14: ffff8800bbaa6d00 R15: ffff880819b81600
FS:  00007fbfd966f700(0000) GS:ffff88083fd00000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 000000000000003a CR3: 0000000819a97000 CR4: 00000000000006e0
Stack:
 ffff880819b81200 ffff88081bf0bdf8 ffffffff81295cbe 0000000019b81620
 ffff880819b81628 00000000207f9000 ffff88081bf0be80 ffffffff81142d14
 ffff8800bbaa6d00 0000000000000007 0000000000000000 0000000000000007
Call Trace:
 [<ffffffff81295cbe>] shm_mmap+0x4e/0x80 ipc/shm.c:399 (discriminator 2)
 [<ffffffff81142d14>] mmap_region+0x3c4/0x5e0 mm/mmap.c:1627
 [<ffffffff81143227>] do_mmap+0x2f7/0x3d0 mm/mmap.c:1402
 [<     inline     >] do_mmap_pgoff include/linux/mm.h:1930
 [<     inline     >] SYSC_remap_file_pages mm/mmap.c:2694
 [<ffffffff811434a9>] SyS_remap_file_pages+0x179/0x240 mm/mmap.c:2641
 [<ffffffff81859a97>] entry_SYSCALL_64_fastpath+0x12/0x6a
arch/x86/entry/entry_64.S:185
Code: 00 00 48 8b 80 d0 00 00 00 48 8b 50 08 8b 30 48 8d ba c8 00 00
00 e8 6b b1 ff ff 48 3d 00 f0 ff ff 48 89 c3 77 33 e8 5b 6b e1 ff <48>
89 43 50 65 48 8b 04 25 c0 ad 00 00 48 8b 80 40 04 00 00 48
RIP  [<ffffffff81295c25>] shm_open+0x35/0x80 ipc/shm.c:197
 RSP <ffff88081bf0bdc8>
CR2: 000000000000003a
---[ end trace 0873e743fc645a8d ]---

Found with syzkaller fuzzer.

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@xxxxxxxxx.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Don't email: <a href=mailto:"dont@xxxxxxxxx";> email@xxxxxxxxx </a>



[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]