lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20191029091210.0a7f0b37@cakuba.hsd1.ca.comcast.net>
Date:   Tue, 29 Oct 2019 09:12:10 -0700
From:   Jakub Kicinski <jakub.kicinski@...ronome.com>
To:     Björn Töpel <bjorn.topel@...il.com>
Cc:     netdev@...r.kernel.org, ast@...nel.org, daniel@...earbox.net,
        Björn Töpel <bjorn.topel@...el.com>,
        bpf@...r.kernel.org, toke@...hat.com
Subject: Re: [PATCH bpf] bpf: change size to u64 for
 bpf_map_{area_alloc,charge_init}()

On Tue, 29 Oct 2019 16:43:07 +0100, Björn Töpel wrote:
> From: Björn Töpel <bjorn.topel@...el.com>
> 
> The functions bpf_map_area_alloc() and bpf_map_charge_init() prior
> this commit passed the size parameter as size_t. In this commit this
> is changed to u64.
> 
> All users of these functions avoid size_t overflows on 32-bit systems,
> by explicitly using u64 when calculating the allocation size and
> memory charge cost. However, since the result was narrowed by the
> size_t when passing size and cost to the functions, the overflow
> handling was in vain.
> 
> Instead of changing all call sites to size_t and handle overflow at
> the call site, the parameter is changed to u64 and checked in the
> functions above.
> 
> Fixes: d407bd25a204 ("bpf: don't trigger OOM killer under pressure with map alloc")
> Fixes: c85d69135a91 ("bpf: move memory size checks to bpf_map_charge_init()")
> Signed-off-by: Björn Töpel <bjorn.topel@...el.com>

Okay, I guess that's the smallest change we can make here.

I'd prefer we went the way of using the standard overflow handling the
kernel has, rather than proliferating this u64 + U32_MAX comparison
stuff. But it's hard to argue with the patch length in light of the
necessary backports..

Reviewed-by: Jakub Kicinski <jakub.kicinski@...ronome.com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