From: Yonghong Song <yhs@fb.com>
To: Dongliang Mu <mudongliangabcd@gmail.com>,
Alexei Starovoitov <ast@kernel.org>,
Daniel Borkmann <daniel@iogearbox.net>,
Andrii Nakryiko <andrii@kernel.org>,
Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
John Fastabend <john.fastabend@gmail.com>,
KP Singh <kpsingh@kernel.org>, Willy Tarreau <w@1wt.eu>
Cc: <syzbot+f3e749d4c662818ae439@syzkaller.appspotmail.com>,
<netdev@vger.kernel.org>, <bpf@vger.kernel.org>,
<linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] bpf: fix kmalloc bug in bpf_check
Date: Mon, 13 Sep 2021 08:33:51 -0700 [thread overview]
Message-ID: <4f260295-b7a2-92ad-3bb0-06074288dd23@fb.com> (raw)
In-Reply-To: <20210913110246.2955737-1-mudongliangabcd@gmail.com>
On 9/13/21 4:02 AM, Dongliang Mu wrote:
> Since 7661809d493b ("mm: don't allow oversized kvmalloc() calls
> ") does not allow oversized kvmalloc, it triggers a kmalloc bug warning
> at bpf_check.
>
> Fix it by adding a sanity check in th check_btf_line.
>
> Reported-by: syzbot+f3e749d4c662818ae439@syzkaller.appspotmail.com
> Fixes: 7661809d493b ("mm: don't allow oversized kvmalloc() calls")
> Signed-off-by: Dongliang Mu <mudongliangabcd@gmail.com>
Thanks for the fix. A similar patch has been proposed here:
https://lore.kernel.org/bpf/20210911005557.45518-1-cuibixuan@huawei.com/
> ---
> kernel/bpf/verifier.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/kernel/bpf/verifier.c b/kernel/bpf/verifier.c
> index 047ac4b4703b..3c5a79f78bc5 100644
> --- a/kernel/bpf/verifier.c
> +++ b/kernel/bpf/verifier.c
> @@ -9913,6 +9913,9 @@ static int check_btf_line(struct bpf_verifier_env *env,
> if (!nr_linfo)
> return 0;
>
> + if (nr_linfo > INT_MAX/sizeof(struct bpf_line_info))
> + return -EINVAL;
> +
> rec_size = attr->line_info_rec_size;
> if (rec_size < MIN_BPF_LINEINFO_SIZE ||
> rec_size > MAX_LINEINFO_REC_SIZE ||
>
next prev parent reply other threads:[~2021-09-13 15:35 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-13 11:02 Dongliang Mu
2021-09-13 15:33 ` Yonghong Song [this message]
2021-09-13 15:36 ` Dongliang Mu
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=4f260295-b7a2-92ad-3bb0-06074288dd23@fb.com \
--to=yhs@fb.com \
--cc=andrii@kernel.org \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=john.fastabend@gmail.com \
--cc=kafai@fb.com \
--cc=kpsingh@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mudongliangabcd@gmail.com \
--cc=netdev@vger.kernel.org \
--cc=songliubraving@fb.com \
--cc=syzbot+f3e749d4c662818ae439@syzkaller.appspotmail.com \
--cc=w@1wt.eu \
/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®