* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in tls_encrypt_done
[not found] <20230930074624.1542-1-hdanton@sina.com>
@ 2023-09-30 8:10 ` syzbot
0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-30 8:10 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+29c22ea2d6b2c5fd2eae@syzkaller.appspotmail.com
Tested on:
commit: 6465e260 Linux 6.6-rc3
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=156b6fc6680000
kernel config: https://syzkaller.appspot.com/x/.config?x=8d7d7928f78936aa
dashboard link: https://syzkaller.appspot.com/bug?extid=29c22ea2d6b2c5fd2eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=13cc351a680000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in tls_encrypt_done
[not found] <20231002003015.103-1-hdanton@sina.com>
@ 2023-10-02 0:53 ` syzbot
0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-10-02 0:53 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch and the reproducer did not trigger any issue:
Reported-and-tested-by: syzbot+29c22ea2d6b2c5fd2eae@syzkaller.appspotmail.com
Tested on:
commit: 6465e260 Linux 6.6-rc3
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=1281458a680000
kernel config: https://syzkaller.appspot.com/x/.config?x=8d7d7928f78936aa
dashboard link: https://syzkaller.appspot.com/bug?extid=29c22ea2d6b2c5fd2eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=100ab82a680000
Note: testing is done by a robot and is best-effort only.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in tls_encrypt_done
[not found] <20230930045452.1463-1-hdanton@sina.com>
@ 2023-09-30 5:15 ` syzbot
0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-30 5:15 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-use-after-free Read in tls_encrypt_done
==================================================================
BUG: KASAN: slab-use-after-free in debug_spin_unlock kernel/locking/spinlock_debug.c:99 [inline]
BUG: KASAN: slab-use-after-free in do_raw_spin_unlock+0x1f7/0x230 kernel/locking/spinlock_debug.c:140
Read of size 4 at addr ffff88801ed8493c by task kworker/3:2/813
CPU: 3 PID: 813 Comm: kworker/3:2 Not tainted 6.6.0-rc3-syzkaller-dirty #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: pencrypt_serial padata_serial_worker
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xc4/0x620 mm/kasan/report.c:475
kasan_report+0xda/0x110 mm/kasan/report.c:588
debug_spin_unlock kernel/locking/spinlock_debug.c:99 [inline]
do_raw_spin_unlock+0x1f7/0x230 kernel/locking/spinlock_debug.c:140
__raw_spin_unlock_bh include/linux/spinlock_api_smp.h:166 [inline]
_raw_spin_unlock_bh+0x1e/0x30 kernel/locking/spinlock.c:210
spin_unlock_bh include/linux/spinlock.h:396 [inline]
tls_encrypt_done+0x281/0x560 net/tls/tls_sw.c:488
padata_serial_worker+0x246/0x490 kernel/padata.c:378
process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
process_scheduled_works kernel/workqueue.c:2703 [inline]
worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
kthread+0x33c/0x440 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
</TASK>
Allocated by task 7577:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:599 [inline]
kzalloc include/linux/slab.h:720 [inline]
tls_set_sw_offload+0x12e0/0x1700 net/tls/tls_sw.c:2606
do_tls_setsockopt_conf net/tls/tls_main.c:666 [inline]
do_tls_setsockopt net/tls/tls_main.c:771 [inline]
tls_setsockopt+0x108c/0x1340 net/tls/tls_main.c:799
__sys_setsockopt+0x2cd/0x5b0 net/socket.c:2308
__do_sys_setsockopt net/socket.c:2319 [inline]
__se_sys_setsockopt net/socket.c:2316 [inline]
__x64_sys_setsockopt+0xbd/0x150 net/socket.c:2316
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 7576:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x138/0x190 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:164 [inline]
__cache_free mm/slab.c:3370 [inline]
__do_kmem_cache_free mm/slab.c:3557 [inline]
__kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564
tls_sk_proto_close+0x5ce/0xac0 net/tls/tls_main.c:389
inet_release+0x132/0x270 net/ipv4/af_inet.c:433
inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:484
__sock_release+0xae/0x260 net/socket.c:659
sock_close+0x1c/0x20 net/socket.c:1402
__fput+0x3f7/0xa70 fs/file_table.c:384
__fput_sync+0x47/0x50 fs/file_table.c:465
__do_sys_close fs/open.c:1572 [inline]
__se_sys_close fs/open.c:1557 [inline]
__x64_sys_close+0x87/0xf0 fs/open.c:1557
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492
kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372
tls_ctx_free net/tls/tls_main.c:333 [inline]
tls_ctx_free+0x69/0x90 net/tls/tls_main.c:323
tls_sk_proto_close+0x588/0xac0 net/tls/tls_main.c:397
inet_release+0x132/0x270 net/ipv4/af_inet.c:433
inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:484
__sock_release+0xae/0x260 net/socket.c:659
sock_close+0x1c/0x20 net/socket.c:1402
__fput+0x3f7/0xa70 fs/file_table.c:384
__fput_sync+0x47/0x50 fs/file_table.c:465
__do_sys_close fs/open.c:1572 [inline]
__se_sys_close fs/open.c:1557 [inline]
__x64_sys_close+0x87/0xf0 fs/open.c:1557
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Second to last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492
kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372
tls_ctx_free net/tls/tls_main.c:333 [inline]
tls_ctx_free+0x69/0x90 net/tls/tls_main.c:323
tls_sk_proto_close+0x588/0xac0 net/tls/tls_main.c:397
inet_release+0x132/0x270 net/ipv4/af_inet.c:433
inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:484
__sock_release+0xae/0x260 net/socket.c:659
sock_close+0x1c/0x20 net/socket.c:1402
__fput+0x3f7/0xa70 fs/file_table.c:384
__fput_sync+0x47/0x50 fs/file_table.c:465
__do_sys_close fs/open.c:1572 [inline]
__se_sys_close fs/open.c:1557 [inline]
__x64_sys_close+0x87/0xf0 fs/open.c:1557
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff88801ed84800
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 316 bytes inside of
freed 512-byte region [ffff88801ed84800, ffff88801ed84a00)
The buggy address belongs to the physical page:
page:ffffea00007b6100 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1ed84
flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0x4()
raw: 00fff00000000800 ffff888012c40600 ffffea00008cf150 ffffea0000ee6e10
raw: 0000000000000000 ffff88801ed84000 0000000100000004 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x3420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_HARDWALL|__GFP_THISNODE), pid 5237, tgid 5237 (udevd), ts 60297213654, free_ts 60296881728
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536
prep_new_page mm/page_alloc.c:1543 [inline]
get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170
__alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426
__alloc_pages_node include/linux/gfp.h:237 [inline]
kmem_getpages mm/slab.c:1356 [inline]
cache_grow_begin+0x99/0x3a0 mm/slab.c:2550
cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923
____cache_alloc mm/slab.c:2999 [inline]
____cache_alloc mm/slab.c:2982 [inline]
__do_cache_alloc mm/slab.c:3182 [inline]
slab_alloc_node mm/slab.c:3230 [inline]
__kmem_cache_alloc_node+0x3c5/0x470 mm/slab.c:3521
kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114
kmalloc include/linux/slab.h:599 [inline]
kzalloc include/linux/slab.h:720 [inline]
kernfs_fop_open+0x318/0xe00 fs/kernfs/file.c:670
do_dentry_open+0x88b/0x1730 fs/open.c:929
do_open fs/namei.c:3639 [inline]
path_openat+0x19af/0x29c0 fs/namei.c:3796
do_filp_open+0x1de/0x430 fs/namei.c:3823
do_sys_openat2+0x176/0x1e0 fs/open.c:1422
do_sys_open fs/open.c:1437 [inline]
__do_sys_openat fs/open.c:1453 [inline]
__se_sys_openat fs/open.c:1448 [inline]
__x64_sys_openat+0x175/0x210 fs/open.c:1448
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1136 [inline]
free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312
free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405
selinux_genfs_get_sid security/selinux/hooks.c:1341 [inline]
inode_doinit_with_dentry+0xac0/0x12c0 security/selinux/hooks.c:1539
selinux_d_instantiate+0x26/0x30 security/selinux/hooks.c:6284
security_d_instantiate+0x54/0xe0 security/security.c:3799
d_splice_alias+0x94/0xdf0 fs/dcache.c:3145
kernfs_iop_lookup+0x283/0x330 fs/kernfs/dir.c:1208
__lookup_slow+0x24d/0x450 fs/namei.c:1693
lookup_slow fs/namei.c:1710 [inline]
walk_component+0x349/0x5a0 fs/namei.c:2001
lookup_last fs/namei.c:2458 [inline]
path_lookupat+0x17f/0x770 fs/namei.c:2482
filename_lookup+0x1e7/0x5b0 fs/namei.c:2511
vfs_statx+0x160/0x430 fs/stat.c:240
vfs_fstatat+0xb3/0x140 fs/stat.c:295
__do_sys_newfstatat+0x98/0x110 fs/stat.c:459
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Memory state around the buggy address:
ffff88801ed84800: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801ed84880: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801ed84900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801ed84980: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801ed84a00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
Tested on:
commit: 6465e260 Linux 6.6-rc3
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=10465026680000
kernel config: https://syzkaller.appspot.com/x/.config?x=8d7d7928f78936aa
dashboard link: https://syzkaller.appspot.com/bug?extid=29c22ea2d6b2c5fd2eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1084ea06680000
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [syzbot] [net?] KASAN: slab-use-after-free Read in tls_encrypt_done
[not found] <20230930033224.1393-1-hdanton@sina.com>
@ 2023-09-30 3:48 ` syzbot
0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-30 3:48 UTC (permalink / raw)
To: hdanton, linux-kernel, syzkaller-bugs
Hello,
syzbot has tested the proposed patch but the reproducer is still triggering an issue:
KASAN: slab-use-after-free Read in tls_encrypt_done
==================================================================
BUG: KASAN: slab-use-after-free in debug_spin_unlock kernel/locking/spinlock_debug.c:99 [inline]
BUG: KASAN: slab-use-after-free in do_raw_spin_unlock+0x1f7/0x230 kernel/locking/spinlock_debug.c:140
Read of size 4 at addr ffff888021a7253c by task kworker/1:1/46
CPU: 1 PID: 46 Comm: kworker/1:1 Not tainted 6.6.0-rc3-syzkaller-dirty #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: pencrypt_serial padata_serial_worker
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xc4/0x620 mm/kasan/report.c:475
kasan_report+0xda/0x110 mm/kasan/report.c:588
debug_spin_unlock kernel/locking/spinlock_debug.c:99 [inline]
do_raw_spin_unlock+0x1f7/0x230 kernel/locking/spinlock_debug.c:140
__raw_spin_unlock_bh include/linux/spinlock_api_smp.h:166 [inline]
_raw_spin_unlock_bh+0x1e/0x30 kernel/locking/spinlock.c:210
spin_unlock_bh include/linux/spinlock.h:396 [inline]
tls_encrypt_done+0x281/0x560 net/tls/tls_sw.c:488
padata_serial_worker+0x246/0x490 kernel/padata.c:378
process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
process_scheduled_works kernel/workqueue.c:2703 [inline]
worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
kthread+0x33c/0x440 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
</TASK>
Allocated by task 5717:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:599 [inline]
kzalloc include/linux/slab.h:720 [inline]
tls_set_sw_offload+0x12e0/0x1700 net/tls/tls_sw.c:2606
do_tls_setsockopt_conf net/tls/tls_main.c:667 [inline]
do_tls_setsockopt net/tls/tls_main.c:772 [inline]
tls_setsockopt+0x108c/0x1340 net/tls/tls_main.c:800
__sys_setsockopt+0x2cd/0x5b0 net/socket.c:2308
__do_sys_setsockopt net/socket.c:2319 [inline]
__se_sys_setsockopt net/socket.c:2316 [inline]
__x64_sys_setsockopt+0xbd/0x150 net/socket.c:2316
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 5716:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x138/0x190 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:164 [inline]
__cache_free mm/slab.c:3370 [inline]
__do_kmem_cache_free mm/slab.c:3557 [inline]
__kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564
tls_sk_proto_close+0x4c3/0xb00 net/tls/tls_main.c:390
inet_release+0x132/0x270 net/ipv4/af_inet.c:433
inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:484
__sock_release+0xae/0x260 net/socket.c:659
sock_close+0x1c/0x20 net/socket.c:1402
__fput+0x3f7/0xa70 fs/file_table.c:384
__fput_sync+0x47/0x50 fs/file_table.c:465
__do_sys_close fs/open.c:1572 [inline]
__se_sys_close fs/open.c:1557 [inline]
__x64_sys_close+0x87/0xf0 fs/open.c:1557
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492
kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372
mld_clear_delrec+0x134/0x660 net/ipv6/mcast.c:824
ipv6_mc_destroy_dev+0x49/0x680 net/ipv6/mcast.c:2788
addrconf_ifdown.isra.0+0x1597/0x1c50 net/ipv6/addrconf.c:3935
addrconf_notify+0x22d/0x1920 net/ipv6/addrconf.c:3715
notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970
call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
call_netdevice_notifiers net/core/dev.c:2022 [inline]
unregister_netdevice_many_notify+0x85f/0x1a20 net/core/dev.c:10938
unregister_netdevice_many net/core/dev.c:10994 [inline]
default_device_exit_batch+0x584/0x740 net/core/dev.c:11453
ops_exit_list+0x125/0x170 net/core/net_namespace.c:175
cleanup_net+0x505/0xb20 net/core/net_namespace.c:614
process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
process_scheduled_works kernel/workqueue.c:2703 [inline]
worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
kthread+0x33c/0x440 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
Second to last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492
__call_rcu_common.constprop.0+0x9a/0x790 kernel/rcu/tree.c:2653
fib6_info_release include/net/ip6_fib.h:332 [inline]
fib6_info_release include/net/ip6_fib.h:329 [inline]
fixup_permanent_addr net/ipv6/addrconf.c:3533 [inline]
addrconf_permanent_addr net/ipv6/addrconf.c:3561 [inline]
addrconf_notify+0x149e/0x1920 net/ipv6/addrconf.c:3633
notifier_call_chain+0xb6/0x3b0 kernel/notifier.c:93
call_netdevice_notifiers_info+0xb9/0x130 net/core/dev.c:1970
call_netdevice_notifiers_extack net/core/dev.c:2008 [inline]
call_netdevice_notifiers net/core/dev.c:2022 [inline]
__dev_notify_flags+0x12d/0x2e0 net/core/dev.c:8636
dev_change_flags+0x122/0x170 net/core/dev.c:8674
do_setlink+0x1a2a/0x3fa0 net/core/rtnetlink.c:2880
__rtnl_newlink+0xc1d/0x1940 net/core/rtnetlink.c:3671
rtnl_newlink+0x67/0xa0 net/core/rtnetlink.c:3718
rtnetlink_rcv_msg+0x3c4/0xdf0 net/core/rtnetlink.c:6444
netlink_rcv_skb+0x16b/0x440 net/netlink/af_netlink.c:2545
netlink_unicast_kernel net/netlink/af_netlink.c:1342 [inline]
netlink_unicast+0x536/0x810 net/netlink/af_netlink.c:1368
netlink_sendmsg+0x93c/0xe40 net/netlink/af_netlink.c:1910
sock_sendmsg_nosec net/socket.c:730 [inline]
sock_sendmsg+0xd9/0x180 net/socket.c:753
__sys_sendto+0x255/0x340 net/socket.c:2177
__do_sys_sendto net/socket.c:2189 [inline]
__se_sys_sendto net/socket.c:2185 [inline]
__x64_sys_sendto+0xe0/0x1b0 net/socket.c:2185
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff888021a72400
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 316 bytes inside of
freed 512-byte region [ffff888021a72400, ffff888021a72600)
The buggy address belongs to the physical page:
page:ffffea0000869c80 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x21a72
flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0x4()
raw: 00fff00000000800 ffff888012c40600 ffffea00006c3ed0 ffffea0000f39050
raw: 0000000000000000 ffff888021a72000 0000000100000004 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x2420c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 1, tgid 1 (swapper/0), ts 18600299140, free_ts 18486327960
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536
prep_new_page mm/page_alloc.c:1543 [inline]
get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170
__alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426
__alloc_pages_node include/linux/gfp.h:237 [inline]
kmem_getpages mm/slab.c:1356 [inline]
cache_grow_begin+0x99/0x3a0 mm/slab.c:2550
cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923
____cache_alloc mm/slab.c:2999 [inline]
____cache_alloc mm/slab.c:2982 [inline]
__do_cache_alloc mm/slab.c:3182 [inline]
slab_alloc_node mm/slab.c:3230 [inline]
__kmem_cache_alloc_node+0x3c5/0x470 mm/slab.c:3521
kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114
kmalloc include/linux/slab.h:599 [inline]
kzalloc include/linux/slab.h:720 [inline]
dev_pm_qos_constraints_allocate+0x87/0x4b0 drivers/base/power/qos.c:204
__dev_pm_qos_add_request+0x47b/0x570 drivers/base/power/qos.c:344
dev_pm_qos_add_request+0x3a/0x60 drivers/base/power/qos.c:394
usb_hub_create_port_device+0x474/0xe30 drivers/usb/core/port.c:727
hub_configure drivers/usb/core/hub.c:1685 [inline]
hub_probe+0x1e62/0x3070 drivers/usb/core/hub.c:1922
usb_probe_interface+0x307/0x930 drivers/usb/core/driver.c:396
call_driver_probe drivers/base/dd.c:579 [inline]
really_probe+0x234/0xc90 drivers/base/dd.c:658
__driver_probe_device+0x1de/0x4b0 drivers/base/dd.c:800
driver_probe_device+0x4c/0x1a0 drivers/base/dd.c:830
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1136 [inline]
free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312
free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405
vfree+0x181/0x7a0 mm/vmalloc.c:2842
delayed_vfree_work+0x56/0x70 mm/vmalloc.c:2763
process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
process_scheduled_works kernel/workqueue.c:2703 [inline]
worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
kthread+0x33c/0x440 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
Memory state around the buggy address:
ffff888021a72400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888021a72480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff888021a72500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff888021a72580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff888021a72600: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
Tested on:
commit: 6465e260 Linux 6.6-rc3
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
console output: https://syzkaller.appspot.com/x/log.txt?x=10436bda680000
kernel config: https://syzkaller.appspot.com/x/.config?x=8d7d7928f78936aa
dashboard link: https://syzkaller.appspot.com/bug?extid=29c22ea2d6b2c5fd2eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
patch: https://syzkaller.appspot.com/x/patch.diff?x=1004ea06680000
^ permalink raw reply [flat|nested] 5+ messages in thread
* [syzbot] [net?] KASAN: slab-use-after-free Read in tls_encrypt_done
@ 2023-09-29 18:43 syzbot
0 siblings, 0 replies; 5+ messages in thread
From: syzbot @ 2023-09-29 18:43 UTC (permalink / raw)
To: borisp, bpf, davem, edumazet, john.fastabend, kuba, linux-kernel,
netdev, pabeni, syzkaller-bugs
Hello,
syzbot found the following issue on:
HEAD commit: 6465e260f487 Linux 6.6-rc3
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=114f1f96680000
kernel config: https://syzkaller.appspot.com/x/.config?x=8d7d7928f78936aa
dashboard link: https://syzkaller.appspot.com/bug?extid=29c22ea2d6b2c5fd2eae
compiler: gcc (Debian 12.2.0-14) 12.2.0, GNU ld (GNU Binutils for Debian) 2.40
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=15c6888e680000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=174c3996680000
Downloadable assets:
disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/7bc7510fe41f/non_bootable_disk-6465e260.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/3560b94cfbc8/vmlinux-6465e260.xz
kernel image: https://storage.googleapis.com/syzbot-assets/a098d6f44df3/bzImage-6465e260.xz
IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+29c22ea2d6b2c5fd2eae@syzkaller.appspotmail.com
==================================================================
BUG: KASAN: slab-use-after-free in debug_spin_unlock kernel/locking/spinlock_debug.c:99 [inline]
BUG: KASAN: slab-use-after-free in do_raw_spin_unlock+0x1f7/0x230 kernel/locking/spinlock_debug.c:140
Read of size 4 at addr ffff88801f5a7d3c by task kworker/2:1/36
CPU: 2 PID: 36 Comm: kworker/2:1 Not tainted 6.6.0-rc3-syzkaller #0
Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 1.16.2-debian-1.16.2-1 04/01/2014
Workqueue: pencrypt_serial padata_serial_worker
Call Trace:
<TASK>
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0xd9/0x1b0 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:364 [inline]
print_report+0xc4/0x620 mm/kasan/report.c:475
kasan_report+0xda/0x110 mm/kasan/report.c:588
debug_spin_unlock kernel/locking/spinlock_debug.c:99 [inline]
do_raw_spin_unlock+0x1f7/0x230 kernel/locking/spinlock_debug.c:140
__raw_spin_unlock_bh include/linux/spinlock_api_smp.h:166 [inline]
_raw_spin_unlock_bh+0x1e/0x30 kernel/locking/spinlock.c:210
spin_unlock_bh include/linux/spinlock.h:396 [inline]
tls_encrypt_done+0x281/0x560 net/tls/tls_sw.c:488
padata_serial_worker+0x246/0x490 kernel/padata.c:378
process_one_work+0x884/0x15c0 kernel/workqueue.c:2630
process_scheduled_works kernel/workqueue.c:2703 [inline]
worker_thread+0x8b9/0x1290 kernel/workqueue.c:2784
kthread+0x33c/0x440 kernel/kthread.c:388
ret_from_fork+0x45/0x80 arch/x86/kernel/process.c:147
ret_from_fork_asm+0x11/0x20 arch/x86/entry/entry_64.S:304
</TASK>
Allocated by task 19233:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xa3/0xb0 mm/kasan/common.c:383
kmalloc include/linux/slab.h:599 [inline]
kzalloc include/linux/slab.h:720 [inline]
tls_set_sw_offload+0x12e0/0x1700 net/tls/tls_sw.c:2606
do_tls_setsockopt_conf net/tls/tls_main.c:667 [inline]
do_tls_setsockopt net/tls/tls_main.c:772 [inline]
tls_setsockopt+0x108c/0x1340 net/tls/tls_main.c:800
__sys_setsockopt+0x2cd/0x5b0 net/socket.c:2308
__do_sys_setsockopt net/socket.c:2319 [inline]
__se_sys_setsockopt net/socket.c:2316 [inline]
__x64_sys_setsockopt+0xbd/0x150 net/socket.c:2316
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Freed by task 19233:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
kasan_set_track+0x25/0x30 mm/kasan/common.c:52
kasan_save_free_info+0x28/0x40 mm/kasan/generic.c:522
____kasan_slab_free mm/kasan/common.c:236 [inline]
____kasan_slab_free+0x138/0x190 mm/kasan/common.c:200
kasan_slab_free include/linux/kasan.h:164 [inline]
__cache_free mm/slab.c:3370 [inline]
__do_kmem_cache_free mm/slab.c:3557 [inline]
__kmem_cache_free+0xcc/0x2d0 mm/slab.c:3564
tls_sk_proto_close+0x4c3/0xb00 net/tls/tls_main.c:390
inet_release+0x132/0x270 net/ipv4/af_inet.c:433
inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:484
__sock_release+0xae/0x260 net/socket.c:659
sock_close+0x1c/0x20 net/socket.c:1402
__fput+0x3f7/0xa70 fs/file_table.c:384
task_work_run+0x14d/0x240 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xa92/0x2a20 kernel/exit.c:874
do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
__do_sys_exit_group kernel/exit.c:1035 [inline]
__se_sys_exit_group kernel/exit.c:1033 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1033
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492
kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372
tls_ctx_free net/tls/tls_main.c:333 [inline]
tls_ctx_free+0x69/0x90 net/tls/tls_main.c:323
tls_sk_proto_close+0x46b/0xb00 net/tls/tls_main.c:398
inet_release+0x132/0x270 net/ipv4/af_inet.c:433
inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:484
__sock_release+0xae/0x260 net/socket.c:659
sock_close+0x1c/0x20 net/socket.c:1402
__fput+0x3f7/0xa70 fs/file_table.c:384
task_work_run+0x14d/0x240 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xa92/0x2a20 kernel/exit.c:874
do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
__do_sys_exit_group kernel/exit.c:1035 [inline]
__se_sys_exit_group kernel/exit.c:1033 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1033
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
Second to last potentially related work creation:
kasan_save_stack+0x33/0x50 mm/kasan/common.c:45
__kasan_record_aux_stack+0x78/0x80 mm/kasan/generic.c:492
kvfree_call_rcu+0x70/0xbe0 kernel/rcu/tree.c:3372
tls_ctx_free net/tls/tls_main.c:333 [inline]
tls_ctx_free+0x69/0x90 net/tls/tls_main.c:323
tls_sk_proto_close+0x46b/0xb00 net/tls/tls_main.c:398
inet_release+0x132/0x270 net/ipv4/af_inet.c:433
inet6_release+0x4f/0x70 net/ipv6/af_inet6.c:484
__sock_release+0xae/0x260 net/socket.c:659
sock_close+0x1c/0x20 net/socket.c:1402
__fput+0x3f7/0xa70 fs/file_table.c:384
task_work_run+0x14d/0x240 kernel/task_work.c:180
exit_task_work include/linux/task_work.h:38 [inline]
do_exit+0xa92/0x2a20 kernel/exit.c:874
do_group_exit+0xd4/0x2a0 kernel/exit.c:1024
__do_sys_exit_group kernel/exit.c:1035 [inline]
__se_sys_exit_group kernel/exit.c:1033 [inline]
__x64_sys_exit_group+0x3e/0x50 kernel/exit.c:1033
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
The buggy address belongs to the object at ffff88801f5a7c00
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 316 bytes inside of
freed 512-byte region [ffff88801f5a7c00, ffff88801f5a7e00)
The buggy address belongs to the physical page:
page:ffffea00007d69c0 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x1f5a7
flags: 0xfff00000000800(slab|node=0|zone=1|lastcpupid=0x7ff)
page_type: 0x4()
raw: 00fff00000000800 ffff888012c40600 ffffea000076b490 ffffea00006bae50
raw: 0000000000000000 ffff88801f5a7000 0000000100000004 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 0, migratetype Unmovable, gfp_mask 0x242020(__GFP_HIGH|__GFP_NOWARN|__GFP_COMP|__GFP_THISNODE), pid 6562, tgid 6562 (syz-executor469), ts 291264206650, free_ts 291263177339
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook+0x2cf/0x340 mm/page_alloc.c:1536
prep_new_page mm/page_alloc.c:1543 [inline]
get_page_from_freelist+0xee0/0x2f20 mm/page_alloc.c:3170
__alloc_pages+0x1d0/0x4a0 mm/page_alloc.c:4426
__alloc_pages_node include/linux/gfp.h:237 [inline]
kmem_getpages mm/slab.c:1356 [inline]
cache_grow_begin+0x99/0x3a0 mm/slab.c:2550
cache_alloc_refill+0x294/0x3a0 mm/slab.c:2923
____cache_alloc mm/slab.c:2999 [inline]
____cache_alloc mm/slab.c:2982 [inline]
__do_cache_alloc mm/slab.c:3182 [inline]
slab_alloc_node mm/slab.c:3230 [inline]
__kmem_cache_alloc_node+0x3c5/0x470 mm/slab.c:3521
kmalloc_trace+0x25/0xe0 mm/slab_common.c:1114
kmalloc include/linux/slab.h:599 [inline]
kzalloc include/linux/slab.h:720 [inline]
tls_ctx_create+0x45/0x140 net/tls/tls_main.c:808
tls_init net/tls/tls_main.c:951 [inline]
tls_init+0x11e/0xbc0 net/tls/tls_main.c:928
__tcp_set_ulp net/ipv4/tcp_ulp.c:146 [inline]
tcp_set_ulp+0x31f/0x7e0 net/ipv4/tcp_ulp.c:167
do_tcp_setsockopt+0x5cb/0x2830 net/ipv4/tcp.c:3429
tcp_setsockopt+0xd4/0x100 net/ipv4/tcp.c:3679
__sys_setsockopt+0x2cd/0x5b0 net/socket.c:2308
__do_sys_setsockopt net/socket.c:2319 [inline]
__se_sys_setsockopt net/socket.c:2316 [inline]
__x64_sys_setsockopt+0xbd/0x150 net/socket.c:2316
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x38/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1136 [inline]
free_unref_page_prepare+0x476/0xa40 mm/page_alloc.c:2312
free_unref_page+0x33/0x3b0 mm/page_alloc.c:2405
__folio_put_small mm/swap.c:106 [inline]
__folio_put+0xc3/0x110 mm/swap.c:129
folio_put include/linux/mm.h:1475 [inline]
put_page include/linux/mm.h:1544 [inline]
free_page_and_swap_cache+0x25a/0x2d0 mm/swap_state.c:303
__tlb_remove_table arch/x86/include/asm/tlb.h:34 [inline]
__tlb_remove_table_free mm/mmu_gather.c:154 [inline]
tlb_remove_table_rcu+0x89/0xe0 mm/mmu_gather.c:209
rcu_do_batch kernel/rcu/tree.c:2139 [inline]
rcu_core+0x805/0x1bb0 kernel/rcu/tree.c:2403
__do_softirq+0x218/0x965 kernel/softirq.c:553
Memory state around the buggy address:
ffff88801f5a7c00: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801f5a7c80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff88801f5a7d00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88801f5a7d80: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88801f5a7e00: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
---
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.
If the bug is already fixed, 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 bug's subsystems, reply with:
#syz set subsystems: new-subsystem
(See the list of subsystem names on the web dashboard)
If the bug is a duplicate of another bug, reply with:
#syz dup: exact-subject-of-another-report
If you want to undo deduplication, reply with:
#syz undup
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2023-10-02 0:53 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20230930074624.1542-1-hdanton@sina.com>
2023-09-30 8:10 ` [syzbot] [net?] KASAN: slab-use-after-free Read in tls_encrypt_done syzbot
[not found] <20231002003015.103-1-hdanton@sina.com>
2023-10-02 0:53 ` syzbot
[not found] <20230930045452.1463-1-hdanton@sina.com>
2023-09-30 5:15 ` syzbot
[not found] <20230930033224.1393-1-hdanton@sina.com>
2023-09-30 3:48 ` syzbot
2023-09-29 18:43 syzbot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).