[v6.1] UBSAN: array-index-out-of-bounds in dbFindLeaf

0 views
Skip to first unread message

syzbot

unread,
Jun 30, 2023, 11:36:00 AM6/30/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: a1c449d00ff8 Linux 6.1.36
git tree: linux-6.1.y
console output: https://syzkaller.appspot.com/x/log.txt?x=13c21134a80000
kernel config: https://syzkaller.appspot.com/x/.config?x=88fba5343539f90e
dashboard link: https://syzkaller.appspot.com/bug?extid=f13e21cafdff50a3757d
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64

Unfortunately, I don't have any reproducer for this issue yet.

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/46c419b02b39/disk-a1c449d0.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/cc8fc6c3c06c/vmlinux-a1c449d0.xz
kernel image: https://storage.googleapis.com/syzbot-assets/7ed5c1022bfe/Image-a1c449d0.gz.xz

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

loop3: detected capacity change from 0 to 32768
================================================================================
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:2942:16
index 1381 is out of range for type 's8[1365]' (aka 'signed char[1365]')
CPU: 0 PID: 20984 Comm: syz-executor.3 Not tainted 6.1.36-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0xfc/0x148 lib/ubsan.c:282
dbFindLeaf+0x2b8/0x3e4 fs/jfs/jfs_dmap.c:2942
dbAllocDmapLev+0xc4/0x3b8 fs/jfs/jfs_dmap.c:1953
dbAllocCtl+0x104/0x840 fs/jfs/jfs_dmap.c:1809
dbAllocAG+0x208/0xe4c fs/jfs/jfs_dmap.c:1350
dbAlloc+0x520/0xb68 fs/jfs/jfs_dmap.c:874
dtSplitUp fs/jfs/jfs_dtree.c:974 [inline]
dtInsert+0xab0/0x54f4 fs/jfs/jfs_dtree.c:863
jfs_mkdir+0x6bc/0xa0c fs/jfs/namei.c:270
vfs_mkdir+0x334/0x4e4 fs/namei.c:4036
do_mkdirat+0x20c/0x610 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4074
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
================================================================================
==================================================================
BUG: KASAN: slab-out-of-bounds in dbFindLeaf+0x24c/0x3e4 fs/jfs/jfs_dmap.c:2942
Read of size 1 at addr ffff0000ca5e35b6 by task syz-executor.3/20984

CPU: 0 PID: 20984 Comm: syz-executor.3 Not tainted 6.1.36-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description mm/kasan/report.c:284 [inline]
print_report+0x174/0x4c0 mm/kasan/report.c:395
kasan_report+0xd4/0x130 mm/kasan/report.c:495
__asan_report_load1_noabort+0x2c/0x38 mm/kasan/report_generic.c:348
dbFindLeaf+0x24c/0x3e4 fs/jfs/jfs_dmap.c:2942
dbAllocDmapLev+0xc4/0x3b8 fs/jfs/jfs_dmap.c:1953
dbAllocCtl+0x104/0x840 fs/jfs/jfs_dmap.c:1809
dbAllocAG+0x208/0xe4c fs/jfs/jfs_dmap.c:1350
dbAlloc+0x520/0xb68 fs/jfs/jfs_dmap.c:874
dtSplitUp fs/jfs/jfs_dtree.c:974 [inline]
dtInsert+0xab0/0x54f4 fs/jfs/jfs_dtree.c:863
jfs_mkdir+0x6bc/0xa0c fs/jfs/namei.c:270
vfs_mkdir+0x334/0x4e4 fs/namei.c:4036
do_mkdirat+0x20c/0x610 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4074
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

