syzbot


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

Status: upstream: reported C repro on 2021/08/13 15:48
Reported-by: syzbot+4c5c39dc88f23814d63d@syzkaller.appspotmail.com
First crash: 1235d, last: 1174d
Fix bisection: failed (error log, bisect log)
  
Fix bisection attempts (3)
Created Duration User Patch Repo Result
2021/11/11 17:51 12m bisect fix linux-4.19.y error job log
2021/10/12 17:07 23m bisect fix linux-4.19.y OK (0) job log log
2021/09/12 16:42 24m bisect fix linux-4.19.y OK (0) job log log

Sample crash report:
==================================================================
BUG: KASAN: slab-out-of-bounds in memcpy include/linux/string.h:377 [inline]
BUG: KASAN: slab-out-of-bounds in skcipher_null_crypt+0xb0/0x130 crypto/crypto_null.c:89
Write of size 4096 at addr ffff88809bfd0000 by task syz-executor348/8107

CPU: 1 PID: 8107 Comm: syz-executor348 Not tainted 4.19.203-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+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
 memcpy+0x35/0x50 mm/kasan/kasan.c:303
 memcpy include/linux/string.h:377 [inline]
 skcipher_null_crypt+0xb0/0x130 crypto/crypto_null.c:89
 skcipher_crypt_blkcipher crypto/skcipher.c:639 [inline]
 skcipher_encrypt_blkcipher+0x1c6/0x290 crypto/skcipher.c:648
 crypto_skcipher_encrypt include/crypto/skcipher.h:445 [inline]
 crypto_authenc_encrypt+0x723/0xad0 crypto/authenc.c:237
 crypto_aead_encrypt include/crypto/aead.h:337 [inline]
 esp6_output_tail+0x87a/0x1920 net/ipv6/esp6.c:406
 esp6_output+0x48d/0xa60 net/ipv6/esp6.c:476
 xfrm_output_one net/xfrm/xfrm_output.c:115 [inline]
 xfrm_output_resume+0x81d/0x22b0 net/xfrm/xfrm_output.c:150
 xfrm_output2 net/xfrm/xfrm_output.c:177 [inline]
 xfrm_output+0x266/0x980 net/xfrm/xfrm_output.c:262
 __xfrm6_output+0x1c6/0x11e0 net/ipv6/xfrm6_output.c:184
 NF_HOOK_COND include/linux/netfilter.h:278 [inline]
 xfrm6_output+0x127/0x510 net/ipv6/xfrm6_output.c:189
 dst_output include/net/dst.h:455 [inline]
 ip6_local_out+0xaf/0x170 net/ipv6/output_core.c:160
 ip6_send_skb+0xb3/0x300 net/ipv6/ip6_output.c:1741
 ip6_push_pending_frames+0xbd/0xe0 net/ipv6/ip6_output.c:1761
 rawv6_push_pending_frames net/ipv6/raw.c:618 [inline]
 rawv6_sendmsg+0x2a81/0x36a0 net/ipv6/raw.c:959
 inet_sendmsg+0x132/0x5a0 net/ipv4/af_inet.c:798
 sock_sendmsg_nosec net/socket.c:651 [inline]
 sock_sendmsg+0xc3/0x120 net/socket.c:661
 ___sys_sendmsg+0x7bb/0x8e0 net/socket.c:2225
 __sys_sendmsg net/socket.c:2263 [inline]
 __do_sys_sendmsg net/socket.c:2272 [inline]
 __se_sys_sendmsg net/socket.c:2270 [inline]
 __x64_sys_sendmsg+0x132/0x220 net/socket.c:2270
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x43f4b9
Code: 1d 01 00 85 c0 b8 00 00 00 00 48 0f 44 c3 5b c3 90 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:00007ffffc29d778 EFLAGS: 00000246 ORIG_RAX: 000000000000002e
RAX: ffffffffffffffda RBX: 0000000000400488 RCX: 000000000043f4b9
RDX: 0000000000000000 RSI: 0000000020000500 RDI: 0000000000000004
RBP: 0000000000000005 R08: 6c616b7a79732f2e R09: 6c616b7a79732f2e
R10: 00000000000000e8 R11: 0000000000000246 R12: 00000000004034b0
R13: 0000000000000000 R14: 00000000004ad018 R15: 0000000000400488

Allocated by task 6253:
 kmem_cache_alloc+0x122/0x370 mm/slab.c:3559
 getname_flags+0xce/0x590 fs/namei.c:140
 do_sys_open+0x26c/0x520 fs/open.c:1079
 do_syscall_64+0xf9/0x620 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 6253:
 __cache_free mm/slab.c:3503 [inline]
 kmem_cache_free+0x7f/0x260 mm/slab.c:3765
 putname+0xe1/0x120 fs/namei.c:261
 do_sys_open+0x2ba/0x520 fs/open.c:1094
 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 ffff88809bfd0940
 which belongs to the cache names_cache of size 4096
The buggy address is located 2368 bytes to the left of
 4096-byte region [ffff88809bfd0940, ffff88809bfd1940)
The buggy address belongs to the page:
page:ffffea00026ff400 count:1 mapcount:0 mapping:ffff88823b843380 index:0x0 compound_mapcount: 0
flags: 0xfff00000008100(slab|head)
raw: 00fff00000008100 ffffea00026d1b88 ffffea00026ff488 ffff88823b843380
raw: 0000000000000000 ffff88809bfd0940 0000000100000001 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff88809bfcff00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff88809bfcff80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff88809bfd0000: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
                   ^
 ffff88809bfd0080: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
 ffff88809bfd0100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
==================================================================
----------------
Code disassembly (best guess):
   0:	1d 01 00 85 c0       	sbb    $0xc0850001,%eax
   5:	b8 00 00 00 00       	mov    $0x0,%eax
   a:	48 0f 44 c3          	cmove  %rbx,%rax
   e:	5b                   	pop    %rbx
   f:	c3                   	retq   
  10:	90                   	nop
  11:	48 89 f8             	mov    %rdi,%rax
  14:	48 89 f7             	mov    %rsi,%rdi
  17:	48 89 d6             	mov    %rdx,%rsi
  1a:	48 89 ca             	mov    %rcx,%rdx
  1d:	4d 89 c2             	mov    %r8,%r10
  20:	4d 89 c8             	mov    %r9,%r8
  23:	4c 8b 4c 24 08       	mov    0x8(%rsp),%r9
  28:	0f 05                	syscall 
  2a:	48 3d 01 f0 ff ff    	cmp    $0xfffffffffffff001,%rax <-- trapping instruction
  30:	73 01                	jae    0x33
  32:	c3                   	retq   
  33:	48 c7 c1 c0 ff ff ff 	mov    $0xffffffffffffffc0,%rcx
  3a:	f7 d8                	neg    %eax
  3c:	64 89 01             	mov    %eax,%fs:(%rcx)
  3f:	48                   	rex.W

Crashes (2):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2021/08/13 16:42 linux-4.19.y addba38e7c3b 3fd2ea69 .config console log report syz C ci2-linux-4-19 KASAN: slab-out-of-bounds Write in skcipher_null_crypt
2021/08/13 15:47 linux-4.19.y addba38e7c3b 3fd2ea69 .config console log report info ci2-linux-4-19 KASAN: slab-out-of-bounds Write in skcipher_null_crypt
* Struck through repros no longer work on HEAD.