public inbox for [email protected]
 help / color / mirror / Atom feed
* [syzbot] [io-uring?] general protection fault in __io_remove_buffers
@ 2024-07-18  1:20 syzbot
  2024-07-18 18:03 ` Pavel Begunkov
  0 siblings, 1 reply; 3+ messages in thread
From: syzbot @ 2024-07-18  1:20 UTC (permalink / raw)
  To: asml.silence, axboe, io-uring, linux-kernel, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    d67978318827 Merge tag 'x86_cpu_for_v6.11_rc1' of git://gi..
git tree:       upstream
console+strace: https://syzkaller.appspot.com/x/log.txt?x=1178e9e9980000
kernel config:  https://syzkaller.appspot.com/x/.config?x=e206d588252bd3ff
dashboard link: https://syzkaller.appspot.com/bug?extid=2074b1a3d447915c6f1c
compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10e07d9e980000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16adf045980000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f34b31760156/disk-d6797831.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/a92e51d8d32e/vmlinux-d6797831.xz
kernel image: https://storage.googleapis.com/syzbot-assets/000a6a162550/bzImage-d6797831.xz

The issue was bisected to:

commit 87585b05757dc70545efb434669708d276125559
Author: Jens Axboe <[email protected]>
Date:   Wed Mar 13 02:24:21 2024 +0000

    io_uring/kbuf: use vm_insert_pages() for mmap'ed pbuf ring

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=16458ba5980000
final oops:     https://syzkaller.appspot.com/x/report.txt?x=15458ba5980000
console output: https://syzkaller.appspot.com/x/log.txt?x=11458ba5980000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: [email protected]
Fixes: 87585b05757d ("io_uring/kbuf: use vm_insert_pages() for mmap'ed pbuf ring")

Oops: general protection fault, probably for non-canonical address 0xdffffc0000000000: 0000 [#1] PREEMPT SMP KASAN PTI
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
CPU: 1 PID: 35 Comm: kworker/u8:2 Not tainted 6.10.0-syzkaller-01155-gd67978318827 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 06/07/2024
Workqueue: iou_exit io_ring_exit_work
RIP: 0010:__io_remove_buffers+0xac/0x700 io_uring/kbuf.c:341
Code: 42 80 3c 28 00 74 08 48 89 df e8 5f 02 5b fd 4d 89 fe 48 89 6c 24 40 48 89 5c 24 18 48 8b 1b 48 83 c3 0e 48 89 d8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 3b 05 00 00 44 0f b7 3b 49 8d 7c 24 16
RSP: 0018:ffffc90000ab7840 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff888017a8da00
RDX: ffff888017a8da00 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 1ffff110052be8e4 R08: ffffffff849ddaa4 R09: 1ffff110052be8e3
R10: dffffc0000000000 R11: ffffed10052be8e4 R12: ffff8880295f4700
R13: dffffc0000000000 R14: ffff8880295f4720 R15: ffff8880295f4720
FS:  0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555589c12650 CR3: 000000000e132000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
 <TASK>
 io_put_bl io_uring/kbuf.c:378 [inline]
 io_destroy_buffers+0x14e/0x490 io_uring/kbuf.c:392
 io_ring_ctx_free+0xa00/0x1070 io_uring/io_uring.c:2613
 io_ring_exit_work+0x80f/0x8a0 io_uring/io_uring.c:2844
 process_one_work kernel/workqueue.c:3231 [inline]
 process_scheduled_works+0xa2c/0x1830 kernel/workqueue.c:3312
 worker_thread+0x86d/0xd40 kernel/workqueue.c:3390
 kthread+0x2f0/0x390 kernel/kthread.c:389
 ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
 ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:244
 </TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__io_remove_buffers+0xac/0x700 io_uring/kbuf.c:341
Code: 42 80 3c 28 00 74 08 48 89 df e8 5f 02 5b fd 4d 89 fe 48 89 6c 24 40 48 89 5c 24 18 48 8b 1b 48 83 c3 0e 48 89 d8 48 c1 e8 03 <42> 0f b6 04 28 84 c0 0f 85 3b 05 00 00 44 0f b7 3b 49 8d 7c 24 16
RSP: 0018:ffffc90000ab7840 EFLAGS: 00010246
RAX: 0000000000000000 RBX: 0000000000000002 RCX: ffff888017a8da00
RDX: ffff888017a8da00 RSI: 0000000000000001 RDI: 0000000000000000
RBP: 1ffff110052be8e4 R08: ffffffff849ddaa4 R09: 1ffff110052be8e3
R10: dffffc0000000000 R11: ffffed10052be8e4 R12: ffff8880295f4700
R13: dffffc0000000000 R14: ffff8880295f4720 R15: ffff8880295f4720
FS:  0000000000000000(0000) GS:ffff8880b9500000(0000) knlGS:0000000000000000
CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000555589c12650 CR3: 000000000e132000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess):
   0:	42 80 3c 28 00       	cmpb   $0x0,(%rax,%r13,1)
   5:	74 08                	je     0xf
   7:	48 89 df             	mov    %rbx,%rdi
   a:	e8 5f 02 5b fd       	call   0xfd5b026e
   f:	4d 89 fe             	mov    %r15,%r14
  12:	48 89 6c 24 40       	mov    %rbp,0x40(%rsp)
  17:	48 89 5c 24 18       	mov    %rbx,0x18(%rsp)
  1c:	48 8b 1b             	mov    (%rbx),%rbx
  1f:	48 83 c3 0e          	add    $0xe,%rbx
  23:	48 89 d8             	mov    %rbx,%rax
  26:	48 c1 e8 03          	shr    $0x3,%rax
* 2a:	42 0f b6 04 28       	movzbl (%rax,%r13,1),%eax <-- trapping instruction
  2f:	84 c0                	test   %al,%al
  31:	0f 85 3b 05 00 00    	jne    0x572
  37:	44 0f b7 3b          	movzwl (%rbx),%r15d
  3b:	49 8d 7c 24 16       	lea    0x16(%r12),%rdi


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at [email protected].

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
For information about bisection process see: https://goo.gl/tpsmEJ#bisection

If the report is already addressed, let syzbot know by replying with:
#syz fix: exact-commit-title

If you want syzbot to run the reproducer, reply with:
#syz test: git://repo/address.git branch-or-commit-hash
If you attach or paste a git patch, syzbot will apply it before testing.

If you want to overwrite report's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)

If the report is a duplicate of another one, reply with:
#syz dup: exact-subject-of-another-report

If you want to undo deduplication, reply with:
#syz undup

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] [io-uring?] general protection fault in __io_remove_buffers
  2024-07-18 18:03 ` Pavel Begunkov
