syzbot


KASAN: use-after-free Read in scatterwalk_copychunks

Status: upstream: reported C repro on 2019/04/21 07:18
Reported-by: syzbot+920a7eb5795273e180f6@syzkaller.appspotmail.com
First crash: 2041d, last: 1386d
Fix bisection the fix commit could be any of (bisect log):
  68d7a45eec10 Linux 4.14.113
  4139fb08c05f Linux 4.14.187
  
Similar bugs (9)
Kernel Title Repro Cause bisect Fix bisect Count Last Reported Patched Status
upstream general protection fault in scatterwalk_copychunks (4) net crypto C done done 1341 334d 1346d 25/28 fixed on 2023/12/22 15:08
linux-4.19 KASAN: use-after-free Read in scatterwalk_copychunks C error 17 660d 1876d 0/1 upstream: reported C repro on 2019/10/03 04:34
upstream KASAN: use-after-free Read in scatterwalk_copychunks bcachefs C done 36 7d17h 200d 0/28 upstream: reported C repro on 2024/05/04 09:57
linux-4.14 KASAN: slab-out-of-bounds Read in scatterwalk_copychunks C inconclusive 6 1394d 1898d 0/1 upstream: reported C repro on 2019/09/11 08:57
linux-4.14 general protection fault in scatterwalk_copychunks C error 204 648d 2041d 0/1 upstream: reported C repro on 2019/04/21 07:15
linux-5.15 BUG: unable to handle kernel paging request in scatterwalk_copychunks 3 574d 611d 0/3 auto-obsoleted due to no activity on 2023/08/23 09:08
linux-6.1 BUG: unable to handle kernel paging request in scatterwalk_copychunks 1 522d 522d 0/3 auto-obsoleted due to no activity on 2023/09/25 13:18
linux-4.19 general protection fault in scatterwalk_copychunks C error 152 650d 1980d 0/1 upstream: reported C repro on 2019/06/20 18:59
upstream general protection fault in scatterwalk_copychunks (5) crypto C done 2920 324d 330d 25/28 fixed on 2024/01/30 15:47
Last patch testing requests (2)
Created Duration User Patch Repo Result
2023/02/06 11:32 9m retest repro linux-4.14.y report log
2022/09/15 21:29 14m retest repro linux-4.14.y report log
Fix bisection attempts (8)
Created Duration User Patch Repo Result
2020/07/06 05:02 38m bisect fix linux-4.14.y OK (2) job log
2020/06/06 04:31 30m bisect fix linux-4.14.y OK (0) job log log
2020/05/07 03:44 33m bisect fix linux-4.14.y OK (0) job log log
2020/04/07 03:08 35m bisect fix linux-4.14.y OK (0) job log log
2020/03/08 01:04 34m bisect fix linux-4.14.y OK (0) job log log
2020/02/07 00:23 41m bisect fix linux-4.14.y OK (0) job log log
2020/01/07 23:50 32m bisect fix linux-4.14.y OK (0) job log log
2019/12/08 23:14 35m bisect fix linux-4.14.y OK (0) job log log

Sample crash report:
 cache_alloc_refill mm/slab.c:3043 [inline]
 ____cache_alloc mm/slab.c:3125 [inline]
 ____cache_alloc mm/slab.c:3108 [inline]
 __do_cache_alloc mm/slab.c:3347 [inline]
 slab_alloc mm/slab.c:3382 [inline]
 kmem_cache_alloc_trace+0x6b5/0x790 mm/slab.c:3616
 kmalloc include/linux/slab.h:488 [inline]
 pagemap_read+0x23c/0x520 fs/proc/task_mmu.c:1500
==================================================================
 do_loop_readv_writev fs/read_write.c:694 [inline]
 do_loop_readv_writev fs/read_write.c:681 [inline]
 do_iter_read+0x3e7/0x5b0 fs/read_write.c:918
 vfs_readv+0xd3/0x130 fs/read_write.c:980
