[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <c7c1f29e-f245-ac91-1325-1ed2faa7e3ef@iogearbox.net>
Date: Tue, 26 May 2020 00:19:29 +0200
From: Daniel Borkmann <daniel@...earbox.net>
To: Björn Töpel <bjorn.topel@...il.com>,
magnus.karlsson@...el.com, jonathan.lemon@...il.com,
ast@...nel.org, netdev@...r.kernel.org, bpf@...r.kernel.org
Cc: Björn Töpel <bjorn.topel@...el.com>,
maximmi@...lanox.com,
Minh Bùi Quang <minhquangbui99@...il.com>
Subject: Re: [PATCH bpf] xsk: add overflow check for u64 division, stored into
u32
On 5/25/20 10:03 AM, Björn Töpel wrote:
> From: Björn Töpel <bjorn.topel@...el.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@...il.com>
> Signed-off-by: Björn Töpel <bjorn.topel@...el.com>
Applied, thanks!
Powered by blists - more mailing lists