Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp4757570rwe; Mon, 17 Apr 2023 18:45:44 -0700 (PDT) X-Google-Smtp-Source: AKy350bhu1BQY4huhiCJkGWuyXnGKXu3+2EnLx5c+LJyu2U1IQxbBRiznrFKJIRTbkX5q84/tmGn X-Received: by 2002:a05:6a20:3d03:b0:ef:4321:a8a4 with SMTP id y3-20020a056a203d0300b000ef4321a8a4mr9618111pzi.44.1681782344622; Mon, 17 Apr 2023 18:45:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681782344; cv=none; d=google.com; s=arc-20160816; b=DKRhcGnq07CqK+8p2wuFo2lH+LoD/+vZsjO22Ej0LfucxaEjTv3eOtZw+RaVhEhF3z UXhuxZv74tN4aDCmIoH8QYGlMDV2GMZvYqq29CAQhZbFTMisc5YqGbv9IBmVc+oPgqF9 +ZiSjjnv5rz/pfZG3sV7UKtNa2ZRIrvv8ijxt4PJQGIv5ic0gXbCTMaSkE6eLxd3o4nW n7q5nVFdf3xoP+fy6V3FvDIrIgazro/ZxgXoMPzlGwJzlnrsH1SJOJr9jr+nEjLbgBbd aZCC+asKh3JhzKb6kA1Sf8PFdwTWZvyAoCHNfyXgsNuaCTjkNvv1gbYq8rTM8drUSK6R 1NWQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:from:subject:message-id:references :mime-version:in-reply-to:date:dkim-signature; bh=zWwdeYSbe2MZzb6+0YuKWkWzO0OIunr3DIdjLXb+QPs=; b=loCtG6lpOOHUrmIlQX+o3KHGOcaKst55QlXuFcyWGN2RWfC0k+nXVXdMHcRlPYIw+g 2MnJD7zxNo0i+iQ2qVWThjclpieWUmrJuhgCTyrtzfXZ/FjZazq6x7EPyTb9syqc41Uv QvI2bWIdGWew/3G0+sWAi5GufUjvyHa6pbmv6R8vSNFssy/h/y476EtjZaW71ZUyhYXj qfYpS0q8VAAJbDOdJ1LCFR7JkPhqCHcrZXnMieWvL6hkkYulT1MjaWy/5vWYdkiwLh5d yiWa0c1Hj/T2Mej+kHvArU8HMGHtJX2/IFUCvlhruQMEAaCU3UJi0IW/P8MwaTQhhgZ+ wzvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=bvVRAaya; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x184-20020a6386c1000000b0051418f75569si321131pgd.425.2023.04.17.18.45.31; Mon, 17 Apr 2023 18:45:44 -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=@google.com header.s=20221208 header.b=bvVRAaya; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231331AbjDRBon (ORCPT + 99 others); Mon, 17 Apr 2023 21:44:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53706 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231186AbjDRBna (ORCPT ); Mon, 17 Apr 2023 21:43:30 -0400 Received: from mail-yb1-xb4a.google.com (mail-yb1-xb4a.google.com [IPv6:2607:f8b0:4864:20::b4a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9644EBF for ; Mon, 17 Apr 2023 18:42:10 -0700 (PDT) Received: by mail-yb1-xb4a.google.com with SMTP id v200-20020a252fd1000000b00b8f548a72bbso12436676ybv.9 for ; Mon, 17 Apr 2023 18:42:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681782110; x=1684374110; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=zWwdeYSbe2MZzb6+0YuKWkWzO0OIunr3DIdjLXb+QPs=; b=bvVRAayaKb3f4XHecCOw1fq1zrxbTJlfu+X0j4JJ+ODZZ8s343yV2zF5V5cJPVfBrx vO1QktBuUoSHL08PHmb741zrbYTtLR44mlVkerlNbRbCJGYvY5rfLmHur4kpmRZXckp/ 5Xt5y4R3xULWEw01wuUy+z/jQtalviK0udMiGXZVR4o34gUJMO46tjSd9TtEsLa3oC0C Qs9ggxL4witMvtnXFhB17F+6dIIHcCSX5M76pppw2FB4zNzSuRHvs30bGFNla01g3E11 K2LsOQQ7l/LXtTgEgSoMdbEAFkvDtok6PTyc3QsDYVhsfSDu4Pfk86mtQUxZrOSNJ97d ihKA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681782110; x=1684374110; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=zWwdeYSbe2MZzb6+0YuKWkWzO0OIunr3DIdjLXb+QPs=; b=GkMqVkTSA4mBxptcuHTEs738R1c78YFGh/cXNen0BgIgYkWxAp5Pl47zhg8t+R02zE b2FF4/gK72ZELC8bozTiiOjlZUlS+tQpfVhDLvBlhu22/fBHqFYH01X68gMCTDacaiLn ZtnFTkc3xi7CShNQAt+p0qV+TOcdxvMSACPvzOrSbQ9Y1w0PWCrfgZejjtXDOZPOAd6M F3d9uTHV8Oc8E9dAoV6/dzr2k+r3/+wQj1kUyLCRzb/aklQGW2JjxNEAv063U+7o4k6c ma7O0zUTxAFE+wROWoTeNp08y714rDkbXrhzzZ4/uIEEdHEQNJzwDngaabded6ll3W4x iroA== X-Gm-Message-State: AAQBX9dejJ+DoPjlyV9zUNYvivcirv10u8Vdmmn8xaK1l7YBkoIizQlq Ics6zl6i3GIkWgEmOb5Q762byF8Vjcg= X-Received: from drosen.mtv.corp.google.com ([2620:15c:211:201:e67a:98b0:942d:86aa]) (user=drosen job=sendgmr) by 2002:a0d:ec02:0:b0:54c:2723:560d with SMTP id q2-20020a0dec02000000b0054c2723560dmr10855123ywn.3.1681782110238; Mon, 17 Apr 2023 18:41:50 -0700 (PDT) Date: Mon, 17 Apr 2023 18:40:26 -0700 In-Reply-To: <20230418014037.2412394-1-drosen@google.com> Mime-Version: 1.0 References: <20230418014037.2412394-1-drosen@google.com> X-Mailer: git-send-email 2.40.0.634.g4ca3ef3211-goog Message-ID: <20230418014037.2412394-27-drosen@google.com> Subject: [RFC PATCH v3 26/37] bpf: Increase struct_op limits From: Daniel Rosenberg To: Miklos Szeredi , bpf@vger.kernel.org, Alexei Starovoitov Cc: Amir Goldstein , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-unionfs@vger.kernel.org, Daniel Borkmann , John Fastabend , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , KP Singh , Stanislav Fomichev , Hao Luo , Jiri Olsa , Shuah Khan , Jonathan Corbet , Joanne Koong , Mykola Lysenko , kernel-team@android.com, Daniel Rosenberg Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL 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 Fuse bpf goes a bit past the '64' limit here, although in reality, this limit seems to be more like 37. After 37, we start overrunning the safety checks while setting up the trampoline. This simply doubles some of these values. This will have the same issue, as we'll run out of space way before hitting the 128 limit, but for now that unblocks fuse-bpf. Signed-off-by: Daniel Rosenberg --- include/linux/bpf.h | 2 +- kernel/bpf/bpf_struct_ops.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/linux/bpf.h b/include/linux/bpf.h index 18b592fde896..c006f823e634 100644 --- a/include/linux/bpf.h +++ b/include/linux/bpf.h @@ -1537,7 +1537,7 @@ struct bpf_link_primer { struct bpf_struct_ops_value; struct btf_member; -#define BPF_STRUCT_OPS_MAX_NR_MEMBERS 64 +#define BPF_STRUCT_OPS_MAX_NR_MEMBERS 128 struct bpf_struct_ops { const struct bpf_verifier_ops *verifier_ops; int (*init)(struct btf *btf); diff --git a/kernel/bpf/bpf_struct_ops.c b/kernel/bpf/bpf_struct_ops.c index d3f0a4825fa6..deb9eecaf1e4 100644 --- a/kernel/bpf/bpf_struct_ops.c +++ b/kernel/bpf/bpf_struct_ops.c @@ -417,7 +417,7 @@ static long bpf_struct_ops_map_update_elem(struct bpf_map *map, void *key, udata = &uvalue->data; kdata = &kvalue->data; image = st_map->image; - image_end = st_map->image + PAGE_SIZE; + image_end = st_map->image + 2 * PAGE_SIZE; for_each_member(i, t, member) { const struct btf_type *mtype, *ptype; @@ -688,7 +688,7 @@ static struct bpf_map *bpf_struct_ops_map_alloc(union bpf_attr *attr) st_map->links = bpf_map_area_alloc(btf_type_vlen(t) * sizeof(struct bpf_links *), NUMA_NO_NODE); - st_map->image = bpf_jit_alloc_exec(PAGE_SIZE); + st_map->image = bpf_jit_alloc_exec(2 * PAGE_SIZE); if (!st_map->uvalue || !st_map->links || !st_map->image) { __bpf_struct_ops_map_free(map); return ERR_PTR(-ENOMEM); -- 2.40.0.634.g4ca3ef3211-goog