[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200410050333.qshidymodw3oyn6k@kafai-mbp>
Date: Thu, 9 Apr 2020 22:03:33 -0700
From: Martin KaFai Lau <kafai@...com>
To: "Daniel T. Lee" <danieltimlee@...il.com>
CC: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>, <netdev@...r.kernel.org>,
<bpf@...r.kernel.org>
Subject: Re: [PATCH] tools: bpftool: fix struct_ops command invalid pointer
free
On Fri, Apr 10, 2020 at 11:06:12AM +0900, Daniel T. Lee wrote:
> From commit 65c93628599d ("bpftool: Add struct_ops support"),
> a new type of command struct_ops has been added.
>
> This command requires kernel CONFIG_DEBUG_INFO_BTF=y, and for retrieving
> btf info, get_btf_vmlinux() is used.
>
> When running this command on kernel without BTF debug info, this will
> lead to 'btf_vmlinux' variable contains invalid(error) pointer. And by
> this, btf_free() causes a segfault when executing 'bpftool struct_ops'.
>
> This commit adds pointer validation with IS_ERR not to free invalid
> pointer, and this will fix the segfault issue.
>
> Signed-off-by: Daniel T. Lee <danieltimlee@...il.com>
Fixes: 65c93628599d ("bpftool: Add struct_ops support")
Acked-by: Martin KaFai Lau
Thanks for the fix! Please add the Fixes tag in the future.
Powered by blists - more mailing lists