From: John Fastabend <john.fastabend@gmail.com>
To: Richard Weinberger <richard@nod.at>, netdev@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, daniel@iogearbox.net,
ast@kernel.org, sp3485@columbia.edu
Subject: Re: [PATCH] bpf: devmap: Check attr->max_entries more carefully
Date: Mon, 16 Oct 2017 21:30:38 -0700 [thread overview]
Message-ID: <0b5e4a49-3738-5b57-1abf-1912b2afff2c@gmail.com> (raw)
In-Reply-To: <100542240.i6NpMmsy5C@blindfold>
On 10/15/2017 03:13 PM, Richard Weinberger wrote:
> Am Montag, 16. Oktober 2017, 00:00:20 CEST schrieb Richard Weinberger:
>> max_entries is user controlled and used as input for __alloc_percpu().
>> This function expects that the allocation size is a power of two and
>> less than PCPU_MIN_UNIT_SIZE.
>> Otherwise a WARN() is triggered.
>
> On a second though, I think we should also have a hard limit for ->max_entries
> or check for an overflow here:
>
Or just,
static u64 dev_map_bitmap_size(const union bpf_attr *attr)
{
return BITS_TO_LONGS((u64) attr->max_entries) *
sizeof(unsigned long);
}
Let me know if you want me to send a patch or if you want to.
Thanks,
John
> static u64 dev_map_bitmap_size(const union bpf_attr *attr)
> {
> return BITS_TO_LONGS(attr->max_entries) * sizeof(unsigned long);
> }
>
> Thanks,
> //richard
>
next prev parent reply other threads:[~2017-10-17 4:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-15 22:00 Richard Weinberger
2017-10-15 22:13 ` Richard Weinberger
2017-10-17 4:30 ` John Fastabend [this message]
2017-10-16 18:52 ` Daniel Borkmann
2017-10-17 10:29 ` Mark Rutland
2017-10-17 10:32 ` Daniel Borkmann
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=0b5e4a49-3738-5b57-1abf-1912b2afff2c@gmail.com \
--to=john.fastabend@gmail.com \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richard@nod.at \
--cc=sp3485@columbia.edu \
/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®