Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp560140rwd; Wed, 31 May 2023 02:08:17 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ75Y/TCfTM/Kkhvu83IKqt39TLsh6pHBkClhUo89wTwX8y+BtiKBstYJe1hIzL785cfhn5y X-Received: by 2002:a05:6a00:1254:b0:647:3de:c0ff with SMTP id u20-20020a056a00125400b0064703dec0ffmr4645526pfi.30.1685524096978; Wed, 31 May 2023 02:08:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685524096; cv=none; d=google.com; s=arc-20160816; b=UVCCHo5pGeuWdQEXE0Kq0OPoKhSXdZs9q0O69z+TGxcT89+kxb29NPofmVyjtZxnef up8sz6hLOvCc+QlBzChmk1wsK9fZrkM/KkN4e1K20ccUV/AbfElYg/lei0GtlylDWFy2 2/89LYCJNL6pi+k3mje+nLlPvP57wvKeEAlUZQtoymqXXpoGflI22dFDOYbZB0G1K6U1 Wjh1JUN/BBK29qQbXoArBd/jJVqWDsrWQ4h+WM49yabE4/z9CRLGMtxiMC+isAYy7b+C HUER+Exz6HqdVMnHf9Denx6an2ist+6kpCGd3jaQ4yXr4k2BfaBdnUCgb3v/0u10mtb3 LbuQ== 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:message-id:date:subject:cc:to:from:dkim-signature :dkim-filter; bh=baxG0r+ENYpq+lI/FYBiiMgnvFDrHXtZq7+5iYd8pQA=; b=1BTFRpRnZRc3JkWc0NDk8mCPFKB5eojoDIGDeZvKuJvQwY0TX3k6kNzlhDs0X7bHUA JfUvShcA0Wm/9EuqIKYVv/ZejtlDSFEh+TVHEMOBtu6ebrqktJfdQdFImSN7or7PFMeO V2jzQfUsiRVuZlI/O6IfNGwe/KtF2eTWSp5A+qjgQq4Kgxj898JPWGrLAGORBIEif74t RwMbzzH2JqT9dNpbG69L4tGmq3+iWdmZZimdooUrm3LPHTpwhxtI5U4XV2QbKBMDiVzd rMhs/xVLjFN4yAcWB/tYAApzFVJOkFJXxiGPUK89FMNA0n/jDVZnD92ejlg07q/V+MF4 nFog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=dQiR9FnQ; 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 p185-20020a625bc2000000b00642ea71f6d9si1130692pfb.336.2023.05.31.02.08.04; Wed, 31 May 2023 02:08:16 -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=dQiR9FnQ; 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 S235211AbjEaItT (ORCPT + 99 others); Wed, 31 May 2023 04:49:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33600 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235235AbjEaIsy (ORCPT ); Wed, 31 May 2023 04:48:54 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AE1BE125 for ; Wed, 31 May 2023 01:48:25 -0700 (PDT) Received: from epcas5p1.samsung.com (unknown [182.195.41.39]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230531084821epoutp03a1cdaf3986606a1782a0bffad1c982c3~kLiXu8suZ3239232392epoutp03S for ; Wed, 31 May 2023 08:48:20 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230531084821epoutp03a1cdaf3986606a1782a0bffad1c982c3~kLiXu8suZ3239232392epoutp03S DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1685522901; bh=baxG0r+ENYpq+lI/FYBiiMgnvFDrHXtZq7+5iYd8pQA=; h=From:To:Cc:Subject:Date:References:From; b=dQiR9FnQ6W+elEKOya0d4D5rWQ8y2UVrjrskw9f36r/PkSkjB2EQWnfbilQkP7ykG BY5NtLuYjAVb522SDZFQg/wbLO/6GbCsPyrTtRO1lPP8aPTNI4+g+J715GISjfdbSA qmYsp2IM4NtpQLPAPEIaZHfQasx0a9WjcBeHwSuI= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p1.samsung.com (KnoxPortal) with ESMTP id 20230531084820epcas5p1d2dece3895cef198664d199ceef27cb2~kLiW_u3dk0967909679epcas5p1_; Wed, 31 May 2023 08:48:20 +0000 (GMT) Received: from epcas5p1.samsung.com ( [182.195.41.39]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id A3.E4.44881.4D907746; Wed, 31 May 2023 17:48:20 +0900 (KST) Received: from epsmtrp1.samsung.com (unknown [182.195.40.13]) by epcas5p1.samsung.com (KnoxPortal) with ESMTPA id 20230531084800epcas5p1c02d5a7ffcef2bb7cf626bf52beb0eee~kLiFCk88D0492504925epcas5p16; Wed, 31 May 2023 08:48:00 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp1.samsung.com (KnoxPortal) with ESMTP id 20230531084800epsmtrp1fdad5e72796891bef08c9f54f5f6e3cd~kLiFAGqYa1155311553epsmtrp1y; Wed, 31 May 2023 08:48:00 +0000 (GMT) X-AuditID: b6c32a4a-c47ff7000001af51-33-647709d4ec87 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 7A.37.28392.0C907746; Wed, 31 May 2023 17:48:00 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230531084755epsmtip1167910a1f8408e3d75b735c30e9abd8b~kLiAQ9o2Z2274722747epsmtip1J; Wed, 31 May 2023 08:47: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 v2 1/2] bpf: make defination of bpf_dump_raw_ok based on CONFIG_KALLSYMS Date: Wed, 31 May 2023 14:17:44 +0530 Message-Id: <20230531084745.877337-1-maninder1.s@samsung.com> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Sf1CTdRzH+z7Ps2c/avGI3vUVC7x1HOeKIVr2vSvCuwgfuSs6u6uL8Grn Hn5cbK5NROmqDdaGGAQemtsItogYxIlOyDnZcGM1QQxleAJdSjE1JD1hCJgisT3j8r/X5/N5 v7/v7+d7Xx4e20jG8QoVexiVQlokIgXEz70bkpKH+SWyjZMaEo14tQSaf2DG0ez937movVOL oZDPT6Kp3hmAmqxzODJMu3Dk9fdwUf3oJlTmsGHIV2fC0cBBObrprsJQwFlPot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9IHXLwGuT6y4hxkaKfTxRBSv+DblvRytYAwAA X-CMS-MailID: 20230531084800epcas5p1c02d5a7ffcef2bb7cf626bf52beb0eee X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20230531084800epcas5p1c02d5a7ffcef2bb7cf626bf52beb0eee References: X-Spam-Status: No, score=-4.6 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,URIBL_BLOCKED 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 No functional change with this commit. As of now bpf_dump_raw_ok() is dependent on kallsyms_show_value(). Rearranging the code to return false directly in defination of bpf_dump_raw_ok() based on CONFIG_KALLSYMS. @reason: next patch will make kallsyms_show_value() defination generic and bpf_dump_raw_ok() will return true otherwise. Thus make decision based on CONFIG rather than kallsyms_show_value(), as bpf functionality is heavily dependent on KALLSYMS. Co-developed-by: Onkarnath Signed-off-by: Onkarnath Signed-off-by: Maninder Singh --- v1 -> v2 : made separate patches for kallsyms and bpf 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