All of lore.kernel.org
 help / color / mirror / Atom feed
* [syzbot] KASAN: null-ptr-deref Write in __pm_runtime_resume
@ 2021-08-28  4:44 syzbot
  2021-09-01 22:57 ` syzbot
  2021-09-02 18:13 ` syzbot
  0 siblings, 2 replies; 5+ messages in thread
From: syzbot @ 2021-08-28  4:44 UTC (permalink / raw)
  To: gregkh, len.brown, linux-kernel, linux-pm, pavel, rjw, syzkaller-bugs

Hello,

syzbot found the following issue on:

HEAD commit:    5e63226c7228 Add linux-next specific files for 20210827
git tree:       linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=123771b1300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9c03a8fdabc6b3ae
dashboard link: https://syzkaller.appspot.com/bug?extid=7d41312fe3f123a6f605
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1

Unfortunately, I don't have any reproducer for this issue yet.

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7d41312fe3f123a6f605@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: null-ptr-deref in atomic_inc include/linux/atomic/atomic-instrumented.h:181 [inline]
BUG: KASAN: null-ptr-deref in __pm_runtime_resume+0x154/0x180 drivers/base/power/runtime.c:1105
Write of size 4 at addr 0000000000000388 by task syz-executor.1/8810

CPU: 0 PID: 8810 Comm: syz-executor.1 Not tainted 5.14.0-rc7-next-20210827-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:106
 __kasan_report mm/kasan/report.c:446 [inline]
 kasan_report.cold+0x66/0xdf mm/kasan/report.c:459
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_inc include/linux/atomic/atomic-instrumented.h:181 [inline]
 __pm_runtime_resume+0x154/0x180 drivers/base/power/runtime.c:1105
 pm_runtime_get include/linux/pm_runtime.h:370 [inline]
 h5_recv+0x2c4/0x680 drivers/bluetooth/hci_h5.c:590
 hci_uart_tty_receive+0x24d/0x710 drivers/bluetooth/hci_ldisc.c:613
 tiocsti drivers/tty/tty_io.c:2311 [inline]
 tty_ioctl+0x8db/0x1600 drivers/tty/tty_io.c:2719
 vfs_ioctl fs/ioctl.c:51 [inline]
 __do_sys_ioctl fs/ioctl.c:874 [inline]
 __se_sys_ioctl fs/ioctl.c:860 [inline]
 __x64_sys_ioctl+0x193/0x200 fs/ioctl.c:860
 do_syscall_x64 arch/x86/entry/common.c:50 [inline]
 do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
 entry_SYSCALL_64_after_hwframe+0x44/0xae
RIP: 0033:0x4665f9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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:00007fc6badab188 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 000000000056bf80 RCX: 00000000004665f9
RDX: 00000000200000c0 RSI: 0000000000005412 RDI: 0000000000000003
RBP: 00000000004bfcc4 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 000000000056bf80
R13: 00007ffe925987cf R14: 00007fc6badab300 R15: 0000000000022000
==================================================================


---
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 syzkaller@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

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

* Re: [syzbot] KASAN: null-ptr-deref Write in __pm_runtime_resume
  2021-08-28  4:44 [syzbot] KASAN: null-ptr-deref Write in __pm_runtime_resume syzbot
