[syzbot] KASAN: null-ptr-deref Write in rhashtable_free_and_destroy (2)

40 views
Skip to first unread message

syzbot

unread,
Apr 13, 2021, 1:58:19 AM4/13/21
to da...@davemloft.net, joha...@sipsolutions.net, ku...@kernel.org, linux-...@vger.kernel.org, linux-w...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: d93a0d43 Merge tag 'block-5.12-2021-04-02' of git://git.ke..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12d81cfcd00000
kernel config: https://syzkaller.appspot.com/x/.config?x=71a75beb62b62a34
dashboard link: https://syzkaller.appspot.com/bug?extid=860268315ba86ea6b96b
compiler: Debian clang version 11.0.1-2

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+860268...@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 test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
BUG: KASAN: null-ptr-deref in try_to_grab_pending+0xee/0xa50 kernel/workqueue.c:1257
Write of size 8 at addr 0000000000000088 by task kworker/0:3/4787

CPU: 0 PID: 4787 Comm: kworker/0:3 Not tainted 5.12.0-rc5-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events cfg80211_destroy_iface_wk
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x176/0x24e lib/dump_stack.c:120
__kasan_report mm/kasan/report.c:403 [inline]
kasan_report+0x152/0x200 mm/kasan/report.c:416
check_region_inline mm/kasan/generic.c:135 [inline]
kasan_check_range+0x2b5/0x2f0 mm/kasan/generic.c:186
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
try_to_grab_pending+0xee/0xa50 kernel/workqueue.c:1257
__cancel_work_timer+0x81/0x5b0 kernel/workqueue.c:3098
rhashtable_free_and_destroy+0x25/0x8b0 lib/rhashtable.c:1137
mesh_table_free net/mac80211/mesh_pathtbl.c:70 [inline]
mesh_pathtbl_unregister+0x4b/0xa0 net/mac80211/mesh_pathtbl.c:812
unregister_netdevice_many+0x12ea/0x18e0 net/core/dev.c:10951
unregister_netdevice_queue+0x2a9/0x300 net/core/dev.c:10868
unregister_netdevice include/linux/netdevice.h:2884 [inline]
_cfg80211_unregister_wdev+0x17b/0x5b0 net/wireless/core.c:1127
ieee80211_if_remove+0x1cc/0x250 net/mac80211/iface.c:2020
ieee80211_del_iface+0x12/0x20 net/mac80211/cfg.c:144
rdev_del_virtual_intf net/wireless/rdev-ops.h:57 [inline]
cfg80211_destroy_ifaces+0x182/0x250 net/wireless/core.c:341
cfg80211_destroy_iface_wk+0x30/0x40 net/wireless/core.c:354
process_one_work+0x789/0xfd0 kernel/workqueue.c:2275
worker_thread+0xac1/0x1300 kernel/workqueue.c:2421
kthread+0x39a/0x3c0 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
==================================================================


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

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

syzbot

unread,
Apr 26, 2021, 3:17:15 AM4/26/21
to da...@davemloft.net, joha...@sipsolutions.net, ku...@kernel.org, linux-...@vger.kernel.org, linux-w...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com
syzbot has found a reproducer for the following issue on:

HEAD commit: 9f4ad9e4 Linux 5.12
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=12e92c5dd00000
kernel config: https://syzkaller.appspot.com/x/.config?x=39164acdef826e06
dashboard link: https://syzkaller.appspot.com/bug?extid=860268315ba86ea6b96b
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=13438cb9d00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10d37705d00000

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+860268...@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 test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
BUG: KASAN: null-ptr-deref in try_to_grab_pending.part.0+0x26/0x770 kernel/workqueue.c:1257
Write of size 8 at addr 0000000000000088 by task kworker/0:0/5

