From: Richard Weinberger <richard@nod.at>
To: 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 00:13:43 +0200 [thread overview]
Message-ID: <100542240.i6NpMmsy5C@blindfold> (raw)
In-Reply-To: <20171015220020.8157-1-richard@nod.at>
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:
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-15 22:13 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-10-15 22:00 [PATCH] bpf: devmap: Check attr->max_entries more carefully Richard Weinberger
2017-10-15 22:13 ` Richard Weinberger [this message]
2017-10-17 4:30 ` John Fastabend
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=100542240.i6NpMmsy5C@blindfold \
--to=richard@nod.at \
--cc=ast@kernel.org \
--cc=daniel@iogearbox.net \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.