syzbot


UBSAN: undefined-behaviour in init_sb

Status: fixed on 2020/11/29 00:01
Reported-by: syzbot+07c79ba5f89db0967309@syzkaller.appspotmail.com
Fix commit: 6a253f385a2d gfs2: add validation checks for size of superblock
First crash: 1279d, last: 1246d
Fix bisection: fixed by (bisect log) :
commit 6a253f385a2dc9f6a5a1da828e0e9e07f6f9d9b9
Author: Anant Thazhemadam <anant.thazhemadam@gmail.com>
Date: Wed Oct 14 16:31:09 2020 +0000

  gfs2: add validation checks for size of superblock

  
Fix bisection attempts (2)
Created Duration User Patch Repo Result
2020/11/28 13:49 3h20m bisect fix linux-4.19.y job log (1)
2020/10/29 12:29 23m bisect fix linux-4.19.y job log (0) log

Sample crash report:
audit: type=1400 audit(1601382360.126:8): avc:  denied  { execmem } for  pid=6487 comm="syz-executor778" scontext=system_u:system_r:kernel_t:s0 tcontext=system_u:system_r:kernel_t:s0 tclass=process permissive=1
gfs2: fsid=loop0: Trying to join cluster "lock_nolock", "loop0"
gfs2: fsid=loop0: Now mounting FS...
================================================================================
UBSAN: Undefined behaviour in fs/gfs2/ops_fstype.c:288:19
shift exponent 4294967287 is too large for 64-bit type 'long unsigned int'
CPU: 1 PID: 6487 Comm: syz-executor778 Not tainted 4.19.148-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x22c/0x33e lib/dump_stack.c:118
 ubsan_epilogue+0xe/0x3a lib/ubsan.c:161
 __ubsan_handle_shift_out_of_bounds.cold+0x1c4/0x250 lib/ubsan.c:422
 gfs2_read_sb fs/gfs2/ops_fstype.c:288 [inline]
 init_sb.cold+0x52/0x125 fs/gfs2/ops_fstype.c:469
 fill_super+0x174d/0x2680 fs/gfs2/ops_fstype.c:1120
 gfs2_mount+0x4c0/0x598 fs/gfs2/ops_fstype.c:1312
 mount_fs+0xa3/0x318 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2469 [inline]
 do_mount+0x51c/0x2f10 fs/namespace.c:2799
 ksys_mount+0xcf/0x130 fs/namespace.c:3015
 __do_sys_mount fs/namespace.c:3029 [inline]
 __se_sys_mount fs/namespace.c:3026 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3026
 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446dba
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 fd ad fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 da ad fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007ffc2bba29a8 EFLAGS: 00000293 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc2bba2a00 RCX: 0000000000446dba
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc2bba29c0
RBP: 00007ffc2bba29c0 R08: 00007ffc2bba2a00 R09: 00007ffc00000015
R10: 0000000002200000 R11: 0000000000000293 R12: 0000000000000001
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003
================================================================================
================================================================================
UBSAN: Undefined behaviour in fs/gfs2/ops_fstype.c:332:21
index 11 is out of range for type 'u64 [11]'
CPU: 1 PID: 6487 Comm: syz-executor778 Not tainted 4.19.148-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x22c/0x33e lib/dump_stack.c:118
 ubsan_epilogue+0xe/0x3a lib/ubsan.c:161
 __ubsan_handle_out_of_bounds.cold+0x63/0x6f lib/ubsan.c:383
 gfs2_read_sb fs/gfs2/ops_fstype.c:332 [inline]
 init_sb+0xd35/0xe60 fs/gfs2/ops_fstype.c:469
 fill_super+0x174d/0x2680 fs/gfs2/ops_fstype.c:1120
 gfs2_mount+0x4c0/0x598 fs/gfs2/ops_fstype.c:1312
 mount_fs+0xa3/0x318 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2469 [inline]
 do_mount+0x51c/0x2f10 fs/namespace.c:2799
 ksys_mount+0xcf/0x130 fs/namespace.c:3015
 __do_sys_mount fs/namespace.c:3029 [inline]
 __se_sys_mount fs/namespace.c:3026 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3026
 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446dba
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 fd ad fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 da ad fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007ffc2bba29a8 EFLAGS: 00000293 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc2bba2a00 RCX: 0000000000446dba
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc2bba29c0
RBP: 00007ffc2bba29c0 R08: 00007ffc2bba2a00 R09: 00007ffc00000015
R10: 0000000002200000 R11: 0000000000000293 R12: 0000000000000001
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003
================================================================================
================================================================================
UBSAN: Undefined behaviour in fs/gfs2/ops_fstype.c:326:29
index 11 is out of range for type 'u64 [11]'
CPU: 1 PID: 6487 Comm: syz-executor778 Not tainted 4.19.148-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x22c/0x33e lib/dump_stack.c:118
 ubsan_epilogue+0xe/0x3a lib/ubsan.c:161
 __ubsan_handle_out_of_bounds.cold+0x63/0x6f lib/ubsan.c:383
 gfs2_read_sb fs/gfs2/ops_fstype.c:326 [inline]
 init_sb+0xcd6/0xe60 fs/gfs2/ops_fstype.c:469
 fill_super+0x174d/0x2680 fs/gfs2/ops_fstype.c:1120
 gfs2_mount+0x4c0/0x598 fs/gfs2/ops_fstype.c:1312
 mount_fs+0xa3/0x318 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2469 [inline]
 do_mount+0x51c/0x2f10 fs/namespace.c:2799
 ksys_mount+0xcf/0x130 fs/namespace.c:3015
 __do_sys_mount fs/namespace.c:3029 [inline]
 __se_sys_mount fs/namespace.c:3026 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3026
 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446dba
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 fd ad fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 da ad fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007ffc2bba29a8 EFLAGS: 00000293 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc2bba2a00 RCX: 0000000000446dba
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc2bba29c0
RBP: 00007ffc2bba29c0 R08: 00007ffc2bba2a00 R09: 00007ffc00000015
R10: 0000000002200000 R11: 0000000000000293 R12: 0000000000000001
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003
================================================================================
================================================================================
UBSAN: Undefined behaviour in fs/gfs2/ops_fstype.c:330:30
index 11 is out of range for type 'u64 [11]'
CPU: 1 PID: 6487 Comm: syz-executor778 Not tainted 4.19.148-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x22c/0x33e lib/dump_stack.c:118
 ubsan_epilogue+0xe/0x3a lib/ubsan.c:161
 __ubsan_handle_out_of_bounds.cold+0x63/0x6f lib/ubsan.c:383
 gfs2_read_sb fs/gfs2/ops_fstype.c:330 [inline]
 init_sb+0xcef/0xe60 fs/gfs2/ops_fstype.c:469
 fill_super+0x174d/0x2680 fs/gfs2/ops_fstype.c:1120
 gfs2_mount+0x4c0/0x598 fs/gfs2/ops_fstype.c:1312
 mount_fs+0xa3/0x318 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2469 [inline]
 do_mount+0x51c/0x2f10 fs/namespace.c:2799
 ksys_mount+0xcf/0x130 fs/namespace.c:3015
 __do_sys_mount fs/namespace.c:3029 [inline]
 __se_sys_mount fs/namespace.c:3026 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3026
 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446dba
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 fd ad fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 da ad fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007ffc2bba29a8 EFLAGS: 00000293 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc2bba2a00 RCX: 0000000000446dba
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc2bba29c0
RBP: 00007ffc2bba29c0 R08: 00007ffc2bba2a00 R09: 00007ffc00000015
R10: 0000000002200000 R11: 0000000000000293 R12: 0000000000000001
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003
================================================================================
==================================================================
BUG: KASAN: slab-out-of-bounds in gfs2_read_sb fs/gfs2/ops_fstype.c:332 [inline]
BUG: KASAN: slab-out-of-bounds in init_sb+0xd3f/0xe60 fs/gfs2/ops_fstype.c:469
Write of size 8 at addr ffff8880a4249f28 by task syz-executor778/6487