CPU: 0 PID: 5 Comm: kworker/0:0 Not tainted 5.12.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events cfg80211_destroy_iface_wk
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x141/0x1d7 lib/dump_stack.c:120
__kasan_report mm/kasan/report.c:403 [inline]
kasan_report.cold+0x5f/0xd8 mm/kasan/report.c:416
check_region_inline mm/kasan/generic.c:180 [inline]
kasan_check_range+0x13d/0x180 mm/kasan/generic.c:186
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
try_to_grab_pending.part.0+0x26/0x770 kernel/workqueue.c:1257
try_to_grab_pending+0xa1/0xd0 kernel/workqueue.c:1310
__cancel_work_timer+0xa6/0x570 kernel/workqueue.c:3098
rhashtable_free_and_destroy+0x2b/0x920 lib/rhashtable.c:1137
mesh_table_free net/mac80211/mesh_pathtbl.c:70 [inline]
mesh_pathtbl_unregister+0x42/0xa0 net/mac80211/mesh_pathtbl.c:812
ieee80211_teardown_sdata+0x216/0x2d0 net/mac80211/iface.c:691
unregister_netdevice_many+0xc4c/0x1760 net/core/dev.c:10953
unregister_netdevice_queue+0x2dd/0x3c0 net/core/dev.c:10870
unregister_netdevice include/linux/netdevice.h:2884 [inline]
_cfg80211_unregister_wdev+0x485/0x740 net/wireless/core.c:1127
ieee80211_if_remove+0x1df/0x300 net/mac80211/iface.c:2020
ieee80211_del_iface+0x12/0x20 net/mac80211/cfg.c:144
rdev_del_virtual_intf net/wireless/rdev-ops.h:57 [inline]
cfg80211_destroy_ifaces+0x223/0x770 net/wireless/core.c:341
cfg80211_destroy_iface_wk+0x2c/0x40 net/wireless/core.c:354
process_one_work+0x98d/0x1600 kernel/workqueue.c:2275
worker_thread+0x64c/0x1120 kernel/workqueue.c:2421
kthread+0x3b1/0x4a0 kernel/kthread.c:292
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:294
==================================================================

Hillf Danton

unread,
Apr 26, 2021, 5:00:34 AM4/26/21
to syzbot, Johannes Berg, Hillf Danton, linux-...@vger.kernel.org, linux-w...@vger.kernel.org, net...@vger.kernel.org, syzkall...@googlegroups.com
On Mon, 26 Apr 2021 00:17:14
Along the init call chain,

ieee80211_setup_sdata()
memset(&sdata->u, 0, sizeof(sdata->u));
ieee80211_mesh_init_sdata(sdata);
mesh_pathtbl_init(sdata);

no error is checked for the failure of the last function, so it is
likely to free a null poniter at the unregister time.

+++ x/net/mac80211/mesh_pathtbl.c
@@ -809,6 +809,8 @@ void mesh_path_expire(struct ieee80211_s

void mesh_pathtbl_unregister(struct ieee80211_sub_if_data *sdata)
{
+ if (!sdata->u.mesh.mesh_paths)
+ return;
mesh_table_free(sdata->u.mesh.mesh_paths);
mesh_table_free(sdata->u.mesh.mpp_paths);
}

syzbot

unread,
Apr 26, 2021, 9:52:11 PM4/26/21
to alaaemadh...@gmail.com, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: null-ptr-deref Write in rhashtable_free_and_destroy

==================================================================
BUG: KASAN: null-ptr-deref in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: null-ptr-deref in test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
BUG: KASAN: null-ptr-deref in try_to_grab_pending.part.0+0x26/0x770 kernel/workqueue.c:1257
Write of size 8 at addr 0000000000000088 by task kworker/1:3/8602

CPU: 1 PID: 8602 Comm: kworker/1:3 Not tainted 5.12.0-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: events cfg80211_destroy_iface_wk
Call Trace:
__dump_stack lib/dump_stack.c:79 [inline]
dump_stack+0x141/0x1d7 lib/dump_stack.c:120
__kasan_report mm/kasan/report.c:423 [inline]
kasan_report.cold+0x5f/0xd8 mm/kasan/report.c:436
Tested on:

commit: 4a0225c3 Merge tag 'spi-v5.13' of git://git.kernel.org/pub..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=16c82951d00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c442f0f3cf95e1f8
Reply all
Reply to author
Forward
0 new messages