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: <52a45aa6-1554-4cb8-b8df-da601c4e18ca@redhat.com>
Date: Mon, 20 Jan 2025 08:45:07 +0100
From: David Hildenbrand <david@...hat.com>
To: Lance Yang <ioworker0@...il.com>, akpm@...ux-foundation.org
Cc: 21cnbao@...il.com, ryan.roberts@....com, dev.jain@....com,
 shy828301@...il.com, ziy@...dia.com, libang.li@...group.com,
 baolin.wang@...ux.alibaba.com, linux-kernel@...r.kernel.org,
 linux-mm@...ck.org, Liam.Howlett@...cle.com, lorenzo.stoakes@...cle.com,
 vbabka@...e.cz, jannh@...gle.com, Jason@...c4.com,
 Mingzhe Yang <mingzhe.yang@...com>
Subject: Re: [PATCH 1/1] mm/mmap: allow MAP_DROPPABLE | MAP_PRIVATE in mmap()

On 20.01.25 02:26, Lance Yang wrote:
> Currently, mmap() fails with `-EINVAL` when both MAP_DROPPABLE and
> MAP_PRIVATE are specified. This behavior might be inconsistent, as the
> implementation of MAP_DROPPABLE under the hood already includes the
> semantics of MAP_PRIVATE. So, IMO, whether MAP_PRIVATE is explicitly
> specified or not, it should work as expected.
> 
> For example, when mmap() is called with `MAP_DROPPABLE | MAP_ANONYMOUS`,
> it creates a private anonymous mapping. Users can verify this behavior
> via `/proc/self/smaps`, where the resulting VMA is marked with the `dp`
> (MAP_DROPPABLE) flag, and the `Private_*` fields confirm private memory
> semantics. The output for a 2MiB mapping with these flags might look like:

Note that "Private_" in the stats has *nothing* to do with MAP_PRIVATE.

> 
> ```
> f433ace00000-f433ad000000 rw-p 00000000 00:00 0
> Size:               2048 kB
> KernelPageSize:        4 kB
> MMUPageSize:           4 kB
> Rss:                2048 kB
> Pss:                2048 kB
> Pss_Dirty:          2048 kB
> Shared_Clean:          0 kB
> Shared_Dirty:          0 kB
> Private_Clean:         0 kB
> Private_Dirty:      2048 kB
> Referenced:         2048 kB
> Anonymous:          2048 kB
> ...
> VmFlags: rd wr mr mw me nr wf dd dp
> ```
> 
> This patch changes mmap() to allow the combination of `MAP_DROPPABLE |
> MAP_PRIVATE`. For mmap(), at least one of MAP_PRIVATE or MAP_SHARED could
> be explicitly specified, regardless of the combination with other `MAP_*`
> flags.
> 
> Fixes: 9651fcedf7b9 ("mm: add MAP_DROPPABLE for designating always lazily freeable mappings")

"How about we just say that VM_DROPPABLE really is something separate
from MAP_PRIVATE or MAP_SHARED..

And then we make the rule be that VM_DROPPABLE is never dumped and
always dropped on fork, just to make things simpler." [1]

[1] 
https://lore.kernel.org/linux-mm/CAHk-=wi=XvCZ9r897LjEb4ZarLzLtKN1p+Fyig+F2fmQDF8GSA@mail.gmail.com/

So, nack from my side.

-- 
Cheers,

David / dhildenb


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