syzbot


KASAN: use-after-free Read in generic_gcmaes_encrypt

Status: closed as invalid on 2020/06/28 17:44
Subsystems: crypto
[Documentation on labels]
Reported-by: syzbot+6d3612ba5e254e387153@syzkaller.appspotmail.com
First crash: 2253d, last: 1681d
Cause bisection: introduced by (bisect log) :
commit a42055e8d2c30d4decfc13ce943d09c7b9dad221
Author: Vakul Garg <vakul.garg@nxp.com>
Date: Fri Sep 21 04:16:13 2018 +0000

  net/tls: Add support for async encryption of records for performance

Crash: KASAN: use-after-free Read in generic_gcmaes_encrypt (log)
Repro: C syz .config
  
Fix bisection: failed (error log, bisect log)
  
Discussions (2)
Title Replies (including bot) Last reply
Reminder: 17 open syzbot bugs in "net/tls" subsystem 1 (1) 2019/06/25 05:50
KASAN: use-after-free Read in generic_gcmaes_encrypt 2 (4) 2019/03/28 17:08
Fix bisection attempts (7)
Created Duration User Patch Repo Result
2020/05/17 01:54 0m bisect fix upstream error job log
2020/04/16 16:47 24m bisect fix upstream OK (0) job log log
2020/03/17 03:05 26m bisect fix upstream OK (0) job log log
2020/02/12 04:35 26m bisect fix upstream OK (0) job log log
2020/01/13 02:58 22m bisect fix upstream OK (0) job log log
2019/12/11 08:40 24m bisect fix upstream OK (0) job log log
2019/08/11 23:42 26m bisect fix upstream OK (0) job log log

Sample crash report:
sshd (7864) used greatest stack depth: 15736 bytes left
TCP: request_sock_TCPv6: Possible SYN flooding on port 20002. Sending cookies.  Check SNMP counters.
==================================================================
BUG: KASAN: use-after-free in memcpy include/linux/string.h:352 [inline]
BUG: KASAN: use-after-free in generic_gcmaes_encrypt+0xc6/0x190 arch/x86/crypto/aesni-intel_glue.c:1272
Read of size 12 at addr ffff8881d7bf1c00 by task kworker/1:1/22

CPU: 1 PID: 22 Comm: kworker/1:1 Not tainted 4.20.0+ #389
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Workqueue: pencrypt padata_parallel_worker
Call Trace:
 __dump_stack lib/dump_stack.c:77 [inline]
 dump_stack+0x1d3/0x2c6 lib/dump_stack.c:113
 print_address_description.cold.8+0x9/0x1ff mm/kasan/report.c:256
 kasan_report_error mm/kasan/report.c:354 [inline]
 kasan_report.cold.9+0x242/0x309 mm/kasan/report.c:412
 check_memory_region_inline mm/kasan/kasan.c:260 [inline]
 check_memory_region+0x13e/0x1b0 mm/kasan/kasan.c:267
 memcpy+0x23/0x50 mm/kasan/kasan.c:302
 memcpy include/linux/string.h:352 [inline]
 generic_gcmaes_encrypt+0xc6/0x190 arch/x86/crypto/aesni-intel_glue.c:1272
 crypto_aead_encrypt include/crypto/aead.h:364 [inline]
 gcmaes_wrapper_encrypt+0x162/0x200 arch/x86/crypto/aesni-intel_glue.c:1124
 crypto_aead_encrypt include/crypto/aead.h:364 [inline]
 pcrypt_aead_enc+0xcb/0x190 crypto/pcrypt.c:143
 padata_parallel_worker+0x49d/0x760 kernel/padata.c:86
 process_one_work+0xc90/0x1c40 kernel/workqueue.c:2153
 worker_thread+0x17f/0x1390 kernel/workqueue.c:2296
 kthread+0x35a/0x440 kernel/kthread.c:246
 ret_from_fork+0x3a/0x50 arch/x86/entry/entry_64.S:352

Allocated by task 7886:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 kasan_kmalloc+0xc7/0xe0 mm/kasan/kasan.c:553
 kmem_cache_alloc_trace+0x152/0x750 mm/slab.c:3620
 kmalloc include/linux/slab.h:546 [inline]
 tls_set_sw_offload+0xcb3/0x1390 net/tls/tls_sw.c:1947
 do_tls_setsockopt_conf net/tls/tls_main.c:467 [inline]
 do_tls_setsockopt net/tls/tls_main.c:514 [inline]
 tls_setsockopt+0x689/0x770 net/tls/tls_main.c:533
 sock_common_setsockopt+0x9a/0xe0 net/core/sock.c:2978
 __sys_setsockopt+0x1ba/0x3c0 net/socket.c:1902
 __do_sys_setsockopt net/socket.c:1913 [inline]
 __se_sys_setsockopt net/socket.c:1910 [inline]
 __x64_sys_setsockopt+0xbe/0x150 net/socket.c:1910
 do_syscall_64+0x1b9/0x820 arch/x86/entry/common.c:290
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

Freed by task 7886:
 save_stack+0x43/0xd0 mm/kasan/kasan.c:448
 set_track mm/kasan/kasan.c:460 [inline]
 __kasan_slab_free+0x102/0x150 mm/kasan/kasan.c:521
 kasan_slab_free+0xe/0x10 mm/kasan/kasan.c:528
 __cache_free mm/slab.c:3498 [inline]
 kfree+0xcf/0x230 mm/slab.c:3817
 tls_sk_proto_close+0x5fa/0x750 net/tls/tls_main.c:277
 inet_release+0x104/0x1f0 net/ipv4/af_inet.c:428
 inet6_release+0x50/0x70 net/ipv6/af_inet6.c:458
 __sock_release+0xd7/0x250 net/socket.c:579
 sock_close+0x19/0x20 net/socket.c:1141
 __fput+0x385/0xa30 fs/file_table.c:278
 ____fput+0x15/0x20 fs/file_table.c:309
 task_work_run+0x1e8/0x2a0 kernel/task_work.c:113
 tracehook_notify_resume include/linux/tracehook.h:188 [inline]
 exit_to_usermode_loop+0x318/0x380 arch/x86/entry/common.c:166
 prepare_exit_to_usermode arch/x86/entry/common.c:197 [inline]
 syscall_return_slowpath arch/x86/entry/common.c:268 [inline]
 do_syscall_64+0x6be/0x820 arch/x86/entry/common.c:293
 entry_SYSCALL_64_after_hwframe+0x49/0xbe

The buggy address belongs to the object at ffff8881d7bf1c00
 which belongs to the cache kmalloc-32 of size 32
The buggy address is located 0 bytes inside of
 32-byte region [ffff8881d7bf1c00, ffff8881d7bf1c20)
The buggy address belongs to the page:
page:ffffea00075efc40 count:1 mapcount:0 mapping:ffff8881da8001c0 index:0xffff8881d7bf1fc1
flags: 0x2fffc0000000200(slab)
raw: 02fffc0000000200 ffffea0006e29f08 ffffea000763cd08 ffff8881da8001c0
raw: ffff8881d7bf1fc1 ffff8881d7bf1000 000000010000001c 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
 ffff8881d7bf1b00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8881d7bf1b80: fb fb fb fb fc fc fc fc 00 01 fc fc fc fc fc fc
>ffff8881d7bf1c00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
                   ^
 ffff8881d7bf1c80: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
 ffff8881d7bf1d00: fb fb fb fb fc fc fc fc fb fb fb fb fc fc fc fc
==================================================================

Crashes (921):
Time Kernel Commit Syzkaller Config Log Report Syz repro C repro VM info Assets (help?) Manager Title
2018/12/26 20:50 upstream 5694cecdb092 8a41a0ad .config console log report syz C ci-upstream-kasan-gce-root
2018/12/26 19:27 upstream 5694cecdb092 8a41a0ad .config console log report syz C ci-upstream-kasan-gce-smack-root
2018/12/25 15:52 upstream 8fe28cb58bcb 8a41a0ad .config console log report syz C ci-upstream-kasan-gce
2018/12/04 10:00 upstream 0072a0c14d5b 03f94a45 .config console log report syz C ci-upstream-kasan-gce
2018/12/04 09:19 upstream 0072a0c14d5b 03f94a45 .config console log report syz C ci-upstream-kasan-gce-smack-root
2018/12/25 15:44 net-old 38355a5f9a22 8a41a0ad .config console log report syz C ci-upstream-net-this-kasan-gce
2018/09/23 09:32 net-next-old 739d0def85ca 37079712 .config console log report syz C ci-upstream-net-kasan-gce
2018/12/28 13:26 linux-next 6a1d293238c1 fc6ae81a .config console log report syz C ci-upstream-linux-next-kasan-gce-root
2018/12/04 18:20 upstream 0072a0c14d5b 6ad0ae61 .config console log report syz ci-upstream-kasan-gce-selinux-root
2018/12/04 09:11 upstream 0072a0c14d5b 03f94a45 .config console log report syz ci-upstream-kasan-gce-root
2018/12/04 09:12 linux-next 442b8cea2477 03f94a45 .config console log report syz ci-upstream-linux-next-kasan-gce-root
2019/01/27 19:28 upstream ba6069759381 c73f090a .config console log report ci-upstream-kasan-gce
2019/01/27 13:17 upstream ba6069759381 c73f090a .config console log report ci-upstream-kasan-gce
2019/01/26 04:19 upstream ba6069759381 ebf7a37c .config console log report ci-upstream-kasan-gce-smack-root
2019/01/24 15:01 upstream 30bac164aca7 ce1ccf97 .config console log report ci-upstream-kasan-gce-root
2019/01/21 21:39 upstream 49a57857aeea badbbeee .config console log report ci-upstream-kasan-gce-root
2019/01/20 22:35 upstream 6e693b3ffecb fd37a550 .config console log report ci-upstream-kasan-gce
2019/01/20 12:29 upstream b0efca46b570 353f32ea .config console log report ci-upstream-kasan-gce
2019/01/18 12:07 upstream a3a80255d58d 5bf17c30 .config console log report ci-upstream-kasan-gce-root
2019/01/05 17:41 upstream 3fed6ae4b027 53be0a37 .config console log report ci-upstream-kasan-gce-selinux-root
2019/01/19 03:33 upstream d7393226d15a 2103a236 .config console log report ci-upstream-kasan-gce-386
2019/01/30 03:38 net-old abfd04f738c2 aa432daf .config console log report ci-upstream-net-this-kasan-gce
2019/01/29 22:35 net-old abfd04f738c2 aa432daf .config console log report ci-upstream-net-this-kasan-gce
2019/01/28 15:44 net-old abfd04f738c2 629c2a27 .config console log report ci-upstream-net-this-kasan-gce
2019/01/27 22:23 net-old abfd04f738c2 c73f090a .config console log report ci-upstream-net-this-kasan-gce
2019/01/27 11:21 net-old abfd04f738c2 c73f090a .config console log report ci-upstream-net-this-kasan-gce
2019/01/27 07:32 net-old abfd04f738c2 c73f090a .config console log report ci-upstream-net-this-kasan-gce
2019/01/25 21:02 net-old 6eea3527e68a b5d78bce .config console log report ci-upstream-net-this-kasan-gce
2019/01/23 01:42 net-old 56cb4e503499 b1ff06b2 .config console log report ci-upstream-net-this-kasan-gce
2019/01/22 01:19 net-old 49a57857aeea badbbeee .config console log report ci-upstream-net-this-kasan-gce
2019/01/21 11:25 net-old 6436408e814b badbbeee .config console log report ci-upstream-net-this-kasan-gce
2019/01/21 06:19 net-old 6436408e814b fd37a550 .config console log report ci-upstream-net-this-kasan-gce
2019/01/19 09:05 net-old 8a7fa0c35027 2103a236 .config console log report ci-upstream-net-this-kasan-gce
2019/01/29 19:36 net-next-old 085c4c7dd2b6 aa432daf .config console log report ci-upstream-net-kasan-gce
2019/01/29 15:24 net-next-old 085c4c7dd2b6 aa432daf .config console log report ci-upstream-net-kasan-gce
2019/01/29 12:17 net-next-old 085c4c7dd2b6 aa432daf .config console log report ci-upstream-net-kasan-gce
2019/01/28 18:15 net-next-old 085c4c7dd2b6 629c2a27 .config console log report ci-upstream-net-kasan-gce
2019/01/28 11:41 net-next-old 085c4c7dd2b6 629c2a27 .config console log report ci-upstream-net-kasan-gce
2019/01/27 16:36 net-next-old 085c4c7dd2b6 c73f090a .config console log report ci-upstream-net-kasan-gce
2019/01/26 20:09 net-next-old f859a4484703 c73f090a .config console log report ci-upstream-net-kasan-gce
2019/01/26 15:16 net-next-old f859a4484703 c73f090a .config console log report ci-upstream-net-kasan-gce
2019/01/26 02:55 net-next-old 30e5c2c6bf28 ebf7a37c .config console log report ci-upstream-net-kasan-gce
2019/01/25 12:54 net-next-old 556b2710a1ca b5d78bce .config console log report ci-upstream-net-kasan-gce
2019/01/24 18:42 net-next-old 254764e55652 ce1ccf97 .config console log report ci-upstream-net-kasan-gce
2019/01/24 06:34 net-next-old 33a0efa4baec 56558f63 .config console log report ci-upstream-net-kasan-gce
2019/01/24 05:01 net-next-old 33a0efa4baec 56558f63 .config console log report ci-upstream-net-kasan-gce
2019/01/22 16:13 net-next-old fa7f3a8d56b3 985f75cc .config console log report ci-upstream-net-kasan-gce
2019/01/22 14:13 net-next-old fa7f3a8d56b3 985f75cc .config console log report ci-upstream-net-kasan-gce
2019/01/21 03:45 net-next-old 4e15cbe82996 fd37a550 .config console log report ci-upstream-net-kasan-gce
2019/01/21 01:54 net-next-old 4e15cbe82996 fd37a550 .config console log report ci-upstream-net-kasan-gce
2019/01/20 17:11 net-next-old 4e15cbe82996 fd37a550 .config console log report ci-upstream-net-kasan-gce
2019/01/20 08:51 net-next-old 133bbb18ab1a 353f32ea .config console log report ci-upstream-net-kasan-gce
2019/01/19 23:22 net-next-old 133bbb18ab1a 8aa587b0 .config console log report ci-upstream-net-kasan-gce
2019/01/19 17:40 net-next-old f04d402f2f00 8aa587b0 .config console log report ci-upstream-net-kasan-gce
2019/01/19 11:38 net-next-old f04d402f2f00 2103a236 .config console log report ci-upstream-net-kasan-gce
2019/01/19 01:54 net-next-old 435f3f267780 2103a236 .config console log report ci-upstream-net-kasan-gce
2019/01/18 23:59 net-next-old 435f3f267780 2103a236 .config console log report ci-upstream-net-kasan-gce
2019/01/17 19:50 net-next-old 44543f1dd2a3 769e75ed .config console log report ci-upstream-net-kasan-gce
2018/09/22 19:16 net-next-old bd4d08daeb95 37079712 .config console log report ci-upstream-net-kasan-gce
* Struck through repros no longer work on HEAD.