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]
Date:   Tue, 14 Apr 2020 21:44:00 +0200
From:   Daniel Borkmann <daniel@...earbox.net>
To:     Andrii Nakryiko <andrii.nakryiko@...il.com>,
        Jann Horn <jannh@...gle.com>
Cc:     Andrii Nakryiko <andriin@...com>, bpf <bpf@...r.kernel.org>,
        Network Development <netdev@...r.kernel.org>,
        Alexei Starovoitov <ast@...com>,
        Kernel Team <kernel-team@...com>
Subject: Re: [PATCH v2 bpf 1/2] bpf: prevent re-mmap()'ing BPF map as writable
 for initially r/o mapping

On 4/14/20 8:28 PM, Andrii Nakryiko wrote:
> On Tue, Apr 14, 2020 at 9:58 AM Jann Horn <jannh@...gle.com> wrote:
>> On Fri, Apr 10, 2020 at 10:26 PM Andrii Nakryiko <andriin@...com> wrote:
>>> VM_MAYWRITE flag during initial memory mapping determines if already mmap()'ed
>>> pages can be later remapped as writable ones through mprotect() call. To
>>> prevent user application to rewrite contents of memory-mapped as read-only and
>>> subsequently frozen BPF map, remove VM_MAYWRITE flag completely on initially
>>> read-only mapping.
>>>
>>> Alternatively, we could treat any memory-mapping on unfrozen map as writable
>>> and bump writecnt instead. But there is little legitimate reason to map
>>> BPF map as read-only and then re-mmap() it as writable through mprotect(),
>>> instead of just mmap()'ing it as read/write from the very beginning.
>>>
>>> Also, at the suggestion of Jann Horn, drop unnecessary refcounting in mmap
>>> operations. We can just rely on VMA holding reference to BPF map's file
>>> properly.
>>>
>>> Fixes: fc9702273e2e ("bpf: Add mmap() support for BPF_MAP_TYPE_ARRAY")
>>> Reported-by: Jann Horn <jannh@...gle.com>
>>> Signed-off-by: Andrii Nakryiko <andriin@...com>
>>
>> Reviewed-by: Jann Horn <jannh@...gle.com>
>>
>> (in the sense that I think this patch is good and correct, but does
>> not fix the entire problem in the bigger picture)
> 
> I agree, we'll continue discussion on the other thread, but this
> should be applied as a bug fix anyways.

Applied, thanks!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