Allocated by task 4276:
kasan_save_stack mm/kasan/common.c:45 [inline]
kasan_set_track+0x4c/0x80 mm/kasan/common.c:52
kasan_save_alloc_info+0x24/0x30 mm/kasan/generic.c:505
____kasan_kmalloc mm/kasan/common.c:374 [inline]
__kasan_kmalloc+0xac/0xc4 mm/kasan/common.c:383
kasan_kmalloc include/linux/kasan.h:211 [inline]
kmalloc_trace+0x7c/0x94 mm/slab_common.c:1050
kmalloc include/linux/slab.h:553 [inline]
kzalloc include/linux/slab.h:689 [inline]
ref_tracker_alloc+0x130/0x3dc lib/ref_tracker.c:85
__netdev_tracker_alloc include/linux/netdevice.h:4008 [inline]
netdev_hold include/linux/netdevice.h:4037 [inline]
qdisc_alloc+0x5a8/0x7dc net/sched/sch_generic.c:974
qdisc_create_dflt+0x70/0x5b0 net/sched/sch_generic.c:996
attach_one_default_qdisc net/sched/sch_generic.c:1159 [inline]
netdev_for_each_tx_queue include/linux/netdevice.h:2453 [inline]
attach_default_qdiscs net/sched/sch_generic.c:1177 [inline]
dev_activate+0x350/0x10bc net/sched/sch_generic.c:1236
__dev_open+0x3a8/0x4fc net/core/dev.c:1441
__dev_change_flags+0x1a8/0x5a0 net/core/dev.c:8550
dev_change_flags+0x80/0x154 net/core/dev.c:8621
do_setlink+0xc70/0x3328 net/core/rtnetlink.c:2788
__rtnl_newlink net/core/rtnetlink.c:3553 [inline]
rtnl_newlink+0x13b8/0x1b04 net/core/rtnetlink.c:3600
rtnetlink_rcv_msg+0x72c/0xd94 net/core/rtnetlink.c:6097
netlink_rcv_skb+0x20c/0x3b8 net/netlink/af_netlink.c:2524
rtnetlink_rcv+0x28/0x38 net/core/rtnetlink.c:6115
netlink_unicast_kernel net/netlink/af_netlink.c:1328 [inline]
netlink_unicast+0x660/0x8d4 net/netlink/af_netlink.c:1354
netlink_sendmsg+0x834/0xb18 net/netlink/af_netlink.c:1902
sock_sendmsg_nosec net/socket.c:716 [inline]
sock_sendmsg net/socket.c:736 [inline]
__sys_sendto+0x3b4/0x504 net/socket.c:2117
__do_sys_sendto net/socket.c:2129 [inline]
__se_sys_sendto net/socket.c:2125 [inline]
__arm64_sys_sendto+0xd8/0xf8 net/socket.c:2125
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581

The buggy address belongs to the object at ffff0000ca5e3500
which belongs to the cache kmalloc-128 of size 128
The buggy address is located 54 bytes to the right of
128-byte region [ffff0000ca5e3500, ffff0000ca5e3580)

