Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp8086200rwr; Wed, 10 May 2023 17:54:36 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5u0Oi67jmLBcHiMILxiYOBXm2UVMXDhbc7lS6w+PqjTC6GJxj+8ML7IwXe2vfZz8hgO9Gf X-Received: by 2002:a17:902:d68b:b0:1ab:7fb:aac1 with SMTP id v11-20020a170902d68b00b001ab07fbaac1mr19981412ply.24.1683766476107; Wed, 10 May 2023 17:54:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683766476; cv=none; d=google.com; s=arc-20160816; b=YIDOguk4biBylT+YziHuQ+ygkRyy0zKzInalfIEmUWJ/ixH7aNQM6YUkIhPUWNshpo qnOu1IyI3mVeDomY9Dbs82Dnbm5v2fhFa3Q1y0Z2DGOtsiFlnd5B8Nq///lwa2crB5vj Bgk5EFCGX8fELHeZYGp/GDWwBQ82Nv7hsJfW+g2GOUUSwIyZ+Z4Yt6WwbeK2ee0O/P5g wkdIkJi5EOfPiyUP8i/VMZUQRFW7dFVgkMLbBRHFFWromauBeueJodfayYjrzQvpQ3al vWgSzgnOv9NJZX0HBPvB4Qquh5XI4Ej3l9fLDhTsdG+dls354TaxXkfcYhA+vzRpPTSx Gsfg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:to:from:subject :message-id:date:mime-version; bh=IuHvWFwrXhyf6o4L8zl4AHaOvAquuBTYJF18TfOBITo=; b=YdvGXu+D+9Z+bpLwI8SYwesRIyjgAMi55wgSWHfs1KMNh4/cH/XXSOVQFZn28rbCOR M3qpb6VpOjhk/vBLY6gXcnk2kF/FOCbjJqbQA2u+B8llKwmhWqUPrQtxRUeEJJGZvuZp 28E/4orc2ZkBBlQi0kHnmtsAaDRj1E1+SjuXOzkqIm84cBMWpfFjXvyyicluzaRPZAt+ 0tO6ZUEceDa8PVGzM319ovU2ljEMuIaolEsYI3bcjJ+UOoJ4hyj78znYBJbE4qRZZ3Af HmnrjHkab+2l80PjZvvDlkni72N0yz9h9bSNhQlYnDR+6BQ1S2Jine5gi9DFCGNqbq97 bydg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b7-20020a170902b60700b001ac6d4e1d72si5057569pls.149.2023.05.10.17.54.21; Wed, 10 May 2023 17:54:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=appspotmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236811AbjEKAN5 convert rfc822-to-8bit (ORCPT + 99 others); Wed, 10 May 2023 20:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57554 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232414AbjEKAN4 (ORCPT ); Wed, 10 May 2023 20:13:56 -0400 Received: from mail-io1-f69.google.com (mail-io1-f69.google.com [209.85.166.69]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3170D30C6 for ; Wed, 10 May 2023 17:13:54 -0700 (PDT) Received: by mail-io1-f69.google.com with SMTP id ca18e2360f4ac-76c27782e30so398280239f.3 for ; Wed, 10 May 2023 17:13:54 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1683764033; x=1686356033; h=content-transfer-encoding:to:from:subject:message-id:date :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=kpwYvUZfRjlIZVuVnL5DbEC1U/pIjk152uhUoDQJdOs=; b=B9mLnlMq5BoA0PAhfIFbIZAbpfwkAh4fHTjIUS3uH1pJWVxmU4W/YELxnJK11pyA0o uryD2xiMuKiaAa30FC/OjHxgvpQKxQavrDOia0+BUx9kKG+yfuQ+Dwi4C+gj51PsOZ4W J82VkOl5cWSrHJTA7yvf2jKmlubIvOgTagJ2PBGyklp/6ZbGkbF5VJKL2yTE2Ek/D84v /ggw8oszCcQPNPKMFwuZ0rmvsdzEDrNZ/1q3QLX/4M5UMCxCFZ5vnuIIOKCPkjegEhYq 8IbDN2K6LMlKxU4DlQfNA8RMRwUjuuJtJ49VtQM0TuqswOXW+pljbeZwewaF2nGb2YA9 mYew== X-Gm-Message-State: AC+VfDwmZHvW8FVc51lHdcsTuoVWDp9saAoOHO+fDCd1w/Yn/zJs8Wge yaBGn05EyjEsum96VZCt4+Ukg2omy4Ao4YtOQ1163ux+tSiV MIME-Version: 1.0 X-Received: by 2002:a5d:8055:0:b0:76c:50ad:8d89 with SMTP id b21-20020a5d8055000000b0076c50ad8d89mr4125624ior.3.1683764033463; Wed, 10 May 2023 17:13:53 -0700 (PDT) Date: Wed, 10 May 2023 17:13:53 -0700 X-Google-Appengine-App-Id: s~syzkaller X-Google-Appengine-App-Id-Alias: syzkaller Message-ID: <00000000000019af1d05fb5fdd99@google.com> Subject: [syzbot] [bpf?] KASAN: slab-out-of-bounds Write in copy_array (2) From: syzbot To: andrii@kernel.org, ast@kernel.org, bpf@vger.kernel.org, daniel@iogearbox.net, davem@davemloft.net, haoluo@google.com, hawk@kernel.org, john.fastabend@gmail.com, jolsa@kernel.org, kpsingh@kernel.org, kuba@kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev, martin.lau@linux.dev, nathan@kernel.org, ndesaulniers@google.com, netdev@vger.kernel.org, sdf@google.com, song@kernel.org, syzkaller-bugs@googlegroups.com, trix@redhat.com, yhs@fb.com Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 8BIT X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_00,FROM_LOCAL_HEX, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2, SORTED_RECIPS,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hello, syzbot found the following issue on: HEAD commit: 950b879b7f02 riscv: Fixup race condition on PG_dcache_clea.. git tree: git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux.git fixes console output: https://syzkaller.appspot.com/x/log.txt?x=17eaa0c6280000 kernel config: https://syzkaller.appspot.com/x/.config?x=ecebece1b90c0342 dashboard link: https://syzkaller.appspot.com/bug?extid=d742fd7d34097f949179 compiler: riscv64-linux-gnu-gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2 userspace arch: riscv64 Unfortunately, I don't have any reproducer for this issue yet. Downloadable assets: disk image (non-bootable): https://storage.googleapis.com/syzbot-assets/5ab53d394dbf/non_bootable_disk-950b879b.raw.xz vmlinux: https://storage.googleapis.com/syzbot-assets/938475579d6c/vmlinux-950b879b.xz kernel image: https://storage.googleapis.com/syzbot-assets/bcf263d8c574/Image-950b879b.xz IMPORTANT: if you fix the issue, please add the following tag to the commit: Reported-by: syzbot+d742fd7d34097f949179@syzkaller.appspotmail.com ================================================================== BUG: KASAN: slab-out-of-bounds in copy_array+0x8a/0xe8 kernel/bpf/verifier.c:1072 Write of size 80 at addr ff6000000e196e80 by task syz-executor.1/5213 CPU: 1 PID: 5213 Comm: syz-executor.1 Tainted: G W 6.2.0-rc1-syzkaller #0 Hardware name: riscv-virtio,qemu (DT) Call Trace: [] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:121 [] show_stack+0x34/0x40 arch/riscv/kernel/stacktrace.c:127 [] __dump_stack lib/dump_stack.c:88 [inline] [] dump_stack_lvl+0xe0/0x14c lib/dump_stack.c:106 [] print_address_description mm/kasan/report.c:306 [inline] [] print_report+0x1e4/0x4c0 mm/kasan/report.c:417 [] kasan_report+0xb8/0xe6 mm/kasan/report.c:517 [] check_region_inline mm/kasan/generic.c:173 [inline] [] kasan_check_range+0x32/0x148 mm/kasan/generic.c:189 [] memcpy+0x32/0x64 mm/kasan/shadow.c:66 [] copy_array+0x8a/0xe8 kernel/bpf/verifier.c:1072 [] copy_verifier_state+0x6c/0x462 kernel/bpf/verifier.c:1250 [] pop_stack kernel/bpf/verifier.c:1314 [inline] [] do_check kernel/bpf/verifier.c:14031 [inline] [] do_check_common+0x397a/0x6608 kernel/bpf/verifier.c:16289 [] do_check_main kernel/bpf/verifier.c:16352 [inline] [] bpf_check+0x45b2/0x5a5a kernel/bpf/verifier.c:16936 [] bpf_prog_load+0xc90/0x12b0 kernel/bpf/syscall.c:2619 [] __sys_bpf+0x622/0x31d2 kernel/bpf/syscall.c:4979 [] __do_sys_bpf kernel/bpf/syscall.c:5083 [inline] [] sys_bpf+0x28/0x36 kernel/bpf/syscall.c:5081 [] ret_from_syscall+0x0/0x2 Allocated by task 5213: stack_trace_save+0xa6/0xd8 kernel/stacktrace.c:122 kasan_save_stack+0x2c/0x5a mm/kasan/common.c:45 kasan_set_track+0x1a/0x26 mm/kasan/common.c:52 kasan_save_alloc_info+0x1a/0x24 mm/kasan/generic.c:507 ____kasan_kmalloc mm/kasan/common.c:371 [inline] ____kasan_kmalloc mm/kasan/common.c:330 [inline] __kasan_krealloc+0xfa/0x11a mm/kasan/common.c:439 kasan_krealloc include/linux/kasan.h:231 [inline] __do_krealloc mm/slab_common.c:1361 [inline] krealloc+0x82/0xae mm/slab_common.c:1398 push_jmp_history+0xd2/0x140 kernel/bpf/verifier.c:2592 is_state_visited kernel/bpf/verifier.c:13552 [inline] do_check kernel/bpf/verifier.c:13752 [inline] do_check_common+0x47be/0x6608 kernel/bpf/verifier.c:16289 do_check_main kernel/bpf/verifier.c:16352 [inline] bpf_check+0x45b2/0x5a5a kernel/bpf/verifier.c:16936 bpf_prog_load+0xc90/0x12b0 kernel/bpf/syscall.c:2619 __sys_bpf+0x622/0x31d2 kernel/bpf/syscall.c:4979 __do_sys_bpf kernel/bpf/syscall.c:5083 [inline] sys_bpf+0x28/0x36 kernel/bpf/syscall.c:5081 ret_from_syscall+0x0/0x2 The buggy address belongs to the object at ff6000000e196e80 which belongs to the cache kmalloc-96 of size 96 The buggy address is located 0 bytes inside of 96-byte region [ff6000000e196e80, ff6000000e196ee0) The buggy address belongs to the physical page: page:ff1c00000238e580 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x8e396 ksm flags: 0xffe000000000200(slab|node=0|zone=0|lastcpupid=0x7ff) raw: 0ffe000000000200 ff60000008201780 ff1c0000024db740 0000000000000003 raw: 0000000000000000 0000000080200020 00000001ffffffff 0000000000000000 page dumped because: kasan: bad access detected page_owner tracks the page as allocated page last allocated via order 0, migratetype Unmovable, gfp_mask 0x12c40(GFP_NOFS|__GFP_NOWARN|__GFP_NORETRY), pid 2674, tgid 2674 (dhcpcd), ts 215113436000, free_ts 215046751000 __set_page_owner+0x32/0x182 mm/page_owner.c:190 set_page_owner include/linux/page_owner.h:31 [inline] post_alloc_hook+0xf8/0x11a mm/page_alloc.c:2524 prep_new_page mm/page_alloc.c:2531 [inline] get_page_from_freelist+0xc0e/0x1118 mm/page_alloc.c:4283 __alloc_pages+0x1b0/0x165a mm/page_alloc.c:5549 alloc_pages+0x132/0x25e mm/mempolicy.c:2286 alloc_slab_page mm/slub.c:1851 [inline] allocate_slab mm/slub.c:1998 [inline] new_slab+0x270/0x382 mm/slub.c:2051 ___slab_alloc+0x57e/0xaa6 mm/slub.c:3193 __slab_alloc.constprop.0+0x5a/0x98 mm/slub.c:3292 __slab_alloc_node mm/slub.c:3345 [inline] slab_alloc_node mm/slub.c:3442 [inline] __kmem_cache_alloc_node+0xf2/0x2e4 mm/slub.c:3491 __do_kmalloc_node mm/slab_common.c:967 [inline] __kmalloc+0x34/0xe2 mm/slab_common.c:981 kmalloc include/linux/slab.h:584 [inline] kzalloc include/linux/slab.h:720 [inline] tomoyo_get_name+0x1f0/0x2f4 security/tomoyo/memory.c:173 tomoyo_parse_name_union+0xfa/0x156 security/tomoyo/util.c:260 tomoyo_update_path_acl security/tomoyo/file.c:395 [inline] tomoyo_write_file+0x3f4/0x74e security/tomoyo/file.c:1022 tomoyo_write_domain2+0x102/0x18c security/tomoyo/common.c:1143 tomoyo_add_entry security/tomoyo/common.c:2033 [inline] tomoyo_supervisor+0x364/0xc08 security/tomoyo/common.c:2094 tomoyo_audit_path_log security/tomoyo/file.c:168 [inline] tomoyo_path_permission security/tomoyo/file.c:587 [inline] tomoyo_path_permission+0x152/0x18e security/tomoyo/file.c:573 page last free stack trace: __reset_page_owner+0x4a/0xf8 mm/page_owner.c:148 reset_page_owner include/linux/page_owner.h:24 [inline] free_pages_prepare mm/page_alloc.c:1446 [inline] free_pcp_prepare+0x254/0x48e mm/page_alloc.c:1496 free_unref_page_prepare mm/page_alloc.c:3369 [inline] free_unref_page+0x60/0x2ae mm/page_alloc.c:3464 free_the_page mm/page_alloc.c:750 [inline] __free_pages+0xd6/0x106 mm/page_alloc.c:5635 free_pages.part.0+0xd8/0x13a mm/page_alloc.c:5646 free_pages+0xe/0x18 mm/page_alloc.c:5643 pgd_free include/asm-generic/pgalloc.h:193 [inline] mm_free_pgd kernel/fork.c:737 [inline] __mmdrop+0x88/0x2f0 kernel/fork.c:795 mmdrop include/linux/sched/mm.h:50 [inline] mmdrop_sched include/linux/sched/mm.h:78 [inline] finish_task_switch.isra.0+0x32e/0x426 kernel/sched/core.c:5148 context_switch kernel/sched/core.c:5247 [inline] __schedule+0x64c/0x1274 kernel/sched/core.c:6555 schedule+0x7a/0x102 kernel/sched/core.c:6631 schedule_hrtimeout_range_clock+0x2da/0x2e2 kernel/time/hrtimer.c:2296 schedule_hrtimeout_range+0x28/0x36 kernel/time/hrtimer.c:2351 poll_schedule_timeout.constprop.0+0x84/0xde fs/select.c:244 do_poll fs/select.c:965 [inline] do_sys_poll+0x512/0x94a fs/select.c:1015 __do_sys_ppoll fs/select.c:1121 [inline] sys_ppoll+0x18a/0x1b0 fs/select.c:1101 ret_from_syscall+0x0/0x2 Memory state around the buggy address: ff6000000e196d80: 00 00 00 00 00 00 00 00 00 04 fc fc fc fc fc fc ff6000000e196e00: 00 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc >ff6000000e196e80: 00 00 fc fc fc fc fc fc fc fc fc fc fc fc fc fc ^ ff6000000e196f00: 00 00 00 00 00 00 00 00 00 fc fc fc fc fc fc fc ff6000000e196f80: 00 00 00 00 00 00 00 00 00 00 00 06 fc fc fc fc ================================================================== warn_alloc: 3 callbacks suppressed syz-executor.1: vmalloc error: size 4096, vm_struct allocation failed, mode:0xcc0(GFP_KERNEL), nodemask=(null),cpuset=syz1,mems_allowed=0 CPU: 1 PID: 5213 Comm: syz-executor.1 Tainted: G B W 6.2.0-rc1-syzkaller #0 Hardware name: riscv-virtio,qemu (DT) Call Trace: [] dump_backtrace+0x2e/0x3c arch/riscv/kernel/stacktrace.c:121 [] show_stack+0x34/0x40 arch/riscv/kernel/stacktrace.c:127 [] __dump_stack lib/dump_stack.c:88 [inline] [] dump_stack_lvl+0xe0/0x14c lib/dump_stack.c:106 [] dump_stack+0x1c/0x24 lib/dump_stack.c:113 [] warn_alloc+0x168/0x22c mm/page_alloc.c:4356 [] __vmalloc_node_range+0xb6c/0xdb4 mm/vmalloc.c:3192 [] bpf_jit_alloc_exec+0x46/0x52 arch/riscv/net/bpf_jit_core.c:190 [] bpf_jit_binary_alloc+0x96/0x13c kernel/bpf/core.c:1025 [] bpf_int_jit_compile+0x886/0xaa6 arch/riscv/net/bpf_jit_core.c:112 [] bpf_prog_select_runtime+0x1a2/0x22e kernel/bpf/core.c:2190 [] bpf_prog_load+0xcb4/0x12b0 kernel/bpf/syscall.c:2623 [] __sys_bpf+0x622/0x31d2 kernel/bpf/syscall.c:4979 [] __do_sys_bpf kernel/bpf/syscall.c:5083 [inline] [] sys_bpf+0x28/0x36 kernel/bpf/syscall.c:5081 [] ret_from_syscall+0x0/0x2 Mem-Info: active_anon:26162 inactive_anon:84 isolated_anon:0 active_file:0 inactive_file:7832 isolated_file:0 unevictable:768 dirty:22 writeback:0 slab_reclaimable:5680 slab_unreclaimable:24335 mapped:8731 shmem:3924 pagetables:292 sec_pagetables:0 bounce:0 kernel_misc_reclaimable:0 free:231175 free_pcp:515 free_cma:4096 Node 0 active_anon:104648kB inactive_anon:336kB active_file:0kB inactive_file:31328kB unevictable:3072kB isolated(anon):0kB isolated(file):0kB mapped:34924kB dirty:88kB writeback:0kB shmem:15696kB writeback_tmp:0kB kernel_stack:5408kB pagetables:1168kB sec_pagetables:0kB all_unreclaimable? no Node 0 DMA32 free:924700kB boost:0kB min:4656kB low:6012kB high:7368kB reserved_highatomic:0KB active_anon:104648kB inactive_anon:336kB active_file:0kB inactive_file:31328kB unevictable:3072kB writepending:88kB present:2095104kB managed:1359004kB mlocked:0kB bounce:0kB free_pcp:2060kB local_pcp:1596kB free_cma:16384kB lowmem_reserve[]: 0 0 0 Node 0 DMA32: 2659*4kB (UME) 2000*8kB (UME) 981*16kB (UME) 519*32kB (UME) 186*64kB (UME) 35*128kB (UME) 7*256kB (M) 9*512kB (ME) 5*1024kB (ME) 7*2048kB (MEC) 201*4096kB (MC) = 924476kB Node 0 hugepages_total=0 hugepages_free=0 hugepages_surp=0 hugepages_size=1048576kB Node 0 hugepages_total=4 hugepages_free=4 hugepages_surp=0 hugepages_size=2048kB 11756 total pagecache pages 0 pages in swap cache Free swap = 0kB Total swap = 0kB 523776 pages RAM 0 pages HighMem/MovableOnly 184025 pages reserved 4096 pages cma reserved --- This report is generated by a bot. It may contain errors. See https://goo.gl/tpsmEJ for more information about syzbot. syzbot engineers can be reached at syzkaller@googlegroups.com. syzbot will keep track of this issue. See: https://goo.gl/tpsmEJ#status for how to communicate with syzbot. If the bug is already fixed, let syzbot know by replying with: #syz fix: exact-commit-title If you want to change bug's subsystems, reply with: #syz set subsystems: new-subsystem (See the list of subsystem names on the web dashboard) If the bug is a duplicate of another bug, reply with: #syz dup: exact-subject-of-another-report If you want to undo deduplication, reply with: #syz undup