From patchwork Thu Mar 16 05:40:25 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 70578 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp301683wrt; Wed, 15 Mar 2023 22:42:29 -0700 (PDT) X-Google-Smtp-Source: AK7set8Un7p9wZXZmCPcz6m73xfU9Ttb55/ENL7j8YgwMaYuKFyvmp4fOhzvHLrnOqsVpP94aVwD X-Received: by 2002:a05:6a20:4408:b0:cd:3069:28cd with SMTP id ce8-20020a056a20440800b000cd306928cdmr2538075pzb.39.1678945348990; Wed, 15 Mar 2023 22:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678945348; cv=none; d=google.com; s=arc-20160816; b=j+VU4OHcn22BtM7nbEsKdJ5kOnePxBZVXC89pJDZ4C4/0XeG7w+TXntyBk14fTdAqd xqX2Rjf4TQdDJnlLCXXb9UcTmRGPSnqyeZ5XEFtDXV6qW7Exv3MZiEqyUOoKMIlVLnNP W5pbcKI/3EpCv5rRX5BkmRnV0d+ar2D7KE2ndJivG+6KGa8xQdOVLorGymeXsQcYO4Ui bcnSDKqw8uwO8nAU/SiUmX+QrwjfXFQi2MYibx3GvAfYeZbA6DDwmbLvzLAiG55VuNg0 +mT8WBjesMhreODFcnD6H/KOvnOpCHcNuhNfjm/ilAerdj74bQVuUuVV+WmCOC0KExGY vvoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=/+xUrg9q1AAptwCu8YnIT5AXN2cGpwLJEELj3y+obxs=; b=qavboHL5N+GxQWX7jVioZN4DMgHF/LjNuCaIzLeWCvBa5tHyHUs7u3Sch+siKt5iYF oGxdmHv7oJJ/MX8un2LhugFk1KuGFKXnWcqkl7ZEp6KDsoM7aoETjfHkbw/qr6d4TNlW gVu8EcVoOB1ivXzKM+2FRWbtWA3e2BJrl4+j6zrRPD9lIxTeT5fjtg4ARqy5HraZit6U kEsE/yZqHg3N610VMRrZadSNBPGTv1CqqS1LXmhc4ZZSnIiQtrE0UPDy7I3MskyCuco9 0t9mKKrGF92kYvk6zu6dDceC/a2NZjfI9p0AYb82yfn2JXf3XrxrxIoO3ryb50P4eGID 0PUQ== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id h9-20020a631209000000b00502f4be647fsi6792540pgl.641.2023.03.15.22.42.14; Wed, 15 Mar 2023 22:42:28 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229832AbjCPFkq (ORCPT + 99 others); Thu, 16 Mar 2023 01:40:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229487AbjCPFkk (ORCPT ); Thu, 16 Mar 2023 01:40:40 -0400 Received: from mail-qt1-f177.google.com (mail-qt1-f177.google.com [209.85.160.177]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 530965CC1A; Wed, 15 Mar 2023 22:40:39 -0700 (PDT) Received: by mail-qt1-f177.google.com with SMTP id c19so610265qtn.13; Wed, 15 Mar 2023 22:40:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678945238; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=/+xUrg9q1AAptwCu8YnIT5AXN2cGpwLJEELj3y+obxs=; b=Ec5zskyA+CcxxKTcQLOE4iemb6Ht/F4YGEjYmARn3IJU9zMTopdvLtEQOFRc+dkxCM iVUw3qJimroFMgDMUJeswElwKP0HIcXQ3DXHKlGpD6IlpYAyv8VrMuDJKbHHQ+Hc9XFV Tcs69aCIaDSPQ7vuM6e2c0ewBJDZWp/f0CMk3ZvtPU85LeiVnPa4rD8ZCRGl8stTdkQa Pi6o3s0ZPOvOdoX396/WCIDa0QFnE9pneGmXcQH/ZpV/30i6O05VueCVDMNbga09pjuH jo5/n1c6d1/ZjsnhUqdE6gYmRT9tXBD3MRehJoStgyvz0oaSutOYafK4nl8XoTLAgUqt P8MA== X-Gm-Message-State: AO0yUKU5qcyhjm06mOYTHYHxVFpYXsiJRjS6wXmP9K+GC+8oO7lYdL/v i1Nqs7QlL0nd+ZV2zeiI0mV/dYLN9+U97wYd X-Received: by 2002:a05:622a:1049:b0:3d4:f850:2e9 with SMTP id f9-20020a05622a104900b003d4f85002e9mr4349342qte.31.1678945237984; Wed, 15 Mar 2023 22:40:37 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:7f57]) by smtp.gmail.com with ESMTPSA id d63-20020a37b442000000b0073b575f3603sm5153630qkf.101.2023.03.15.22.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 22:40:37 -0700 (PDT) From: David Vernet To: bpf@vger.kernel.org Cc: ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, linux-kernel@vger.kernel.org, kernel-team@meta.com Subject: [PATCH bpf-next v2 2/5] bpf: Mark struct bpf_cpumask as rcu protected Date: Thu, 16 Mar 2023 00:40:25 -0500 Message-Id: <20230316054028.88924-3-void@manifault.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230316054028.88924-1-void@manifault.com> References: <20230316054028.88924-1-void@manifault.com> MIME-Version: 1.0 X-Spam-Status: No, score=-1.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE, SPF_PASS 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760501797962102877?= X-GMAIL-MSGID: =?utf-8?q?1760501797962102877?= struct bpf_cpumask is a BPF-wrapper around the struct cpumask type which can be instantiated by a BPF program, and then queried as a cpumask in similar fashion to normal kernel code. The previous patch in this series makes the type fully RCU safe, so the type can be included in the rcu_protected_type BTF ID list. A subsequent patch will remove bpf_cpumask_kptr_get(), as it's no longer useful now that we can just treat the type as RCU safe by default and do our own if check. Signed-off-by: David Vernet --- kernel/bpf/verifier.c | 1 + 1 file changed, 1 insertion(+) diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c index 60793f793ca6..15b5c5c729f9 100644 --- a/kernel/bpf/verifier.c +++ b/kernel/bpf/verifier.c @@ -4599,6 +4599,7 @@ static bool in_rcu_cs(struct bpf_verifier_env *env) BTF_SET_START(rcu_protected_types) BTF_ID(struct, prog_test_ref_kfunc) BTF_ID(struct, cgroup) +BTF_ID(struct, bpf_cpumask) BTF_SET_END(rcu_protected_types) static bool rcu_protected_object(const struct btf *btf, u32 btf_id)