Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6588467rwd; Mon, 5 Jun 2023 22:03:40 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5sQJfs3S1VhFKwyKJ8GO34oDfILmAryyVriVUnYym27rmMgKyXhFp7ZHpT3b783//Wjk4p X-Received: by 2002:a05:6830:1bfc:b0:6b2:94ca:a2d1 with SMTP id k28-20020a0568301bfc00b006b294caa2d1mr1011901otb.35.1686027820073; Mon, 05 Jun 2023 22:03:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686027820; cv=none; d=google.com; s=arc-20160816; b=ZyIMQhrzosugOOgGUQGOGrwhPRG2rq2b5qX2iq4xyt+/zKvNJAkaINiY7v+OOL4voY GgKKjCp9DGMgsRnEb2k0rS6VO3zFz8O9nJWvEPXl0UmrdFDXKS72+0pVxVycDRapykzD 2RRnWZHFvR00PnuxpnLKwbBZNvANYoS8pnhg0li0nEPY1thMep3RLlx8uk5p2CuJY+jn 0TiPB4+GGMVQ/tXHDzGohSOeIKTDY2gfm3aygtd+EDAn9oPgRgmbVLg4V+PiTl55XY7t g1EXDd5uEw6U9NrZDvCsyPdXGyokdpaHpI5IJUGriuevhXoPWIfoYWgHWdW4AvRtPGCq 7eHg== 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=qRx2MiVjTdrQM2Tl4Oif4fJU4zipVUeupStPUSK9Ej8=; b=XWiCTbAbw1TIE3ZaD3HHs5hHbJKb1mE3xpQiy1z7PZNILj8NRUg+1zA1Ped7a3rsYX vHjrVOAahjvQ+UF4dDcfYeUyTM5AVGnliuEp+cafU0B9tZbVcjEvIOYbNGsNGQz7YxcR n81TfEEZNy1nPfuJeJ77lJnfs0K9N+lkIFwafIhzxnRwBdEy5TiqNEjCXHKCFAGMxtoE nLOAAGXYL/HUXSLSRM9zsUbBbpbissELPI8fNe6mwDvV0V1j2mpQjpvjcwUyth4gQe1d GcjWzyxqL5rLLc2aKpT4MViyOqFmwJ/mcF9mj7t7Uj8NbPQDLrEkkjo70UviTvF3n/Rg QkEw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=tjQmYYwb; 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 w2-20020aa79a02000000b006543d5f340csi5189447pfj.167.2023.06.05.22.03.27; Mon, 05 Jun 2023 22:03:40 -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=tjQmYYwb; 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 S232196AbjFFE2x (ORCPT + 99 others); Tue, 6 Jun 2023 00:28:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60676 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230410AbjFFE2u (ORCPT ); Tue, 6 Jun 2023 00:28:50 -0400 Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ADD9C19C for ; Mon, 5 Jun 2023 21:28:48 -0700 (PDT) Received: from epcas5p4.samsung.com (unknown [182.195.41.42]) by mailout3.samsung.com (KnoxPortal) with ESMTP id 20230606042846epoutp03fe4be2052659dae9bf87c8a3b65f5f19~l93cWKEAV2699826998epoutp03m for ; Tue, 6 Jun 2023 04:28:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout3.samsung.com 20230606042846epoutp03fe4be2052659dae9bf87c8a3b65f5f19~l93cWKEAV2699826998epoutp03m DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1686025726; bh=qRx2MiVjTdrQM2Tl4Oif4fJU4zipVUeupStPUSK9Ej8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tjQmYYwbO+uR5l5br3SlPAU0uWRT1AgrotaR+DY6j2D+kOO37Q8i8croB1hKWKFdD YmTKe20pG3oWtzc6VpbeF1mcI07+3gdJBi3KYM6MHyyWZonuNaSANfLl84hmB0yE4T dzh6Spk8ZvG9dfSmDiBKcr/DQLpX174gS+tF6UNo= Received: from epsmges5p2new.samsung.com (unknown [182.195.42.74]) by epcas5p3.samsung.com (KnoxPortal) with ESMTP id 20230606042845epcas5p3de5c474826c91795dd5736390a65c0c3~l93bYCZbi0807908079epcas5p3Q; Tue, 6 Jun 2023 04:28:45 +0000 (GMT) Received: from epcas5p3.samsung.com ( [182.195.41.41]) by epsmges5p2new.samsung.com (Symantec Messaging Gateway) with SMTP id 9A.18.44881.DF5BE746; Tue, 6 Jun 2023 13:28:45 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas5p4.samsung.com (KnoxPortal) with ESMTPA id 20230606042819epcas5p4f0601efb42d59007cba023c73fa0624a~l93DOuE-p0584205842epcas5p48; Tue, 6 Jun 2023 04:28:19 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20230606042819epsmtrp23a9feb9b8c8d4a4ffdc6654280c22913~l93DNhXea2695426954epsmtrp2C; Tue, 6 Jun 2023 04:28:19 +0000 (GMT) X-AuditID: b6c32a4a-c47ff7000001af51-87-647eb5fdc43c Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 18.13.28392.3E5BE746; Tue, 6 Jun 2023 13:28:19 +0900 (KST) Received: from localhost.localdomain (unknown [107.109.224.44]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20230606042813epsmtip1e7ff603b02a4b4a77f85c0d217c1b66e~l92_F5ULT1767917679epsmtip1A; Tue, 6 Jun 2023 04:28:13 +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 v4 2/3] bpf: make bpf_dump_raw_ok() based on CONFIG_KALLSYMS Date: Tue, 6 Jun 2023 09:58:01 +0530 Message-Id: <20230606042802.508954-2-maninder1.s@samsung.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230606042802.508954-1-maninder1.s@samsung.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Brightmail-Tracker: H4sIAAAAAAAAA02Se0xTVxzHPffe3pbO6uURPYXhTCdDSIrMaXZM0G2EbFdnRoeLRFnmGrgB x6NNK8MXWAW7gLx0EmmLSEXX0rEVa9GuWF1LWYHINjs2kWnEDAMRdZaCINJstHdm/vf5/X7f 7+9xcnh4hImM5u0u2sMoiqQFIpJPXOpOSBAHOstykq11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ruzsjt//ld1f cDBgxRcboRyR5X6vUxy2J5b7a8s2vVGpX/7w9r9EfsGbmv899wmnHQve8vzbjlOn9N713jtV ZDvzyynzPA6x1hjzFYLakwJv/mstr9TrP8tTm/HYv9AjS7lHiaU4I9FQi7moOBEA0svbTG4D AAA= X-CMS-MailID: 20230606042819epcas5p4f0601efb42d59007cba023c73fa0624a X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: REQ_APPROVE CMS-TYPE: 105P X-CMS-RootMailID: 20230606042819epcas5p4f0601efb42d59007cba023c73fa0624a References: <20230606042802.508954-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,URIBL_BLOCKED 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 bpf_dump_raw_ok() depends on kallsyms_show_value() and we already have a false definition for the !CONFIG_KALLSYMS case. But we'll soon expand on kallsyms_show_value() and so to make the code easier to follow just provide a direct !CONFIG_KALLSYMS definition for bpf_dump_raw_ok() as well. 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