[Android 5.10] KASAN: use-after-free Write in l2tp_session_delete (4)

0 views
Skip to first unread message

syzbot

unread,
1:46 AM (5 hours ago) 1:46 AM
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 79e905dd56a7 Merge 9eb240b1a025 ("rtc: allow rtc_read_alar..
git tree: android13-5.10-lts
console output: https://syzkaller.appspot.com/x/log.txt?x=13b74176580000
kernel config: https://syzkaller.appspot.com/x/.config?x=29727da16e7886e6
dashboard link: https://syzkaller.appspot.com/bug?extid=b8f66ab4e698cb5f04f8
compiler: Debian clang version 22.1.6 (++20260514074242+fc4aad7b5db3-1~exp1~20260514074407.73), Debian LLD 22.1.6
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1753330e580000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17575efa580000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/f272df92d588/disk-79e905dd.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/d939333057d5/vmlinux-79e905dd.xz
kernel image: https://storage.googleapis.com/syzbot-assets/404a003c829b/bzImage-79e905dd.xz

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

==================================================================
BUG: KASAN: use-after-free in instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
BUG: KASAN: use-after-free in test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
BUG: KASAN: use-after-free in l2tp_session_delete+0x23/0x4a0 net/l2tp/l2tp_core.c:1580
Write of size 8 at addr ffff88810fd58408 by task syz.2.17/384

CPU: 1 PID: 384 Comm: syz.2.17 Not tainted syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
Call Trace:
__dump_stack+0x21/0x24 lib/dump_stack.c:77
dump_stack_lvl+0x1a7/0x208 lib/dump_stack.c:118
print_address_description+0x7f/0x2c0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:435 [inline]
kasan_report+0x100/0x140 mm/kasan/report.c:452
check_region_inline mm/kasan/generic.c:-1 [inline]
kasan_check_range+0x249/0x2a0 mm/kasan/generic.c:189
__kasan_check_write+0x14/0x20 mm/kasan/shadow.c:37
instrument_atomic_read_write include/linux/instrumented.h:101 [inline]
test_and_set_bit include/asm-generic/bitops/instrumented-atomic.h:70 [inline]
l2tp_session_delete+0x23/0x4a0 net/l2tp/l2tp_core.c:1580
pppol2tp_release+0x169/0x2b0 net/l2tp/l2tp_ppp.c:439
__sock_release net/socket.c:597 [inline]
sock_close+0xb8/0x200 net/socket.c:1286
__fput+0x2dc/0x730 fs/file_table.c:281
____fput+0x15/0x20 fs/file_table.c:314
task_work_run+0x127/0x190 kernel/task_work.c:189
tracehook_notify_resume include/linux/tracehook.h:188 [inline]
exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:172
exit_to_user_mode_prepare+0x76/0xa0 kernel/entry/common.c:199
syscall_exit_to_user_mode+0x1d/0x40 kernel/entry/common.c:274
do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f904f2c2e59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffa3b2cf98 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007fffa3b2d080 RCX: 00007f904f2c2e59
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 0000000000006eea R08: 0000000000000001 R09: 0000000000000000
R10: 0000001b32c20000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f904f53bfac R14: 00007f904f53bfa8 R15: 00007f904f53bfa0

Allocated by task 384:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:45 [inline]
set_alloc_info mm/kasan/common.c:430 [inline]
____kasan_kmalloc mm/kasan/common.c:509 [inline]
__kasan_kmalloc+0xd4/0x100 mm/kasan/common.c:518
kasan_kmalloc include/linux/kasan.h:254 [inline]
__kmalloc+0x19f/0x330 mm/slub.c:4038
kmalloc include/linux/slab.h:560 [inline]
kzalloc include/linux/slab.h:667 [inline]
l2tp_session_create+0x39/0xb60 net/l2tp/l2tp_core.c:1616
pppol2tp_connect+0xbf5/0x1640 net/l2tp/l2tp_ppp.c:772
__sys_connect_file net/socket.c:1866 [inline]
__sys_connect+0x3ce/0x450 net/socket.c:1883
__do_sys_connect net/socket.c:1893 [inline]
__se_sys_connect net/socket.c:1890 [inline]
__x64_sys_connect+0x7a/0x90 net/socket.c:1890
do_syscall_64+0x31/0x40 arch/x86/entry/common.c:46
entry_SYSCALL_64_after_hwframe+0x61/0xcb

Freed by task 48:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track+0x4a/0x70 mm/kasan/common.c:45
kasan_set_free_info+0x23/0x40 mm/kasan/generic.c:370
____kasan_slab_free+0x125/0x160 mm/kasan/common.c:362
__kasan_slab_free+0x11/0x20 mm/kasan/common.c:370
kasan_slab_free include/linux/kasan.h:220 [inline]
slab_free_hook mm/slub.c:1600 [inline]
slab_free_freelist_hook+0xc5/0x190 mm/slub.c:1626
slab_free mm/slub.c:3208 [inline]
kfree+0xc0/0x270 mm/slub.c:4196
l2tp_session_free net/l2tp/l2tp_core.c:168 [inline]
l2tp_session_put+0xb2/0x1a0 net/l2tp/l2tp_core.c:193
l2tp_session_delete+0x3a9/0x4a0 net/l2tp/l2tp_core.c:1589
l2tp_tunnel_closeall net/l2tp/l2tp_core.c:1235 [inline]
l2tp_tunnel_del_work+0x180/0x3d0 net/l2tp/l2tp_core.c:1273
process_one_work+0x6fd/0xbc0 kernel/workqueue.c:2301
worker_thread+0xa8e/0x13c0 kernel/workqueue.c:2447
kthread+0x324/0x3b0 kernel/kthread.c:313
ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:298

The buggy address belongs to the object at ffff88810fd58400
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 8 bytes inside of
512-byte region [ffff88810fd58400, ffff88810fd58600)
The buggy address belongs to the page:
page:ffffea00043f5600 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10fd58
head:ffffea00043f5600 order:2 compound_mapcount:0 compound_pincount:0
flags: 0x4000000000010200(slab|head)
raw: 4000000000010200 ffffea0004448700 0000000200000002 ffff888100043080
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected
page_owner tracks the page as allocated
page last allocated via order 2, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 96, ts 5280209113, free_ts 0
set_page_owner include/linux/page_owner.h:35 [inline]
post_alloc_hook mm/page_alloc.c:2456 [inline]
prep_new_page+0x176/0x190 mm/page_alloc.c:2462
get_page_from_freelist+0x225f/0x23f0 mm/page_alloc.c:4254
__alloc_pages_nodemask+0x29a/0x640 mm/page_alloc.c:5384
alloc_slab_page mm/slub.c:-1 [inline]
allocate_slab mm/slub.c:1813 [inline]
new_slab+0x84/0x3f0 mm/slub.c:1874
new_slab_objects mm/slub.c:2632 [inline]
___slab_alloc+0x2f8/0x4c0 mm/slub.c:2796
__slab_alloc+0x63/0xa0 mm/slub.c:2836
slab_alloc_node mm/slub.c:2918 [inline]
slab_alloc mm/slub.c:2960 [inline]
__kmalloc_track_caller+0x1e4/0x310 mm/slub.c:4541
__kmalloc_reserve net/core/skbuff.c:144 [inline]
__alloc_skb+0xdc/0x520 net/core/skbuff.c:212
alloc_skb include/linux/skbuff.h:1126 [inline]
alloc_uevent_skb+0x85/0x240 lib/kobject_uevent.c:290
uevent_net_broadcast_untagged lib/kobject_uevent.c:326 [inline]
kobject_uevent_net_broadcast+0x335/0x5a0 lib/kobject_uevent.c:409
kobject_uevent_env+0x52b/0x700 lib/kobject_uevent.c:608
kobject_synth_uevent+0x452/0x940 lib/kobject_uevent.c:208
store_uevent+0x16/0x30 kernel/module.c:1233
module_attr_store+0x5f/0x80 kernel/params.c:921
sysfs_kf_write+0x129/0x150 fs/sysfs/file.c:139
kernfs_fop_write_iter+0x2bd/0x400 fs/kernfs/file.c:296
page_owner free stack trace missing

Memory state around the buggy address:
ffff88810fd58300: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff88810fd58380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff88810fd58400: fa fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff88810fd58480: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff88810fd58500: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================
------------[ cut here ]------------
refcount_t: underflow; use-after-free.
WARNING: CPU: 1 PID: 384 at lib/refcount.c:28 refcount_warn_saturate+0x120/0x1a0 lib/refcount.c:28
Modules linked in:
CPU: 0 PID: 384 Comm: syz.2.17 Tainted: G B syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/09/2026
RIP: 0010:refcount_warn_saturate+0x120/0x1a0 lib/refcount.c:28
Code: 04 01 48 c7 c7 20 45 40 85 e8 5c a4 3a 02 0f 0b eb c3 e8 33 94 26 ff c6 05 51 81 82 04 01 48 c7 c7 80 45 40 85 e8 40 a4 3a 02 <0f> 0b eb a7 e8 17 94 26 ff c6 05 32 81 82 04 01 48 c7 c7 a0 44 40
RSP: 0018:ffffc90000ca7d18 EFLAGS: 00010246
RAX: 89a7a43a65409400 RBX: 0000000000000003 RCX: ffff88812b4da780
RDX: 0000000000000000 RSI: 0000000080000000 RDI: 0000000000000000
RBP: ffffc90000ca7d28 R08: ffff8881f7127453 R09: 1ffff1103ee24e8a
R10: dffffc0000000000 R11: ffffed103ee24e8b R12: 0000000000000000
R13: dffffc0000000000 R14: 0000000000000003 R15: 0000000000000000
FS: 000055557fd78500(0000) GS:ffff8881f7100000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000200000000000 CR3: 000000011063c000 CR4: 00000000003506a0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
__refcount_sub_and_test include/linux/refcount.h:283 [inline]
__refcount_dec_and_test include/linux/refcount.h:315 [inline]
refcount_dec_and_test include/linux/refcount.h:333 [inline]
l2tp_session_put+0xcb/0x1a0 net/l2tp/l2tp_core.c:192
l2tp_session_delete+0x3a9/0x4a0 net/l2tp/l2tp_core.c:1589
pppol2tp_release+0x169/0x2b0 net/l2tp/l2tp_ppp.c:439
__sock_release net/socket.c:597 [inline]
sock_close+0xb8/0x200 net/socket.c:1286
__fput+0x2dc/0x730 fs/file_table.c:281
____fput+0x15/0x20 fs/file_table.c:314
task_work_run+0x127/0x190 kernel/task_work.c:189
tracehook_notify_resume include/linux/tracehook.h:188 [inline]
exit_to_user_mode_loop+0xcb/0xe0 kernel/entry/common.c:172
exit_to_user_mode_prepare+0x76/0xa0 kernel/entry/common.c:199
syscall_exit_to_user_mode+0x1d/0x40 kernel/entry/common.c:274
do_syscall_64+0x3d/0x40 arch/x86/entry/common.c:56
entry_SYSCALL_64_after_hwframe+0x61/0xcb
RIP: 0033:0x7f904f2c2e59
Code: ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 44 00 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 e8 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffa3b2cf98 EFLAGS: 00000246 ORIG_RAX: 00000000000001b4
RAX: 0000000000000000 RBX: 00007fffa3b2d080 RCX: 00007f904f2c2e59
RDX: 0000000000000000 RSI: 000000000000001e RDI: 0000000000000003
RBP: 0000000000006eea R08: 0000000000000001 R09: 0000000000000000
R10: 0000001b32c20000 R11: 0000000000000246 R12: 0000000000000000
R13: 00007f904f53bfac R14: 00007f904f53bfa8 R15: 00007f904f53bfa0
---[ end trace 3f8df15c5b8bc8c4 ]---


---
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.

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

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

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

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

If you want to undo deduplication, reply with:
#syz undup
Reply all
Reply to author
Forward
0 new messages