KASAN: use-after-free Read in diAlloc

9 views
Skip to first unread message

syzbot

unread,
Oct 2, 2022, 7:41:39 PM10/2/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 3f8a27f9e27b Linux 4.19.211
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13eff798880000
kernel config: https://syzkaller.appspot.com/x/.config?x=9b9277b418617afe
dashboard link: https://syzkaller.appspot.com/bug?extid=509be8151ee976013200
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1111c4a2880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17b12148880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/98c0bdb4abb3/disk-3f8a27f9.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/ea228ff02669/vmlinux-3f8a27f9.xz

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

==================================================================
BUG: KASAN: use-after-free in atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
BUG: KASAN: use-after-free in diAlloc+0x20e/0x1440 fs/jfs/jfs_imap.c:1374
Read of size 4 at addr ffff8880b02a468c by task syz-executor337/8112

CPU: 1 PID: 8112 Comm: syz-executor337 Not tainted 4.19.211-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1fc/0x2ef lib/dump_stack.c:118
print_address_description.cold+0x54/0x219 mm/kasan/report.c:256
kasan_report_error.cold+0x8a/0x1b9 mm/kasan/report.c:354
kasan_report+0x8f/0xa0 mm/kasan/report.c:412
atomic_read include/asm-generic/atomic-instrumented.h:21 [inline]
diAlloc+0x20e/0x1440 fs/jfs/jfs_imap.c:1374
ialloc+0x8c/0x970 fs/jfs/jfs_inode.c:69
jfs_create.part.0+0x12b/0x880 fs/jfs/namei.c:105
jfs_create+0x3f/0x60 fs/jfs/namei.c:90
lookup_open+0x893/0x1a20 fs/namei.c:3235
do_last fs/namei.c:3327 [inline]
path_openat+0x1094/0x2df0 fs/namei.c:3537
do_filp_open+0x18c/0x3f0 fs/namei.c:3567
do_sys_open+0x3b3/0x520 fs/open.c:1085
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x7fe0d9ce1eb9
Code: ff ff c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 40 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 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007fffbe6589f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007fe0d9ce1eb9
RDX: 0000000000000000 RSI: 0000000000141042 RDI: 0000000020000200
RBP: 00007fe0d9ca1720 R08: 00005555563b82c0 R09: 0000000000000000
R10: 00007fffbe6588c0 R11: 0000000000000246 R12: 0000000200000004
R13: 0000000000000000 R14: 00080000000000f8 R15: 0000000000000000

Allocated by task 6238:
kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
getname_flags+0xce/0x590 fs/namei.c:140
user_path_at_empty+0x2a/0x50 fs/namei.c:2609
do_readlinkat+0xcd/0x2f0 fs/stat.c:394
__do_sys_readlinkat fs/stat.c:421 [inline]
__se_sys_readlinkat fs/stat.c:418 [inline]
__x64_sys_readlinkat+0x93/0xf0 fs/stat.c:418
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6238:
__cache_free mm/slab.c:3503 [inline]
kmem_cache_free+0x7f/0x260 mm/slab.c:3765
putname+0xe1/0x120 fs/namei.c:261
filename_lookup+0x3d0/0x5a0 fs/namei.c:2358
do_readlinkat+0xcd/0x2f0 fs/stat.c:394
__do_sys_readlinkat fs/stat.c:421 [inline]
__se_sys_readlinkat fs/stat.c:418 [inline]
__x64_sys_readlinkat+0x93/0xf0 fs/stat.c:418
do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8880b02a4380
which belongs to the cache names_cache of size 4096
The buggy address is located 780 bytes inside of
4096-byte region [ffff8880b02a4380, ffff8880b02a5380)
The buggy address belongs to the page:
page:ffffea0002c0a900 count:1 mapcount:0 mapping:ffff88823b843380 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea0002522808 ffffea0002beee08 ffff88823b843380
raw: 0000000000000000 ffff8880b02a4380 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b02a4580: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880b02a4600: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
>ffff8880b02a4680: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880b02a4700: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff8880b02a4780: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================


---
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 can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Oct 3, 2022, 5:45:37 AM10/3/22
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: 9d5c0b3a8e1a Linux 4.14.295
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=1212ee24880000
kernel config: https://syzkaller.appspot.com/x/.config?x=746c079015a92425
dashboard link: https://syzkaller.appspot.com/bug?extid=04643c5bca6163c7ac34
compiler: gcc version 10.2.1 20210110 (Debian 10.2.1-6)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=104a17c0880000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=10b05614880000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/ed6fcf5895a2/disk-9d5c0b3a.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/341aa3534116/vmlinux-9d5c0b3a.xz

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

==================================================================
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:185 [inline]
BUG: KASAN: use-after-free in atomic_read arch/x86/include/asm/atomic.h:27 [inline]
BUG: KASAN: use-after-free in diAlloc+0xe7e/0x1230 fs/jfs/jfs_imap.c:1380
Read of size 4 at addr ffff8880b305e90c by task syz-executor178/7979

