Port PartitionAlloc to Fuchsia |
||
Issue descriptionPartitionAllocTest.* are currently disabled in base_unittests on Fuchsia, and of course it's also needed for Blink, etc. There's one particular mmap/mprotect/etc. feature that's not implemented on Fuchsia, that mprotect() doesn't support PROT_NONE. Upstream bug for that is MG-546 and MG-426, but there's a (not-unreasonable) disinclination to implementing that as it seems it's not strictly necessary. I suggested perhaps we could just use PROT_READ to Justin on the basis that disallowing writes would be sorta vaguely guard-pagey, but apparently that leaks information about aslr or somethingsomething so it's a no-go. Dart felt it was sufficient for the time being I see: https://chromium.googlesource.com/external/github.com/dart-lang/sdk/+/master/runtime/vm/virtual_memory_fuchsia.cc#251 . There's some docs on Fuchsia's vmem here https://fuchsia.googlesource.com/magenta/+/HEAD/docs/objects/vm_address_region.md. I think the general idea for a Fuchsia implementation would be to make a vmar and a vmo for each partitionalloc allocation of a superpage, explicitly controlling the location of where it lives, and then use vmar_unmap and vmar_map to guard/unguard particular bits of address space. The map would work then because the address is sufficient to recover which vmo/base vmar would be used for that region. I'm still ignorant on how the sub-vmars that would be created to modify the mapped-ness of subparts of those allocations will work (lifetime, overlapping, children, etc.) though. [+too many people may or may not care, feel free to remove yourself if you don't.]
,
Jul 28 2017
I guess my instinct would be to implement PROT_NONE (which I guess Fuchsia would call MX_VM_FLAG_PERM_NONE?). I think guard pages are in large part what it's for. And Partition Alloc might not be the only caller that will want to have guard pages, going forward. But I don't understand everything yet, so maybe I'm wrong.
,
Jul 28 2017
The VMAR/VMO distinction is attempting to separate address space allocation (VMARs) from memory allocation (VMOs). So far, the typical way of implementing guard pages has been to create an over-sized VMAR to reserve address space, and then leave the parts of the VMAR you want to act as guards unmapped. The behavior that we didn't anticipate being desirable was being able to transition regions back-and-forth to being reserved-and-unmapped. I think a PROT_NONE analog is a reasonable way to meet this use case, since it is desirable for us to 1) reduce the amount of error-prone bookkeeping that API consumers need to write, and 2) minimize the memory overhead of bookkeeping in the kernel.
,
Jul 28 2017
MG-426 tracks the PROT_NONE feature on the Magenta side
,
Aug 15 2017
|
||
►
Sign in to add a comment |
||
Comment 1 by scottmg@chromium.org
, Jul 28 2017