CPU: 1 PID: 6487 Comm: syz-executor778 Not tainted 4.19.148-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x22c/0x33e lib/dump_stack.c:118
 print_address_description.cold+0x56/0x25c mm/kasan/report.c:256
 kasan_report_error.cold+0x66/0xb9 mm/kasan/report.c:354
 kasan_report mm/kasan/report.c:412 [inline]
 __asan_report_store8_noabort+0x88/0x90 mm/kasan/report.c:438
 gfs2_read_sb fs/gfs2/ops_fstype.c:332 [inline]
 init_sb+0xd3f/0xe60 fs/gfs2/ops_fstype.c:469
 fill_super+0x174d/0x2680 fs/gfs2/ops_fstype.c:1120
 gfs2_mount+0x4c0/0x598 fs/gfs2/ops_fstype.c:1312
 mount_fs+0xa3/0x318 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2469 [inline]
 do_mount+0x51c/0x2f10 fs/namespace.c:2799
 ksys_mount+0xcf/0x130 fs/namespace.c:3015
 __do_sys_mount fs/namespace.c:3029 [inline]
 __se_sys_mount fs/namespace.c:3026 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3026
 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x446dba
Code: b8 08 00 00 00 0f 05 48 3d 01 f0 ff ff 0f 83 fd ad fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 49 89 ca b8 a5 00 00 00 0f 05 <48> 3d 01 f0 ff ff 0f 83 da ad fb ff c3 66 0f 1f 84 00 00 00 00 00
RSP: 002b:00007ffc2bba29a8 EFLAGS: 00000293 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 00007ffc2bba2a00 RCX: 0000000000446dba
RDX: 0000000020000000 RSI: 0000000020000100 RDI: 00007ffc2bba29c0
RBP: 00007ffc2bba29c0 R08: 00007ffc2bba2a00 R09: 00007ffc00000015
R10: 0000000002200000 R11: 0000000000000293 R12: 0000000000000001
R13: 0000000000000004 R14: 0000000000000003 R15: 0000000000000003

