syzbot


KASAN: slab-out-of-bounds Write in sctp_setsockopt

Status: fixed on 2020/09/16 22:51
Subsystems: sctp
[Documentation on labels]
Reported-by: syzbot+0e4699d000d8b874d8dc@syzkaller.appspotmail.com
Fix commit: dfd3d5266dc1 sctp: fix slab-out-of-bounds in SCTP_DELAYED_SACK processing
First crash: 1423d, last: 1416d
Cause bisection: failed (error log, bisect log)
  
Discussions (3)
Title Replies (including bot) Last reply
[PATCH v2 net-next] sctp: fix slab-out-of-bounds in SCTP_DELAYED_SACK processing 3 (3) 2020/07/24 23:49
[PATCH net-next] sctp: fix slab-out-of-bounds in SCTP_DELAYED_SACK processing 5 (5) 2020/07/24 06:46
KASAN: slab-out-of-bounds Write in sctp_setsockopt 1 (2) 2020/07/22 19:02

Sample crash report:
sctp: [Deprecated]: syz-executor496 (pid 6834) Use of struct sctp_assoc_value in delayed_ack socket option.
Use struct sctp_sack_info instead
==================================================================
BUG: KASAN: slab-out-of-bounds in sctp_setsockopt_delayed_ack net/sctp/socket.c:2771 [inline]
BUG: KASAN: slab-out-of-bounds in sctp_setsockopt net/sctp/socket.c:4499 [inline]
BUG: KASAN: slab-out-of-bounds in sctp_setsockopt+0x9488/0x95e0 net/sctp/socket.c:4431
Write of size 4 at addr ffff8880a2709288 by task syz-executor496/6834

CPU: 0 PID: 6834 Comm: syz-executor496 Not tainted 5.8.0-rc4-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+0x18f/0x20d lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x436 mm/kasan/report.c:383
 __kasan_report mm/kasan/report.c:513 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:530
 sctp_setsockopt_delayed_ack net/sctp/socket.c:2771 [inline]
 sctp_setsockopt net/sctp/socket.c:4499 [inline]
 sctp_setsockopt+0x9488/0x95e0 net/sctp/socket.c:4431
 __sys_setsockopt+0x337/0x6a0 net/socket.c:2137
 __do_sys_setsockopt net/socket.c:2153 [inline]
 __se_sys_setsockopt net/socket.c:2150 [inline]
 __x64_sys_setsockopt+0xba/0x150 net/socket.c:2150
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9
RIP: 0033:0x440229
Code: Bad RIP value.
RSP: 002b:00007ffc07ceda28 EFLAGS: 00000246 ORIG_RAX: 0000000000000036
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 0000000000440229
RDX: 0000000000000010 RSI: 0000000000000084 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000008 R09: 00000000004002c8
R10: 0000000020000100 R11: 0000000000000246 R12: 0000000000401a30
R13: 0000000000401ac0 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 6834:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:494
 __do_kmalloc mm/slab.c:3656 [inline]
 __kmalloc_track_caller+0x178/0x330 mm/slab.c:3671
 memdup_user+0x22/0xd0 mm/util.c:172
 sctp_setsockopt net/sctp/socket.c:4452 [inline]
 sctp_setsockopt+0x17a/0x95e0 net/sctp/socket.c:4431
 __sys_setsockopt+0x337/0x6a0 net/socket.c:2137
 __do_sys_setsockopt net/socket.c:2153 [inline]
 __se_sys_setsockopt net/socket.c:2150 [inline]
 __x64_sys_setsockopt+0xba/0x150 net/socket.c:2150
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

Freed by task 4827:
 save_stack+0x1b/0x40 mm/kasan/common.c:48
 set_track mm/kasan/common.c:56 [inline]
 kasan_set_free_info mm/kasan/common.c:316 [inline]
 __kasan_slab_free+0xf5/0x140 mm/kasan/common.c:455
 __cache_free mm/slab.c:3426 [inline]
 kfree+0x103/0x2c0 mm/slab.c:3757
 tomoyo_path2_perm+0x28a/0x600 security/tomoyo/file.c:947
 tomoyo_path_rename+0xd2/0x130 security/tomoyo/tomoyo.c:279
 security_path_rename+0x1b5/0x2e0 security/security.c:1135
 do_renameat2+0x481/0xbf0 fs/namei.c:4446
 __do_sys_rename fs/namei.c:4496 [inline]
 __se_sys_rename fs/namei.c:4494 [inline]
 __x64_sys_rename+0x5d/0x80 fs/namei.c:4494
 do_syscall_64+0x60/0xe0 arch/x86/entry/common.c:384
 entry_SYSCALL_64_after_hwframe+0x44/0xa9

The buggy address belongs to the object at ffff8880a2709280
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 8 bytes inside of
 32-byte region [ffff8880a2709280, ffff8880a27092a0)
The buggy address belongs to the page:
page:ffffea000289c240 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff8880a2709fc1
flags: 0xfffe0000000200(slab)
raw: 00fffe0000000200 ffffea00026c1108 ffffea00026ae848 ffff8880aa0001c0
raw: ffff8880a2709fc1 ffff8880a2709000 000000010000003f 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8880a2709180: 06 fc fc fc fc fc fc fc 06 fc fc fc fc fc fc fc
 ffff8880a2709200: 06 fc fc fc fc fc fc fc fb fb fb fb fc fc fc fc
>ffff8880a2709280: 00 fc fc fc fc fc fc fc 05 fc fc fc fc fc fc fc
                      ^
 ffff8880a2709300: fb fb fb fb fc fc fc fc 06 fc fc fc fc fc fc fc
 ffff8880a2709380: 06 fc fc fc fc fc fc fc 06 fc fc fc fc fc fc fc
==================================================================

Crashes (590):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/07/21 04:22 net-next-old 4f1b4da541db d88894e6 .config console log report syz C ci-upstream-net-kasan-gce
2020/07/25 11:28 linux-next 26027945c94a 1f7cc1ca .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2020/07/25 05:17 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/25 03:55 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/25 02:27 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/25 01:25 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 22:17 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 21:10 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 20:07 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 19:30 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 18:26 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 17:19 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 15:49 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 15:36 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 14:21 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 13:07 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/24 11:42 net-next-old 1b6687e31a2d 554af388 .config console log report ci-upstream-net-kasan-gce
2020/07/22 22:30 bpf-next a6c0d0934f0d 340ea530 .config console log report ci-upstream-bpf-next-kasan-gce
2020/07/21 02:39 net-next-old 4f1b4da541db 4285ffa3 .config console log report ci-upstream-net-kasan-gce
2020/07/27 16:08 linux-next 26027945c94a cb93dc6a .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/27 14:46 linux-next 26027945c94a cb93dc6a .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/27 09:47 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/27 06:47 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/27 05:22 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/27 04:10 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/27 02:14 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/27 01:07 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 18:30 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 16:10 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 15:38 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 14:20 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 13:04 linux-next 26027945c94a 51265195 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 10:13 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 08:16 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 05:35 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 02:19 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/26 00:04 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 23:38 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 22:37 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 21:11 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 19:27 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 18:15 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 13:33 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 12:31 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 10:56 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 08:53 linux-next 26027945c94a 1f7cc1ca .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 04:16 linux-next 26027945c94a 554af388 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/25 00:19 linux-next 26027945c94a 554af388 .config console log report ci-upstream-linux-next-kasan-gce-root
2020/07/24 23:17 linux-next 26027945c94a 554af388 .config console log report ci-upstream-linux-next-kasan-gce-root
* Struck through repros no longer work on HEAD.