BUG: KASAN: use-after-free in memcpy include/linux/string.h:347 [inline]
BUG: KASAN: use-after-free in memcpy_dir crypto/scatterwalk.c:28 [inline]
BUG: KASAN: use-after-free in scatterwalk_copychunks+0x260/0x6b0 crypto/scatterwalk.c:43
Read of size 4096 at addr ffff888091def000 by task syz-executor953/6936

 kernel_readv fs/splice.c:361 [inline]
 default_file_splice_read+0x421/0x7b0 fs/splice.c:416
 do_splice_to+0x108/0x170 fs/splice.c:880
 splice_direct_to_actor+0x222/0x7b0 fs/splice.c:952
 do_splice_direct+0x18d/0x230 fs/splice.c:1061
 do_sendfile+0x4db/0xbd0 fs/read_write.c:1440
 SYSC_sendfile64 fs/read_write.c:1501 [inline]
 SyS_sendfile64+0x102/0x110 fs/read_write.c:1487
 do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x446889
RSP: 002b:00007f9279b31d08 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00000000006dbc38 RCX: 0000000000446889
RDX: 0000000000000000 RSI: 0000000000000007 RDI: 0000000000000006
RBP: 00000000006dbc30 R08: 0000000000000002 R09: 0000000000003931
R10: 0000000000006785 R11: 0000000000000246 R12: 00000000006dbc3c
R13: 00007f9279b31d10 R14: 0000000000000008 R15: 0000000000000000
CPU: 0 PID: 6936 Comm: syz-executor953 Not tainted 4.14.113 #3
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
 __dump_stack lib/dump_stack.c:17 [inline]
 dump_stack+0x138/0x19c lib/dump_stack.c:53
 print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
 kasan_report_error mm/kasan/report.c:351 [inline]
 kasan_report mm/kasan/report.c:409 [inline]
 kasan_report.cold+0xaf/0x2b5 mm/kasan/report.c:393
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
 memcpy+0x24/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:347 [inline]
 memcpy_dir crypto/scatterwalk.c:28 [inline]
 scatterwalk_copychunks+0x260/0x6b0 crypto/scatterwalk.c:43
 scatterwalk_map_and_copy crypto/scatterwalk.c:72 [inline]
 scatterwalk_map_and_copy+0x12f/0x1d0 crypto/scatterwalk.c:60
 gcmaes_encrypt.constprop.0+0x1d2/0xb90 arch/x86/crypto/aesni-intel_glue.c:778
 generic_gcmaes_encrypt+0xf4/0x130 arch/x86/crypto/aesni-intel_glue.c:1111
 crypto_aead_encrypt include/crypto/aead.h:330 [inline]
 gcmaes_wrapper_encrypt+0x101/0x170 arch/x86/crypto/aesni-intel_glue.c:945
 crypto_aead_encrypt include/crypto/aead.h:330 [inline]
 tls_do_encryption net/tls/tls_sw.c:234 [inline]
 tls_push_record+0x90b/0x1210 net/tls/tls_sw.c:270
 tls_sw_sendpage+0x437/0xb50 net/tls/tls_sw.c:617
 inet_sendpage+0x15a/0x580 net/ipv4/af_inet.c:779
 kernel_sendpage+0x95/0xf0 net/socket.c:3415
 sock_sendpage+0x8b/0xc0 net/socket.c:871
 pipe_to_sendpage+0x244/0x340 fs/splice.c:451
 splice_from_pipe_feed fs/splice.c:502 [inline]
 __splice_from_pipe+0x351/0x790 fs/splice.c:626
 splice_from_pipe+0xf0/0x150 fs/splice.c:661
 generic_splice_sendpage+0x3c/0x50 fs/splice.c:832
 do_splice_from fs/splice.c:851 [inline]
 direct_splice_actor+0x126/0x1a0 fs/splice.c:1018
 splice_direct_to_actor+0x2a1/0x7b0 fs/splice.c:973
 do_splice_direct+0x18d/0x230 fs/splice.c:1061
 do_sendfile+0x4db/0xbd0 fs/read_write.c:1440
 SYSC_sendfile64 fs/read_write.c:1501 [inline]
 SyS_sendfile64+0x102/0x110 fs/read_write.c:1487
 do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
 entry_SYSCALL_64_after_hwframe+0x42/0xb7
