[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAEKGpzgJces1DVrmKu2fXds1tVfthdFVz-xVbpLn89jHparV0g@mail.gmail.com>
Date: Fri, 10 Apr 2020 14:34:27 +0900
From: "Daniel T. Lee" <danieltimlee@...il.com>
To: Martin KaFai Lau <kafai@...com>
Cc: Daniel Borkmann <daniel@...earbox.net>,
Alexei Starovoitov <ast@...nel.org>,
netdev <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>
Subject: Re: [PATCH] tools: bpftool: fix struct_ops command invalid pointer free
Will do, thanks for letting me know.
Thank you for your time and effort for the review.
Best,
Daniel
On Fri, Apr 10, 2020 at 2:03 PM Martin KaFai Lau <kafai@...com> wrote:
>
> 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