From: Daniel Borkmann <daniel@iogearbox.net>
To: "Björn Töpel" <bjorn.topel@gmail.com>,
magnus.karlsson@intel.com, jonathan.lemon@gmail.com,
ast@kernel.org, netdev@vger.kernel.org, bpf@vger.kernel.org
Cc: "Björn Töpel" <bjorn.topel@intel.com>,
maximmi@mellanox.com, "Minh Bùi Quang" <minhquangbui99@gmail.com>
Subject: Re: [PATCH bpf] xsk: add overflow check for u64 division, stored into u32
Date: Tue, 26 May 2020 00:19:29 +0200 [thread overview]
Message-ID: <c7c1f29e-f245-ac91-1325-1ed2faa7e3ef@iogearbox.net> (raw)
In-Reply-To: <20200525080400.13195-1-bjorn.topel@gmail.com>
On 5/25/20 10:03 AM, Björn Töpel wrote:
> From: Björn Töpel <bjorn.topel@intel.com>
>
> The npgs member of struct xdp_umem is an u32 entity, and stores the
> number of pages the UMEM consumes. The calculation of npgs
>
> npgs = size / PAGE_SIZE
>
> can overflow.
>
> To avoid overflow scenarios, the division is now first stored in a
> u64, and the result is verified to fit into 32b.
>
> An alternative would be storing the npgs as a u64, however, this
> wastes memory and is an unrealisticly large packet area.
>
> Link: https://lore.kernel.org/bpf/CACtPs=GGvV-_Yj6rbpzTVnopgi5nhMoCcTkSkYrJHGQHJWFZMQ@mail.gmail.com/
> Fixes: c0c77d8fb787 ("xsk: add user memory registration support sockopt")
> Reported-by: "Minh Bùi Quang" <minhquangbui99@gmail.com>
> Signed-off-by: Björn Töpel <bjorn.topel@intel.com>
Applied, thanks!
prev parent reply other threads:[~2020-05-25 22:19 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-05-25 8:03 [PATCH bpf] xsk: add overflow check for u64 division, stored into u32 Björn Töpel
2020-05-25 18:30 ` Jonathan Lemon
2020-05-25 22:19 ` Daniel Borkmann [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=c7c1f29e-f245-ac91-1325-1ed2faa7e3ef@iogearbox.net \
--to=daniel@iogearbox.net \
--cc=ast@kernel.org \
--cc=bjorn.topel@gmail.com \
--cc=bjorn.topel@intel.com \
--cc=bpf@vger.kernel.org \
--cc=jonathan.lemon@gmail.com \
--cc=magnus.karlsson@intel.com \
--cc=maximmi@mellanox.com \
--cc=minhquangbui99@gmail.com \
--cc=netdev@vger.kernel.org \
/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