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] [day] [month] [year] [list]
Message-Id: <20170421.152927.791898060188963796.davem@davemloft.net>
Date:   Fri, 21 Apr 2017 15:29:27 -0400 (EDT)
From:   David Miller <davem@...emloft.net>
To:     daniel@...earbox.net
Cc:     ast@...com, borkmann@...earbox.net, netdev@...r.kernel.org
Subject: Re: [PATCH] Fix values type used in test_maps

From: Daniel Borkmann <daniel@...earbox.net>
Date: Thu, 20 Apr 2017 23:24:53 +0200

> On 04/20/2017 09:20 PM, David Miller wrote:
>>
>> Maps of per-cpu type have their value element size adjusted to 8 if it
>> is specified smaller during various map operations.
>>
>> This makes test_maps as a 32-bit binary fail, in fact the kernel
>> writes past the end of the value's array on the user's stack.
>>
>> To be quite honest, I think the kernel should reject creation of a
>> per-cpu map that doesn't have a value size of at least 8 if that's
>> what the kernel is going to silently adjust to later.
> 
> It's unintuitive, agree, and it's in fact a round_up(value_size, 8),
> so rejecting a value size smaller than 8 doesn't really help; commit
> 15a07b33814d ("bpf: add lookup/update support for per-cpu hash and
> array maps") explained the rationale a bit. Hmm, we should probably
> move at least the bpf_num_possible_cpus() and round_up(val_size, 8)
> calculation as a single wrapper function to be used for determining
> the array size into bpf_util.h, so that it's slightly easier to deal
> with.
> 
>> If the user passed something smaller, it is a sizeof() calcualtion
>> based upon the type they will actually use (just like in this testcase
>> code) in later calls to the map operations.
> 
> Fixes: df570f577231 ("samples/bpf: unit test for
> BPF_MAP_TYPE_PERCPU_ARRAY")
> 
>> Signed-off-by: David S. Miller <davem@...emloft.net>
> 
> Acked-by: Daniel Borkmann <daniel@...earbox.net>

Ok, applied to net-next, thanks to you and Alexei for reviewing.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