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: <3cdccacab6244dd3ac9d491ac7233b43@huawei.com>
Date:   Tue, 17 Aug 2021 00:47:19 +0000
From:   "Longpeng (Mike, Cloud Infrastructure Service Product Dept.)" 
        <longpeng2@...wei.com>
To:     Matthew Wilcox <willy@...radead.org>,
        David Hildenbrand <david@...hat.com>
CC:     Khalid Aziz <khalid.aziz@...cle.com>,
        Steven Sistare <steven.sistare@...cle.com>,
        Anthony Yznaga <anthony.yznaga@...cle.com>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-mm@...ck.org" <linux-mm@...ck.org>,
        "Gonglei (Arei)" <arei.gonglei@...wei.com>
Subject: RE: [RFC PATCH 0/5] madvise MADV_DOEXEC



> -----Original Message-----
> From: Matthew Wilcox [mailto:willy@...radead.org]
> Sent: Monday, August 16, 2021 8:08 PM
> To: David Hildenbrand <david@...hat.com>
> Cc: Khalid Aziz <khalid.aziz@...cle.com>; Longpeng (Mike, Cloud Infrastructure
> Service Product Dept.) <longpeng2@...wei.com>; Steven Sistare
> <steven.sistare@...cle.com>; Anthony Yznaga <anthony.yznaga@...cle.com>;
> linux-kernel@...r.kernel.org; linux-mm@...ck.org; Gonglei (Arei)
> <arei.gonglei@...wei.com>
> Subject: Re: [RFC PATCH 0/5] madvise MADV_DOEXEC
> 
> On Mon, Aug 16, 2021 at 10:02:22AM +0200, David Hildenbrand wrote:
> > > Mappings within this address range behave as if they were shared
> > > between threads, so a write to a MAP_PRIVATE mapping will create a
> > > page which is shared between all the sharers. The first process that
> > > declares an address range mshare'd can continue to map objects in
> > > the shared area. All other processes that want mshare'd access to
> > > this memory area can do so by calling mshare(). After this call, the
> > > address range given by mshare becomes a shared range in its address
> > > space. Anonymous mappings will be shared and not COWed.
> >
> > Did I understand correctly that you want to share actual page tables
> > between processes and consequently different MMs? That sounds like a very bad
> idea.
> 
> That is the entire point.  Consider a machine with 10,000 instances of an
> application running (process model, not thread model).  If each application wants
> to map 1TB of RAM using 2MB pages, that's 4MB of page tables per process or
> 40GB of RAM for the whole machine.
> 
> There's a reason hugetlbfs was enhanced to allow this page table sharing.
> I'm not a fan of the implementation as it gets some locks upside down, so this is an
> attempt to generalise the concept beyond hugetlbfs.
> 
> Think of it like partial threading.  You get to share some parts, but not all, of your
> address space with your fellow processes.  Obviously you don't want to expose
> this to random other processes, only to other instances of yourself being run as the
> same user.

I understand your intent now, you want to share memory ranges by sharing the relevant
pgtable pages. 

I had implemented a similar idea to support QEMU live upgrade about four years ago
( in late 2017),

https://patents.google.com/patent/US20210089345A1

"""
[0131]
In a first possible implementation, the generation unit includes a copying subunit configured
to copy an entry corresponding to the virtual memory area in a PGD page table of the first
virtual machine to an entry corresponding to the virtual memory area in a PGD page table of
the second virtual machine.
"""

We want to share the anonymous memory between old QEMU process and the new one, 
so we limit the QEMU to mmap the VM's memory address in 4T-8T and then share the 
memory by direct copy the PGD entries ( implementation is much more complicated than I 
say ).

Besides to save memory, large memory range can be shared fast in this way.

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