Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp5126256rwd; Sun, 4 Jun 2023 21:30:26 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7RIpe8/4dklgmhWdp2qtmNRqdJwiuVk1Ct0nUYF+qBADrCC7YTpykPv7ESJ2a+SFflgQ6S X-Received: by 2002:a05:622a:1a23:b0:3f6:af73:3c59 with SMTP id f35-20020a05622a1a2300b003f6af733c59mr6900704qtb.58.1685939426523; Sun, 04 Jun 2023 21:30:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685939426; cv=none; d=google.com; s=arc-20160816; b=ORkEcFL8V4r3tX9sBgYynj+jnQGGH0m8i4Jke6qAyMMEznNIJif4vUttFHF/+1Wnhd mWwV524JicHpqkoM7dE71o/tRG93C4pI7OpMSZx+kYwYC4hYIRJk3aj95DftubRO96QG ujXoWcxfdiWYBolYk6q4HbQoimK9goQeIkx5mqYpab1PD17PxJ2NJr32rZM1UsQquvTW EO6ppolGo+3ZDvnLlU88ljrXbFfqKM8bv0eSq8CfgpVkzNOeU4Qz2XuYGXVzLiEyuoPe kS2QWi1Zk7qR/yA+Cm2YrrNZw1+OaTr3nA0GCjh75Bvm+vQzHVo6gIIyURmfZxmRuy30 i4iA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:cms-type:content-transfer-encoding :mime-version:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=D6BYeEFjcwK/JjVlG0GME0GZtwXFEU/rtRQJcirZLm8=; b=KPmoBt9SCLgt3cuM5oGmGVNg+WAtA+9fPLigZqmbVcffMes8ITWjm1HkU+i3s7D2P2 sGMYt1+8SL0PU6ZLax3Onw9jrIKilExji7UwBrKUaFtxP70XQPMKlEqPFPFByGoqCsHe 7vD6/iZ59fD/ag7Y0WGAojTGvgcVTC0NAHMgcJOTnNnHZPpcW8wwwM89ZKPFfaQM2Sro r2t/m8Q6n3s+lkZ9LUo3b5rNGzo3YioPUCI6Gc3Hod4edl7nOEVbVPyqb8ZTIzUuo1b4 ci2zsjqFfdswEbZ92muxQw+wVg3lI7Kxb7GfkBm9WPCEbFu/WkOtFwuiHRV08uwCSFD7 9+dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=f8cK3quR; 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=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o11-20020a63730b000000b0054294720d56si5086855pgc.387.2023.06.04.21.30.14; Sun, 04 Jun 2023 21:30:26 -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=@samsung.com header.s=mail20170921 header.b=f8cK3quR; 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=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233092AbjFEELv (ORCPT + 99 others); Mon, 5 Jun 2023 00:11:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232604AbjFEELY (ORCPT ); Mon, 5 Jun 2023 00:11:24 -0400 Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C3ECC19A8 for ; Sun, 4 Jun 2023 21:09:49 -0700 (PDT) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout1.samsung.com (KnoxPortal) with ESMTP id 20230605040943epoutp012d2db9ada47f1909bf286157fd7466ee~lp9h2ihd92247222472epoutp01E for ; Mon, 5 Jun 2023 04:09:43 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout1.samsung.com 20230605040943epoutp012d2db9ada47f1909bf286157fd7466ee~lp9h2ihd92247222472epoutp01E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1685938183; bh=D6BYeEFjcwK/JjVlG0GME0GZtwXFEU/rtRQJcirZLm8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=f8cK3quR+2To1odFVlYZOP7kuZLWsJkXHD3qYsiEdm9mxS6boI5lk9AI0ua2kgzTh onm1WXhNidoMI673PuluvASOoAifDBNrIcE9yJRZ0kDOHmi6qmIgjU/lLbD8e2wKrO XlJ0YL8SmCTc+Nrfb+kYHT+LPetkAWaeZJkMkNgs= Received: from epsmges5p1new.samsung.com (unknown [182.195.42.73]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20230605040942epcas5p152487d3a986533c90ab5bdeebb2e0798~lp9hFZWmR3075730757epcas5p1S; Mon, 5 Jun 2023 04:09:42 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p1new.samsung.com (Symantec Messaging Gateway) with SMTP id 04.7B.04567.6006D746; Mon, 5 Jun 2023 13:09:42 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p2.samsung.com (KnoxPortal) with ESMTPA id 20230605040801epcas5p2ca850464882841a0a5748e217542a10a~lp8CcrBOy0082200822epcas5p2Q; Mon, 5 Jun 2023 04:08:01 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230605040801epsmtrp2a79647a26428599321e6aa4393a74d5a~lp8CbUkZ41080610806epsmtrp2y; Mon, 5 Jun 2023 04:08:01 +0000 (GMT) X-AuditID: b6c32a49-db3fe700000011d7-ec-647d60066fb5 Received: from epsmtip2.samsung.com ( [182.195.34.31]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id D0.C8.28392.1AF5D746; Mon, 5 Jun 2023 13:08:01 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip2.samsung.com (KnoxPortal) with ESMTPA id 20230605040756epsmtip287381b7bf2d8b7632331a41ebaa9cd96~lp79mtpvu0198301983epsmtip2M; Mon, 5 Jun 2023 04:07:55 +0000 (GMT) From: Maninder Singh To: ast@kernel.org, daniel@iogearbox.net, john.fastabend@gmail.com, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, kpsingh@kernel.org, sdf@google.com, haoluo@google.com, jolsa@kernel.org, thunder.leizhen@huawei.com, mcgrof@kernel.org, boqun.feng@gmail.com, vincenzopalazzodev@gmail.com, ojeda@kernel.org, jgross@suse.com, brauner@kernel.org, michael.christie@oracle.com, samitolvanen@google.com, glider@google.com, peterz@infradead.org, keescook@chromium.org, stephen.s.brennan@oracle.com, alan.maguire@oracle.com, pmladek@suse.com Cc: linux-kernel@vger.kernel.org, bpf@vger.kernel.org, Maninder Singh , Onkarnath Subject: [PATCH v3 3/3] bpf: make bpf_dump_raw_ok() based on CONFIG_KALLSYMS Date: Mon, 5 Jun 2023 09:37:31 +0530 Message-Id: <20230605040731.13828-3-maninder1.s@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230605040731.13828-1-maninder1.s@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02SfUxTVxjGd+69vf0w3S6FzCM4ZgjEFCeOMecxobolc7swdLLFzY8ts5G7 2lgqa8HCjBtYAuOjyBhMKAyE4iiIiAy0lrnSj9DgdA7IHJRUCFTZRkChIFNER3sh87/f+77P c57znhweLjpHBvPkylRGpZQqwkgBcckuFm8kD55IejW3ZyMasGURaH6hEkezD4e4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xuMmylxw4vfzzC9pBccyd9WcnRUQsGBdGHclvDqjh6TObr3suSbUf2VZwIr4esVTO6kJLwnm 7Srz2dvkqYoI7PAvTTizOmSjztafPOC1uU4Tmh3TIsK4OGmQGFVx0r/GbRYScQMAAA== X-CMS-MailID: 20230605040801epcas5p2ca850464882841a0a5748e217542a10a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20230605040801epcas5p2ca850464882841a0a5748e217542a10a References: <20230605040731.13828-1-maninder1.s@samsung.com> X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_PASS,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 bpf_dump_raw_ok() depends on kallsyms_show_value() and we already have a false definition for the !CONFIG_KALLSYMS case. But we have expanded kallsyms_show_value() to work for !CONFIG_KALLSYMS case also in previous patch. And so to make the code easier to follow just provide a direct !CONFIG_KALLSYMS definition for bpf_dump_raw_ok() as well. As it is heavily dependent on KALLSYMS and checking based on kallsyms_show_value() will not work now. Co-developed-by: Onkarnath Signed-off-by: Onkarnath Signed-off-by: Maninder Singh Reviewed-by: Luis Chamberlain --- include/linux/filter.h | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/include/linux/filter.h b/include/linux/filter.h index bbce89937fde..1f237a3bb11a 100644 --- a/include/linux/filter.h +++ b/include/linux/filter.h @@ -923,13 +923,21 @@ bool bpf_jit_supports_kfunc_call(void); bool bpf_jit_supports_far_kfunc_call(void); bool bpf_helper_changes_pkt_data(void *func); +/* + * Reconstruction of call-sites is dependent on kallsyms, + * thus make dump the same restriction. + */ +#ifdef CONFIG_KALLSYMS static inline bool bpf_dump_raw_ok(const struct cred *cred) { - /* Reconstruction of call-sites is dependent on kallsyms, - * thus make dump the same restriction. - */ return kallsyms_show_value(cred); } +#else +static inline bool bpf_dump_raw_ok(const struct cred *cred) +{ + return false; +} +#endif struct bpf_prog *bpf_patch_insn_single(struct bpf_prog *prog, u32 off, const struct bpf_insn *patch, u32 len); -- 2.17.1