[Android 5.4] KASAN: use-after-free Read in get_max_inline_xattr_value_size (2)

7 views
Skip to first unread message

syzbot

unread,
Jul 15, 2023, 5:37:04 AM7/15/23
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 6d5c2c1877e5 UPSTREAM: usb: gadget: udc: renesas_usb3: Fix..
git tree: android12-5.4
console+strace: https://syzkaller.appspot.com/x/log.txt?x=16835462a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=7e7a30073ba0c05d
dashboard link: https://syzkaller.appspot.com/bug?extid=4d9e1952e516bf404bfe
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=149e0eb6a80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15d0af32a80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/c5f411325ee7/disk-6d5c2c18.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/eeda11c0d078/vmlinux-6d5c2c18.xz
kernel image: https://storage.googleapis.com/syzbot-assets/ae14e5605e9e/bzImage-6d5c2c18.xz
mounted in repro: https://storage.googleapis.com/syzbot-assets/a788490d9b61/mount_0.gz

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

EXT4-fs (loop0): mounted filesystem without journal. Opts: ,errors=continue
EXT4-fs error (device loop0): ext4_xattr_ibody_get:617: inode #18: comm syz-executor197: corrupted in-inode xattr
==================================================================
BUG: KASAN: use-after-free in get_max_inline_xattr_value_size+0x369/0x510 fs/ext4/inline.c:61
Read of size 4 at addr ffff8881dc88e004 by task syz-executor197/379

