* Re: [syzbot] test uaf in hci_conn_drop
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
@ 2023-11-03 1:01 ` syzbot
2023-11-03 5:13 ` syzbot
` (7 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2023-11-03 1:01 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: test uaf in hci_conn_drop
Author: lizhi.xu@windriver.com
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 15b33579007c..757ff04bb5d8 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -13,6 +13,8 @@ static const struct class bt_class = {
static void bt_link_release(struct device *dev)
{
struct hci_conn *conn = to_hci_conn(dev);
+ struct sco_conn *scn = container_of(conn, struct sco_conn, hci_conn);
+ scn->hci_conn = NULL;
kfree(conn);
}
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [syzbot] test uaf in hci_conn_drop
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
2023-11-03 1:01 ` [syzbot] test uaf in hci_conn_drop syzbot
@ 2023-11-03 5:13 ` syzbot
2023-11-03 7:01 ` syzbot
` (6 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2023-11-03 5:13 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: test uaf in hci_conn_drop
Author: lizhi.xu@windriver.com
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 15b33579007c..3237ad0d0645 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -6,6 +6,8 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
+static void sco_set_hci_cnn_null(struct hci_conn * conn);
+
static const struct class bt_class = {
.name = "bluetooth",
};
@@ -13,6 +15,7 @@ static const struct class bt_class = {
static void bt_link_release(struct device *dev)
{
struct hci_conn *conn = to_hci_conn(dev);
+ sco_set_hci_cnn_null(conn);
kfree(conn);
}
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index c736186aba26..858de967ffd3 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -76,6 +76,12 @@ struct sco_pinfo {
#define SCO_CONN_TIMEOUT (HZ * 40)
#define SCO_DISCONN_TIMEOUT (HZ * 2)
+static void sco_set_hci_cnn_null(struct hci_conn * conn)
+{
+ struct sco_conn * scn = container_of(conn, struct sco_conn, hci_conn);
+ scn->hci_conn = NULL;
+}
+
static void sco_sock_timeout(struct work_struct *work)
{
struct sco_conn *conn = container_of(work, struct sco_conn,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [syzbot] test uaf in hci_conn_drop
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
2023-11-03 1:01 ` [syzbot] test uaf in hci_conn_drop syzbot
2023-11-03 5:13 ` syzbot
@ 2023-11-03 7:01 ` syzbot
2023-11-03 8:00 ` syzbot
` (5 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2023-11-03 7:01 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: test uaf in hci_conn_drop
Author: lizhi.xu@windriver.com
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 15b33579007c..3c6592da21c4 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -6,6 +6,8 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
+static void sco_set_hci_cnn_null(struct hci_conn * conn);
+
static const struct class bt_class = {
.name = "bluetooth",
};
@@ -13,6 +15,7 @@ static const struct class bt_class = {
static void bt_link_release(struct device *dev)
{
struct hci_conn *conn = to_hci_conn(dev);
+ sco_set_hci_cnn_null(conn);
kfree(conn);
}
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index c736186aba26..739956cfc26b 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -76,6 +76,12 @@ struct sco_pinfo {
#define SCO_CONN_TIMEOUT (HZ * 40)
#define SCO_DISCONN_TIMEOUT (HZ * 2)
+static void sco_set_hci_cnn_null(struct hci_conn * conn)
+{
+ struct sco_conn * scn = container_of(conn, struct sco_conn, hcon);
+ scn->hci_conn = NULL;
+}
+
static void sco_sock_timeout(struct work_struct *work)
{
struct sco_conn *conn = container_of(work, struct sco_conn,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [syzbot] test uaf in hci_conn_drop
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
` (2 preceding siblings ...)
2023-11-03 7:01 ` syzbot
@ 2023-11-03 8:00 ` syzbot
2023-11-04 3:23 ` syzbot
` (4 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2023-11-03 8:00 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: test uaf in hci_conn_drop
Author: lizhi.xu@windriver.com
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 15b33579007c..3c6592da21c4 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -6,6 +6,8 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
+static void sco_set_hci_cnn_null(struct hci_conn * conn);
+
static const struct class bt_class = {
.name = "bluetooth",
};
@@ -13,6 +15,7 @@ static const struct class bt_class = {
static void bt_link_release(struct device *dev)
{
struct hci_conn *conn = to_hci_conn(dev);
+ sco_set_hci_cnn_null(conn);
kfree(conn);
}
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index c736186aba26..6c3b1ee78ba8 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -76,6 +76,12 @@ struct sco_pinfo {
#define SCO_CONN_TIMEOUT (HZ * 40)
#define SCO_DISCONN_TIMEOUT (HZ * 2)
+static void sco_set_hci_cnn_null(struct hci_conn * conn)
+{
+ struct sco_conn * scn = container_of(conn, struct sco_conn, hcon);
+ scn->hcon = NULL;
+}
+
static void sco_sock_timeout(struct work_struct *work)
{
struct sco_conn *conn = container_of(work, struct sco_conn,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [syzbot] test uaf in hci_conn_drop
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
` (3 preceding siblings ...)
2023-11-03 8:00 ` syzbot
@ 2023-11-04 3:23 ` syzbot
2023-11-04 4:47 ` syzbot
` (3 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2023-11-04 3:23 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: test uaf in hci_conn_drop
Author: lizhi.xu@windriver.com
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c
diff --git a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
index 15b33579007c..f593a9f39aa9 100644
--- a/net/bluetooth/hci_sysfs.c
+++ b/net/bluetooth/hci_sysfs.c
@@ -6,6 +6,8 @@
#include <net/bluetooth/bluetooth.h>
#include <net/bluetooth/hci_core.h>
+static void sco_set_hci_cnn_null(struct hci_conn *conn);
+
static const struct class bt_class = {
.name = "bluetooth",
};
@@ -13,6 +15,7 @@ static const struct class bt_class = {
static void bt_link_release(struct device *dev)
{
struct hci_conn *conn = to_hci_conn(dev);
+ sco_set_hci_cnn_null(conn);
kfree(conn);
}
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index c736186aba26..0a6404ba8e4b 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -76,6 +76,14 @@ struct sco_pinfo {
#define SCO_CONN_TIMEOUT (HZ * 40)
#define SCO_DISCONN_TIMEOUT (HZ * 2)
+static void sco_set_hci_cnn_null(struct hci_conn *conn)
+{
+ struct sco_conn *scn = container_of(conn, struct sco_conn, hcon);
+ sco_conn_lock(scn);
+ scn->hcon = NULL;
+ sco_conn_unlock(scn);
+}
+
static void sco_sock_timeout(struct work_struct *work)
{
struct sco_conn *conn = container_of(work, struct sco_conn,
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [syzbot] test uaf in hci_conn_drop
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
` (4 preceding siblings ...)
2023-11-04 3:23 ` syzbot
@ 2023-11-04 4:47 ` syzbot
2023-11-04 5:40 ` syzbot
` (2 subsequent siblings)
8 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2023-11-04 4:47 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: test uaf in hci_conn_drop
Author: lizhi.xu@windriver.com
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 9d5057cef30a..bb02f1ca8cd0 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1719,6 +1719,7 @@ struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
hci_sco_setup(acl, 0x00);
}
+ hci_conn_get(sco);
return sco;
}
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index c736186aba26..5cba9cfff8ec 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -442,6 +442,7 @@ static void __sco_sock_close(struct sock *sk)
sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
sco_conn_lock(sco_pi(sk)->conn);
hci_conn_drop(sco_pi(sk)->conn->hcon);
+ hci_conn_put(sco_pi(sk)->conn->hcon);
sco_pi(sk)->conn->hcon = NULL;
sco_conn_unlock(sco_pi(sk)->conn);
} else
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [syzbot] test uaf in hci_conn_drop
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
` (5 preceding siblings ...)
2023-11-04 4:47 ` syzbot
@ 2023-11-04 5:40 ` syzbot
2024-02-17 2:09 ` [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
2024-02-17 19:33 ` syzbot
8 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2023-11-04 5:40 UTC (permalink / raw)
To: linux-kernel
For archival purposes, forwarding an incoming command email to
linux-kernel@vger.kernel.org.
***
Subject: test uaf in hci_conn_drop
Author: lizhi.xu@windriver.com
#syz test git://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git 8de1e7afcc1c
diff --git a/net/bluetooth/hci_conn.c b/net/bluetooth/hci_conn.c
index 9d5057cef30a..efcf8a560d6f 100644
--- a/net/bluetooth/hci_conn.c
+++ b/net/bluetooth/hci_conn.c
@@ -1702,6 +1702,7 @@ struct hci_conn *hci_connect_sco(struct hci_dev *hdev, int type, bdaddr_t *dst,
hci_conn_drop(sco);
return ERR_PTR(-ENOLINK);
}
+ hci_conn_get(sco);
sco->setting = setting;
sco->codec = *codec;
diff --git a/net/bluetooth/sco.c b/net/bluetooth/sco.c
index c736186aba26..5cba9cfff8ec 100644
--- a/net/bluetooth/sco.c
+++ b/net/bluetooth/sco.c
@@ -442,6 +442,7 @@ static void __sco_sock_close(struct sock *sk)
sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
sco_conn_lock(sco_pi(sk)->conn);
hci_conn_drop(sco_pi(sk)->conn->hcon);
+ hci_conn_put(sco_pi(sk)->conn->hcon);
sco_pi(sk)->conn->hcon = NULL;
sco_conn_unlock(sco_pi(sk)->conn);
} else
^ permalink raw reply related [flat|nested] 14+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2)
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
` (6 preceding siblings ...)
2023-11-04 5:40 ` syzbot
@ 2024-02-17 2:09 ` syzbot
2024-02-17 10:57 ` Hillf Danton
2024-02-18 8:44 ` Hillf Danton
2024-02-17 19:33 ` syzbot
8 siblings, 2 replies; 14+ messages in thread
From: syzbot @ 2024-02-17 2:09 UTC (permalink / raw)
To: hdanton, johan.hedberg, linux-bluetooth, linux-kernel, lizhi.xu,
luiz.dentz, marcel, syzkaller-bugs
syzbot has found a reproducer for the following issue on:
HEAD commit: 2c3b09aac00d Add linux-next specific files for 20240214
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=10316ac2180000
kernel config: https://syzkaller.appspot.com/x/.config?x=176d2dcbf8ba7017
dashboard link: https://syzkaller.appspot.com/bug?extid=1683f76f1b20b826de67
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=1765258a180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16c27a58180000
Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ac51042b61c6/disk-2c3b09aa.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/012344301c35/vmlinux-2c3b09aa.xz
kernel image: https://storage.googleapis.com/syzbot-assets/cba3c3e5cd7c/bzImage-2c3b09aa.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+1683f76f1b20b826de67@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: slab-use-after-free in instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
BUG: KASAN: slab-use-after-free in atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1375 [inline]
BUG: KASAN: slab-use-after-free in hci_conn_drop+0x34/0x2c0 include/net/bluetooth/hci_core.h:1574
Write of size 4 at addr ffff8880781d6010 by task syz-executor409/22560
CPU: 0 PID: 22560 Comm: syz-executor409 Not tainted 6.8.0-rc4-next-20240214-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x241/0x360 lib/dump_stack.c:114
print_address_description mm/kasan/report.c:377 [inline]
print_report+0x169/0x550 mm/kasan/report.c:488
kasan_report+0x143/0x180 mm/kasan/report.c:601
kasan_check_range+0x282/0x290 mm/kasan/generic.c:189
instrument_atomic_read_write include/linux/instrumented.h:96 [inline]
atomic_dec_and_test include/linux/atomic/atomic-instrumented.h:1375 [inline]
hci_conn_drop+0x34/0x2c0 include/net/bluetooth/hci_core.h:1574
__sco_sock_close+0x37b/0x570 net/bluetooth/sco.c:445
sco_sock_close net/bluetooth/sco.c:470 [inline]
sco_sock_release+0xb3/0x320 net/bluetooth/sco.c:1247
__sock_release net/socket.c:659 [inline]
sock_close+0xbc/0x240 net/socket.c:1421
__fput+0x429/0x8a0 fs/file_table.c:411
__do_sys_close fs/open.c:1557 [inline]
__se_sys_close fs/open.c:1542 [inline]
__x64_sys_close+0x7f/0x110 fs/open.c:1542
do_syscall_64+0xfb/0x240
entry_SYSCALL_64_after_hwframe+0x6d/0x75
RIP: 0033:0x7f53a414802a
Code: 48 3d 00 f0 ff ff 77 48 c3 0f 1f 80 00 00 00 00 48 83 ec 18 89 7c 24 0c e8 f3 64 02 00 8b 7c 24 0c 89 c2 b8 03 00 00 00 0f 05 <48> 3d 00 f0 ff ff 77 36 89 d7 89 44 24 0c e8 53 65 02 00 8b 44 24
RSP: 002b:00007ffcd1d20920 EFLAGS: 00000293 ORIG_RAX: 0000000000000003
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 00007f53a414802a
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 0000000000000003 R08: 00007ffcd1d209c4 R09: 00007ffcd1d209c4
R10: 0000000000000000 R11: 0000000000000293 R12: 0000555557478370
R13: 0000000000000011 R14: 00007ffcd1d20968 R15: 00007ffcd1d209c0
</TASK>
Allocated by task 22560:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
poison_kmalloc_redzone mm/kasan/common.c:370 [inline]
__kasan_kmalloc+0x98/0xb0 mm/kasan/common.c:387
kasan_kmalloc include/linux/kasan.h:211 [inline]
kmalloc_trace+0x1d9/0x360 mm/slub.c:4013
kmalloc include/linux/slab.h:590 [inline]
kzalloc include/linux/slab.h:711 [inline]
hci_conn_add+0xc7/0x13a0 net/bluetooth/hci_conn.c:914
hci_conn_add_unset net/bluetooth/hci_conn.c:1016 [inline]
hci_connect_sco+0xc9/0x350 net/bluetooth/hci_conn.c:1701
sco_connect net/bluetooth/sco.c:266 [inline]
sco_sock_connect+0x2fc/0x990 net/bluetooth/sco.c:592
__sys_connect_file net/socket.c:2048 [inline]
__sys_connect+0x2df/0x310 net/socket.c:2065
__do_sys_connect net/socket.c:2075 [inline]
__se_sys_connect net/socket.c:2072 [inline]
__x64_sys_connect+0x7a/0x90 net/socket.c:2072
do_syscall_64+0xfb/0x240
entry_SYSCALL_64_after_hwframe+0x6d/0x75
Freed by task 5084:
kasan_save_stack mm/kasan/common.c:47 [inline]
kasan_save_track+0x3f/0x80 mm/kasan/common.c:68
kasan_save_free_info+0x40/0x50 mm/kasan/generic.c:586
poison_slab_object+0xa6/0xe0 mm/kasan/common.c:240
__kasan_slab_free+0x37/0x60 mm/kasan/common.c:256
kasan_slab_free include/linux/kasan.h:184 [inline]
slab_free_hook mm/slub.c:2122 [inline]
slab_free mm/slub.c:4296 [inline]
kfree+0x14a/0x380 mm/slub.c:4406
device_release+0x99/0x1c0
kobject_cleanup lib/kobject.c:689 [inline]
kobject_release lib/kobject.c:720 [inline]
kref_put include/linux/kref.h:65 [inline]
kobject_put+0x22f/0x480 lib/kobject.c:737
hci_conn_cleanup net/bluetooth/hci_conn.c:176 [inline]
hci_conn_del+0x8f0/0xc70 net/bluetooth/hci_conn.c:1126
hci_abort_conn_sync+0x583/0xde0 net/bluetooth/hci_sync.c:5361
hci_cmd_sync_work+0x22b/0x400 net/bluetooth/hci_sync.c:306
process_one_work kernel/workqueue.c:3146 [inline]
process_scheduled_works+0x9d7/0x1730 kernel/workqueue.c:3226
worker_thread+0x86d/0xd70 kernel/workqueue.c:3307
kthread+0x2f0/0x390 kernel/kthread.c:388
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:242
The buggy address belongs to the object at ffff8880781d6000
which belongs to the cache kmalloc-4k of size 4096
The buggy address is located 16 bytes inside of
freed 4096-byte region [ffff8880781d6000, ffff8880781d7000)
The buggy address belongs to the physical page:
page:ffffea0001e07400 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x781d0
head:ffffea0001e07400 order:3 entire_mapcount:0 nr_pages_mapped:0 pincount:0
flags: 0xfff80000000840(slab|head|node=0|zone=1|lastcpupid=0xfff)
page_type: 0xffffffff()
raw: 00fff80000000840 ffff888014c42140 dead000000000100 dead000000000122
raw: 0000000000000000 0000000080040004 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 3, migratetype Unmovable, gfp_mask 0xd2040(__GFP_IO|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 4486, tgid 4486 (mount), ts 16228925553, free_ts 14928891043
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x1ea/0x210 mm/page_alloc.c:1533
prep_new_page mm/page_alloc.c:1540 [inline]
get_page_from_freelist+0x33ea/0x3580 mm/page_alloc.c:3311
__alloc_pages+0x256/0x6a0 mm/page_alloc.c:4567
__alloc_pages_node include/linux/gfp.h:238 [inline]
alloc_pages_node include/linux/gfp.h:261 [inline]
alloc_slab_page+0x5f/0x160 mm/slub.c:2191
allocate_slab mm/slub.c:2354 [inline]
new_slab+0x84/0x2f0 mm/slub.c:2407
___slab_alloc+0xc73/0x1260 mm/slub.c:3541
__slab_alloc mm/slub.c:3626 [inline]
__slab_alloc_node mm/slub.c:3679 [inline]
slab_alloc_node mm/slub.c:3851 [inline]
kmalloc_trace+0x267/0x360 mm/slub.c:4008
kmalloc include/linux/slab.h:590 [inline]
tomoyo_print_header security/tomoyo/audit.c:156 [inline]
tomoyo_init_log+0x1ca/0x2050 security/tomoyo/audit.c:255
tomoyo_supervisor+0x38a/0x11f0 security/tomoyo/common.c:2089
tomoyo_audit_mount_log security/tomoyo/mount.c:32 [inline]
tomoyo_mount_acl security/tomoyo/mount.c:166 [inline]
tomoyo_mount_permission+0x792/0xb80 security/tomoyo/mount.c:237
security_sb_mount+0x8f/0xd0 security/security.c:1459
path_mount+0xb9/0xfb0 fs/namespace.c:3621
do_mount fs/namespace.c:3692 [inline]
__do_sys_mount fs/namespace.c:3898 [inline]
__se_sys_mount+0x2d9/0x3c0 fs/namespace.c:3875
do_syscall_64+0xfb/0x240
entry_SYSCALL_64_after_hwframe+0x6d/0x75
page last free pid 1 tgid 1 stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1140 [inline]
free_unref_page_prepare+0x968/0xa90 mm/page_alloc.c:2346
free_unref_page+0x37/0x3f0 mm/page_alloc.c:2486
free_contig_range+0x9e/0x160 mm/page_alloc.c:6532
destroy_args+0x8a/0x890 mm/debug_vm_pgtable.c:1028
debug_vm_pgtable+0x4be/0x550 mm/debug_vm_pgtable.c:1408
do_one_initcall+0x238/0x830 init/main.c:1233
do_initcall_level+0x157/0x210 init/main.c:1295
do_initcalls+0x3f/0x80 init/main.c:1311
kernel_init_freeable+0x435/0x5d0 init/main.c:1543
kernel_init+0x1d/0x2b0 init/main.c:1432
ret_from_fork+0x4b/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x1a/0x30 arch/x86/entry/entry_64.S:242
Memory state around the buggy address:
ffff8880781d5f00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff8880781d5f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff8880781d6000: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880781d6080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880781d6100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
---
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.
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2)
2024-02-17 2:09 ` [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
@ 2024-02-17 10:57 ` Hillf Danton
2024-02-17 11:23 ` syzbot
2024-02-18 8:44 ` Hillf Danton
1 sibling, 1 reply; 14+ messages in thread
From: Hillf Danton @ 2024-02-17 10:57 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On Fri, 16 Feb 2024 18:09:19 -0800
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 2c3b09aac00d Add linux-next specific files for 20240214
> git tree: linux-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16c27a58180000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
--- x/net/bluetooth/sco.c
+++ y/net/bluetooth/sco.c
@@ -297,6 +297,7 @@ static int sco_connect(struct sock *sk)
sco_sock_set_timer(sk, sk->sk_sndtimeo);
}
+ hci_conn_get(hcon);
release_sock(sk);
unlock:
@@ -439,12 +440,15 @@ static void __sco_sock_close(struct sock
case BT_CONNECTED:
case BT_CONFIG:
if (sco_pi(sk)->conn->hcon) {
+ struct hci_conn *hcon = sco_pi(sk)->conn->hcon;
+
sk->sk_state = BT_DISCONN;
sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
sco_conn_lock(sco_pi(sk)->conn);
- hci_conn_drop(sco_pi(sk)->conn->hcon);
sco_pi(sk)->conn->hcon = NULL;
sco_conn_unlock(sco_pi(sk)->conn);
+
+ hci_conn_put(hcon);
} else
sco_chan_del(sk, ECONNRESET);
break;
--
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2)
2024-02-17 10:57 ` Hillf Danton
@ 2024-02-17 11:23 ` syzbot
0 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2024-02-17 11:23 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot tried to test the proposed patch but the build/boot failed:
st device registered (name=vmci, major=10, minor=118)
[ 7.646156][ T1] Initialized host personality
[ 7.647936][ T1] usbcore: registered new interface driver rtsx_usb
[ 7.649988][ T1] usbcore: registered new interface driver viperboard
[ 7.651838][ T1] usbcore: registered new interface driver dln2
[ 7.653834][ T1] usbcore: registered new interface driver pn533_usb
[ 7.664347][ T1] nfcsim 0.2 initialized
[ 7.665691][ T1] usbcore: registered new interface driver port100
[ 7.668533][ T1] usbcore: registered new interface driver nfcmrvl
[ 7.675630][ T1] Loading iSCSI transport class v2.0-870.
[ 7.698216][ T1] virtio_scsi virtio0: 1/0/0 default/read/poll queues
[ 7.709913][ T1] ------------[ cut here ]------------
[ 7.711179][ T1] refcount_t: decrement hit 0; leaking memory.
[ 7.712836][ T1] WARNING: CPU: 0 PID: 1 at lib/refcount.c:31 refcount_warn_saturate+0xfa/0x1d0
[ 7.715358][ T1] Modules linked in:
[ 7.716481][ T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.8.0-rc4-next-20240216-syzkaller-07658-gd37e1e4c52bc-dirty #0
[ 7.719681][ T1] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
[ 7.722153][ T1] RIP: 0010:refcount_warn_saturate+0xfa/0x1d0
[ 7.723825][ T1] Code: b2 00 00 00 e8 b7 94 f0 fc 5b 5d c3 cc cc cc cc e8 ab 94 f0 fc c6 05 c6 16 ce 0a 01 90 48 c7 c7 a0 5a fe 8b e8 67 69 b4 fc 90 <0f> 0b 90 90 eb d9 e8 8b 94 f0 fc c6 05 a3 16 ce 0a 01 90 48 c7 c7
[ 7.728144][ T1] RSP: 0000:ffffc90000066e10 EFLAGS: 00010246
[ 7.729780][ T1] RAX: ca34bf339345e800 RBX: ffff888020eb0f4c RCX: ffff8880162d8000
[ 7.731521][ T1] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 7.733264][ T1] RBP: 0000000000000004 R08: ffffffff8157b942 R09: fffffbfff1bf95cc
[ 7.735392][ T1] R10: dffffc0000000000 R11: fffffbfff1bf95cc R12: ffffea000502ddc0
[ 7.737235][ T1] R13: ffffea000502ddc8 R14: 1ffffd4000a05bb9 R15: 0000000000000000
[ 7.738734][ T1] FS: 0000000000000000(0000) GS:ffff8880b9400000(0000) knlGS:0000000000000000
[ 7.741305][ T1] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 7.742963][ T1] CR2: ffff88823ffff000 CR3: 000000000df32000 CR4: 00000000003506f0
[ 7.744872][ T1] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
[ 7.746542][ T1] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
[ 7.749418][ T1] Call Trace:
[ 7.750267][ T1] <TASK>
[ 7.750946][ T1] ? __warn+0x163/0x4b0
[ 7.751918][ T1] ? refcount_warn_saturate+0xfa/0x1d0
[ 7.752945][ T1] ? report_bug+0x2b3/0x500
[ 7.754131][ T1] ? refcount_warn_saturate+0xfa/0x1d0
[ 7.755275][ T1] ? handle_bug+0x3e/0x70
[ 7.756610][ T1] ? exc_invalid_op+0x1a/0x50
[ 7.757756][ T1] ? asm_exc_invalid_op+0x1a/0x20
[ 7.759043][ T1] ? __warn_printk+0x292/0x360
[ 7.760038][ T1] ? refcount_warn_saturate+0xfa/0x1d0
[ 7.761095][ T1] __free_pages_ok+0xc42/0xd70
[ 7.761887][ T1] make_alloc_exact+0xc4/0x140
[ 7.762733][ T1] vring_alloc_queue_split+0x20a/0x600
[ 7.763909][ T1] ? __pfx_vring_alloc_queue_split+0x10/0x10
[ 7.765171][ T1] ? vp_find_vqs+0x4c/0x4e0
[ 7.765822][ T1] ? virtscsi_probe+0x3ea/0xf60
[ 7.766497][ T1] ? virtio_dev_probe+0x991/0xaf0
[ 7.767234][ T1] ? really_probe+0x29e/0xc50
[ 7.767992][ T1] ? driver_probe_device+0x50/0x430
[ 7.769193][ T1] vring_create_virtqueue_split+0xc6/0x310
[ 7.770403][ T1] ? ret_from_fork+0x4b/0x80
[ 7.771350][ T1] ? __pfx_vring_create_virtqueue_split+0x10/0x10
[ 7.772638][ T1] vring_create_virtqueue+0xca/0x110
[ 7.773683][ T1] ? __pfx_vp_notify+0x10/0x10
[ 7.774585][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.775665][ T1] setup_vq+0xe9/0x2d0
[ 7.776917][ T1] ? __pfx_vp_notify+0x10/0x10
[ 7.778204][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.779467][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.781403][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.782743][ T1] vp_setup_vq+0xbf/0x330
[ 7.783647][ T1] ? __pfx_vp_config_changed+0x10/0x10
[ 7.784936][ T1] ? ioread16+0x2f/0x90
[ 7.785529][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.786299][ T1] vp_find_vqs_msix+0x8b2/0xc80
[ 7.787023][ T1] vp_find_vqs+0x4c/0x4e0
[ 7.788532][ T1] virtscsi_init+0x8db/0xd00
[ 7.790004][ T1] ? __pfx_virtscsi_init+0x10/0x10
[ 7.790970][ T1] ? __pfx_default_calc_sets+0x10/0x10
[ 7.792125][ T1] ? scsi_host_alloc+0xa57/0xea0
[ 7.793057][ T1] ? vp_get+0xfd/0x140
[ 7.793938][ T1] virtscsi_probe+0x3ea/0xf60
[ 7.794992][ T1] ? __pfx_virtscsi_probe+0x10/0x10
[ 7.795946][ T1] ? kernfs_add_one+0x156/0x8b0
[ 7.796940][ T1] ? virtio_no_restricted_mem_acc+0x9/0x10
[ 7.798029][ T1] ? virtio_features_ok+0x10c/0x270
[ 7.799045][ T1] virtio_dev_probe+0x991/0xaf0
[ 7.800155][ T1] ? __pfx_virtio_dev_probe+0x10/0x10
[ 7.801103][ T1] really_probe+0x29e/0xc50
[ 7.802608][ T1] __driver_probe_device+0x1a2/0x3e0
[ 7.803793][ T1] driver_probe_device+0x50/0x430
[ 7.804857][ T1] __driver_attach+0x45f/0x710
[ 7.805550][ T1] ? __pfx___driver_attach+0x10/0x10
[ 7.806333][ T1] bus_for_each_dev+0x239/0x2b0
[ 7.807759][ T1] ? __pfx___driver_attach+0x10/0x10
[ 7.808888][ T1] ? __pfx_bus_for_each_dev+0x10/0x10
[ 7.809993][ T1] ? do_raw_spin_unlock+0x13c/0x8b0
[ 7.811278][ T1] bus_add_driver+0x347/0x620
[ 7.812206][ T1] driver_register+0x23a/0x320
[ 7.813748][ T1] ? __pfx_virtio_scsi_init+0x10/0x10
[ 7.815079][ T1] virtio_scsi_init+0x65/0xe0
[ 7.816135][ T1] ? __pfx_virtio_scsi_init+0x10/0x10
[ 7.817203][ T1] do_one_initcall+0x238/0x830
[ 7.818686][ T1] ? __pfx_virtio_scsi_init+0x10/0x10
[ 7.819999][ T1] ? __pfx_lockdep_hardirqs_on_prepare+0x10/0x10
[ 7.821171][ T1] ? __pfx_do_one_initcall+0x10/0x10
[ 7.822983][ T1] ? __pfx_parse_args+0x10/0x10
[ 7.823803][ T1] ? do_initcalls+0x1c/0x80
[ 7.825039][ T1] ? rcu_is_watching+0x15/0xb0
[ 7.825767][ T1] do_initcall_level+0x157/0x210
[ 7.827178][ T1] do_initcalls+0x3f/0x80
[ 7.828780][ T1] kernel_init_freeable+0x435/0x5d0
[ 7.829898][ T1] ? __pfx_kernel_init_freeable+0x10/0x10
[ 7.831154][ T1] ? __pfx_lockdep_hardirqs_on_prepare+0x10/0x10
[ 7.833103][ T1] ? __pfx_kernel_init+0x10/0x10
[ 7.834732][ T1] ? __pfx_kernel_init+0x10/0x10
[ 7.835783][ T1] ? __pfx_kernel_init+0x10/0x10
[ 7.836738][ T1] kernel_init+0x1d/0x2b0
[ 7.837904][ T1] ret_from_fork+0x4b/0x80
[ 7.838532][ T1] ? __pfx_kernel_init+0x10/0x10
[ 7.839490][ T1] ret_from_fork_asm+0x1a/0x30
[ 7.840865][ T1] </TASK>
[ 7.842221][ T1] Kernel panic - not syncing: kernel: panic_on_warn set ...
[ 7.844095][ T1] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 6.8.0-rc4-next-20240216-syzkaller-07658-gd37e1e4c52bc-dirty #0
[ 7.844711][ T1] Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/25/2024
[ 7.844711][ T1] Call Trace:
[ 7.844711][ T1] <TASK>
[ 7.844711][ T1] dump_stack_lvl+0x241/0x360
[ 7.844711][ T1] ? __pfx_dump_stack_lvl+0x10/0x10
[ 7.844711][ T1] ? __pfx__printk+0x10/0x10
[ 7.844711][ T1] ? _printk+0xd5/0x120
[ 7.844711][ T1] ? vscnprintf+0x5d/0x90
[ 7.844711][ T1] panic+0x349/0x860
[ 7.844711][ T1] ? __warn+0x172/0x4b0
[ 7.844711][ T1] ? __pfx_panic+0x10/0x10
[ 7.844711][ T1] ? show_trace_log_lvl+0x4e6/0x520
[ 7.844711][ T1] ? ret_from_fork_asm+0x1a/0x30
[ 7.844711][ T1] __warn+0x31e/0x4b0
[ 7.844711][ T1] ? refcount_warn_saturate+0xfa/0x1d0
[ 7.844711][ T1] report_bug+0x2b3/0x500
[ 7.844711][ T1] ? refcount_warn_saturate+0xfa/0x1d0
[ 7.844711][ T1] handle_bug+0x3e/0x70
[ 7.844711][ T1] exc_invalid_op+0x1a/0x50
[ 7.844711][ T1] asm_exc_invalid_op+0x1a/0x20
[ 7.844711][ T1] RIP: 0010:refcount_warn_saturate+0xfa/0x1d0
[ 7.844711][ T1] Code: b2 00 00 00 e8 b7 94 f0 fc 5b 5d c3 cc cc cc cc e8 ab 94 f0 fc c6 05 c6 16 ce 0a 01 90 48 c7 c7 a0 5a fe 8b e8 67 69 b4 fc 90 <0f> 0b 90 90 eb d9 e8 8b 94 f0 fc c6 05 a3 16 ce 0a 01 90 48 c7 c7
[ 7.844711][ T1] RSP: 0000:ffffc90000066e10 EFLAGS: 00010246
[ 7.844711][ T1] RAX: ca34bf339345e800 RBX: ffff888020eb0f4c RCX: ffff8880162d8000
[ 7.844711][ T1] RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000000
[ 7.844711][ T1] RBP: 0000000000000004 R08: ffffffff8157b942 R09: fffffbfff1bf95cc
[ 7.844711][ T1] R10: dffffc0000000000 R11: fffffbfff1bf95cc R12: ffffea000502ddc0
[ 7.844711][ T1] R13: ffffea000502ddc8 R14: 1ffffd4000a05bb9 R15: 0000000000000000
[ 7.844711][ T1] ? __warn_printk+0x292/0x360
[ 7.844711][ T1] __free_pages_ok+0xc42/0xd70
[ 7.844711][ T1] make_alloc_exact+0xc4/0x140
[ 7.844711][ T1] vring_alloc_queue_split+0x20a/0x600
[ 7.844711][ T1] ? __pfx_vring_alloc_queue_split+0x10/0x10
[ 7.844711][ T1] ? vp_find_vqs+0x4c/0x4e0
[ 7.844711][ T1] ? virtscsi_probe+0x3ea/0xf60
[ 7.844711][ T1] ? virtio_dev_probe+0x991/0xaf0
[ 7.844711][ T1] ? really_probe+0x29e/0xc50
[ 7.844711][ T1] ? driver_probe_device+0x50/0x430
[ 7.844711][ T1] vring_create_virtqueue_split+0xc6/0x310
[ 7.844711][ T1] ? ret_from_fork+0x4b/0x80
[ 7.844711][ T1] ? __pfx_vring_create_virtqueue_split+0x10/0x10
[ 7.844711][ T1] vring_create_virtqueue+0xca/0x110
[ 7.844711][ T1] ? __pfx_vp_notify+0x10/0x10
[ 7.894210][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.894210][ T1] setup_vq+0xe9/0x2d0
[ 7.894210][ T1] ? __pfx_vp_notify+0x10/0x10
[ 7.894210][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.894210][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.894210][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.894210][ T1] vp_setup_vq+0xbf/0x330
[ 7.894210][ T1] ? __pfx_vp_config_changed+0x10/0x10
[ 7.894210][ T1] ? ioread16+0x2f/0x90
[ 7.894210][ T1] ? __pfx_virtscsi_ctrl_done+0x10/0x10
[ 7.894210][ T1] vp_find_vqs_msix+0x8b2/0xc80
[ 7.894210][ T1] vp_find_vqs+0x4c/0x4e0
[ 7.894210][ T1] virtscsi_init+0x8db/0xd00
[ 7.894210][ T1] ? __pfx_virtscsi_init+0x10/0x10
[ 7.894210][ T1] ? __pfx_default_calc_sets+0x10/0x10
[ 7.894210][ T1] ? scsi_host_alloc+0xa57/0xea0
[ 7.894210][ T1] ? vp_get+0xfd/0x140
[ 7.894210][ T1] virtscsi_probe+0x3ea/0xf60
[ 7.894210][ T1] ? __pfx_virtscsi_probe+0x10/0x10
[ 7.894210][ T1] ? kernfs_add_one+0x156/0x8b0
[ 7.894210][ T1] ? virtio_no_restricted_mem_acc+0x9/0x10
[ 7.894210][ T1] ? virtio_features_ok+0x10c/0x270
[ 7.894210][ T1] virtio_dev_probe+0x991/0xaf0
[ 7.894210][ T1] ? __pfx_virtio_dev_probe+0x10/0x10
[ 7.894210][ T1] really_probe+0x29e/0xc50
[ 7.894210][ T1] __driver_probe_device+0x1a2/0x3e0
[ 7.894210][ T1] driver_probe_device+0x50/0x430
[ 7.894210][ T1] __driver_attach+0x45f/0x710
[ 7.894210][ T1] ? __pfx___driver_attach+0x10/0x10
[ 7.894210][ T1] bus_for_each_dev+0x239/0x2b0
[ 7.894210][ T1] ? __pfx___driver_attach+0x10/0x10
[ 7.894210][ T1] ? __pfx_bus_for_each_dev+0x10/0x10
[ 7.894210][ T1] ? do_raw_spin_unlock+0x13c/0x8b0
[ 7.894210][ T1] bus_add_driver+0x347/0x620
[ 7.894210][ T1] driver_register+0x23a/0x320
[ 7.894210][ T1] ? __pfx_virtio_scsi_init+0x10/0x10
[ 7.894210][ T1] virtio_scsi_init+0x65/0xe0
[ 7.894210][ T1] ? __pfx_virtio_scsi_init+0x10/0x10
[ 7.894210][ T1] do_one_initcall+0x238/0x830
[ 7.894210][ T1] ? __pfx_virtio_scsi_init+0x10/0x10
[ 7.894210][ T1] ? __pfx_lockdep_hardirqs_on_prepare+0x10/0x10
[ 7.894210][ T1] ? __pfx_do_one_initcall+0x10/0x10
[ 7.894210][ T1] ? __pfx_parse_args+0x10/0x10
[ 7.894210][ T1] ? do_initcalls+0x1c/0x80
[ 7.894210][ T1] ? rcu_is_watching+0x15/0xb0
[ 7.894210][ T1] do_initcall_level+0x157/0x210
[ 7.894210][ T1] do_initcalls+0x3f/0x80
[ 7.894210][ T1] kernel_init_freeable+0x435/0x5d0
[ 7.894210][ T1] ? __pfx_kernel_init_freeable+0x10/0x10
[ 7.894210][ T1] ? __pfx_lockdep_hardirqs_on_prepare+0x10/0x10
[ 7.894210][ T1] ? __pfx_kernel_init+0x10/0x10
[ 7.894210][ T1] ? __pfx_kernel_init+0x10/0x10
[ 7.894210][ T1] ? __pfx_kernel_init+0x10/0x10
[ 7.894210][ T1] kernel_init+0x1d/0x2b0
[ 7.894210][ T1] ret_from_fork+0x4b/0x80
[ 7.894210][ T1] ? __pfx_kernel_init+0x10/0x10
[ 7.894210][ T1] ret_from_fork_asm+0x1a/0x30
[ 7.894210][ T1] </TASK>
[ 7.894210][ T1] Kernel Offset: disabled
[ 7.894210][ T1] Rebooting in 86400 seconds..
syzkaller build log:
go env (err=<nil>)
GO111MODULE='auto'
GOARCH='amd64'
GOBIN=''
GOCACHE='/syzkaller/.cache/go-build'
GOENV='/syzkaller/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/syzkaller/jobs/linux/gopath/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/syzkaller/jobs/linux/gopath'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/local/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/local/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.21.4'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/syzkaller/jobs/linux/gopath/src/github.com/google/syzkaller/go.mod'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build2616846364=/tmp/go-build -gno-record-gcc-switches'
git status (err=<nil>)
HEAD detached at 578f75388
nothing to commit, working tree clean
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
Makefile:32: run command via tools/syz-env for best compatibility, see:
Makefile:33: https://github.com/google/syzkaller/blob/master/docs/contributing.md#using-syz-env
go list -f '{{.Stale}}' ./sys/syz-sysgen | grep -q false || go install ./sys/syz-sysgen
make .descriptions
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
bin/syz-sysgen
touch .descriptions
GOOS=linux GOARCH=amd64 go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=578f753887693e1375d17cf79dc1c575f6032a5d -X 'github.com/google/syzkaller/prog.gitRevisionDate=20240215-140143'" "-tags=syz_target syz_os_linux syz_arch_amd64 " -o ./bin/linux_amd64/syz-fuzzer github.com/google/syzkaller/syz-fuzzer
GOOS=linux GOARCH=amd64 go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=578f753887693e1375d17cf79dc1c575f6032a5d -X 'github.com/google/syzkaller/prog.gitRevisionDate=20240215-140143'" "-tags=syz_target syz_os_linux syz_arch_amd64 " -o ./bin/linux_amd64/syz-execprog github.com/google/syzkaller/tools/syz-execprog
GOOS=linux GOARCH=amd64 go build "-ldflags=-s -w -X github.com/google/syzkaller/prog.GitRevision=578f753887693e1375d17cf79dc1c575f6032a5d -X 'github.com/google/syzkaller/prog.gitRevisionDate=20240215-140143'" "-tags=syz_target syz_os_linux syz_arch_amd64 " -o ./bin/linux_amd64/syz-stress github.com/google/syzkaller/tools/syz-stress
mkdir -p ./bin/linux_amd64
gcc -o ./bin/linux_amd64/syz-executor executor/executor.cc \
-m64 -O2 -pthread -Wall -Werror -Wparentheses -Wunused-const-variable -Wframe-larger-than=16384 -Wno-stringop-overflow -Wno-array-bounds -Wno-format-overflow -Wno-unused-but-set-variable -Wno-unused-command-line-argument -static-pie -fpermissive -w -DGOOS_linux=1 -DGOARCH_amd64=1 \
-DHOSTGOOS_linux=1 -DGIT_REVISION=\"578f753887693e1375d17cf79dc1c575f6032a5d\"
Error text is too large and was truncated, full error text is at:
https://syzkaller.appspot.com/x/error.txt?x=10615fc8180000
Tested on:
commit: d37e1e4c Add linux-next specific files for 20240216
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
kernel config: https://syzkaller.appspot.com/x/.config?x=4bc446d42a7d56c0
dashboard link: https://syzkaller.appspot.com/bug?extid=1683f76f1b20b826de67
compiler: Debian clang version 15.0.6, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13dd25d0180000
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2)
2024-02-17 2:09 ` [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
2024-02-17 10:57 ` Hillf Danton
@ 2024-02-18 8:44 ` Hillf Danton
2024-02-18 8:46 ` syzbot
1 sibling, 1 reply; 14+ messages in thread
From: Hillf Danton @ 2024-02-18 8:44 UTC (permalink / raw)
To: syzbot; +Cc: linux-kernel, syzkaller-bugs
On Fri, 16 Feb 2024 18:09:19 -0800
> syzbot has found a reproducer for the following issue on:
>
> HEAD commit: 2c3b09aac00d Add linux-next specific files for 20240214
> git tree: linux-next
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16c27a58180000
#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 2c3b09aac00d
--- x/net/bluetooth/sco.c
+++ y/net/bluetooth/sco.c
@@ -297,6 +297,7 @@ static int sco_connect(struct sock *sk)
sco_sock_set_timer(sk, sk->sk_sndtimeo);
}
+ hci_conn_get(hcon);
release_sock(sk);
unlock:
@@ -439,12 +440,15 @@ static void __sco_sock_close(struct sock
case BT_CONNECTED:
case BT_CONFIG:
if (sco_pi(sk)->conn->hcon) {
+ struct hci_conn *hcon = sco_pi(sk)->conn->hcon;
+
sk->sk_state = BT_DISCONN;
sco_sock_set_timer(sk, SCO_DISCONN_TIMEOUT);
sco_conn_lock(sco_pi(sk)->conn);
- hci_conn_drop(sco_pi(sk)->conn->hcon);
sco_pi(sk)->conn->hcon = NULL;
sco_conn_unlock(sco_pi(sk)->conn);
+
+ hci_conn_put(hcon);
} else
sco_chan_del(sk, ECONNRESET);
break;
--
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2)
2023-11-02 22:01 [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
` (7 preceding siblings ...)
2024-02-17 2:09 ` [syzbot] [bluetooth?] KASAN: slab-use-after-free Write in hci_conn_drop (2) syzbot
@ 2024-02-17 19:33 ` syzbot
8 siblings, 0 replies; 14+ messages in thread
From: syzbot @ 2024-02-17 19:33 UTC (permalink / raw)
To: davem, edumazet, hdanton, johan.hedberg, kuba, linux-bluetooth,
linux-kernel, lizhi.xu, luiz.dentz, luiz.von.dentz, marcel,
netdev, pabeni, syzkaller-bugs, verdre
syzbot has bisected this issue to:
commit 456561ba8e495e9320c1f304bf1cd3d1043cbe7b
Author: Jonas Dreßler <verdre@v0yd.nl>
Date: Tue Feb 6 11:08:13 2024 +0000
Bluetooth: hci_conn: Only do ACL connections sequentially
bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=132137fc180000
start commit: 2c3b09aac00d Add linux-next specific files for 20240214
git tree: linux-next
final oops: https://syzkaller.appspot.com/x/report.txt?x=10a137fc180000
console output: https://syzkaller.appspot.com/x/log.txt?x=172137fc180000
kernel config: https://syzkaller.appspot.com/x/.config?x=176d2dcbf8ba7017
dashboard link: https://syzkaller.appspot.com/bug?extid=1683f76f1b20b826de67
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1765258a180000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=16c27a58180000
Reported-by: syzbot+1683f76f1b20b826de67@syzkaller.appspotmail.com
Fixes: 456561ba8e49 ("Bluetooth: hci_conn: Only do ACL connections sequentially")
For information about bisection process see: https://goo.gl/tpsmEJ#bisection
^ permalink raw reply [flat|nested] 14+ messages in thread