From patchwork Thu Mar 16 01:41:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Vernet X-Patchwork-Id: 70537 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp230171wrt; Wed, 15 Mar 2023 18:47:39 -0700 (PDT) X-Google-Smtp-Source: AK7set/+ZEHt08IISQMVJI/kxuyQYsKbakiNMEo7mX+3aNWbqO4sNs6ArHupIYThkT4vJJYUrzNy X-Received: by 2002:a17:903:120b:b0:19e:6989:bcac with SMTP id l11-20020a170903120b00b0019e6989bcacmr1402310plh.15.1678931259399; Wed, 15 Mar 2023 18:47:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678931259; cv=none; d=google.com; s=arc-20160816; b=i83H3I7qMzTzE081aYAgyKZ6IYHvBTJlieJ/kNnSjB8UhOHVaQDwAUibBlEFbzDohG TmHcsDxJMS9LKPxOZA5I9BCaspSJ7ImjioMO42dk9NqOt3uNz/HpOF4PKDNtWzkqBh/6 i2BgT9kUjlMW1U0dAx0b/9O2rem84rEDZSiubzcZY9haZElXLt7K8FN0sNDsrg0lU1Qj fHU1zusud9MjTrH5y/2krl6SQZQe3BqHf7mOwLel3iKXCGKgnaFEKlutbazBZ8ngAoPq JhvgdJLg7Lur20Gu4iuAFPwfK+aOIeaSkG0H1FQCYBX19R8VikmcnrValAzqner6zo3X mleQ== 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=3Mw+fd0bH4Z7LLAT9myck2MFtZEkV/SC3orkjhIOzHc=; b=hFpuNSYsI9//ZduP02mVNoVaqmg++X3s7KbimBgKV8fnWBFd8EreqPPC7D83BCWUS7 ocreFU3EWyLuDwTo4y64NI2eKZydXILBv55o7iz9YhLJwbD0SwgWCsLHI9SFPaSX/hWf vXvwlfC7qtvVvlapS3y6pzshM2osQxk99+FPwHIB0iGL8Au0F8maJOlCTjEI4SnpojgE 56c/1zcY+2DqIl3roO+4b5jJtuT04pOOuUT6B8uHJBjGMXQoeuadcR8vnZ+ojQUzN+a5 EQV55Pk1dsBX/0Lj/3B7y6vuqW9rqUAFCyB3GWaDBwxia4n5F7jobCI1dG8WrimfqzX5 4q+Q== 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 e18-20020a17090301d200b001a0767b58d4si4377971plh.81.2023.03.15.18.47.26; Wed, 15 Mar 2023 18:47:39 -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 S229829AbjCPBlc (ORCPT + 99 others); Wed, 15 Mar 2023 21:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57228 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229808AbjCPBl3 (ORCPT ); Wed, 15 Mar 2023 21:41:29 -0400 Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5E58AAB080; Wed, 15 Mar 2023 18:41:28 -0700 (PDT) Received: by mail-qv1-f44.google.com with SMTP id m6so360888qvq.0; Wed, 15 Mar 2023 18:41:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678930887; 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=3Mw+fd0bH4Z7LLAT9myck2MFtZEkV/SC3orkjhIOzHc=; b=tJPoVaVle+g1LVzEL/kjV0dMc3kcdagkVf1HUpdHYyEBwAbNUAFbjWg6myvthWvDu2 XhZegT5DCt5+iPl90BPS1WGMN6d4ojRNQwXtyOIQMna1eiwJUUnP644/1uYqOJSIZqmm 139e65Hmttnnx5vTLBnLJ2oiLt07bxYOIFnsYueqm0ZXOWxUKIzHSIlxnEuKbj5aV1ra FWV5RqIw1TdjWxFMcjZ6Sj1xDX2C6flhS42MEWIvoGwbNWip7J3Ovxtdbs6OdTgyMAc9 BoFxHC8M0jtMol9zgBLwpjb2TJVYX5VULvIfeIX6cOH/0wO0tz3+uJEu12YTTncKBLXP fp8A== X-Gm-Message-State: AO0yUKWWK2IzQ9NcwBiQWZ/O8YP9j5eBMy3RCYcpyb4cuBsIHQg5qQWe PJ6o39h5qI9Zz07uaeIcgPkVBj1s1CjGglhi X-Received: by 2002:a05:6214:238e:b0:572:5a16:51c0 with SMTP id fw14-20020a056214238e00b005725a1651c0mr28574433qvb.16.1678930887158; Wed, 15 Mar 2023 18:41:27 -0700 (PDT) Received: from localhost ([2620:10d:c091:400::5:5c58]) by smtp.gmail.com with ESMTPSA id u19-20020a37ab13000000b00725d8d6983asm3390746qke.61.2023.03.15.18.41.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Mar 2023 18:41:26 -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@meta.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 2/5] bpf: Mark struct bpf_cpumask as RCU protected Date: Wed, 15 Mar 2023 20:41:19 -0500 Message-Id: <20230316014122.678082-3-void@manifault.com> X-Mailer: git-send-email 2.39.0 In-Reply-To: <20230316014122.678082-1-void@manifault.com> References: <20230316014122.678082-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_H2,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?1760487023940947783?= X-GMAIL-MSGID: =?utf-8?q?1760487023940947783?= 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, allowing 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 the verifier allows us to use bpf_rcu_read_{un}lock() to get an RCU-safe pointer. 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)