svn commit: r316767 - head/sys/amd64/amd64

Dexuan Cui decui at microsoft.com
Tue Apr 18 12:41:17 UTC 2017


> From: owner-svn-src-head at freebsd.org [mailto:owner-svn-src-
> head at freebsd.org] On Behalf Of Konstantin Belousov
> Sent: Thursday, April 13, 2017 23:50
> 
> Author: kib
> Date: Thu Apr 13 15:49:55 2017
> New Revision: 316767
> URL:
> 
> Log:
>   Map DMAP as nx.
> 
>   Demotions preserve PG_NX, so it is enough to set nx bit for initial
>   lowest-level paging entries.
> 
> Modified:
>   head/sys/amd64/amd64/pmap.c
 
Hi kib,
Unluckily this patch breaks Hyper-V VM:

In dev/hyperv/vmbus/hyperv.c: hypercall_create() we allocate one
page and pass its physical address to the hypervisor, which initializes
the page with executable code.

Later in dev/hyperv/vmbus/hyperv.c: hypercall_post_message(), we
"call" the executable code in the above page.

Now with NX, the "call" gets a fault and as a result FreeBSD VM
can't boot on Hyper-V.

It looks memory allocated by bus_dmamem_alloc() and malloc()
is not executable now.

What else can we use?
I guess we can only use contigmalloc() or kmem_malloc() to
get a page that can be executable and use vtophys() to get its
physical address?

Looking forward to your suggestion!

Thanks!
-- Dexuan



More information about the svn-src-head mailing list