@ 2021-09-01 22:57 ` syzbot
  2021-09-02 19:19   ` Pavel Skripkin
  2021-09-02 18:13 ` syzbot
  1 sibling, 1 reply; 5+ messages in thread
From: syzbot @ 2021-09-01 22:57 UTC (permalink / raw)
  To: gregkh, len.brown, linux-kernel, linux-pm, pavel, rjw, syzkaller-bugs

syzbot has found a reproducer for the following issue on:

HEAD commit:    835d31d319d9 Merge tag 'media/v5.15-1' of git://git.kernel..
git tree:       upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1374b85d300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=9c32e23fada3a0e4
dashboard link: https://syzkaller.appspot.com/bug?extid=7d41312fe3f123a6f605
compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=16fde215300000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11aa9149300000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+7d41312fe3f123a6f605@syzkaller.appspotmail.com

Bluetooth: : Invalid header checksum
Bluetooth: : Invalid header checksum
==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: null-ptr-deref in atomic_inc include/linux/atomic/atomic-instrumented.h:181 [inline]
BUG: KASAN: null-ptr-deref in __pm_runtime_resume+0x154/0x180 drivers/base/power/runtime.c:1105
Write of size 4 at addr 0000000000000388 by task kworker/u4:4/244

CPU: 1 PID: 244 Comm: kworker/u4:4 Not tainted 5.14.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound flush_to_ldisc
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 __kasan_report mm/kasan/report.c:423 [inline]
 kasan_report.cold+0x66/0xdf mm/kasan/report.c:436
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_inc include/linux/atomic/atomic-instrumented.h:181 [inline]
 __pm_runtime_resume+0x154/0x180 drivers/base/power/runtime.c:1105
 pm_runtime_get include/linux/pm_runtime.h:370 [inline]
 h5_recv+0x2c4/0x680 drivers/bluetooth/hci_h5.c:590
 hci_uart_tty_receive+0x24d/0x710 drivers/bluetooth/hci_ldisc.c:613
 tty_ldisc_receive_buf+0x14d/0x190 drivers/tty/tty_buffer.c:475
 tty_port_default_receive_buf+0x6e/0xa0 drivers/tty/tty_port.c:39
 receive_buf drivers/tty/tty_buffer.c:491 [inline]
 flush_to_ldisc+0x20d/0x380 drivers/tty/tty_buffer.c:543
 process_one_work+0x9bf/0x16b0 kernel/workqueue.c:2297
 worker_thread+0x658/0x11f0 kernel/workqueue.c:2444
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
==================================================================
Kernel panic - not syncing: panic_on_warn set ...
CPU: 1 PID: 244 Comm: kworker/u4:4 Tainted: G    B             5.14.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events_unbound flush_to_ldisc
Call Trace:
 __dump_stack lib/dump_stack.c:88 [inline]
 dump_stack_lvl+0xcd/0x134 lib/dump_stack.c:105
 panic+0x306/0x73d kernel/panic.c:232
 end_report mm/kasan/report.c:103 [inline]
 end_report.cold+0x5a/0x5a mm/kasan/report.c:88
 __kasan_report mm/kasan/report.c:426 [inline]
 kasan_report.cold+0x71/0xdf mm/kasan/report.c:436
 check_region_inline mm/kasan/generic.c:183 [inline]
 kasan_check_range+0x13d/0x180 mm/kasan/generic.c:189
 instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
 atomic_inc include/linux/atomic/atomic-instrumented.h:181 [inline]
 __pm_runtime_resume+0x154/0x180 drivers/base/power/runtime.c:1105
 pm_runtime_get include/linux/pm_runtime.h:370 [inline]
 h5_recv+0x2c4/0x680 drivers/bluetooth/hci_h5.c:590
 hci_uart_tty_receive+0x24d/0x710 drivers/bluetooth/hci_ldisc.c:613
 tty_ldisc_receive_buf+0x14d/0x190 drivers/tty/tty_buffer.c:475
 tty_port_default_receive_buf+0x6e/0xa0 drivers/tty/tty_port.c:39
 receive_buf drivers/tty/tty_buffer.c:491 [inline]
 flush_to_ldisc+0x20d/0x380 drivers/tty/tty_buffer.c:543
 process_one_work+0x9bf/0x16b0 kernel/workqueue.c:2297
 worker_thread+0x658/0x11f0 kernel/workqueue.c:2444
 kthread+0x3e5/0x4d0 kernel/kthread.c:319
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:295
Kernel Offset: disabled
Rebooting in 86400 seconds..


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

* Re: [syzbot] KASAN: null-ptr-deref Write in __pm_runtime_resume
  2021-08-28  4:44 [syzbot] KASAN: null-ptr-deref Write in __pm_runtime_resume syzbot
  2021-09-01 22:57 ` syzbot
@ 2021-09-02 18:13 ` syzbot
  1 sibling, 0 replies; 5+ messages in thread
From: syzbot @ 2021-09-02 18:13 UTC (permalink / raw)
  To: abhishekpandit, apusaka, davem, gregkh, hildawu, johan.hedberg,
	kuba, len.brown, linux-bluetooth, linux-kernel, linux-pm,
	luiz.dentz, marcel, netdev, pavel, rjw, syzkaller-bugs

syzbot has bisected this issue to:

commit 66f077dde74943e9dd84a9205b4951b19556c9ea
Author: Archie Pusaka <apusaka@chromium.org>
Date:   Fri Jul 23 11:31:55 2021 +0000

    Bluetooth: hci_h5: add WAKEUP_DISABLE flag

bisection log:  https://syzkaller.appspot.com/x/bisect.txt?x=17258e45300000
start commit:   835d31d319d9 Merge tag 'media/v5.15-1' of git://git.kernel..
git tree:       upstream
final oops:     https://syzkaller.appspot.com/x/report.txt?x=14a58e45300000
console output: https://syzkaller.appspot.com/x/log.txt?x=10a58e45300000
kernel config:  https://syzkaller.appspot.com/x/.config?x=d793523866f2daea
dashboard link: https://syzkaller.appspot.com/bug?extid=7d41312fe3f123a6f605
syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=17608125300000
C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=17465ffe300000

Reported-by: syzbot+7d41312fe3f123a6f605@syzkaller.appspotmail.com
Fixes: 66f077dde749 ("Bluetooth: hci_h5: add WAKEUP_DISABLE flag")

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

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

* Re: [syzbot] KASAN: null-ptr-deref Write in __pm_runtime_resume
  2021-09-01 22:57 ` syzbot
