syzbot


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

Status: fixed on 2021/03/10 01:48
Subsystems: net
[Documentation on labels]
Reported-by: syzbot+c43831072e7df506a646@syzkaller.appspotmail.com
Fix commit: d1949d045fd6 xfrm/compat: memset(0) 64-bit padding at right place
First crash: 1503d, last: 1454d
Cause bisection: introduced by (bisect log) :
commit 5106f4a8acff480e244300bc5097c0ad7048c3a2
Author: Dmitry Safonov <dima@arista.com>
Date: Mon Sep 21 14:36:55 2020 +0000

  xfrm/compat: Add 32=>64-bit messages translator

Crash: INFO: trying to register non-static key in netlink_release (log)
Repro: C syz .config
  
Discussions (5)
Title Replies (including bot) Last reply
[PATCH 2/4] xfrm/compat: memset(0) 64-bit padding at right place 1 (1) 2020/12/07 09:39
[PATCH v2 0/3] xfrm/compat: syzbot-found fixes 5 (5) 2020/11/10 06:35
[PATCH 0/3] xfrm/compat: syzbot-found fixes 5 (5) 2020/11/02 08:21
KASAN: slab-out-of-bounds Write in xfrm_attr_cpy32 0 (3) 2020/11/02 07:23
Re: KASAN: slab-out-of-bounds Write in xfrm_attr_cpy32 1 (1) 2020/10/28 10:43

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memset include/linux/string.h:384 [inline]
BUG: KASAN: slab-out-of-bounds in xfrm_attr_cpy32+0x15a/0x1d0 net/xfrm/xfrm_compat.c:393
Write of size 4 at addr ffff888147aba4fc by task syz-executor829/8497

CPU: 0 PID: 8497 Comm: syz-executor829 Not tainted 5.10.0-rc2-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+0x107/0x163 lib/dump_stack.c:118
 print_address_description.constprop.0.cold+0xae/0x4c8 mm/kasan/report.c:385
 __kasan_report mm/kasan/report.c:545 [inline]
 kasan_report.cold+0x1f/0x37 mm/kasan/report.c:562
 check_memory_region_inline mm/kasan/generic.c:186 [inline]
 check_memory_region+0x13d/0x180 mm/kasan/generic.c:192
 memset+0x20/0x40 mm/kasan/common.c:84
 memset include/linux/string.h:384 [inline]
 xfrm_attr_cpy32+0x15a/0x1d0 net/xfrm/xfrm_compat.c:393
 xfrm_xlate32_attr net/xfrm/xfrm_compat.c:426 [inline]
 xfrm_xlate32 net/xfrm/xfrm_compat.c:525 [inline]
 xfrm_user_rcv_msg_compat+0x76b/0x1040 net/xfrm/xfrm_compat.c:570
 xfrm_user_rcv_msg+0x55b/0x8b0 net/xfrm/xfrm_user.c:2714
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494
 xfrm_netlink_rcv+0x6b/0x90 net/xfrm/xfrm_user.c:2764
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2353
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2407
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2440
 do_syscall_32_irqs_on arch/x86/entry/common.c:78 [inline]
 __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:137
 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:160
 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c
RIP: 0023:0xf7fb2549
Code: b8 01 10 06 03 74 b4 01 10 07 03 74 b0 01 10 08 03 74 d8 01 00 00 00 00 00 00 00 00 00 00 00 00 00 51 52 55 89 e5 0f 34 cd 80 <5d> 5a 59 c3 90 90 90 90 eb 0d 90 90 90 90 90 90 90 90 90 90 90 90
RSP: 002b:00000000ffdebbcc EFLAGS: 00000246 ORIG_RAX: 0000000000000172
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000020000080
RDX: 0000000000000000 RSI: 00000000080ea078 RDI: 00000000ffdebc20
RBP: 0000000000000000 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000000
R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000

