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: <8A7F0E86-9A11-4ED9-AE8A-881A5A260DB7@fb.com>
Date:   Thu, 29 Oct 2020 22:57:42 +0000
From:   Song Liu <songliubraving@...com>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>
CC:     Ian Rogers <irogers@...gle.com>,
        Alexei Starovoitov <ast@...nel.org>,
        Daniel Borkmann <daniel@...earbox.net>,
        Martin Lau <kafai@...com>, "Yonghong Song" <yhs@...com>,
        Andrii Nakryiko <andriin@...com>,
        John Fastabend <john.fastabend@...il.com>,
        KP Singh <kpsingh@...omium.org>,
        Networking <netdev@...r.kernel.org>, bpf <bpf@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH v2] libbpf hashmap: Fix undefined behavior in hash_bits



> On Oct 29, 2020, at 3:38 PM, Andrii Nakryiko <andrii.nakryiko@...il.com> wrote:
> 
> On Thu, Oct 29, 2020 at 3:38 PM Ian Rogers <irogers@...gle.com> wrote:
>> 
>> If bits is 0, the case when the map is empty, then the >> is the size of
>> the register which is undefined behavior - on x86 it is the same as a
>> shift by 0. Fix by handling the 0 case explicitly and guarding calls to
>> hash_bits for empty maps in hashmap__for_each_key_entry and
>> hashmap__for_each_entry_safe.
>> 
>> Suggested-by: Andrii Nakryiko <andriin@...com>,
>> Signed-off-by: Ian Rogers <irogers@...gle.com>
>> ---
> 
> Looks good. Thanks and sorry for unnecessary iterations.
> 
> Acked-by: Andrii Nakryiko <andrii@...nel.org>

Acked-by: Song Liu <songliubraving@...com>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