From: Jonathan Lemon <bsd@fb.com>
To: "Björn Töpel" <bjorn.topel@gmail.com>
Cc: magnus.karlsson@intel.com, jonathan.lemon@gmail.com,
ast@kernel.org, daniel@iogearbox.net, netdev@vger.kernel.org,
bpf@vger.kernel.org, "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: Mon, 25 May 2020 11:30:59 -0700 [thread overview]
Message-ID: <20200525183059.aeaepmpa5h2nbzvc@bsd-mbp> (raw)
In-Reply-To: <20200525080400.13195-1-bjorn.topel@gmail.com>
On Mon, May 25, 2020 at 10:03:59AM +0200, 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>
Acked-by: Jonathan Lemon <jonathan.lemon@gmail.com>
next prev parent reply other threads:[~2020-05-25 18:31 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 [this message]
2020-05-25 22:19 ` 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=20200525183059.aeaepmpa5h2nbzvc@bsd-mbp \
--to=bsd@fb.com \
--cc=ast@kernel.org \
--cc=bjorn.topel@gmail.com \
--cc=bjorn.topel@intel.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--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