The buggy address belongs to the physical page:
page:00000000051c6d1c refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff0000ca5e3000 pfn:0x10a5e3
flags: 0x5ffc00000000200(slab|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000000200 fffffc0003377608 fffffc0003c88a88 ffff0000c0002300
raw: ffff0000ca5e3000 000000000010000c 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000ca5e3480: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
ffff0000ca5e3500: 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000ca5e3580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff0000ca5e3600: 00 00 00 00 00 00 00 00 00 00 00 00 00 fc fc fc
ffff0000ca5e3680: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
================================================================================
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:1965:6
index 1431655765 is out of range for type 's8[341]' (aka 'signed char[341]')
CPU: 0 PID: 20984 Comm: syz-executor.3 Tainted: G B 6.1.36-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0xfc/0x148 lib/ubsan.c:282
dbAllocDmapLev+0x374/0x3b8 fs/jfs/jfs_dmap.c:1965
dbAllocCtl+0x104/0x840 fs/jfs/jfs_dmap.c:1809
dbAllocAG+0x208/0xe4c fs/jfs/jfs_dmap.c:1350
dbAlloc+0x520/0xb68 fs/jfs/jfs_dmap.c:874
dtSplitUp fs/jfs/jfs_dtree.c:974 [inline]
dtInsert+0xab0/0x54f4 fs/jfs/jfs_dtree.c:863
jfs_mkdir+0x6bc/0xa0c fs/jfs/namei.c:270
vfs_mkdir+0x334/0x4e4 fs/namei.c:4036
do_mkdirat+0x20c/0x610 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4074
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
================================================================================
================================================================================
UBSAN: array-index-out-of-bounds in fs/jfs/jfs_dmap.c:1966:23
index 1431655680 is out of range for type '__le32[256]' (aka 'unsigned int[256]')
CPU: 0 PID: 20984 Comm: syz-executor.3 Tainted: G B 6.1.36-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
Call trace:
dump_backtrace+0x1c8/0x1f4 arch/arm64/kernel/stacktrace.c:158
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:165
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
dump_stack+0x1c/0x58 lib/dump_stack.c:113
ubsan_epilogue lib/ubsan.c:151 [inline]
__ubsan_handle_out_of_bounds+0xfc/0x148 lib/ubsan.c:282
dbAllocDmapLev+0x38c/0x3b8 fs/jfs/jfs_dmap.c:1966
dbAllocCtl+0x104/0x840 fs/jfs/jfs_dmap.c:1809
dbAllocAG+0x208/0xe4c fs/jfs/jfs_dmap.c:1350
dbAlloc+0x520/0xb68 fs/jfs/jfs_dmap.c:874
dtSplitUp fs/jfs/jfs_dtree.c:974 [inline]
dtInsert+0xab0/0x54f4 fs/jfs/jfs_dtree.c:863
jfs_mkdir+0x6bc/0xa0c fs/jfs/namei.c:270
vfs_mkdir+0x334/0x4e4 fs/namei.c:4036
do_mkdirat+0x20c/0x610 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4074
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
================================================================================
Unable to handle kernel paging request at virtual address ffff600043f66f80
KASAN: maybe wild-memory-access in range [0xffff00021fb37c00-0xffff00021fb37c07]
Mem abort info:
ESR = 0x0000000096000005
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x05: level 1 translation fault
Data abort info:
ISV = 0, ISS = 0x00000005
CM = 0, WnR = 0
swapper pgtable: 4k pages, 48-bit VAs, pgdp=00000001b1f53000
[ffff600043f66f80] pgd=000000023c8e3003, p4d=000000023c8e3003, pud=0000000000000000
Internal error: Oops: 0000000096000005 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 20984 Comm: syz-executor.3 Tainted: G B 6.1.36-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 05/27/2023
pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : dbAllocDmapLev+0x194/0x3b8 fs/jfs/jfs_dmap.c:1966
lr : dbAllocDmapLev+0x38c/0x3b8 fs/jfs/jfs_dmap.c:1966
sp : ffff800023637060
x29: ffff8000236370f0 x28: 1ffff000046c6e10 x27: dfff800000000000
x26: 0000000000000001 x25: ffff00021fb37c00 x24: ffffffffaaaaa000
x23: 0000000000000000 x22: ffff0000db220000 x21: ffff0000ca5e2000
x20: 0000000000000000 x19: 0000000000000001 x18: 1fffe000368b5f76
x17: ffff8000155bd000 x16: ffff80001210ac24 x15: ffff0001b45afbbc
x14: ffff0001b45afbb8 x13: 1fffe000368b5f76 x12: 0000000000040000
x11: 000000000003ffff x10: ffff80002614d000 x9 : ffff8000081adec8
x8 : 1fffe00043f66f80 x7 : 1fffe000368b5f77 x6 : ffff80000827cdcc
x5 : 0000000000000000 x4 : 0000000000000001 x3 : ffff8000081ade90
x2 : 0000000000000001 x1 : 0000000000000004 x0 : 00000000ffffffff
Call trace:
dbAllocDmapLev+0x194/0x3b8 fs/jfs/jfs_dmap.c:1966
dbAllocCtl+0x104/0x840 fs/jfs/jfs_dmap.c:1809
dbAllocAG+0x208/0xe4c fs/jfs/jfs_dmap.c:1350
dbAlloc+0x520/0xb68 fs/jfs/jfs_dmap.c:874
dtSplitUp fs/jfs/jfs_dtree.c:974 [inline]
dtInsert+0xab0/0x54f4 fs/jfs/jfs_dtree.c:863
jfs_mkdir+0x6bc/0xa0c fs/jfs/namei.c:270
vfs_mkdir+0x334/0x4e4 fs/namei.c:4036
do_mkdirat+0x20c/0x610 fs/namei.c:4061
__do_sys_mkdirat fs/namei.c:4076 [inline]
__se_sys_mkdirat fs/namei.c:4074 [inline]
__arm64_sys_mkdirat+0x90/0xa8 fs/namei.c:4074
__invoke_syscall arch/arm64/kernel/syscall.c:38 [inline]
invoke_syscall+0x98/0x2c0 arch/arm64/kernel/syscall.c:52
el0_svc_common+0x138/0x258 arch/arm64/kernel/syscall.c:142
do_el0_svc+0x64/0x218 arch/arm64/kernel/syscall.c:206
el0_svc+0x58/0x168 arch/arm64/kernel/entry-common.c:637
el0t_64_sync_handler+0x84/0xf0 arch/arm64/kernel/entry-common.c:655
el0t_64_sync+0x18c/0x190 arch/arm64/kernel/entry.S:581
Code: 8b190aa8 2a1303fa 91200119 d343ff28 (38fb6908)
---[ end trace 0000000000000000 ]---
----------------
Code disassembly (best guess):
0: 8b190aa8 add x8, x21, x25, lsl #2
4: 2a1303fa mov w26, w19
8: 91200119 add x25, x8, #0x800
c: d343ff28 lsr x8, x25, #3
* 10: 38fb6908 ldrsb w8, [x8, x27] <-- trapping instruction


---
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 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 8, 2023, 11:35:53 AM10/8/23
to syzkaller...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages