From: Maninder Singh <maninder1.s@samsung.com>
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 <maninder1.s@samsung.com>,
Onkarnath <onkarnath.1@samsung.com>
Subject: [PATCH v3 3/3] bpf: make bpf_dump_raw_ok() based on CONFIG_KALLSYMS
Date: Mon, 5 Jun 2023 09:37:31 +0530 [thread overview]
Message-ID: <20230605040731.13828-3-maninder1.s@samsung.com> (raw)
In-Reply-To: <20230605040731.13828-1-maninder1.s@samsung.com>
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 <onkarnath.1@samsung.com>
Signed-off-by: Onkarnath <onkarnath.1@samsung.com>
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Luis Chamberlain <mcgrof@kernel.org>
---
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
next prev parent reply other threads:[~2023-06-05 4:12 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20230605040744epcas5p21968bee09fba5c3505a729fe2f57c507@epcas5p2.samsung.com>
2023-06-05 4:07 ` [PATCH v3 1/3] kallsyms: move kallsyms_show_value() out of kallsyms.c Maninder Singh
[not found] ` <CGME20230605040753epcas5p2640ca20e5fe0f628926d5cba16d8270a@epcas5p2.samsung.com>
2023-06-05 4:07 ` [PATCH v3 2/3] kallsyms: make kallsyms_show_value() as generic function Maninder Singh
[not found] ` <CGME20230605040801epcas5p2ca850464882841a0a5748e217542a10a@epcas5p2.samsung.com>
2023-06-05 4:07 ` Maninder Singh [this message]
2023-06-05 11:46 ` [PATCH v3 3/3] bpf: make bpf_dump_raw_ok() based on CONFIG_KALLSYMS Leizhen (ThunderTown)
2023-06-05 11:32 ` [PATCH v3 1/3] kallsyms: move kallsyms_show_value() out of kallsyms.c Leizhen (ThunderTown)
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230605040731.13828-3-maninder1.s@samsung.com \
--to=maninder1.s@samsung.com \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=boqun.feng@gmail.com \
--cc=bpf@vger.kernel.org \
--cc=brauner@kernel.org \
--cc=daniel@iogearbox.net \
--cc=glider@google.com \
--cc=haoluo@google.com \
--cc=jgross@suse.com \
--cc=john.fastabend@gmail.com \
--cc=jolsa@kernel.org \
--cc=keescook@chromium.org \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=martin.lau@linux.dev \
--cc=mcgrof@kernel.org \
--cc=michael.christie@oracle.com \
--cc=ojeda@kernel.org \
--cc=onkarnath.1@samsung.com \
--cc=peterz@infradead.org \
--cc=pmladek@suse.com \
--cc=samitolvanen@google.com \
--cc=sdf@google.com \
--cc=song@kernel.org \
--cc=stephen.s.brennan@oracle.com \
--cc=thunder.leizhen@huawei.com \
--cc=vincenzopalazzodev@gmail.com \
--cc=yhs@fb.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®