@ 2024-07-18 18:03   ` syzbot
  0 siblings, 0 replies; 3+ messages in thread
From: syzbot @ 2024-07-18 18:03 UTC (permalink / raw)
  To: asml.silence; +Cc: asml.silence, axboe, io-uring, linux-kernel, syzkaller-bugs

> On 7/18/24 02:20, syzbot wrote:
>> Hello,
>> 
>> syzbot found the following issue on:
>> 
>> HEAD commit:    d67978318827 Merge tag 'x86_cpu_for_v6.11_rc1' of git://gi..
>> git tree:       upstream
>> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1178e9e9980000
>> kernel config:  https://syzkaller.appspot.com/x/.config?x=e206d588252bd3ff
>> dashboard link: https://syzkaller.appspot.com/bug?extid=2074b1a3d447915c6f1c
>> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
>> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10e07d9e980000
>> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16adf045980000
>> 
>> Downloadable assets:
>> disk image: https://storage.googleapis.com/syzbot-assets/f34b31760156/disk-d6797831.raw.xz
>> vmlinux: https://storage.googleapis.com/syzbot-assets/a92e51d8d32e/vmlinux-d6797831.xz
>> kernel image: https://storage.googleapis.com/syzbot-assets/000a6a162550/bzImage-d6797831.xz
>> 
>> The issue was bisected to:
>> 
>> commit 87585b05757dc70545efb434669708d276125559
>> Author: Jens Axboe <[email protected]>
>> Date:   Wed Mar 13 02:24:21 2024 +0000
>> 
>>      io_uring/kbuf: use vm_insert_pages() for mmap'ed pbuf ring
> Easily reproducible, the diff helps
>
> #syz test:

want either no args or 2 args (repo, branch), got 4

>
>
> diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
> index d2945c9c812b..c95dc1736dd9 100644
> --- a/io_uring/kbuf.c
> +++ b/io_uring/kbuf.c
> @@ -657,8 +657,10 @@ static int io_alloc_pbuf_ring(struct io_ring_ctx *ctx,
>   	ring_size = reg->ring_entries * sizeof(struct io_uring_buf_ring);
>   
>   	bl->buf_ring = io_pages_map(&bl->buf_pages, &bl->buf_nr_pages, ring_size);
> -	if (!bl->buf_ring)
> +	if (IS_ERR(bl->buf_ring)) {
> +		bl->buf_ring = NULL;
>   		return -ENOMEM;
> +	}
>   
>   	bl->is_buf_ring = 1;
>   	bl->is_mmap = 1;
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [syzbot] [io-uring?] general protection fault in __io_remove_buffers
  2024-07-18  1:20 [syzbot] [io-uring?] general protection fault in __io_remove_buffers syzbot
@ 2024-07-18 18:03 ` Pavel Begunkov
  2024-07-18 18:03   ` syzbot
  0 siblings, 1 reply; 3+ messages in thread
From: Pavel Begunkov @ 2024-07-18 18:03 UTC (permalink / raw)
  To: syzbot, axboe, io-uring, linux-kernel, syzkaller-bugs

On 7/18/24 02:20, syzbot wrote:
> Hello,
> 
> syzbot found the following issue on:
> 
> HEAD commit:    d67978318827 Merge tag 'x86_cpu_for_v6.11_rc1' of git://gi..
> git tree:       upstream
> console+strace: https://syzkaller.appspot.com/x/log.txt?x=1178e9e9980000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=e206d588252bd3ff
> dashboard link: https://syzkaller.appspot.com/bug?extid=2074b1a3d447915c6f1c
> compiler:       Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=10e07d9e980000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=16adf045980000
> 
> Downloadable assets:
> disk image: https://storage.googleapis.com/syzbot-assets/f34b31760156/disk-d6797831.raw.xz
> vmlinux: https://storage.googleapis.com/syzbot-assets/a92e51d8d32e/vmlinux-d6797831.xz
> kernel image: https://storage.googleapis.com/syzbot-assets/000a6a162550/bzImage-d6797831.xz
> 
> The issue was bisected to:
> 
> commit 87585b05757dc70545efb434669708d276125559
> Author: Jens Axboe <[email protected]>
> Date:   Wed Mar 13 02:24:21 2024 +0000
> 
>      io_uring/kbuf: use vm_insert_pages() for mmap'ed pbuf ring
Easily reproducible, the diff helps

#syz test:


diff --git a/io_uring/kbuf.c b/io_uring/kbuf.c
index d2945c9c812b..c95dc1736dd9 100644
--- a/io_uring/kbuf.c
+++ b/io_uring/kbuf.c
@@ -657,8 +657,10 @@ static int io_alloc_pbuf_ring(struct io_ring_ctx *ctx,
  	ring_size = reg->ring_entries * sizeof(struct io_uring_buf_ring);
  
  	bl->buf_ring = io_pages_map(&bl->buf_pages, &bl->buf_nr_pages, ring_size);
-	if (!bl->buf_ring)
+	if (IS_ERR(bl->buf_ring)) {
+		bl->buf_ring = NULL;
  		return -ENOMEM;
+	}
  
  	bl->is_buf_ring = 1;
  	bl->is_mmap = 1;


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-18 18:03 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-18  1:20 [syzbot] [io-uring?] general protection fault in __io_remove_buffers syzbot
2024-07-18 18:03 ` Pavel Begunkov
2024-07-18 18:03   ` syzbot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox