That's a very good point.

I almost wonder if we shouldn't drop the stack down 512GB and use the top
512GB of user VA for "no access under any circumstancs"

ron

On Wed, Jun 1, 2016 at 3:20 PM barret rhoden <[email protected]> wrote:

> On 2016-06-01 at 13:22 Gan Shun wrote:
> > diff --git a/tests/vmm/vmrunkernel.c b/tests/vmm/vmrunkernel.c
> > index 6a86284..a08eaa4 100644
> > --- a/tests/vmm/vmrunkernel.c
> > +++ b/tests/vmm/vmrunkernel.c
> > @@ -582,6 +571,46 @@ int main(int argc, char **argv)
> >       bp->e820_map[e820i].size = 0x10000000;
> >       bp->e820_map[e820i++].type = E820_RESERVED;
> >
> > +     /* The MMIO address of the console device is really the address of
> an
> > +      * unbacked EPT page: accesses to this page will cause a page
> fault that
> > +      * traps to the host, which will examine the fault, see it was for
> the
> > +      * known MMIO address, and fulfill the MMIO read or write on the
> guest's
> > +      * behalf accordingly. We place the virtio space at 512 GB higher
> than the
> > +      * guest physical memory to avoid a full page table walk. */
> > +     uint64_t virtio_mmio_base_addr = ROUNDUP((bp->e820_map[e820i -
> 1].addr +
> > +                                               bp->e820_map[e820i -
> 1].size),
> > +                                              512 * GiB);
>
> This should be okay for now.
>
> One issue we'll need to address is that there is nothing preventing
> someone accidentally mapping something at that address.  You'd find
> out when the guest suddenly stops talking over virtio and your memory
> is silently corrupted.
>
> You could try to prevent it with an anonymous, fixed mmap with
> PROT_NONE.  That shouldn't populate the intermediate page tables, and
> it would prevent any un-fixed mmaps from finding that spot.  However, a
> MAP_FIXED mmap (i.e. what sbrk() does) would unmap it.  And that
> wouldn't help in this case, where I think that mmio_base is below
> BRK_END.  That region is specifically mmaped with MAP_FIXED for sbrk.
>
> Barret
>
>
> Merged to master at f083c63e874c..840012689b63 (from, to]
>
> You can see the entire diff with 'git diff' or at
> https://github.com/brho/akaros/compare/f083c63e874c...840012689b63
>
> --
> You received this message because you are subscribed to the Google Groups
> "Akaros" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to