RIP: 0033:0x446889
RSP: 002b:00007f9279b52d08 EFLAGS: 00000246 ORIG_RAX: 0000000000000028
RAX: ffffffffffffffda RBX: 00000000006dbc28 RCX: 0000000000446889
RDX: 0000000000000000 RSI: 0000000000000004 RDI: 0000000000000003
RBP: 00000000006dbc20 R08: 0000000000000002 R09: 65732f636f003931
R10: 0000000000006785 R11: 0000000000000246 R12: 00000000006dbc2c
R13: 00007f9279b52d10 R14: 0000000000000005 R15: 0000000000000000

Allocated by task 6311:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_kmalloc mm/kasan/kasan.c:551 [inline]
 kasan_kmalloc+0xce/0xf0 mm/kasan/kasan.c:529
 kasan_slab_alloc+0xf/0x20 mm/kasan/kasan.c:489
 kmem_cache_alloc+0x12e/0x780 mm/slab.c:3552
 kmem_cache_zalloc include/linux/slab.h:651 [inline]
 get_empty_filp+0x8c/0x3b0 fs/file_table.c:123
 path_openat+0x8f/0x3f70 fs/namei.c:3542
 do_filp_open+0x18e/0x250 fs/namei.c:3600
 do_open_execat+0xe7/0x4a0 fs/exec.c:849
 do_execveat_common.isra.0+0x6d2/0x1dd0 fs/exec.c:1740
 do_execve fs/exec.c:1847 [inline]
 SYSC_execve fs/exec.c:1928 [inline]
 SyS_execve+0x39/0x50 fs/exec.c:1923
 do_syscall_64+0x1eb/0x630 arch/x86/entry/common.c:289
 entry_SYSCALL_64_after_hwframe+0x42/0xb7

Freed by task 0:
 save_stack_trace+0x16/0x20 arch/x86/kernel/stacktrace.c:59
 save_stack+0x45/0xd0 mm/kasan/kasan.c:447
 set_track mm/kasan/kasan.c:459 [inline]
 kasan_slab_free+0x75/0xc0 mm/kasan/kasan.c:524
 __cache_free mm/slab.c:3496 [inline]
 kmem_cache_free+0x83/0x2b0 mm/slab.c:3758
 file_free_rcu+0x63/0xa0 fs/file_table.c:50
 __rcu_reclaim kernel/rcu/rcu.h:195 [inline]
 rcu_do_batch kernel/rcu/tree.c:2699 [inline]
 invoke_rcu_callbacks kernel/rcu/tree.c:2962 [inline]
 __rcu_process_callbacks kernel/rcu/tree.c:2929 [inline]
 rcu_process_callbacks+0x7c0/0x12c0 kernel/rcu/tree.c:2946
 __do_softirq+0x24e/0x9ae kernel/softirq.c:288

The buggy address belongs to the object at ffff888091def000
 which belongs to the cache filp of size 456
The buggy address is located 0 bytes inside of
 456-byte region [ffff888091def000, ffff888091def1c8)
The buggy address belongs to the page:
page:ffffea0002477bc0 count:1 mapcount:0 mapping:ffff888091def000 index:0x0
flags: 0x1fffc0000000100(slab)
raw: 01fffc0000000100 ffff888091def000 0000000000000000 0000000100000006
raw: ffffea0002974a20 ffffea0002983460 ffff8880aa9e09c0 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff888091deef00: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
 ffff888091deef80: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
>ffff888091def000: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
                   ^
 ffff888091def080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
 ffff888091def100: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
==================================================================

Crashes (4):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2019/04/21 07:22 linux-4.14.y 68d7a45eec10 b0e8efcb .config console log report syz C ci2-linux-4-14
2021/02/03 22:18 linux-4.14.y 2c8a3fceddf0 624dad51 .config console log report info ci2-linux-4-14 KASAN: use-after-free Read in scatterwalk_copychunks
2019/09/21 15:56 linux-4.14.y f6e27dbb1afa d96e88f3 .config console log report ci2-linux-4-14
2019/04/21 06:17 linux-4.14.y 68d7a45eec10 b0e8efcb .config console log report ci2-linux-4-14
* Struck through repros no longer work on HEAD.