linux-kernel-mentees.lists.linuxfoundation.org archive mirror
 help / color / mirror / Atom feed
* [Linux-kernel-mentees] [PATCH] bpf: Fix NULL pointer dereference in __btf_resolve_helper_id()
@ 2020-07-14  0:38 Peilin Ye
  2020-07-14  0:53 ` Andrii Nakryiko
  0 siblings, 1 reply; 7+ messages in thread
From: Peilin Ye @ 2020-07-14  0:38 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann
  Cc: Song Liu, John Fastabend, linux-kernel, Martin KaFai Lau,
	syzkaller-bugs, clang-built-linux, netdev, KP Singh,
	Yonghong Song, bpf, Andrii Nakryiko, Peilin Ye,
	linux-kernel-mentees

Prevent __btf_resolve_helper_id() from dereferencing `btf_vmlinux`
as NULL. This patch fixes the following syzbot bug:

    https://syzkaller.appspot.com/bug?id=5edd146856fd513747c1992442732e5a0e9ba355

Reported-by: syzbot+ee09bda7017345f1fbe6@syzkaller.appspotmail.com
Signed-off-by: Peilin Ye <yepeilin.cs@gmail.com>
---
 kernel/bpf/btf.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/bpf/btf.c b/kernel/bpf/btf.c
index 30721f2c2d10..3e981b183fa4 100644
--- a/kernel/bpf/btf.c
+++ b/kernel/bpf/btf.c
@@ -4088,7 +4088,7 @@ static int __btf_resolve_helper_id(struct bpf_verifier_log *log, void *fn,
 	const char *tname, *sym;
 	u32 btf_id, i;
 
-	if (IS_ERR(btf_vmlinux)) {
+	if (IS_ERR_OR_NULL(btf_vmlinux)) {
 		bpf_log(log, "btf_vmlinux is malformed\n");
 		return -EINVAL;
 	}
-- 
2.25.1

_______________________________________________
Linux-kernel-mentees mailing list
Linux-kernel-mentees@lists.linuxfoundation.org
https://lists.linuxfoundation.org/mailman/listinfo/linux-kernel-mentees

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

end of thread, other threads:[~2020-07-15 21:07 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-14  0:38 [Linux-kernel-mentees] [PATCH] bpf: Fix NULL pointer dereference in __btf_resolve_helper_id() Peilin Ye
2020-07-14  0:53 ` Andrii Nakryiko
2020-07-14  1:27   ` [Linux-kernel-mentees] [PATCH v2] " Peilin Ye
2020-07-14  4:37     ` Andrii Nakryiko
2020-07-14 17:27       ` Alexei Starovoitov
2020-07-14 18:09         ` [Linux-kernel-mentees] [PATCH v3] " Peilin Ye
2020-07-15 21:07           ` Daniel Borkmann

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).