Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 18 Apr 2017 12:41:09 +0000
From:      Dexuan Cui <decui@microsoft.com>
To:        Konstantin Belousov <kib@FreeBSD.org>, "src-committers@freebsd.org" <src-committers@freebsd.org>, "svn-src-all@freebsd.org" <svn-src-all@freebsd.org>, "svn-src-head@freebsd.org" <svn-src-head@freebsd.org>
Cc:        Sepherosa Ziehau <sephe@freebsd.org>, Hongjiang Zhang <honzhan@microsoft.com>
Subject:   RE: svn commit: r316767 - head/sys/amd64/amd64
Message-ID:  <HK2P15301MB00033BEA7B656EBCD3BDFC5CBF190@HK2P15301MB0003.APCP153.PROD.OUTLOOK.COM>
In-Reply-To: <201704131549.v3DFnt9I004050@repo.freebsd.org>
References:  <201704131549.v3DFnt9I004050@repo.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
> From: owner-svn-src-head@freebsd.org [mailto:owner-svn-src-
> head@freebsd.org] On Behalf Of Konstantin Belousov
> Sent: Thursday, April 13, 2017 23:50
>=20
> Author: kib
> Date: Thu Apr 13 15:49:55 2017
> New Revision: 316767
> URL:
>=20
> Log:
>   Map DMAP as nx.
>=20
>   Demotions preserve PG_NX, so it is enough to set nx bit for initial
>   lowest-level paging entries.
>=20
> Modified:
>   head/sys/amd64/amd64/pmap.c
=20
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?HK2P15301MB00033BEA7B656EBCD3BDFC5CBF190>