BPF Archive on lore.kernel.org
 help / color / Atom feed
* [PATCH] libbpf: Add NULL check to add_dummy_ksym_var
@ 2021-05-04 23:49 Ian Rogers
  2021-05-05 18:40 ` patchwork-bot+netdevbpf
  0 siblings, 1 reply; 2+ messages in thread
From: Ian Rogers @ 2021-05-04 23:49 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Martin KaFai Lau, Song Liu,
	Yonghong Song, Andrii Nakryiko, John Fastabend, KP Singh, netdev,
	bpf, linux-kernel
  Cc: Ian Rogers, Stanislav Fomichev, Petar Penkov

Avoids a segv if btf isn't present. Seen on the call path
__bpf_object__open calling bpf_object__collect_externs.

Fixes: 5bd022ec01f0 (libbpf: Support extern kernel function)
Suggested-by: Stanislav Fomichev <sdf@google.com>
Suggested-by: Petar Penkov <ppenkov@google.com>
Signed-off-by: Ian Rogers <irogers@google.com>
---
 tools/lib/bpf/libbpf.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index de9a5b0118fe..97d9a1c2d680 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -3216,6 +3216,9 @@ static int add_dummy_ksym_var(struct btf *btf)
 	const struct btf_var_secinfo *vs;
 	const struct btf_type *sec;
 
+	if (!btf)
+		return 0;
+
 	sec_btf_id = btf__find_by_name_kind(btf, KSYMS_SEC,
 					    BTF_KIND_DATASEC);
 	if (sec_btf_id < 0)
-- 
2.31.1.607.g51e8a6a459-goog


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] libbpf: Add NULL check to add_dummy_ksym_var
  2021-05-04 23:49 [PATCH] libbpf: Add NULL check to add_dummy_ksym_var Ian Rogers
@ 2021-05-05 18:40 ` patchwork-bot+netdevbpf
  0 siblings, 0 replies; 2+ messages in thread
From: patchwork-bot+netdevbpf @ 2021-05-05 18:40 UTC (permalink / raw)
  To: Ian Rogers
  Cc: ast, daniel, kafai, songliubraving, yhs, andriin, john.fastabend,
	kpsingh, netdev, bpf, linux-kernel, sdf, ppenkov

Hello:

This patch was applied to bpf/bpf.git (refs/heads/master):

On Tue,  4 May 2021 16:49:10 -0700 you wrote:
> Avoids a segv if btf isn't present. Seen on the call path
> __bpf_object__open calling bpf_object__collect_externs.
> 
> Fixes: 5bd022ec01f0 (libbpf: Support extern kernel function)
> Suggested-by: Stanislav Fomichev <sdf@google.com>
> Suggested-by: Petar Penkov <ppenkov@google.com>
> Signed-off-by: Ian Rogers <irogers@google.com>
> 
> [...]

Here is the summary with links:
  - libbpf: Add NULL check to add_dummy_ksym_var
    https://git.kernel.org/bpf/bpf/c/9683e5775c75

You are awesome, thank you!
--
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-04 23:49 [PATCH] libbpf: Add NULL check to add_dummy_ksym_var Ian Rogers
2021-05-05 18:40 ` patchwork-bot+netdevbpf

BPF Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/bpf/0 bpf/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 bpf bpf/ https://lore.kernel.org/bpf \
		bpf@vger.kernel.org
	public-inbox-index bpf

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.bpf


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git