[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20190321013258.6eoy5nm5qqbulfa7@ast-mbp.dhcp.thefacebook.com>
Date: Wed, 20 Mar 2019 18:33:00 -0700
From: Alexei Starovoitov <alexei.starovoitov@...il.com>
To: Michal Rostecki <mrostecki@...nsuse.org>
Cc: Alexei Starovoitov <ast@...nel.org>,
Daniel Borkmann <daniel@...earbox.net>,
Martin KaFai Lau <kafai@...com>,
Song Liu <songliubraving@...com>, Yonghong Song <yhs@...com>,
netdev@...r.kernel.org, bpf@...r.kernel.org
Subject: Re: [PATCH bpf] libbpf: Check if map names are not NULL
On Wed, Mar 20, 2019 at 01:27:42PM +0100, Michal Rostecki wrote:
> BPF maps do not have to be named, so map names can be NULL. Map name
> pointers should be checked before doing any operations which cannot be
> done on NULL pointers.
>
> This issue was detected by the following errors coming from bpftool
> built with AddressSanitizer:
>
> bpf.c:256:2: runtime error: null pointer passed as argument 2, which is declared to never be null
> bpf.c:92:2: runtime error: null pointer passed as argument 2, which is declared to never be null
> bpf.c:169:2: runtime error: null pointer passed as argument 2, which is declared to never be null
>
> Fixes: 88cda1c9da02 ("bpf: libbpf: Provide basic API support to specify BPF obj name")
> Fixes: d7be143b67c2 ("libbpf: Support expected_attach_type at prog load")
> Fixes: 8a138aed4a80 ("bpf: btf: Add BTF support to libbpf")
> Signed-off-by: Michal Rostecki <mrostecki@...nsuse.org>
I don't think that's necessary. memcpy is fine with src==null and len==0
Powered by blists - more mailing lists