Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp138355rdb; Tue, 5 Dec 2023 00:34:36 -0800 (PST) X-Google-Smtp-Source: AGHT+IFiBz7PJKE7+e572/T16Ilxs/ftsXwdjDC2AaLQa8JdkwtPdDoDneoGdp2bhh9LpxGIzur9 X-Received: by 2002:a92:d34b:0:b0:35c:66f8:1b92 with SMTP id a11-20020a92d34b000000b0035c66f81b92mr3694392ilh.2.1701765275832; Tue, 05 Dec 2023 00:34:35 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701765275; cv=none; d=google.com; s=arc-20160816; b=djbiGnFa1bkcWZENL+zl/Dmrpfs5C3m9mV960tIlBs48TCHqfQWSbndmK3sKzAqHf9 dug+Scg5zR+DI6a9yPTJ7nNfSOPn/XG31gkvqxOJI1XDj2wq8AyxF02oCnoA1t8yUwah CUhwMTCZ5CtWy3DWgd9ZvUhAfFpPtezL1DhhOmtTvOjvtKXhhT5mLDNvJTIlCosj9r+K W9l8eB/PyqsJOdDb5BXHw74CP1CPZLCwmgUXX18HSROtt9/NDStgQEeFEFRHbaRbyGZS rBdBgjQey1W94j+0DMdBynHIxRtTt6iEOhbvAzEsUWP0ms9XdC+KE6xrSKV6Xjrb3CvA XoEg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=hhr1V+EAcU1dwaKgle8hJRlya6D98rFDjaOEOA7Iu0s=; fh=3A7u3A0ZTKpCk4EIQ7Wcs2dGO3xa894Cd7y9tgpTvSc=; b=ZEezmmNl4w62cwzUsU2VUdyMzqTXXYdQoSJHoUiFTsXlF5l0t+4n4h2iVYBj5MCqdR kCu7PVbnkFYMEswhwZwwYCn7pgeNM0+dds7vDnIkYAvZyzL3nK+EmFdO/L7r57l9kYmN R2z8OC4yJFTAVTr1hUdbPJwghGe9hJZzRiAz2004+ls7BTx0REx7JQqVQsE5tiigwxZU 1PaKnTHfJrPAwEylTnIf7ds36TmoBHzbCVQiTH+xx3iS6Lbq0VPSgm9cj1Jw+jB0/xMm IzLD4SDGEkpEV6yAPswVFmz7TUi5yIyKEVWv4/mCcyGtkeEang6RhFV/ft5NVH5Wv0uw NwJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EWk68OgC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id u16-20020a63ef10000000b005c659dc546csi5550028pgh.24.2023.12.05.00.34.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 05 Dec 2023 00:34:35 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=EWk68OgC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id A7E9D8046BE2; Tue, 5 Dec 2023 00:34:32 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234787AbjLEIeQ (ORCPT + 99 others); Tue, 5 Dec 2023 03:34:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231714AbjLEIeO (ORCPT ); Tue, 5 Dec 2023 03:34:14 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EABEA183 for ; Tue, 5 Dec 2023 00:34:20 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A38ACC433C7; Tue, 5 Dec 2023 08:34:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1701765260; bh=S+jEnDi0DYvRicPHFkbDYYg7tscTh0rePei/TRXtL1U=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=EWk68OgCMcIzQjusJMpMiQc3iNYpt50iIcoH/RrCoIZbjt3/+l1WgSM3adTU/TmpY 1hEiyxDCKdpY7832J6k5NtCdAxmB5v7DYOvN7cyl9uaidtbZSZN1lGJy1t/KxfzgoZ IH+j8nykya/tFwzt7alyVVg/gZpRPzgC2SuZp4R8rfUFIwhtimVYrl49oTe99rqmZa 9y8jMGeOaudT9pN4rYTo+MezQsy/bQvq5Az3dhJp6hVR5dqCQpZvI+PBqokSqbfPcX Afm5EYzneVJNQzhUDyS40vN8y5SGGkwm3iFBEhqmQTa1xPVIZZfrvyx8Q+n6JlWrbu EhftncYt8TjOw== Date: Tue, 5 Dec 2023 08:34:15 +0000 From: Simon Horman To: "D. Wythe" Cc: pablo@netfilter.org, kadlec@netfilter.org, fw@strlen.de, dxu@dxuuu.xyz, bpf@vger.kernel.org, linux-kernel@vger.kernel.org, netdev@vger.kernel.org, coreteam@netfilter.org, netfilter-devel@vger.kernel.org, davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, ast@kernel.org Subject: Re: [PATCH net] net/netfilter: bpf: fix bad registration on nf_defrag Message-ID: <20231205083415.GQ50400@kernel.org> References: <1701329003-14564-1-git-send-email-alibuda@linux.alibaba.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1701329003-14564-1-git-send-email-alibuda@linux.alibaba.com> X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,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 lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 05 Dec 2023 00:34:32 -0800 (PST) On Thu, Nov 30, 2023 at 03:23:23PM +0800, D. Wythe wrote: > From: "D. Wythe" > > We should pass a pointer to global_hook to the get_proto_defrag_hook() > instead of its value, since the passed value won't be updated even if > the request module was loaded successfully. > > Log: > > [ 54.915713] nf_defrag_ipv4 has bad registration > [ 54.915779] WARNING: CPU: 3 PID: 6323 at net/netfilter/nf_bpf_link.c:62 get_proto_defrag_hook+0x137/0x160 > [ 54.915835] CPU: 3 PID: 6323 Comm: fentry Kdump: loaded Tainted: G E 6.7.0-rc2+ #35 > [ 54.915839] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.15.0-0-g2dd4b9b3f840-prebuilt.qemu.org 04/01/2014 > [ 54.915841] RIP: 0010:get_proto_defrag_hook+0x137/0x160 > [ 54.915844] Code: 4f 8c e8 2c cf 68 ff 80 3d db 83 9a 01 00 0f 85 74 ff ff ff 48 89 ee 48 c7 c7 8f 12 4f 8c c6 05 c4 83 9a 01 01 e8 09 ee 5f ff <0f> 0b e9 57 ff ff ff 49 8b 3c 24 4c 63 e5 e8 36 28 6c ff 4c 89 e0 > [ 54.915849] RSP: 0018:ffffb676003fbdb0 EFLAGS: 00010286 > [ 54.915852] RAX: 0000000000000023 RBX: ffff9596503d5600 RCX: ffff95996fce08c8 > [ 54.915854] RDX: 00000000ffffffd8 RSI: 0000000000000027 RDI: ffff95996fce08c0 > [ 54.915855] RBP: ffffffff8c4f12de R08: 0000000000000000 R09: 00000000fffeffff > [ 54.915859] R10: ffffb676003fbc70 R11: ffffffff8d363ae8 R12: 0000000000000000 > [ 54.915861] R13: ffffffff8e1f75c0 R14: ffffb676003c9000 R15: 00007ffd15e78ef0 > [ 54.915864] FS: 00007fb6e9cab740(0000) GS:ffff95996fcc0000(0000) knlGS:0000000000000000 > [ 54.915867] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 > [ 54.915868] CR2: 00007ffd15e75c40 CR3: 0000000101e62006 CR4: 0000000000360ef0 > [ 54.915870] DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000 > [ 54.915871] DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400 > [ 54.915873] Call Trace: > [ 54.915891] > [ 54.915894] ? __warn+0x84/0x140 > [ 54.915905] ? get_proto_defrag_hook+0x137/0x160 > [ 54.915908] ? __report_bug+0xea/0x100 > [ 54.915925] ? report_bug+0x2b/0x80 > [ 54.915928] ? handle_bug+0x3c/0x70 > [ 54.915939] ? exc_invalid_op+0x18/0x70 > [ 54.915942] ? asm_exc_invalid_op+0x1a/0x20 > [ 54.915948] ? get_proto_defrag_hook+0x137/0x160 > [ 54.915950] bpf_nf_link_attach+0x1eb/0x240 > [ 54.915953] link_create+0x173/0x290 > [ 54.915969] __sys_bpf+0x588/0x8f0 > [ 54.915974] __x64_sys_bpf+0x20/0x30 > [ 54.915977] do_syscall_64+0x45/0xf0 > [ 54.915989] entry_SYSCALL_64_after_hwframe+0x6e/0x76 > [ 54.915998] RIP: 0033:0x7fb6e9daa51d > [ 54.916001] Code: 00 c3 66 2e 0f 1f 84 00 00 00 00 00 90 f3 0f 1e fa 48 89 f8 48 89 f7 48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff ff 73 01 c3 48 8b 0d 2b 89 0c 00 f7 d8 64 89 01 48 > [ 54.916003] RSP: 002b:00007ffd15e78ed8 EFLAGS: 00000246 ORIG_RAX: 0000000000000141 > [ 54.916006] RAX: ffffffffffffffda RBX: 00007ffd15e78fc0 RCX: 00007fb6e9daa51d > [ 54.916007] RDX: 0000000000000040 RSI: 00007ffd15e78ef0 RDI: 000000000000001c > [ 54.916009] RBP: 000000000000002d R08: 00007fb6e9e73a60 R09: 0000000000000001 > [ 54.916010] R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000000006 > [ 54.916012] R13: 0000000000000006 R14: 0000000000000000 R15: 0000000000000000 > [ 54.916014] > [ 54.916015] ---[ end trace 0000000000000000 ]--- > > Fixes: 91721c2d02d3 ("netfilter: bpf: Support BPF_F_NETFILTER_IP_DEFRAG in netfilter link") > Signed-off-by: D. Wythe Reviewed-by: Simon Horman