BUG: unable to handle kernel NULL pointer dereference in irq_may_run

25 views
Skip to first unread message

syzbot

unread,
Dec 21, 2017, 10:52:03 AM12/21/17
to linux-...@vger.kernel.org, syzkall...@googlegroups.com, tg...@linutronix.de
Hello,

syzkaller hit the following crash on
6084b576dca2e898f5c101baef151f7bfdbb606d
git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
compiler: gcc (GCC) 7.1.1 20170620
.config is attached
Raw console output is attached.
C reproducer is attached
syzkaller reproducer is attached. See https://goo.gl/kgGztJ
for information about syzkaller reproducers


BUG: unable to handle kernel NULL pointer dereference at (null)
IP: irqd_has_set kernel/irq/internals.h:230 [inline]
IP: irq_may_run+0x19/0x70 kernel/irq/chip.c:506
PGD 0 P4D 0
Oops: 0000 [#1] SMP
Dumping ftrace buffer:
(ftrace buffer empty)
Modules linked in:
CPU: 0 PID: 3177 Comm: kworker/u4:2 Not tainted 4.15.0-rc3-next-20171214+
#67
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:irqd_has_set kernel/irq/internals.h:230 [inline]
RIP: 0010:irq_may_run+0x19/0x70 kernel/irq/chip.c:506
RSP: 0018:ffff88021fc03f58 EFLAGS: 00010006
RAX: 0000000000000000 RBX: ffff8802151fa400 RCX: ffffffff81243385
RDX: 0000000000010000 RSI: 0000000000000000 RDI: ffff8802151fa400
RBP: ffff88021fc03f68 R08: 0000000000000001 R09: 000000000000000c
R10: ffff88021fc03ee8 R11: 000000000000000c R12: 0000000000000001
R13: ffff8802151fa400 R14: 0000000000000027 R15: 0000000000000000
FS: 0000000000000000(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000000 CR3: 000000000301e003 CR4: 00000000001606f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<IRQ>
handle_edge_irq+0x33/0x220 kernel/irq/chip.c:755
generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
handle_irq+0x15/0x20 arch/x86/kernel/irq_64.c:77
do_IRQ+0x53/0x100 arch/x86/kernel/irq.c:229
common_interrupt+0xa9/0xa9 arch/x86/entry/entry_64.S:695
</IRQ>
RIP: 0010:atomic_add_return arch/x86/include/asm/atomic.h:157 [inline]
RIP: 0010:queued_read_lock include/asm-generic/qrwlock.h:85 [inline]
RIP: 0010:do_raw_read_lock+0x1a/0x50 kernel/locking/spinlock_debug.c:154
RSP: 0018:ffffc900018ebe28 EFLAGS: 00000206 ORIG_RAX: ffffffffffffffd8
RAX: 0000000000000000 RBX: ffffffff830a5100 RCX: 0000000051c3f387
RDX: 0000000000001c96 RSI: 000000004477e779 RDI: ffffffff830a5100
RBP: ffffc900018ebe30 R08: 0000000000000001 R09: 0000000000000001
R10: ffffc900018ebdd0 R11: 0000000000000000 R12: ffff880213744900
R13: 00000000fffffff8 R14: ffffffff830a5100 R15: ffff880213744900
__raw_read_lock include/linux/rwlock_api_smp.h:150 [inline]
_raw_read_lock+0x35/0x40 kernel/locking/spinlock.c:216
search_binary_handler+0xa9/0x2d0 fs/exec.c:1640
exec_binprm fs/exec.c:1681 [inline]
do_execveat_common.isra.30+0x861/0xb90 fs/exec.c:1803
do_execve+0x31/0x40 fs/exec.c:1848
call_usermodehelper_exec_async+0x104/0x190 kernel/umh.c:100
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:524
Code: 07 00 31 c0 5b 5d c3 90 66 2e 0f 1f 84 00 00 00 00 00 55 48 89 e5 41
54 53 48 89 fb 41 bc 01 00 00 00 e8 bb 6f 07 00 48 8b 43 38 <f7> 00 00 00
0c 00 75 0d e8 aa 6f 07 00 44 89 e0 5b 41 5c 5d c3
RIP: irqd_has_set kernel/irq/internals.h:230 [inline] RSP: ffff88021fc03f58
RIP: irq_may_run+0x19/0x70 kernel/irq/chip.c:506 RSP: ffff88021fc03f58
CR2: 0000000000000000
---[ end trace 733d3f531bf70369 ]---


---
This bug is generated by a dumb bot. It may contain errors.
See https://goo.gl/tpsmEJ for details.
Direct all questions to syzk...@googlegroups.com.
Please credit me with: Reported-by: syzbot <syzk...@googlegroups.com>

syzbot will keep track of this bug report.
Once a fix for this bug is merged into any tree, reply to this email with:
#syz fix: exact-commit-title
If you want to test a patch for this bug, please reply with:
#syz test: git://repo/address.git branch
and provide the patch inline or as an attachment.
To mark this as a duplicate of another syzbot report, please reply with:
#syz dup: exact-subject-of-another-report
If it's a one-off invalid bug report, please reply with:
#syz invalid
Note: if the crash happens again, it will cause creation of a new bug
report.
Note: all commands must start from beginning of the line in the email body.
config.txt
raw.log
repro.txt
repro.c

Thomas Gleixner

unread,
Dec 22, 2017, 2:13:49 PM12/22/17
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
On Thu, 21 Dec 2017, syzbot wrote:

> Hello,
>
> syzkaller hit the following crash on 6084b576dca2e898f5c101baef151f7bfdbb606d
> git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/master
> compiler: gcc (GCC) 7.1.1 20170620
> .config is attached
> Raw console output is attached.
> C reproducer is attached
> syzkaller reproducer is attached. See https://goo.gl/kgGztJ
> for information about syzkaller reproducers

Unfortunately I cannot reproduce that issue.

> BUG: unable to handle kernel NULL pointer dereference at (null)
> IP: irqd_has_set kernel/irq/internals.h:230 [inline]
> IP: irq_may_run+0x19/0x70 kernel/irq/chip.c:506
> PGD 0 P4D 0
> Oops: 0000 [#1] SMP
> Dumping ftrace buffer:
> (ftrace buffer empty)
> Modules linked in:
> CPU: 0 PID: 3177 Comm: kworker/u4:2 Not tainted 4.15.0-rc3-next-20171214+ #67
> Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google
> 01/01/2011
> RIP: 0010:irqd_has_set kernel/irq/internals.h:230 [inline]

So this dereferences

irq_desc->irq_data->common

which is NULL:

2b:* f7 00 00 00 0c 00 testl $0xc0000,(%rax) <-- trapping instruction

> RIP: 0010:irq_may_run+0x19/0x70 kernel/irq/chip.c:506
> RSP: 0018:ffff88021fc03f58 EFLAGS: 00010006
> RAX: 0000000000000000 RBX: ffff8802151fa400 RCX: ffffffff81243385

^^^^^^^^^^^^^^^^

> RDX: 0000000000010000 RSI: 0000000000000000 RDI: ffff8802151fa400
> RBP: ffff88021fc03f68 R08: 0000000000000001 R09: 000000000000000c
> R10: ffff88021fc03ee8 R11: 000000000000000c R12: 0000000000000001
> R13: ffff8802151fa400 R14: 0000000000000027 R15: 0000000000000000
> FS: 0000000000000000(0000) GS:ffff88021fc00000(0000) knlGS:0000000000000000
> CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
> CR2: 0000000000000000 CR3: 000000000301e003 CR4: 00000000001606f0
> DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
> DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
> Call Trace:
> <IRQ>
> handle_edge_irq+0x33/0x220 kernel/irq/chip.c:755
> generic_handle_irq_desc include/linux/irqdesc.h:159 [inline]
> handle_irq+0x15/0x20 arch/x86/kernel/irq_64.c:77
> do_IRQ+0x53/0x100 arch/x86/kernel/irq.c:229
> common_interrupt+0xa9/0xa9 arch/x86/entry/entry_64.S:695

Now what confuses me is the fact that

irq_desc->irq_data->common

is initialized in desc_set_defaults() when the irq descriptor is
allocated. It's not written to after that. Plus it got dereferenced before.
So this looks like a stray pointer.

I have no clue how that could be related to the reproducer. Is this
reproducing 100% on your end? If yes I surely can try to add some debug
which might help to catch this.

Thanks,

tglx


Eric Biggers

unread,
Dec 23, 2017, 3:38:29 PM12/23/17
to Thomas Gleixner, syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
This is yet another one where the reproducer is using AF_ALG and binding to an
algorithm using 'pcrypt', so it's running into the pcrypt_free() bug which is
causing slab cache corruption:

https://groups.google.com/forum/#!topic/syzkaller-bugs/NKn_ivoPOpk

https://patchwork.kernel.org/patch/10126761/

So let's mark it as a duplicate:

#syz dup: KASAN: use-after-free Read in __list_del_entry_valid (2)

Eric
Reply all
Reply to author
Forward
0 new messages