From: Hao Sun <[email protected]>
To: [email protected], [email protected]
Cc: [email protected], [email protected]
Subject: BUG: unable to handle kernel NULL pointer dereference in io_uring_cancel_task_requests
Date: Sun, 11 Apr 2021 11:08:13 +0800 [thread overview]
Message-ID: <CACkBjsb4Ad60ZTyaaObBj2DKxSv1avmTSo3WUrnvH+amuDuhrA@mail.gmail.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 5992 bytes --]
Hi
When using Healer(https://github.com/SunHao-0/healer/tree/dev) to fuzz
the Linux kernel, I found a null-ptr-deref bug in
io_uring_cancel_task_requests under fault injection condition, but I'm
not sure about this.
Sorry, I do not have a reproducing program for this bug.
I hope that the stack trace information in the crash log can help you
locate the problem.
Here is the details:
commit: 3b9cdafb5358eb9f3790de2f728f765fef100731
version: linux 5.11
git tree: upstream
Full log can be found in the attachment.
Fault injection log:
FAULT_INJECTION: forcing a failure.
name fail_usercopy, interval 1, probability 0, space 0, times 0
CPU: 1 PID: 9161 Comm: executor Not tainted 5.11.0+ #5
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x137/0x194 lib/dump_stack.c:120
fail_dump lib/fault-inject.c:52 [inline]
should_fail+0x23e/0x250 lib/fault-inject.c:146
should_fail_usercopy+0x16/0x20 lib/fault-inject-usercopy.c:37
_copy_from_user+0x1c/0xd0 lib/usercopy.c:14
copy_from_user include/linux/uaccess.h:192 [inline]
set_user_sigmask+0x4b/0x110 kernel/signal.c:3015
io_cqring_wait+0x2e3/0x8b0 fs/io_uring.c:7250
__do_sys_io_uring_enter fs/io_uring.c:9480 [inline]
__se_sys_io_uring_enter+0x8fc/0xb70 fs/io_uring.c:9397
__x64_sys_io_uring_enter+0x74/0x80 fs/io_uring.c:9397
do_syscall_64+0x39/0x80 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x46a379
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f046fa19c58 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa
RAX: ffffffffffffffda RBX: 000000000078c080 RCX: 000000000046a379
RDX: 00000000000066ab RSI: 0000000000000001 RDI: 0000000000000003
RBP: 00007f046fa19c90 R08: 0000000020000040 R09: 0000000000000008
R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
R13: 0000000000000000 R14: 000000000078c080 R15: 00007fff769deef0
Crash log:
BUG: kernel NULL pointer dereference, address: 0000000000000040
#PF: supervisor read access in kernel mode
#PF: error_code(0x0000) - not-present page
PGD 49954067 P4D 49954067 PUD 45f92067 PMD 0
Oops: 0000 [#1] PREEMPT SMP
CPU: 1 PID: 9161 Comm: executor Not tainted 5.11.0+ #5
Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS
rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
RIP: 0010:io_uring_cancel_task_requests+0x3f/0x990 fs/io_uring.c:9045
Code: 48 8b 04 25 28 00 00 00 48 89 44 24 68 e8 89 e6 c5 ff 65 4c 8b
34 25 00 6d 01 00 49 8d 7c 24 40 48 89 7c 24 30 e8 81 97 d6 ff <41> 8b
5c 24 40 89 de 83 e6 02 31 ff e8 70 ea c5 ff 83 e3 02 48 89
RSP: 0018:ffffc90002a97b48 EFLAGS: 00010246
RAX: ffff88804b8e0d38 RBX: ffff88804b8ad700 RCX: 0000000000000764
RDX: 0000000000000040 RSI: ffff8880409d5140 RDI: 0000000000000040
RBP: ffff8880409d5140 R08: 0000000000000000 R09: 0000000000000043
R10: 0001ffffffffffff R11: ffff88804b8e0280 R12: 0000000000000000
R13: ffff8880409d5140 R14: ffff88804b8e0280 R15: ffff8880481c1800
FS: 00007f046fa1a700(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000040 CR3: 00000000479a5000 CR4: 0000000000750ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
Call Trace:
__io_uring_files_cancel+0x9b/0x200 fs/io_uring.c:9140
io_uring_files_cancel include/linux/io_uring.h:65 [inline]
do_exit+0x1a8/0x16d0 kernel/exit.c:780
do_group_exit+0xc5/0x180 kernel/exit.c:922
get_signal+0xd90/0x1470 kernel/signal.c:2773
arch_do_signal_or_restart+0x2a/0x260 arch/x86/kernel/signal.c:811
handle_signal_work kernel/entry/common.c:147 [inline]
exit_to_user_mode_loop kernel/entry/common.c:171 [inline]
exit_to_user_mode_prepare+0x109/0x1a0 kernel/entry/common.c:208
__syscall_exit_to_user_mode_work kernel/entry/common.c:290 [inline]
syscall_exit_to_user_mode+0x20/0x40 kernel/entry/common.c:301
do_syscall_64+0x45/0x80 arch/x86/entry/common.c:56
entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x46a379
Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48
89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d
01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007f046fa19cd8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: fffffffffffffe00 RBX: 000000000078c080 RCX: 000000000046a379
RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000078c088
RBP: 000000000078c088 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000078c08c
R13: 0000000000000000 R14: 000000000078c080 R15: 00007fff769deef0
Modules linked in:
Dumping ftrace buffer:
(ftrace buffer empty)
CR2: 0000000000000040
---[ end trace 613db1a25ecf6443 ]---
RIP: 0010:io_uring_cancel_task_requests+0x3f/0x990 fs/io_uring.c:9045
Code: 48 8b 04 25 28 00 00 00 48 89 44 24 68 e8 89 e6 c5 ff 65 4c 8b
34 25 00 6d 01 00 49 8d 7c 24 40 48 89 7c 24 30 e8 81 97 d6 ff <41> 8b
5c 24 40 89 de 83 e6 02 31 ff e8 70 ea c5 ff 83 e3 02 48 89
RSP: 0018:ffffc90002a97b48 EFLAGS: 00010246
RAX: ffff88804b8e0d38 RBX: ffff88804b8ad700 RCX: 0000000000000764
RDX: 0000000000000040 RSI: ffff8880409d5140 RDI: 0000000000000040
RBP: ffff8880409d5140 R08: 0000000000000000 R09: 0000000000000043
R10: 0001ffffffffffff R11: ffff88804b8e0280 R12: 0000000000000000
R13: ffff8880409d5140 R14: ffff88804b8e0280 R15: ffff8880481c1800
FS: 00007f046fa1a700(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000000000040 CR3: 00000000479a5000 CR4: 0000000000750ee0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
PKRU: 55555554
[-- Attachment #2: log --]
[-- Type: application/octet-stream, Size: 7264 bytes --]
[ 80.194310][ T9161] FAULT_INJECTION: forcing a failure.
[ 80.194310][ T9161] name fail_usercopy, interval 1, probability 0, space 0, times 0
[ 80.200789][ T9161] CPU: 1 PID: 9161 Comm: executor Not tainted 5.11.0+ #5
[ 80.202599][ T9161] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
[ 80.205451][ T9161] Call Trace:
[ 80.206172][ T9161] dump_stack+0x137/0x194
[ 80.207190][ T9161] should_fail+0x23e/0x250
[ 80.208268][ T9161] should_fail_usercopy+0x16/0x20
[ 80.209477][ T9161] _copy_from_user+0x1c/0xd0
[ 80.210467][ T9161] set_user_sigmask+0x4b/0x110
[ 80.211586][ T9161] io_cqring_wait+0x2e3/0x8b0
[ 80.212705][ T9161] ? _raw_spin_unlock_irqrestore+0x27/0x50
[ 80.214054][ T9161] ? io_req_defer+0x6d0/0x6d0
[ 80.215182][ T9161] __se_sys_io_uring_enter+0x8fc/0xb70
[ 80.216495][ T9161] ? __fget_light+0x219/0x260
[ 80.217580][ T9161] ? fput+0x2d/0x130
[ 80.218498][ T9161] __x64_sys_io_uring_enter+0x74/0x80
[ 80.219815][ T9161] do_syscall_64+0x39/0x80
[ 80.221102][ T9161] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 80.222560][ T9161] RIP: 0033:0x46a379
[ 80.226924][ T9161] Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
[ 80.231614][ T9161] RSP: 002b:00007f046fa19c58 EFLAGS: 00000246 ORIG_RAX: 00000000000001aa
[ 80.233959][ T9161] RAX: ffffffffffffffda RBX: 000000000078c080 RCX: 000000000046a379
[ 80.239341][ T9161] RDX: 00000000000066ab RSI: 0000000000000001 RDI: 0000000000000003
[ 80.240801][ T9161] RBP: 00007f046fa19c90 R08: 0000000020000040 R09: 0000000000000008
[ 80.242296][ T9161] R10: 0000000000000003 R11: 0000000000000246 R12: 0000000000000000
[ 80.243988][ T9161] R13: 0000000000000000 R14: 000000000078c080 R15: 00007fff769deef0
[ 80.462925][ T9160] VFS: Close: file count is 0
[ 80.468297][ T9161] BUG: kernel NULL pointer dereference, address: 0000000000000040
[ 80.469991][ T9161] #PF: supervisor read access in kernel mode
[ 80.471267][ T9161] #PF: error_code(0x0000) - not-present page
[ 80.472459][ T9161] PGD 49954067 P4D 49954067 PUD 45f92067 PMD 0
[ 80.480597][ T9161] Oops: 0000 [#1] PREEMPT SMP
[ 80.481581][ T9161] CPU: 1 PID: 9161 Comm: executor Not tainted 5.11.0+ #5
[ 80.487977][ T9161] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014
[ 80.490775][ T9161] RIP: 0010:io_uring_cancel_task_requests+0x3f/0x990
[ 80.492145][ T9161] Code: 48 8b 04 25 28 00 00 00 48 89 44 24 68 e8 89 e6 c5 ff 65 4c 8b 34 25 00 6d 01 00 49 8d 7c 24 40 48 89 7c 24 30 e8 81 97 d6 ff <41> 8b 5c 24 40 89 de 83 e6 02 31 ff e8 70 ea c5 ff 83 e3 02 48 89
[ 80.495817][ T9161] RSP: 0018:ffffc90002a97b48 EFLAGS: 00010246
[ 80.496852][ T9161] RAX: ffff88804b8e0d38 RBX: ffff88804b8ad700 RCX: 0000000000000764
[ 80.498150][ T9161] RDX: 0000000000000040 RSI: ffff8880409d5140 RDI: 0000000000000040
[ 80.499303][ T9161] RBP: ffff8880409d5140 R08: 0000000000000000 R09: 0000000000000043
[ 80.500467][ T9161] R10: 0001ffffffffffff R11: ffff88804b8e0280 R12: 0000000000000000
[ 80.501773][ T9161] R13: ffff8880409d5140 R14: ffff88804b8e0280 R15: ffff8880481c1800
[ 80.503083][ T9161] FS: 00007f046fa1a700(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
[ 80.504670][ T9161] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 80.505896][ T9161] CR2: 0000000000000040 CR3: 00000000479a5000 CR4: 0000000000750ee0
[ 80.507373][ T9161] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 80.508895][ T9161] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 80.510264][ T9161] PKRU: 55555554
[ 80.510784][ T9161] Call Trace:
[ 80.511258][ T9161] ? xa_find+0x10c/0x140
[ 80.512020][ T9161] __io_uring_files_cancel+0x9b/0x200
[ 80.512859][ T9161] ? _raw_spin_unlock_irqrestore+0x27/0x50
[ 80.513682][ T9161] do_exit+0x1a8/0x16d0
[ 80.514339][ T9161] ? do_futex+0xfc8/0x1c70
[ 80.514999][ T9161] do_group_exit+0xc5/0x180
[ 80.515927][ T9161] get_signal+0xd90/0x1470
[ 80.516868][ T9161] arch_do_signal_or_restart+0x2a/0x260
[ 80.518010][ T9161] ? __se_sys_futex+0x2a3/0x390
[ 80.518943][ T9161] exit_to_user_mode_prepare+0x109/0x1a0
[ 80.520072][ T9161] syscall_exit_to_user_mode+0x20/0x40
[ 80.521086][ T9161] do_syscall_64+0x45/0x80
[ 80.521713][ T9161] entry_SYSCALL_64_after_hwframe+0x44/0xae
[ 80.522597][ T9161] RIP: 0033:0x46a379
[ 80.523274][ T9161] Code: f7 d8 64 89 02 b8 ff ff ff ff c3 66 0f 1f 44 00 00 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 c7 c1 bc ff ff ff f7 d8 64 89 01 48
[ 80.526494][ T9161] RSP: 002b:00007f046fa19cd8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
[ 80.528079][ T9161] RAX: fffffffffffffe00 RBX: 000000000078c080 RCX: 000000000046a379
[ 80.529574][ T9161] RDX: 0000000000000000 RSI: 0000000000000080 RDI: 000000000078c088
[ 80.531033][ T9161] RBP: 000000000078c088 R08: 0000000000000000 R09: 0000000000000000
[ 80.532198][ T9161] R10: 0000000000000000 R11: 0000000000000246 R12: 000000000078c08c
[ 80.533531][ T9161] R13: 0000000000000000 R14: 000000000078c080 R15: 00007fff769deef0
[ 80.535336][ T9161] Modules linked in:
[ 80.536093][ T9161] Dumping ftrace buffer:
[ 80.537032][ T9161] (ftrace buffer empty)
[ 80.537886][ T9161] CR2: 0000000000000040
[ 80.538510][ T9161] ---[ end trace 613db1a25ecf6443 ]---
[ 80.539567][ T9161] RIP: 0010:io_uring_cancel_task_requests+0x3f/0x990
[ 80.540857][ T9161] Code: 48 8b 04 25 28 00 00 00 48 89 44 24 68 e8 89 e6 c5 ff 65 4c 8b 34 25 00 6d 01 00 49 8d 7c 24 40 48 89 7c 24 30 e8 81 97 d6 ff <41> 8b 5c 24 40 89 de 83 e6 02 31 ff e8 70 ea c5 ff 83 e3 02 48 89
[ 80.544561][ T9161] RSP: 0018:ffffc90002a97b48 EFLAGS: 00010246
[ 80.545784][ T9161] RAX: ffff88804b8e0d38 RBX: ffff88804b8ad700 RCX: 0000000000000764
[ 80.547292][ T9161] RDX: 0000000000000040 RSI: ffff8880409d5140 RDI: 0000000000000040
[ 80.548769][ T9161] RBP: ffff8880409d5140 R08: 0000000000000000 R09: 0000000000000043
[ 80.550324][ T9161] R10: 0001ffffffffffff R11: ffff88804b8e0280 R12: 0000000000000000
[ 80.551889][ T9161] R13: ffff8880409d5140 R14: ffff88804b8e0280 R15: ffff8880481c1800
[ 80.553417][ T9161] FS: 00007f046fa1a700(0000) GS:ffff88807ec00000(0000) knlGS:0000000000000000
[ 80.555083][ T9161] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 80.556430][ T9161] CR2: 0000000000000040 CR3: 00000000479a5000 CR4: 0000000000750ee0
[ 80.557915][ T9161] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 80.561795][ T9161] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 80.563000][ T9161] PKRU: 55555554
[ 80.563589][ T9161] Kernel panic - not syncing: Fatal exception
[ 80.564863][ T9161] Dumping ftrace buffer:
[ 80.565515][ T9161] (ftrace buffer empty)
[ 80.566182][ T9161] Kernel Offset: disabled
[ 80.566826][ T9161] Rebooting in 1 seconds..
next reply other threads:[~2021-04-11 3:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-11 3:08 Hao Sun [this message]
2021-04-11 8:10 ` BUG: unable to handle kernel NULL pointer dereference in io_uring_cancel_task_requests Pavel Begunkov
2021-04-11 8:58 ` Hao Sun
2021-04-11 9:09 ` Pavel Begunkov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CACkBjsb4Ad60ZTyaaObBj2DKxSv1avmTSo3WUrnvH+amuDuhrA@mail.gmail.com \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
[email protected] \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox