Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5476561pxb; Mon, 7 Feb 2022 02:59:14 -0800 (PST) X-Google-Smtp-Source: ABdhPJxJ7zEL3OreYLuNHMxoIHFJh2qHfJnzwT6Hq2VxVtJKFdqEF3dVlvwd1tJ7Q8Yg3PRNbf1h X-Received: by 2002:a05:6a00:1882:: with SMTP id x2mr15108136pfh.26.1644231554543; Mon, 07 Feb 2022 02:59:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644231554; cv=none; d=google.com; s=arc-20160816; b=x1oKdMUWjm76xft3azd25p9RgqK/ex50vTpZtpzzpkhdOBvLOoQxXhYkMo3Fynycdl P2n/ULFnxnOK/WBW4M1CDYUJJdNLNi0Q50n0jK8s2ChAaiT04CLtRV8qcitCux7j+fI3 Il/S5xQqNiwzabLhbr2QhXnNOJIqjO2WHlqC4rDOAiXon7Oamxjt9ahM6tELNyf4e5Yy GFt/b5CutBXSvRNNv/Js6WgHQtuLQt2uYJJ8ISmFpGZnaX3oTi4E6PdjDfEyM0+ZyH2k S1g+/ne0TzRPG+oX5neLtmC1V4CWd38HT82v5VODwbW0au8ijBVF3ulmUdkUlSPocsot dfxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=gShRWvUd9Ow7a7WNN2vAkv7bSulf8ktrvRALywosIDY=; b=nQ6LYFDBnML0gGv53inJLZlzce1MAsosQ/LGtByKOvGp7Yfb2MX4LmPacSsQYM/ba9 CtBZbvFhzj0rdAu89OqLse6Y38UqIuznNNw8jCC5579koMPwdxbUd4J5D4U3f/x/oq4s knAPzQ5Rj6IXqZS53YdRRlxWkm9iWFfNsprdp2d4SBHsgP4NhA4FOpajFp+YCwd4bUxA FAJAWU5ZLRM6hv5/hF258cT5qJZmeTV+SJL6fPcngKZkJwB4sTg5GBsVokNowHzHamiK sUl6so0RT+8oKZmm1/1EUZj1m9ElR4NlJZSJjsvPIzFCtrXYW5BrpUWjwN+RU5yhWuw/ pPjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=e7yB3Prx; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id pg16si10117389pjb.74.2022.02.07.02.59.02; Mon, 07 Feb 2022 02:59:14 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20210112 header.b=e7yB3Prx; 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=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1348632AbiBGCWX (ORCPT + 99 others); Sun, 6 Feb 2022 21:22:23 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45182 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236621AbiBGCWV (ORCPT ); Sun, 6 Feb 2022 21:22:21 -0500 Received: from mail-yb1-xb33.google.com (mail-yb1-xb33.google.com [IPv6:2607:f8b0:4864:20::b33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4D20AC043180 for ; Sun, 6 Feb 2022 18:22:20 -0800 (PST) Received: by mail-yb1-xb33.google.com with SMTP id bt13so11860663ybb.2 for ; Sun, 06 Feb 2022 18:22:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=gShRWvUd9Ow7a7WNN2vAkv7bSulf8ktrvRALywosIDY=; b=e7yB3Prxf+J7bVf+/a2nIir83849wgtDQk2BJ7M1DF4TBP37cuBDpdB31Y7riwDj/j LhSu6kbCMfxBI6GA4T7OmZlS2cCZ7OEWVPbngWC421tEew37Y+O84gqJk1fEAEwC8LVk l+vuvCn5qvSKR+y/g3CqozYlrOdHJVigyosv17O1HeONiueto6O3XrzGtKOF8yn5/CtG v/2kinBnRVx48YtWh0OSULoMl4c4LlnvMaMyTmjsav4CRcbZyjJJ7Yw7uDerJVBCFO7z Xv9IOX4DYj7FHkjNpHztmy1SgbLriaW4CayuHOcUy+yHQ7i7X6l+diswez1nc4wmKfkY 5Jrw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gShRWvUd9Ow7a7WNN2vAkv7bSulf8ktrvRALywosIDY=; b=WOzr3eaxV9uv9oY1uaRNxTxGkK9er5KGH1WgYwhfZeJBeANdCmE2pW3EmYt5XBlf4J 1uehRKXORTqtwjvkblzaqAmMDEnHABycSxqOeEMu6YzDVQkvTqQtkJE2xh5U86W+eMh6 EhxCr7/hn2U5hURGDOxcWhc1g2Si81qx2JpdAGDiHRg2W4xTt4EJpFypFJc+j4sNhfJ5 PNG4W5rHApK8/SMHba8tkd7opLQJAcEKYq3NzLSV67Z23cSog7SeIr8DsExtsUCUG2Uj vjqox0txNLjhPu6BtJrgjN2ODzCVWbbXgCWjLDiBuFnLOYAQLQKBqVQn0ofRZxckS3Hw 6P6Q== X-Gm-Message-State: AOAM532NWgM4Ai6vKkiKEcxgNdPNUJfHwqbUKvJFUfpxVTOx7Vo5f/qp tOjiePsUXhxbhCnWQO+Hdm1tRppm9nzFDNvD5FHfiXw0xNW3GOxm X-Received: by 2002:a81:e345:: with SMTP id w5mr6660964ywl.32.1644200538925; Sun, 06 Feb 2022 18:22:18 -0800 (PST) MIME-Version: 1.0 References: <20220207014955.GA33412@xsang-OptiPlex-9020> In-Reply-To: From: Eric Dumazet Date: Sun, 6 Feb 2022 18:22:07 -0800 Message-ID: Subject: Re: [ip6mr] f2f2325ec7: BUG:KASAN:use-after-free_in_ip6mr_sk_done To: kernel test robot Cc: "David S. Miller" , LKML , lkp@lists.01.org, lkp@intel.com Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham 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 On Sun, Feb 6, 2022 at 6:20 PM Eric Dumazet wrote: > > On Sun, Feb 6, 2022 at 5:50 PM kernel test robot wrote: > > > > > > > > Greeting, > > > > FYI, we noticed the following commit (built with gcc-9): > > > > commit: f2f2325ec79970807012dfc9e716cdbb02d9b574 ("ip6mr: ip6mr_sk_done() can exit early in common cases") > > url: https://github.com/0day-ci/linux/commits/Biju-Das/dt-bindings-net-renesas-etheravb-Document-RZ-V2L-SoC/20220207-042554 > > > > Yes, syzbot found it yesterday, and the fix is sent for review. thanks. > > https://patchwork.kernel.org/project/netdevbpf/patch/20220206143348.350693-1-eric.dumazet@gmail.com/ Correct link is : https://patchwork.kernel.org/project/netdevbpf/list/?series=611632 > > > > in testcase: trinity > > version: trinity-x86_64-608712d8-1_20220128 > > with following parameters: > > > > runtime: 300s > > > > test-description: Trinity is a linux system call fuzz tester. > > test-url: http://codemonkey.org.uk/projects/trinity/ > > > > > > on test machine: qemu-system-x86_64 -enable-kvm -cpu SandyBridge -smp 2 -m 16G > > > > caused below changes (please refer to attached dmesg/kmsg for entire log/backtrace): > > > > > > > > If you fix the issue, kindly add following tag > > Reported-by: kernel test robot > > > > > > [ 43.727566][ T7] BUG: KASAN: use-after-free in ip6mr_sk_done (arch/x86/include/asm/atomic.h:29 include/linux/atomic/atomic-instrumented.h:28 net/ipv6/ip6mr.c:1578) > > [ 43.728665][ T7] Read of size 4 at addr ffff88810eb94888 by task kworker/u4:0/7 > > [ 43.729851][ T7] > > [ 43.730219][ T7] CPU: 0 PID: 7 Comm: kworker/u4:0 Not tainted 5.17.0-rc2-00638-gf2f2325ec799 #1 > > [ 43.731561][ T7] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.12.0-1 04/01/2014 > > [ 43.732945][ T7] Workqueue: netns cleanup_net > > [ 43.733744][ T7] Call Trace: > > [ 43.734297][ T7] > > [ 43.734792][ T7] dump_stack_lvl (lib/dump_stack.c:107) > > [ 43.735543][ T7] print_address_description+0x21/0x180 > > [ 43.736636][ T7] ? ip6mr_sk_done (arch/x86/include/asm/atomic.h:29 include/linux/atomic/atomic-instrumented.h:28 net/ipv6/ip6mr.c:1578) > > [ 43.737405][ T7] kasan_report.cold (mm/kasan/report.c:443 mm/kasan/report.c:459) > > [ 43.738113][ T7] ? ip6mr_sk_done (arch/x86/include/asm/atomic.h:29 include/linux/atomic/atomic-instrumented.h:28 net/ipv6/ip6mr.c:1578) > > [ 43.738764][ T7] kasan_check_range (mm/kasan/generic.c:190) > > [ 43.739475][ T7] ip6mr_sk_done (arch/x86/include/asm/atomic.h:29 include/linux/atomic/atomic-instrumented.h:28 net/ipv6/ip6mr.c:1578) > > [ 43.740207][ T7] rawv6_close (net/ipv6/raw.c:1202) > > [ 43.743739][ T7] inet_release (net/ipv4/af_inet.c:429) > > [ 43.747360][ T7] __sock_release (net/socket.c:651) > > [ 43.749878][ T7] igmp6_net_exit (net/ipv6/mcast.c:3174) > > [ 43.752005][ T7] ops_exit_list+0x98/0x180 > > [ 43.754973][ T7] cleanup_net (net/core/net_namespace.c:599 (discriminator 3)) > > [ 43.757738][ T7] ? peernet2id_alloc (net/core/net_namespace.c:553) > > [ 43.760247][ T7] ? __schedule (kernel/sched/core.c:6174) > > [ 43.762857][ T7] process_one_work (arch/x86/include/asm/jump_label.h:27 include/linux/jump_label.h:212 include/trace/events/workqueue.h:108 kernel/workqueue.c:2312) > > [ 43.765808][ T7] worker_thread (include/linux/list.h:292 kernel/workqueue.c:2455) > > [ 43.768529][ T7] ? process_one_work (kernel/workqueue.c:2397) > > [ 43.771855][ T7] kthread (kernel/kthread.c:377) > > [ 43.775300][ T7] ? kthread_complete_and_exit (kernel/kthread.c:332) > > [ 43.778982][ T7] ret_from_fork (arch/x86/entry/entry_64.S:301) > > [ 43.782691][ T7] > > [ 43.786069][ T7] > > [ 43.789270][ T7] Allocated by task 1: > > [ 43.792813][ T7] kasan_save_stack (mm/kasan/common.c:39) > > [ 43.796486][ T7] __kasan_kmalloc (mm/kasan/common.c:45 mm/kasan/common.c:436 mm/kasan/common.c:515 mm/kasan/common.c:524) > > [ 43.799875][ T7] fib_create_info (include/linux/slab.h:586 include/linux/slab.h:715 net/ipv4/fib_semantics.c:1442) > > [ 43.803543][ T7] fib_table_insert (net/ipv4/fib_trie.c:1224) > > [ 43.807195][ T7] fib_magic+0x297/0x440 > > [ 43.810869][ T7] fib_add_ifaddr (net/ipv4/fib_frontend.c:1129) > > [ 43.814464][ T7] fib_netdev_event (net/ipv4/fib_frontend.c:1465 (discriminator 3)) > > [ 43.818098][ T7] raw_notifier_call_chain (kernel/notifier.c:89 kernel/notifier.c:392) > > [ 43.821558][ T7] __dev_notify_flags (net/core/dev.c:1931 net/core/dev.c:1945 net/core/dev.c:8177) > > [ 43.824595][ T7] dev_change_flags (net/core/dev.c:8217) > > [ 43.827778][ T7] ip_auto_config (net/ipv4/ipconfig.c:224 net/ipv4/ipconfig.c:1502) > > [ 43.831118][ T7] do_one_initcall (init/main.c:1300) > > [ 43.834106][ T7] kernel_init_freeable (init/main.c:1372 init/main.c:1389 init/main.c:1408 init/main.c:1613) > > [ 43.837190][ T7] kernel_init (init/main.c:1504) > > [ 43.839802][ T7] ret_from_fork (arch/x86/entry/entry_64.S:301) > > [ 43.842527][ T7] > > [ 43.844785][ T7] Freed by task 7: > > [ 43.845862][ T660] VFS: Warning: trinity-c3 using old stat() call. Recompile your binary. > > [ 43.847180][ T7] kasan_save_stack (mm/kasan/common.c:39) > > [ 43.847193][ T7] kasan_set_track (mm/kasan/common.c:45) > > [ 43.847198][ T7] kasan_set_free_info (mm/kasan/generic.c:372) > > [ 43.858233][ T7] __kasan_slab_free (mm/kasan/common.c:368 mm/kasan/common.c:328 mm/kasan/common.c:374) > > [ 43.861032][ T7] kfree (mm/slub.c:1754 mm/slub.c:3509 mm/slub.c:4562) > > [ 43.863634][ T7] ops_exit_list+0x98/0x180 > > [ 43.866428][ T7] cleanup_net (net/core/net_namespace.c:599 (discriminator 3)) > > [ 43.868846][ T7] process_one_work (arch/x86/include/asm/jump_label.h:27 include/linux/jump_label.h:212 include/trace/events/workqueue.h:108 kernel/workqueue.c:2312) > > [ 43.871491][ T7] worker_thread (include/linux/list.h:292 kernel/workqueue.c:2455) > > [ 43.874217][ T7] kthread (kernel/kthread.c:377) > > [ 43.876775][ T7] ret_from_fork (arch/x86/entry/entry_64.S:301) > > [ 43.879429][ T7] > > [ 43.881813][ T7] Last potentially related work creation: > > [ 43.884669][ T7] kasan_save_stack (mm/kasan/common.c:39) > > [ 43.887467][ T7] __kasan_record_aux_stack (mm/kasan/generic.c:348) > > [ 43.890366][ T7] call_rcu (kernel/rcu/tree.c:3027 kernel/rcu/tree.c:3106) > > [ 43.893057][ T7] fib_create_info (net/ipv4/fib_semantics.c:1574) > > [ 43.895888][ T7] fib_table_insert (net/ipv4/fib_trie.c:1224) > > [ 43.898686][ T7] fib_magic+0x297/0x440 > > [ 43.901503][ T7] fib_add_ifaddr (net/ipv4/fib_frontend.c:1129) > > [ 43.904283][ T7] fib_netdev_event (net/ipv4/fib_frontend.c:1465 (discriminator 3)) > > [ 43.906925][ T7] raw_notifier_call_chain (kernel/notifier.c:89 kernel/notifier.c:392) > > [ 43.909660][ T7] __dev_notify_flags (net/core/dev.c:1931 net/core/dev.c:1945 net/core/dev.c:8177) > > [ 43.912346][ T7] dev_change_flags (net/core/dev.c:8217) > > [ 43.915108][ T7] ip_auto_config (net/ipv4/ipconfig.c:224 net/ipv4/ipconfig.c:1502) > > [ 43.917827][ T7] do_one_initcall (init/main.c:1300) > > [ 43.920549][ T7] kernel_init_freeable (init/main.c:1372 init/main.c:1389 init/main.c:1408 init/main.c:1613) > > [ 43.923383][ T7] kernel_init (init/main.c:1504) > > [ 43.926096][ T7] ret_from_fork (arch/x86/entry/entry_64.S:301) > > [ 43.928757][ T7] > > [ 43.931153][ T7] The buggy address belongs to the object at ffff88810eb94800 > > [ 43.931153][ T7] which belongs to the cache kmalloc-256 of size 256 > > [ 43.937453][ T7] The buggy address is located 136 bytes inside of > > [ 43.937453][ T7] 256-byte region [ffff88810eb94800, ffff88810eb94900) > > [ 43.943729][ T7] The buggy address belongs to the page: > > [ 43.946822][ T7] page:00000000392d4f15 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x10eb94 > > [ 43.950810][ T7] head:00000000392d4f15 order:1 compound_mapcount:0 > > [ 43.954208][ T7] flags: 0x17ffffc0010200(slab|head|node=0|zone=2|lastcpupid=0x1fffff) > > [ 43.957836][ T7] raw: 0017ffffc0010200 dead000000000100 dead000000000122 ffff888100041b40 > > [ 43.961613][ T7] raw: 0000000000000000 0000000000100010 00000001ffffffff 0000000000000000 > > [ 43.965353][ T7] page dumped because: kasan: bad access detected > > [ 43.968765][ T7] page_owner tracks the page as allocated > > [ 43.971860][ T7] page last allocated via order 1, migratetype Unmovable, gfp_mask 0xd20c0(__GFP_IO|__GFP_FS|__GFP_NOWARN|__GFP_NORETRY|__GFP_COMP|__GFP_NOMEMALLOC), pid 1, ts 24086391223, free_ts 24079533892 > > [ 43.979986][ T7] prep_new_page (include/linux/page_owner.h:31 mm/page_alloc.c:2427 mm/page_alloc.c:2434) > > [ 43.983297][ T7] get_page_from_freelist (mm/page_alloc.c:4171) > > [ 43.986879][ T7] __alloc_pages (mm/page_alloc.c:5390) > > [ 43.990280][ T7] alloc_page_interleave (arch/x86/include/asm/jump_label.h:27 mm/mempolicy.c:2118) > > [ 43.993759][ T7] allocate_slab (mm/slub.c:1799 mm/slub.c:1944) > > [ 43.997239][ T7] ___slab_alloc (mm/slub.c:3018) > > [ 44.000639][ T7] __slab_alloc+0x1c/0x40 > > [ 44.004090][ T7] __kmalloc (mm/slub.c:3196 mm/slub.c:3238 mm/slub.c:4420) > > > > > > To reproduce: > > > > # build kernel > > cd linux > > cp config-5.17.0-rc2-00638-gf2f2325ec799 .config > > make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 olddefconfig prepare modules_prepare bzImage modules > > make HOSTCC=gcc-9 CC=gcc-9 ARCH=x86_64 INSTALL_MOD_PATH= modules_install > > cd > > find lib/ | cpio -o -H newc --quiet | gzip > modules.cgz > > > > > > git clone https://github.com/intel/lkp-tests.git > > cd lkp-tests > > bin/lkp qemu -k -m modules.cgz job-script # job-script is attached in this email > > > > # if come across any failure that blocks the test, > > # please remove ~/.lkp and /lkp dir to run from a clean state. > > > > > > > > --- > > 0DAY/LKP+ Test Infrastructure Open Source Technology Center > > https://lists.01.org/hyperkitty/list/lkp@lists.01.org Intel Corporation > > > > Thanks, > > Oliver Sang > >