@ 2021-09-02 19:19   ` Pavel Skripkin
  2021-09-02 19:55     ` syzbot
  0 siblings, 1 reply; 5+ messages in thread
From: Pavel Skripkin @ 2021-09-02 19:19 UTC (permalink / raw)
  To: syzbot, gregkh, len.brown, linux-kernel, linux-pm, pavel, rjw,
	syzkaller-bugs

[-- Attachment #1: Type: text/plain, Size: 1502 bytes --]

On 9/2/21 01:57, syzbot wrote:
> syzbot has found a reproducer for the following issue on:
> 
> HEAD commit:    835d31d319d9 Merge tag 'media/v5.15-1' of git://git.kernel..
> git tree:       upstream
> console output: https://syzkaller.appspot.com/x/log.txt?x=1374b85d300000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=9c32e23fada3a0e4
> dashboard link: https://syzkaller.appspot.com/bug?extid=7d41312fe3f123a6f605
> compiler:       gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.1
> syz repro:      https://syzkaller.appspot.com/x/repro.syz?x=16fde215300000
> C reproducer:   https://syzkaller.appspot.com/x/repro.c?x=11aa9149300000
> 
> IMPORTANT: if you fix the issue, please add the following tag to the commit:
> Reported-by: syzbot+7d41312fe3f123a6f605@syzkaller.appspotmail.com
> 
> Bluetooth: : Invalid header checksum
> Bluetooth: : Invalid header checksum
> ==================================================================
> BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
> BUG: KASAN: null-ptr-deref in atomic_inc include/linux/atomic/atomic-instrumented.h:181 [inline]
> BUG: KASAN: null-ptr-deref in __pm_runtime_resume+0x154/0x180 drivers/base/power/runtime.c:1105
> Write of size 4 at addr 0000000000000388 by task kworker/u4:4/244
> 


Looks like missing if (hu->serdev)

#syz test
git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master


With regards,
Pavel Skripkin

[-- Attachment #2: 0001-Bluetooth-hci-fix-GPF-in-h5_recv.patch --]
[-- Type: text/x-patch, Size: 976 bytes --]

From a30dfa93fc6f7e2ecc7759ac75c742e512b527f0 Mon Sep 17 00:00:00 2001
From: Pavel Skripkin <paskripkin@gmail.com>
Date: Thu, 2 Sep 2021 22:17:05 +0300
Subject: [PATCH] Bluetooth: hci: fix GPF in h5_recv

/* ... */

Signed-off-by: Pavel Skripkin <paskripkin@gmail.com>
---
 drivers/bluetooth/hci_h5.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 0c0dedece59c..eb0099a21288 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -587,9 +587,11 @@ static int h5_recv(struct hci_uart *hu, const void *data, int count)
 		count -= processed;
 	}
 
-	pm_runtime_get(&hu->serdev->dev);
-	pm_runtime_mark_last_busy(&hu->serdev->dev);
-	pm_runtime_put_autosuspend(&hu->serdev->dev);
+	if (hu->serdev) {
+		pm_runtime_get(&hu->serdev->dev);
+		pm_runtime_mark_last_busy(&hu->serdev->dev);
+		pm_runtime_put_autosuspend(&hu->serdev->dev);
+	}
 
 	return 0;
 }
-- 
2.33.0


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

* Re: [syzbot] KASAN: null-ptr-deref Write in __pm_runtime_resume
  2021-09-02 19:19   ` Pavel Skripkin
@ 2021-09-02 19:55     ` syzbot
  0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2021-09-02 19:55 UTC (permalink / raw)
  To: gregkh, len.brown, linux-kernel, linux-pm, paskripkin, pavel,
	rjw, syzkaller-bugs

Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+7d41312fe3f123a6f605@syzkaller.appspotmail.com

Tested on:

commit:         4a3bb420 Merge tag 'dma-mapping-5.15' of git://git.inf..
git tree:       upstream
kernel config:  https://syzkaller.appspot.com/x/.config?x=3e782839f57ad47e
dashboard link: https://syzkaller.appspot.com/bug?extid=7d41312fe3f123a6f605
compiler:       Debian clang version 11.0.1-2, GNU ld (GNU Binutils for Debian) 2.35.1
patch:          https://syzkaller.appspot.com/x/patch.diff?x=14b6fc2e300000

Note: testing is done by a robot and is best-effort only.

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

end of thread, other threads:[~2021-09-02 19:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-08-28  4:44 [syzbot] KASAN: null-ptr-deref Write in __pm_runtime_resume syzbot
2021-09-01 22:57 ` syzbot
2021-09-02 19:19   ` Pavel Skripkin
2021-09-02 19:55     ` syzbot
2021-09-02 18:13 ` syzbot

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.