CPU: 0 PID: 7979 Comm: syz-executor178 Not tainted 4.14.295-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 09/22/2022
Call Trace:
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x1b2/0x281 lib/dump_stack.c:58
print_address_description.cold+0x54/0x1d3 mm/kasan/report.c:252
kasan_report_error.cold+0x8a/0x191 mm/kasan/report.c:351
kasan_report mm/kasan/report.c:409 [inline]
__asan_report_load4_noabort+0x68/0x70 mm/kasan/report.c:429
__read_once_size include/linux/compiler.h:185 [inline]
atomic_read arch/x86/include/asm/atomic.h:27 [inline]
diAlloc+0xe7e/0x1230 fs/jfs/jfs_imap.c:1380
ialloc+0x7b/0x940 fs/jfs/jfs_inode.c:70
jfs_create.part.0+0xf7/0x800 fs/jfs/namei.c:105
jfs_create+0x35/0x50 fs/jfs/namei.c:90
lookup_open+0x77a/0x1750 fs/namei.c:3241
do_last fs/namei.c:3334 [inline]
path_openat+0xe08/0x2970 fs/namei.c:3571
do_filp_open+0x179/0x3c0 fs/namei.c:3605
do_sys_open+0x296/0x410 fs/open.c:1081
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb
RIP: 0033:0x7f04dea49eb9
RSP: 002b:00007ffdbf2222c8 EFLAGS: 00000246 ORIG_RAX: 0000000000000002
RAX: ffffffffffffffda RBX: 0000000000000000 RCX: 00007f04dea49eb9
RDX: 0000000000000000 RSI: 0000000000141042 RDI: 0000000020000200
RBP: 00007f04dea09720 R08: 00005555572832c0 R09: 0000000000000000
R10: 00007ffdbf222190 R11: 0000000000000246 R12: 0000000200000004
R13: 0000000000000000 R14: 00080000000000f8 R15: 0000000000000000

Allocated by task 6249:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_kmalloc+0xeb/0x160 mm/kasan/kasan.c:551
kmem_cache_alloc+0x124/0x3c0 mm/slab.c:3552
skb_clone+0x126/0x9a0 net/core/skbuff.c:1291
do_one_broadcast net/netlink/af_netlink.c:1421 [inline]
netlink_broadcast_filtered+0x815/0x9e0 net/netlink/af_netlink.c:1496
netlink_broadcast net/netlink/af_netlink.c:1520 [inline]
netlink_sendmsg+0x9fd/0xbc0 net/netlink/af_netlink.c:1891
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

Freed by task 6249:
save_stack mm/kasan/kasan.c:447 [inline]
set_track mm/kasan/kasan.c:459 [inline]
kasan_slab_free+0xc3/0x1a0 mm/kasan/kasan.c:524
__cache_free mm/slab.c:3496 [inline]
kmem_cache_free+0x7c/0x2b0 mm/slab.c:3758
kfree_skbmem+0x98/0x100 net/core/skbuff.c:595
__kfree_skb net/core/skbuff.c:655 [inline]
kfree_skb+0xf4/0x390 net/core/skbuff.c:672
do_one_broadcast net/netlink/af_netlink.c:1445 [inline]
netlink_broadcast_filtered+0x575/0x9e0 net/netlink/af_netlink.c:1496
netlink_broadcast net/netlink/af_netlink.c:1520 [inline]
netlink_sendmsg+0x9fd/0xbc0 net/netlink/af_netlink.c:1891
sock_sendmsg_nosec net/socket.c:646 [inline]
sock_sendmsg+0xb5/0x100 net/socket.c:656
___sys_sendmsg+0x6c8/0x800 net/socket.c:2062
__sys_sendmsg+0xa3/0x120 net/socket.c:2096
SYSC_sendmsg net/socket.c:2107 [inline]
SyS_sendmsg+0x27/0x40 net/socket.c:2103
do_syscall_64+0x1d5/0x640 arch/x86/entry/common.c:292
entry_SYSCALL_64_after_hwframe+0x46/0xbb

The buggy address belongs to the object at ffff8880b305e8c0
which belongs to the cache skbuff_head_cache of size 232
The buggy address is located 76 bytes inside of
232-byte region [ffff8880b305e8c0, ffff8880b305e9a8)
The buggy address belongs to the page:
page:ffffea0002cc1780 count:1 mapcount:0 mapping:ffff8880b305e000 index:0x0
flags: 0xfff00000000100(slab)
raw: 00fff00000000100 ffff8880b305e000 0000000000000000 000000010000000c
raw: ffffea00026e78a0 ffffea00026ed360 ffff8880b5538900 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8880b305e800: fb fb fb fb fb fb fb fb fb fb fb fb fb fc fc fc
ffff8880b305e880: fc fc fc fc fc fc fc fc fb fb fb fb fb fb fb fb
>ffff8880b305e900: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
^
ffff8880b305e980: fb fb fb fb fb fc fc fc fc fc fc fc fc fc fc fc
ffff8880b305ea00: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
Reply all
Reply to author
Forward
0 new messages