CPU: 0 PID: 379 Comm: syz-executor197 Not tainted 5.4.242-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/03/2023
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x241 lib/dump_stack.c:118
print_address_description+0x8c/0x600 mm/kasan/report.c:384
__kasan_report+0xf3/0x120 mm/kasan/report.c:516
kasan_report+0x30/0x60 mm/kasan/common.c:653
get_max_inline_xattr_value_size+0x369/0x510 fs/ext4/inline.c:61
ext4_get_max_inline_size+0x134/0x1f0 fs/ext4/inline.c:112
ext4_try_to_write_inline_data+0xda/0x1720 fs/ext4/inline.c:672
ext4_write_begin+0x25a/0x1900 fs/ext4/inode.c:1314
ext4_da_write_begin+0x4a3/0xfe0 fs/ext4/inode.c:3120
generic_perform_write+0x2c7/0x560 mm/filemap.c:3311
__generic_file_write_iter+0x224/0x530 mm/filemap.c:3440
ext4_file_write_iter+0x499/0x10e0 fs/ext4/file.c:270
call_write_iter include/linux/fs.h:1981 [inline]
new_sync_write fs/read_write.c:483 [inline]
__vfs_write+0x5d3/0x750 fs/read_write.c:496
vfs_write+0x206/0x4e0 fs/read_write.c:558
ksys_write+0x199/0x2c0 fs/read_write.c:611
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Allocated by task 350:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
__kasan_kmalloc+0x171/0x210 mm/kasan/common.c:529
slab_post_alloc_hook mm/slab.h:584 [inline]
slab_alloc_node mm/slub.c:2829 [inline]
slab_alloc mm/slub.c:2837 [inline]
kmem_cache_alloc+0xd9/0x250 mm/slub.c:2842
skb_clone+0x1c0/0x360 net/core/skbuff.c:1467
dev_queue_xmit_nit+0x258/0xa10 net/core/dev.c:1966
xmit_one net/core/dev.c:3207 [inline]
dev_hard_start_xmit+0x12b/0x6b0 net/core/dev.c:3227
sch_direct_xmit+0x28f/0xa10 net/sched/sch_generic.c:336
qdisc_restart net/sched/sch_generic.c:401 [inline]
__qdisc_run+0xa14/0x1e80 net/sched/sch_generic.c:409
qdisc_run+0xf8/0x300 include/net/pkt_sched.h:122
__dev_xmit_skb net/core/dev.c:3403 [inline]
__dev_queue_xmit+0xb43/0x27e0 net/core/dev.c:3758
neigh_hh_output include/net/neighbour.h:509 [inline]
neigh_output include/net/neighbour.h:523 [inline]
ip_finish_output2+0xb4f/0xfc0 net/ipv4/ip_output.c:236
NF_HOOK_COND include/linux/netfilter.h:297 [inline]
ip_output+0x19b/0x3a0 net/ipv4/ip_output.c:440
dst_output include/net/dst.h:444 [inline]
ip_local_out net/ipv4/ip_output.c:126 [inline]
__ip_queue_xmit+0xfaa/0x1850 net/ipv4/ip_output.c:541
__tcp_transmit_skb+0x1de5/0x3390 net/ipv4/tcp_output.c:1180
tcp_transmit_skb net/ipv4/tcp_output.c:1196 [inline]
tcp_write_xmit+0x17b0/0x5cd0 net/ipv4/tcp_output.c:2467
__tcp_push_pending_frames+0x91/0x2e0 net/ipv4/tcp_output.c:2648
tcp_sendmsg_locked+0x2fff/0x3810 net/ipv4/tcp.c:1417
tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1447
sock_sendmsg_nosec net/socket.c:638 [inline]
sock_sendmsg net/socket.c:658 [inline]
sock_write_iter+0x344/0x470 net/socket.c:990
call_write_iter include/linux/fs.h:1981 [inline]
new_sync_write fs/read_write.c:483 [inline]
__vfs_write+0x5d3/0x750 fs/read_write.c:496
vfs_write+0x206/0x4e0 fs/read_write.c:558
ksys_write+0x199/0x2c0 fs/read_write.c:611
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Freed by task 350:
save_stack mm/kasan/common.c:70 [inline]
set_track mm/kasan/common.c:78 [inline]
kasan_set_free_info mm/kasan/common.c:345 [inline]
__kasan_slab_free+0x1b5/0x270 mm/kasan/common.c:487
slab_free_hook mm/slub.c:1455 [inline]
slab_free_freelist_hook mm/slub.c:1494 [inline]
slab_free mm/slub.c:3080 [inline]
kmem_cache_free+0x10b/0x2c0 mm/slub.c:3096
packet_rcv+0x13b/0x1170 net/packet/af_packet.c:2168
dev_queue_xmit_nit+0x976/0xa10 net/core/dev.c:1998
xmit_one net/core/dev.c:3207 [inline]
dev_hard_start_xmit+0x12b/0x6b0 net/core/dev.c:3227
sch_direct_xmit+0x28f/0xa10 net/sched/sch_generic.c:336
qdisc_restart net/sched/sch_generic.c:401 [inline]
__qdisc_run+0xa14/0x1e80 net/sched/sch_generic.c:409
qdisc_run+0xf8/0x300 include/net/pkt_sched.h:122
__dev_xmit_skb net/core/dev.c:3403 [inline]
__dev_queue_xmit+0xb43/0x27e0 net/core/dev.c:3758
neigh_hh_output include/net/neighbour.h:509 [inline]
neigh_output include/net/neighbour.h:523 [inline]
ip_finish_output2+0xb4f/0xfc0 net/ipv4/ip_output.c:236
NF_HOOK_COND include/linux/netfilter.h:297 [inline]
ip_output+0x19b/0x3a0 net/ipv4/ip_output.c:440
dst_output include/net/dst.h:444 [inline]
ip_local_out net/ipv4/ip_output.c:126 [inline]
__ip_queue_xmit+0xfaa/0x1850 net/ipv4/ip_output.c:541
__tcp_transmit_skb+0x1de5/0x3390 net/ipv4/tcp_output.c:1180
tcp_transmit_skb net/ipv4/tcp_output.c:1196 [inline]
tcp_write_xmit+0x17b0/0x5cd0 net/ipv4/tcp_output.c:2467
__tcp_push_pending_frames+0x91/0x2e0 net/ipv4/tcp_output.c:2648
tcp_sendmsg_locked+0x2fff/0x3810 net/ipv4/tcp.c:1417
tcp_sendmsg+0x2c/0x40 net/ipv4/tcp.c:1447
sock_sendmsg_nosec net/socket.c:638 [inline]
sock_sendmsg net/socket.c:658 [inline]
sock_write_iter+0x344/0x470 net/socket.c:990
call_write_iter include/linux/fs.h:1981 [inline]
new_sync_write fs/read_write.c:483 [inline]
__vfs_write+0x5d3/0x750 fs/read_write.c:496
vfs_write+0x206/0x4e0 fs/read_write.c:558
ksys_write+0x199/0x2c0 fs/read_write.c:611
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

The buggy address belongs to the object at ffff8881dc88e000
which belongs to the cache skbuff_head_cache of size 240
The buggy address is located 4 bytes inside of
240-byte region [ffff8881dc88e000, ffff8881dc88e0f0)
The buggy address belongs to the page:
page:ffffea0007722380 refcount:1 mapcount:0 mapping:ffff8881f1cd8c80 index:0x0
flags: 0x8000000000000200(slab)
raw: 8000000000000200 dead000000000100 dead000000000122 ffff8881f1cd8c80
raw: 0000000000000000 00000000000c000c 00000001ffffffff 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 0x12a20(GFP_ATOMIC|__GFP_NOWARN|__GFP_NORETRY)
set_page_owner include/linux/page_owner.h:31 [inline]
post_alloc_hook mm/page_alloc.c:2165 [inline]
prep_new_page+0x18f/0x370 mm/page_alloc.c:2171
get_page_from_freelist+0x2d13/0x2d90 mm/page_alloc.c:3794
__alloc_pages_nodemask+0x393/0x840 mm/page_alloc.c:4891
alloc_slab_page+0x39/0x3c0 mm/slub.c:343
allocate_slab mm/slub.c:1683 [inline]
new_slab+0x97/0x440 mm/slub.c:1749
new_slab_objects mm/slub.c:2505 [inline]
___slab_alloc+0x2fe/0x490 mm/slub.c:2667
__slab_alloc+0x62/0xa0 mm/slub.c:2707
slab_alloc_node mm/slub.c:2792 [inline]
slab_alloc mm/slub.c:2837 [inline]
kmem_cache_alloc+0x109/0x250 mm/slub.c:2842
skb_clone+0x1c0/0x360 net/core/skbuff.c:1467
dev_queue_xmit_nit+0x258/0xa10 net/core/dev.c:1966
xmit_one net/core/dev.c:3207 [inline]
dev_hard_start_xmit+0x12b/0x6b0 net/core/dev.c:3227
sch_direct_xmit+0x28f/0xa10 net/sched/sch_generic.c:336
qdisc_restart net/sched/sch_generic.c:401 [inline]
__qdisc_run+0xa14/0x1e80 net/sched/sch_generic.c:409
qdisc_run+0xf8/0x300 include/net/pkt_sched.h:122
__dev_xmit_skb net/core/dev.c:3403 [inline]
__dev_queue_xmit+0xb43/0x27e0 net/core/dev.c:3758
neigh_hh_output include/net/neighbour.h:509 [inline]
neigh_output include/net/neighbour.h:523 [inline]
ip_finish_output2+0xb4f/0xfc0 net/ipv4/ip_output.c:236
page last free stack trace:
reset_page_owner include/linux/page_owner.h:24 [inline]
free_pages_prepare mm/page_alloc.c:1176 [inline]
free_pcp_prepare mm/page_alloc.c:1233 [inline]
free_unref_page_prepare+0x297/0x380 mm/page_alloc.c:3085
free_unref_page_list+0x10a/0x590 mm/page_alloc.c:3154
release_pages+0xad8/0xb20 mm/swap.c:842
pagevec_lru_move_fn+0x1cb/0x250 mm/swap.c:215
__pagevec_lru_add mm/swap.c:966 [inline]
lru_add_drain_cpu+0x105/0x600 mm/swap.c:594
lru_add_drain mm/swap.c:689 [inline]
__pagevec_release+0x6e/0x150 mm/swap.c:859
pagevec_release include/linux/pagevec.h:88 [inline]
shmem_undo_range+0x8a5/0x1ad0 mm/shmem.c:875
shmem_truncate_range mm/shmem.c:997 [inline]
shmem_evict_inode+0x218/0x9a0 mm/shmem.c:1097
evict+0x29b/0x6a0 fs/inode.c:575
__dentry_kill+0x429/0x630 fs/dcache.c:579
dentry_kill+0xb8/0x280 fs/dcache.c:673
dput+0x154/0x2f0 fs/dcache.c:859
do_renameat2+0x9bd/0x1110 fs/namei.c:4712
__do_sys_rename fs/namei.c:4754 [inline]
__se_sys_rename fs/namei.c:4752 [inline]
__x64_sys_rename+0x64/0x70 fs/namei.c:4752
do_syscall_64+0xca/0x1c0 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x5c/0xc1

Memory state around the buggy address:
ffff8881dc88df00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff8881dc88df80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8881dc88e000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8881dc88e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc
ffff8881dc88e100: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
==================================================================
EXT4-fs error (device loop0): ext4_read_block_bitmap_nowait:430: comm syz-executor197: Invalid block bitmap block 4294967295 in block_group 0


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

syzbot

unread,
Oct 31, 2023, 12:10:16 AM10/31/23
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
No recent activity, existing reproducers are no longer triggering the issue.
Reply all
Reply to author
Forward
0 new messages