Allocated by task 8497:
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_set_track mm/kasan/common.c:56 [inline]
 __kasan_kmalloc.constprop.0+0xc2/0xd0 mm/kasan/common.c:461
 kmalloc_node include/linux/slab.h:575 [inline]
 kvmalloc_node+0x61/0xf0 mm/util.c:575
 kvmalloc include/linux/mm.h:765 [inline]
 xfrm_user_rcv_msg_compat+0x3cd/0x1040 net/xfrm/xfrm_compat.c:566
 xfrm_user_rcv_msg+0x55b/0x8b0 net/xfrm/xfrm_user.c:2714
 netlink_rcv_skb+0x153/0x420 net/netlink/af_netlink.c:2494
 xfrm_netlink_rcv+0x6b/0x90 net/xfrm/xfrm_user.c:2764
 netlink_unicast_kernel net/netlink/af_netlink.c:1304 [inline]
 netlink_unicast+0x533/0x7d0 net/netlink/af_netlink.c:1330
 netlink_sendmsg+0x856/0xd90 net/netlink/af_netlink.c:1919
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xcf/0x120 net/socket.c:671
 ____sys_sendmsg+0x6e8/0x810 net/socket.c:2353
 ___sys_sendmsg+0xf3/0x170 net/socket.c:2407
 __sys_sendmsg+0xe5/0x1b0 net/socket.c:2440
 do_syscall_32_irqs_on arch/x86/entry/common.c:78 [inline]
 __do_fast_syscall_32+0x56/0x80 arch/x86/entry/common.c:137
 do_fast_syscall_32+0x2f/0x70 arch/x86/entry/common.c:160
 entry_SYSENTER_compat_after_hwframe+0x4d/0x5c

Last call_rcu():
 kasan_save_stack+0x1b/0x40 mm/kasan/common.c:48
 kasan_record_aux_stack+0xc0/0xf0 mm/kasan/generic.c:346
 __call_rcu kernel/rcu/tree.c:2953 [inline]
 call_rcu+0xbb/0x700 kernel/rcu/tree.c:3027
 rhashtable_rehash_table lib/rhashtable.c:345 [inline]
 rht_deferred_worker+0x10f4/0x1d40 lib/rhashtable.c:429
 process_one_work+0x933/0x15a0 kernel/workqueue.c:2272
 worker_thread+0x64c/0x1120 kernel/workqueue.c:2418
 kthread+0x3af/0x4a0 kernel/kthread.c:292
 ret_from_fork+0x1f/0x30 arch/x86/entry/entry_64.S:296

The buggy address belongs to the object at ffff888147aba400
 which belongs to the cache kmalloc-256 of size 256
The buggy address is located 252 bytes inside of
 256-byte region [ffff888147aba400, ffff888147aba500)
The buggy address belongs to the page:
page:00000000e11e2d62 refcount:1 mapcount:0 mapping:0000000000000000 index:0xffff888147abbe00 pfn:0x147aba
head:00000000e11e2d62 order:1 compound_mapcount:0
flags: 0x57ff00000010200(slab|head)
raw: 057ff00000010200 ffffea000084e900 0000000700000007 ffff8880100413c0
raw: ffff888147abbe00 000000008010000f 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888147aba380: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888147aba400: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888147aba480: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 04
                                                                ^
 ffff888147aba500: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff888147aba580: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================

