Re: VMA merging updateds?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu Sep 26, 2024 at 3:38 AM EEST, Kai Huang wrote:
>
>
> On 26/09/2024 12:33 pm, Jarkko Sakkinen wrote:
> > On Thu Sep 26, 2024 at 3:07 AM EEST, Kai Huang wrote:
> >>
> >>
> >> On 23/09/2024 7:48 pm, Jarkko Sakkinen wrote:
> >>> On Sun Sep 22, 2024 at 7:57 PM EEST, Jarkko Sakkinen wrote:
> >>>>> On Sun Sep 22, 2024 at 7:27 PM EEST, Jarkko Sakkinen wrote:
> >>>>>> Hi
> >>>>>>
> >>>>>> I started to look into this old issue with mm subsystem and SGX, i.e.
> >>>>>> can we make SGX VMA's to merge together?
> >>>>>>
> >>>>>> This demonstrates the problem pretty well:
> >>>>>>
> >>>>>> https://lore.kernel.org/linux-sgx/884c7ea454cf2eb0ba2e95f7c25bd42018824f97.camel@xxxxxxxxxx/
> >>>>>>
> >>>>>> It was result of brk() syscall being applied a few times.
> >>>>
> >>>> Briging some context here. This can be fixed in the run-time by book
> >>>> keeping the ranges and doing unmapping/mapping. I guess this goes
> >>>> beyond what mm should support?
> >>>>
> >>>> I thought to plain check this as it has been two years since my last
> >>>> query on topic (if we could improve either the driver or mm somehow).
> >>>
> >>> In the past I've substituted kernel's mm merge code with user space
> >>> replacement:
> >>>
> >>> https://github.com/enarx/mmledger/blob/main/src/lib.rs
> >>>
> >>> It's essentially a reimplementation of al stuff that goes into
> >>> mm/mmap.c's vma_merge(). I cannot recall anymore whether merges
> >>> which map over existing ranges were working correctly, i.e. was
> >>> the issue only concerning adjacent VMA's.
> >>>
> >>> What I'm looking here is that can we make some cosntraints that
> >>> if satisfied by the pfnmap code, it could leverage the code from
> >>> vma_merge(). Perhaps by making explicit call to vma_merge()?
> >>> I get that implicit use moves too much responsibility to the mm
> >>> subsystem.
> >>>
> >>
> >> Hi Jarkko,
> >>
> >> Just want to understand more on the background:
> >>
> >> Are you seeing any real problem due to needing a lot of mmap()s to the
> >> same enclave, or it is just a problem that doesn't look nice and you
> >> want to resolve?
> >>
> >> I mean, this problem doesn't seem to be SGX-specific but a common one
> >> for VMAs with VM_PFNMAP (any bit in VM_SPECIAL), e.g., from random
> >> device drivers with mmap() support.  We will need a good justification
> >> if we want to make any core-mm change, if any, for this.
> > 
> > It requires essentially replicating core mm in user space.
> > 
>
> Is there any real problem if we don't do this at all (neither in core mm 
> nor in userspace)?

7f8f00000000-7f8f00009000 r--s 00000000 00:05 84                         /dev/sgx_enclave
7f8f00009000-7f8f00034000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f00034000-7f8f000ff000 r-xs 00000000 00:05 84                         /dev/sgx_enclave
7f8f000ff000-7f8f00201000 ---p 00000000 00:00 0
7f8f00201000-7f8f003fc000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f003fc000-7f8f003fd000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f003fd000-7f8f00400000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f00400000-7f8f00643000 r--s 00000000 00:05 84                         /dev/sgx_enclave
7f8f00643000-7f8f0197b000 r-xs 00000000 00:05 84                         /dev/sgx_enclave
7f8f0197b000-7f8f01bab000 r--s 00000000 00:05 84                         /dev/sgx_enclave
7f8f01bab000-7f8f01fa7000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f01fa7000-7f8f08000000 ---p 00000000 00:00 0
7f8f08000000-7f8f08001000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08001000-7f8f08003000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08003000-7f8f08006000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08006000-7f8f0800b000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0800b000-7f8f08014000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08014000-7f8f08025000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08025000-7f8f08046000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08046000-7f8f0804a000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0804a000-7f8f0804b000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0804b000-7f8f0804c000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0804c000-7f8f0804d000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0804d000-7f8f0804e000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0804e000-7f8f0804f000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0804f000-7f8f08050000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08050000-7f8f08051000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08051000-7f8f08052000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08052000-7f8f08053000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08053000-7f8f08054000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08054000-7f8f08055000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08055000-7f8f08056000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08056000-7f8f08057000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08057000-7f8f08058000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08058000-7f8f08059000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08059000-7f8f0805a000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0805a000-7f8f0805b000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0805b000-7f8f0805c000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0805c000-7f8f0805d000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0805d000-7f8f0805e000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0805e000-7f8f0805f000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0805f000-7f8f08060000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08060000-7f8f08062000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08062000-7f8f08063000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08063000-7f8f08064000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08064000-7f8f08065000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08065000-7f8f08066000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08066000-7f8f08067000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08067000-7f8f08068000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08068000-7f8f08069000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08069000-7f8f0806a000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0806a000-7f8f0806b000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0806b000-7f8f0806c000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0806c000-7f8f0806d000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0806d000-7f8f0806e000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0806e000-7f8f0806f000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0806f000-7f8f08070000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08070000-7f8f08071000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08071000-7f8f08072000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08072000-7f8f08081000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08081000-7f8f08082000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08082000-7f8f08083000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08083000-7f8f08084000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08084000-7f8f08085000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08085000-7f8f08086000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08086000-7f8f08087000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08087000-7f8f08088000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08088000-7f8f08089000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08089000-7f8f0808a000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0808a000-7f8f0808b000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0808b000-7f8f0809a000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0809a000-7f8f0809c000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0809c000-7f8f0809d000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0809d000-7f8f0809e000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0809e000-7f8f080a0000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080a0000-7f8f080a3000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080a3000-7f8f080a9000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080a9000-7f8f080b5000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080b5000-7f8f080c0000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080c0000-7f8f080c6000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080c6000-7f8f080d1000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080d1000-7f8f080dd000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080dd000-7f8f080f4000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f080f4000-7f8f08121000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08121000-7f8f0814a000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f0814a000-7f8f08162000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08162000-7f8f08177000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08177000-7f8f081a0000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f081a0000-7f8f081c1000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f081c1000-7f8f081d6000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f081d6000-7f8f081ff000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f081ff000-7f8f08228000 rw-s 00000000 00:05 84                         /dev/sgx_enclave
7f8f08228000-7f8ffffff000 ---p 00000000 00:00 0
7f8ffffff000-7f9000000000 rw-s 00000000 00:05 84                         /dev/sgx_enclave

BR, Jarkko





[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux