bpf.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alexei Starovoitov <alexei.starovoitov@gmail.com>
To: Michal Rostecki <mrostecki@opensuse.org>
Cc: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	netdev@vger.kernel.org, bpf@vger.kernel.org
Subject: Re: [PATCH bpf] libbpf: Check if map names are not NULL
Date: Wed, 20 Mar 2019 18:33:00 -0700	[thread overview]
Message-ID: <20190321013258.6eoy5nm5qqbulfa7@ast-mbp.dhcp.thefacebook.com> (raw)
In-Reply-To: <20190320122742.19311-1-mrostecki@opensuse.org>

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@opensuse.org>

I don't think that's necessary. memcpy is fine with src==null and len==0


      reply	other threads:[~2019-03-21  1:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-20 12:27 [PATCH bpf] libbpf: Check if map names are not NULL Michal Rostecki
2019-03-21  1:33 ` Alexei Starovoitov [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190321013258.6eoy5nm5qqbulfa7@ast-mbp.dhcp.thefacebook.com \
    --to=alexei.starovoitov@gmail.com \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=mrostecki@opensuse.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).