Allocated by task 6487:
 kmem_cache_alloc_trace+0x12f/0x4b0 mm/slab.c:3625
 kmalloc include/linux/slab.h:515 [inline]
 kzalloc include/linux/slab.h:709 [inline]
 init_sbd fs/gfs2/ops_fstype.c:71 [inline]
 fill_super+0xca/0x2680 fs/gfs2/ops_fstype.c:1041
 gfs2_mount+0x4c0/0x598 fs/gfs2/ops_fstype.c:1312
 mount_fs+0xa3/0x318 fs/super.c:1261
 vfs_kern_mount.part.0+0x68/0x470 fs/namespace.c:961
 vfs_kern_mount fs/namespace.c:951 [inline]
 do_new_mount fs/namespace.c:2469 [inline]
 do_mount+0x51c/0x2f10 fs/namespace.c:2799
 ksys_mount+0xcf/0x130 fs/namespace.c:3015
 __do_sys_mount fs/namespace.c:3029 [inline]
 __se_sys_mount fs/namespace.c:3026 [inline]
 __x64_sys_mount+0xba/0x150 fs/namespace.c:3026
 do_syscall_64+0xf9/0x670 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 0:
(stack is not available)

The buggy address belongs to the object at ffff8880a4248bc0
 which belongs to the cache kmalloc-8192 of size 8192
The buggy address is located 4968 bytes inside of
 8192-byte region [ffff8880a4248bc0, ffff8880a424abc0)
The buggy address belongs to the page:
page:ffffea0002909200 count:1 mapcount:0 mapping:ffff88812c3f5080 index:0x0 compound_mapcount: 0
flags: 0xfffe0000008100(slab|head)
raw: 00fffe0000008100 ffffea0002125208 ffff88812c3f4b48 ffff88812c3f5080
raw: 0000000000000000 ffff8880a4248bc0 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a4249e00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff8880a4249e80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff8880a4249f00: 00 00 00 00 00 fc fc fc fc fc fc fc fc fc fc fc
                                  ^
 ffff8880a4249f80: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff8880a424a000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/09/29 12:27 linux-4.19.y 10ad6cfd5736 1b88c6d5 .config console log report syz C ci2-linux-4-19
2020/09/26 23:46 linux-4.19.y 10ad6cfd5736 5dd8aee8 .config console log report info ci2-linux-4-19
* Struck through repros no longer work on HEAD.