Crashes (106):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2020/11/02 04:22 upstream 3cea11cd5e3b 8bc4594f .config console log report syz C ci-upstream-kasan-gce-386
2020/12/10 08:54 upstream a68a0262abda c090b4da .config console log report info ci-upstream-kasan-gce-386
2020/12/10 07:40 upstream a68a0262abda c090b4da .config console log report info ci-upstream-kasan-gce-386
2020/12/08 19:50 upstream cd796ed33450 a7f7f4a4 .config console log report info ci-upstream-kasan-gce-386
2020/12/08 18:04 upstream cd796ed33450 9af51e31 .config console log report info ci-qemu-upstream-386
2020/12/08 15:47 upstream cd796ed33450 51a9082e .config console log report info ci-upstream-kasan-gce-386
2020/12/07 17:02 upstream 0477e9288185 1190297f .config console log report info ci-upstream-kasan-gce-386
2020/12/07 16:58 upstream 0477e9288185 1190297f .config console log report info ci-upstream-kasan-gce-386
2020/12/07 06:36 upstream 7059c2c00a21 c521566d .config console log report info ci-upstream-kasan-gce-386
2020/12/03 16:42 upstream 34816d20f173 e6b0d314 .config console log report info ci-upstream-kasan-gce-386
2020/12/02 21:39 upstream 509a15421674 8c9190ef .config console log report info ci-upstream-kasan-gce-386
2020/12/01 16:47 upstream b65054597872 07bfe8a5 .config console log report info ci-upstream-kasan-gce-386
2020/12/01 11:05 upstream b65054597872 b3a34598 .config console log report info ci-upstream-kasan-gce-386
2020/11/30 19:12 upstream b65054597872 76831598 .config console log report info ci-qemu-upstream-386
2020/11/30 07:29 upstream aae5ab854e38 a0092f9d .config console log report info ci-upstream-kasan-gce-386
2020/11/29 04:40 upstream 45e885c439e8 a0092f9d .config console log report info ci-upstream-kasan-gce-386
2020/11/29 02:54 upstream 45e885c439e8 a0092f9d .config console log report info ci-qemu-upstream-386
2020/11/28 17:29 upstream c84e1efae022 76b4dcc7 .config console log report info ci-upstream-kasan-gce-386
2020/11/28 15:40 upstream c84e1efae022 76b4dcc7 .config console log report info ci-upstream-kasan-gce-386
2020/11/28 05:10 upstream 99c710c46dfc 5018c946 .config console log report info ci-qemu-upstream-386
2020/11/27 01:33 upstream 4df910620beb 1d2b823e .config console log report info ci-upstream-kasan-gce-386
2020/11/26 17:13 upstream fa02fcd94b0c 1d2b823e .config console log report info ci-upstream-kasan-gce-386
2020/11/26 02:38 upstream fa02fcd94b0c 2f1cec62 .config console log report info ci-upstream-kasan-gce-386
2020/11/25 16:38 upstream 127c501a03d5 1a1f4bd8 .config console log report info ci-upstream-kasan-gce-386
2020/11/25 00:04 upstream 80145ac2f739 e34b696c .config console log report info ci-upstream-kasan-gce-386
2020/11/24 20:30 upstream d5beb3140f91 e34b696c .config console log report info ci-qemu-upstream-386
2020/11/24 08:02 upstream d5beb3140f91 1ab681a4 .config console log report info ci-upstream-kasan-gce-386
2020/11/23 08:17 upstream a349e4c65960 0d27f508 .config console log report info ci-upstream-kasan-gce-386
2020/11/22 21:18 upstream a349e4c65960 0d27f508 .config console log report info ci-upstream-kasan-gce-386
2020/11/22 15:01 upstream a349e4c65960 0d27f508 .config console log report info ci-upstream-kasan-gce-386
2020/11/22 12:14 upstream a349e4c65960 0d27f508 .config console log report info ci-upstream-kasan-gce-386
2020/11/21 09:05 upstream 27bba9c532a8 68068804 .config console log report info ci-upstream-kasan-gce-386
2020/11/20 04:20 upstream 131ad0b6f529 0767f13f .config console log report info ci-upstream-kasan-gce-386
2020/11/19 23:30 upstream 131ad0b6f529 0767f13f .config console log report info ci-upstream-kasan-gce-386
2020/11/18 04:08 upstream 111e91a6df50 bd2a760b .config console log report info ci-upstream-kasan-gce-386
2020/11/18 01:06 upstream 9c87c9f41245 7eca15bf .config console log report info ci-qemu-upstream-386
2020/11/17 16:52 upstream 9c87c9f41245 bd2a760b .config console log report info ci-upstream-kasan-gce-386
2020/11/17 08:35 upstream 9c87c9f41245 1bf9a662 .config console log report info ci-upstream-kasan-gce-386
2020/11/17 04:54 upstream 9c87c9f41245 1bf9a662 .config console log report info ci-upstream-kasan-gce-386
2020/11/16 19:14 upstream 09162bc32c88 1bf9a662 .config console log report info ci-upstream-kasan-gce-386
2020/11/16 13:36 upstream 09162bc32c88 1bf9a662 .config console log report info ci-upstream-kasan-gce-386
2020/11/16 03:02 upstream 9cfd9c45994b 1bf9a662 .config console log report info ci-qemu-upstream-386
2020/11/15 13:48 upstream e28c0d7c92c8 1bf9a662 .config console log report info ci-upstream-kasan-gce-386
2020/11/15 07:28 upstream e28c0d7c92c8 1bf9a662 .config console log report info ci-upstream-kasan-gce-386
2020/11/14 23:07 upstream e28c0d7c92c8 1bf9a662 .config console log report info ci-qemu-upstream-386
2020/11/13 19:23 upstream 585e5b17b92d e1140d25 .config console log report info ci-upstream-kasan-gce-386
2020/11/13 14:15 upstream af5043c89a8e 16fca0c8 .config console log report info ci-upstream-kasan-gce-386
2020/11/13 02:36 upstream af5043c89a8e 16fca0c8 .config console log report info ci-upstream-kasan-gce-386
2020/10/21 22:31 upstream c4d6fe731176 99c64d5c .config console log report info ci-qemu-upstream-386
2020/10/21 22:29 upstream c4d6fe731176 99c64d5c .config console log report info ci-qemu-upstream-386
* Struck through repros no longer work on HEAD.