Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp4607294iob; Sun, 8 May 2022 19:02:14 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz2BRbfnHaVUe06lWhZMs0QSd265PDyQfwAYVHzArpc2owUF0Rp/qFRFUk/2VzkUKiyzy2s X-Received: by 2002:a17:902:eb87:b0:15e:a144:78ab with SMTP id q7-20020a170902eb8700b0015ea14478abmr14216746plg.55.1652061733856; Sun, 08 May 2022 19:02:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652061733; cv=none; d=google.com; s=arc-20160816; b=MNwK9ljw7hBYfiBE5RFGx18VWzFBO2LKj5QaKhXbo7iIpFtK+jiJnPTIQVA43tsGg9 V0Me//3udbEaRVW8M+YpW/DyCG+zRhT5iwSTJsUG1gzhqPoOIMImy2spYqeBVZvxQLPA uQzPc7y0xRSfzDWj5zwWOcwoIhtlF1f+OjCA8PGtDnjXgCnYqABL31xi0jWuxNoUA629 t3l2MDg+gq5h7VgjkyhRLWxnk3QiO5Pudye5wYXCyoErJLXMDshmD6+Abn0gTSc5aBnc +ABW7iPgboZPqkLqsbaJNpHa8TTk127BgutTK4PaNwHGVoHUfwTTKrfZgrs8+myEvGj5 GKWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=Z3EdRDupfbZVTscWphFqpGJPaG/9Q1gPCXcbZxePk/c=; b=zTdePoeyvFaoFRxE+wrKhWi0DpG4+o/r9eEn6oTCxFYrxRmLlfmB7Qs2Plj8v95rZ9 VljGXAE+yHU6KqZ1Xnd6CX3HKX/OUqobJhnJQSMaj9gYs5KBhtZ9NJ4/9aephdJbeotV O6NMaBpbPjv8+dJqO3CUfSHlWENEQz2QkyVcBLM3EutJbWafaed9xwLfUmzk/J4HUSxz Af1DPd7JwLntA2T946IMexCHqhP9xo9zL94EduUzcC8D1ItKYdKCqufLoAPtEFDBlZmO 5ARgj0lc+zhEUKwMfq7Pj7PxwzEGgidaMzPwEp3It2tzhlv6Dul8auNtAz+siVOIb5A5 S5uQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jsBG26qh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id g4-20020a655944000000b003c2648bad67si14450585pgu.771.2022.05.08.19.02.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 08 May 2022 19:02:13 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=jsBG26qh; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id A8710340CE; Sun, 8 May 2022 19:02:06 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388556AbiEFDcI (ORCPT + 99 others); Thu, 5 May 2022 23:32:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1388539AbiEFDcC (ORCPT ); Thu, 5 May 2022 23:32:02 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58B15644C0; Thu, 5 May 2022 20:28:21 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 219B5B832C4; Fri, 6 May 2022 03:28:20 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 685DEC385AC; Fri, 6 May 2022 03:28:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1651807698; bh=/Busav/MercVn3U7qos3BeCdpeFW+y8S+aaQ9UEgLOg=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=jsBG26qh+s213Ai58L/c76nzSly7WUrMn1CW1KN9i9Ky51OURpsDA8Sue2D1CJ9Sq D8CjECh08aUOh24sOOD33Rszb5HqzS3oCrMHt7J9QZ5KK7ThbTIN8fWjSxQGvAxN6Q wdSWi/aFNzQ4Fsh/B+YFmhpQTvm3gFaA7Eu/Kznm3H/n3c1g3DKxwrUj8NDa4bbkUr dTaDkNqV1drIVgG1E8DYViBhnnKaMxvcP6cr9gNLtlfs6p8gtWeqONXKRInUx3IuES matYNYW+DmzRSrK9oWJeilQ6ahPS2ea5Mt7yGypTxX+HYFgfWH2LN7Lpta8o7j2xya hf/isN0EBWRXQ== Message-ID: <366d529e-6149-423a-e012-dbfd9c41baac@kernel.org> Date: Thu, 5 May 2022 20:28:16 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:91.0) Gecko/20100101 Thunderbird/91.8.1 Subject: Re: [net PATCH] ipv4: drop dst in multicast routing path Content-Language: en-US To: Chris Packham , davem@davemloft.net, yoshfuji@linux-ipv6.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, tgraf@suug.ch, lokesh.dhoundiyal@alliedtelesis.co.nz Cc: netdev@vger.kernel.org, linux-kernel@vger.kernel.org References: <20220505020017.3111846-1-chris.packham@alliedtelesis.co.nz> From: David Ahern In-Reply-To: <20220505020017.3111846-1-chris.packham@alliedtelesis.co.nz> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, NICE_REPLY_A,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 5/4/22 7:00 PM, Chris Packham wrote: > From: Lokesh Dhoundiyal > > kmemleak reports the following when routing multicast traffic over an > ipsec tunnel. > > Kmemleak output: > unreferenced object 0x8000000044bebb00 (size 256): > comm "softirq", pid 0, jiffies 4294985356 (age 126.810s) > hex dump (first 32 bytes): > 00 00 00 00 00 00 00 00 80 00 00 00 05 13 74 80 ..............t. > 80 00 00 00 04 9b bf f9 00 00 00 00 00 00 00 00 ................ > backtrace: > [<00000000f83947e0>] __kmalloc+0x1e8/0x300 > [<00000000b7ed8dca>] metadata_dst_alloc+0x24/0x58 > [<0000000081d32c20>] __ipgre_rcv+0x100/0x2b8 > [<00000000824f6cf1>] gre_rcv+0x178/0x540 > [<00000000ccd4e162>] gre_rcv+0x7c/0xd8 > [<00000000c024b148>] ip_protocol_deliver_rcu+0x124/0x350 > [<000000006a483377>] ip_local_deliver_finish+0x54/0x68 > [<00000000d9271b3a>] ip_local_deliver+0x128/0x168 > [<00000000bd4968ae>] xfrm_trans_reinject+0xb8/0xf8 > [<0000000071672a19>] tasklet_action_common.isra.16+0xc4/0x1b0 > [<0000000062e9c336>] __do_softirq+0x1fc/0x3e0 > [<00000000013d7914>] irq_exit+0xc4/0xe0 > [<00000000a4d73e90>] plat_irq_dispatch+0x7c/0x108 > [<000000000751eb8e>] handle_int+0x16c/0x178 > [<000000001668023b>] _raw_spin_unlock_irqrestore+0x1c/0x28 > > The metadata dst is leaked when ip_route_input_mc() updates the dst for > the skb. Commit f38a9eb1f77b ("dst: Metadata destinations") correctly > handled dropping the dst in ip_route_input_slow() but missed the > multicast case which is handled by ip_route_input_mc(). Drop the dst in > ip_route_input_mc() avoiding the leak. > > Fixes: f38a9eb1f77b ("dst: Metadata destinations") > Signed-off-by: Lokesh Dhoundiyal > Signed-off-by: Chris Packham > --- > > Notes: > We started seeing this leak in our scenario after commit c0d59da79534 > ("ip_gre: Make none-tun-dst gre tunnel store tunnel info as metadat_dst > in recv") but there may be other paths that hit the leak so I've set the > fixes tag as f38a9eb1f77b ("dst: Metadata destinations"). > > net/ipv4/route.c | 1 + > 1 file changed, 1 insertion(+) > Reviewed-by: David Ahern