Received: by 2002:a05:6358:7058:b0:131:369:b2a3 with SMTP id 24csp513098rwp; Wed, 12 Jul 2023 17:47:23 -0700 (PDT) X-Google-Smtp-Source: APBJJlFqA8O2/KW0RDE3xE9IHwCypthL5PFUspx6ZzXW7aV3/hVqy/+w5wRH+ZjeWNU/LYJB/5m2 X-Received: by 2002:a05:6a00:1941:b0:682:713e:e510 with SMTP id s1-20020a056a00194100b00682713ee510mr231055pfk.27.1689209243293; Wed, 12 Jul 2023 17:47:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689209243; cv=none; d=google.com; s=arc-20160816; b=fo+HfzsWyGzQJTGgBGGuKOq2ii27k+/yDioqdZg1c9x7I/lWWaALRJbhd0RXlAGg1K aJsI9GsmtZhDLlm90JBTpBYX1X6iJMrEq4+8vCJmtlTBEkld8k2ilO+zaDx2GMtLvSz1 AkZ6eg9z8RmO1FYCHKt0ggAjsxJcSuoppSdOyvyP9za9H2OlOaGQCb47L3pUrl7oyFA8 OikzRnqwVN2iiiSFR9sydpSaAoOq7BXoytZiCc1rLfI+H09y68dQTSygdfehT7SEcXKY WUSf+rQBvb6iH9WQi78Aqe+43WBF1V8pbPAmXaTfiITxm6yOXelZQm1E0tHhT8gxUeE3 1HjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=hsR7IIVR2C+r7VaTstdlodEeJE6UeuUCvZM4AYitVX4=; fh=K7fFINMq11bAhCWodUjGaYM0JHLPPKkK9/6n5KyG/Rw=; b=lwW7jPFal3sZgU1EYOv6t87ozcda1AFCdMzDgAogKqvC42X3HEp/B9/UfkUDELG1J7 f1851XHq04oTeUsnDJ1oIwuJ/2VMzc0NzWG6Q6KkH3pCvly6zzSmHorf37dVKMoRxWB1 DZcJcCV5DgOojQH5FTgH/WcHcgIzlNgpBTBkvqIr3i+DClH+e+YC8aMG8uJcydz8Y6va zLE6QoHvzcaN0I2vkF/jjqSM68Z4Dt5pY28CkzUflhPu/ftEPOG20r8PUJCHmWomZ9WS Tc6hjnyrVhUjHkc9OXKGVS01cMSI0IJOHXz9KtnuMCvXQsaERVJ0F9F0wEc2mOsZh22L MGLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b=hiPaVIfC; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v64-20020a638943000000b0055337ca9cefsi3979800pgd.857.2023.07.12.17.47.10; Wed, 12 Jul 2023 17:47:23 -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; dkim=pass header.i=@gmail.com header.s=20221208 header.b=hiPaVIfC; 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232801AbjGMAoG (ORCPT + 99 others); Wed, 12 Jul 2023 20:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44724 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232609AbjGMAoE (ORCPT ); Wed, 12 Jul 2023 20:44:04 -0400 Received: from mail-lj1-x230.google.com (mail-lj1-x230.google.com [IPv6:2a00:1450:4864:20::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B79401BFB; Wed, 12 Jul 2023 17:44:03 -0700 (PDT) Received: by mail-lj1-x230.google.com with SMTP id 38308e7fff4ca-2b703d7ed3aso870241fa.1; Wed, 12 Jul 2023 17:44:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1689209042; x=1691801042; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=hsR7IIVR2C+r7VaTstdlodEeJE6UeuUCvZM4AYitVX4=; b=hiPaVIfC+3Ijf+FJf8AudDGt8nmkFp5h80+Iz61I7MQas53BRygqwVPqfAnBOsuP24 ckX4RjiiTus29/wG0c26hZBJBpbr4y8InppBLftwSlXRyZsrRskiVJRYsmbrD56HGD1G z3Hx2nUf8cPAF8+/kCPg+l+Mc6peqiqblpduM9zeBPL5a20h9oJkUZYElP1TN/6K5yYX QEeRnYTrZaCM5Af55e5bok2MDViBxVK5LJC7qc/xZPz28wc4riAcGon+6lCqapp9yuBD 1atuvtoq6xiYLgumEJ9EYRfIksY31OeutQE1yLt7GjtBEp7PD5py0k9xZcZ/4sMsyTnn wwxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1689209042; x=1691801042; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=hsR7IIVR2C+r7VaTstdlodEeJE6UeuUCvZM4AYitVX4=; b=DInnk6ng2EatXf5BM1+3ULKlCy2kGcmnbhMtV61osA+MfdcwybGmTtoOcaHCMeTWSA 42W/8lw07hob2YsYu+Vc3QfXPRfwN/V0xjafk495KrYsuc6IypvEOnGjXkKvAQ5VMC8T Hqz0EcQZToRLqxH4oM2sJzwTY8nERB5eJePns/gMng2CFj7IUPelIeYJaxAeIZoC5auq W0dF1zqwSt1jcZaRDB579nJx2fMyTxikaHq6g4lWa7PK0KfUfqly0r3g/WC7cxkLlp/D 340r0jvgcxgKk580zspPwXyDBsXrGg5Va1sA6Xjre/Qi2MvmWxV/QStTlXS+HXbvRWmM SlTQ== X-Gm-Message-State: ABy/qLaQr2rfJAQ0ODnKt3asH916bGFSRev6uw+oK2hPslrl0V073514 w+ipk0M0FyDIycdSJXRuWwx1eMpjc9ueDE0OgSU= X-Received: by 2002:a2e:95c4:0:b0:2ac:82c1:5a3d with SMTP id y4-20020a2e95c4000000b002ac82c15a3dmr17882748ljh.23.1689209041673; Wed, 12 Jul 2023 17:44:01 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Alexei Starovoitov Date: Wed, 12 Jul 2023 17:43:49 -0700 Message-ID: Subject: Re: [PATCH bpf-next v4 2/6] netfilter: bpf: Support BPF_F_NETFILTER_IP_DEFRAG in netfilter link To: Daniel Xu Cc: Andrii Nakryiko , Alexei Starovoitov , Florian Westphal , "David S. Miller" , Pablo Neira Ayuso , Paolo Abeni , Daniel Borkmann , Eric Dumazet , Jakub Kicinski , Jozsef Kadlecsik , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , bpf , LKML , netfilter-devel , coreteam@netfilter.org, Network Development , David Ahern Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 Wed, Jul 12, 2023 at 4:44=E2=80=AFPM Daniel Xu wrote: > +#if IS_ENABLED(CONFIG_NF_DEFRAG_IPV6) > + case NFPROTO_IPV6: > + rcu_read_lock(); > + v6_hook =3D rcu_dereference(nf_defrag_v6_hook); > + if (!v6_hook) { > + rcu_read_unlock(); > + err =3D request_module("nf_defrag_ipv6"); > + if (err) > + return err < 0 ? err : -EINVAL; > + > + rcu_read_lock(); > + v6_hook =3D rcu_dereference(nf_defrag_v6_hook); > + if (!v6_hook) { > + WARN_ONCE(1, "nf_defrag_ipv6_hooks bad re= gistration"); > + err =3D -ENOENT; > + goto out_v6; > + } > + } > + > + err =3D v6_hook->enable(link->net); I was about to apply, but luckily caught this issue in my local test: [ 18.462448] BUG: sleeping function called from invalid context at kernel/locking/mutex.c:283 [ 18.463238] in_atomic(): 0, irqs_disabled(): 0, non_block: 0, pid: 2042, name: test_progs [ 18.463927] preempt_count: 0, expected: 0 [ 18.464249] RCU nest depth: 1, expected: 0 [ 18.464631] CPU: 15 PID: 2042 Comm: test_progs Tainted: G O 6.4.0-04319-g6f6ec4fa00dc #4896 [ 18.465480] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS rel-1.12.0-59-gc9ba5276e321-prebuilt.qemu.org 04/01/2014 [ 18.466531] Call Trace: [ 18.466767] [ 18.466975] dump_stack_lvl+0x32/0x40 [ 18.467325] __might_resched+0x129/0x180 [ 18.467691] mutex_lock+0x1a/0x40 [ 18.468057] nf_defrag_ipv4_enable+0x16/0x70 [ 18.468467] bpf_nf_link_attach+0x141/0x300 [ 18.468856] __sys_bpf+0x133e/0x26d0 You cannot call mutex under rcu_read_lock. Please make sure you have all kernel debug flags on in your testing.