From: Yonghong Song <yhs@fb.com>
To: Daniel Borkmann <daniel@iogearbox.net>,
Colin King <colin.king@canonical.com>,
Alexei Starovoitov <ast@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
Andrii Nakryiko <andriin@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@chromium.org>, <netdev@vger.kernel.org>,
<bpf@vger.kernel.org>
Cc: <kernel-janitors@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH][next] bpf: fix swapped arguments in calls to check_buffer_access
Date: Tue, 28 Jul 2020 12:12:47 -0700 [thread overview]
Message-ID: <7a0b563a-9853-9d6f-9d3a-0595e701c1b0@fb.com> (raw)
In-Reply-To: <882cd37d-0af2-3412-6bd7-73aa466df23c@iogearbox.net>
On 7/28/20 3:43 AM, Daniel Borkmann wrote:
> On 7/27/20 11:39 PM, Yonghong Song wrote:
>> On 7/27/20 10:54 AM, Colin King wrote:
>>> From: Colin Ian King <colin.king@canonical.com>
>>>
>>> There are a couple of arguments of the boolean flag zero_size_allowed
>>> and the char pointer buf_info when calling to function
>>> check_buffer_access
>>> that are swapped by mistake. Fix these by swapping them to correct
>>> the argument ordering.
>>>
>>> Addresses-Coverity: ("Array compared to 0")
>>> Fixes: afbf21dce668 ("bpf: Support readonly/readwrite buffers in
>>> verifier")
>>> Signed-off-by: Colin Ian King <colin.king@canonical.com>
>>
>> Thanks for the fix!
>> Acked-by: Yonghong Song <yhs@fb.com>
>
> Sigh, thanks for the fix Colin, applied! Yonghong, could you follow-up with
> BPF selftest test cases that exercise these paths? Thx
This will be triggered with a verifier rejection path, e.g., negative
offset from the base. I will send a follow-up patch soon.
BTW, using llvm to build the kernel (without this change), the compiler
actually issues a warning:
-bash-4.4$ make -j100 LLVM=1 && make LLVM=1 vmlinux
GEN Makefile
...
CC kernel/bpf/verifier.o
/data/users/yhs/work/net-next/kernel/bpf/verifier.c:3481:18: warning:
expression which evaluates to zero treate$
as a null pointer constant of type 'const char *'
[-Wnon-literal-null-conversion]
"rdonly", false,
^~~~~
/data/users/yhs/work/net-next/kernel/bpf/verifier.c:3487:16: warning:
expression which evaluates to zero treate$
as a null pointer constant of type 'const char *'
[-Wnon-literal-null-conversion]
"rdwr", false,
^~~~~
2 warnings generated.
AR kernel/bpf/built-in.a
Looks like I need to use LLVM compiler more often...
prev parent reply other threads:[~2020-07-28 19:13 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-27 17:54 Colin King
2020-07-27 21:39 ` Yonghong Song
2020-07-28 10:43 ` Daniel Borkmann
2020-07-28 10:45 ` Colin Ian King
2020-07-28 19:12 ` Yonghong Song [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=7a0b563a-9853-9d6f-9d3a-0595e701c1b0@fb.com \
--to=yhs@fb.com \
--cc=andriin@fb.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=colin.king@canonical.com \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kernel-janitors@vger.kernel.org \
--cc=kpsingh@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@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
all inboxes | Powered by JetHome®