From: Andrew Cooper <andrew.cooper3@citrix.com>
To: Ian Campbell <ian.campbell@citrix.com>, stefano.stabellini@eu.citrix.com
Cc: ian.jackson@eu.citrix.com, wei.liu2@citrix.com,
qemu-devel@nongnu.org, xen-devel@lists.xen.org
Subject: Re: [Qemu-devel] [Xen-devel] [PATCH QEMU-XEN v6 4/8] xen: Switch uses of xc_map_foreign_range into xc_map_foreign_pages
Date: Wed, 9 Dec 2015 13:56:44 +0000 [thread overview]
Message-ID: <5668331C.3040200@citrix.com> (raw)
In-Reply-To: <1449668506.16124.239.camel@citrix.com>
On 09/12/15 13:41, Ian Campbell wrote:
> On Thu, 2015-12-03 at 11:23 +0000, Ian Campbell wrote:
>> diff --git a/hw/display/xenfb.c b/hw/display/xenfb.c
>> index 5e324ef..c96d974 100644
>> --- a/hw/display/xenfb.c
>> +++ b/hw/display/xenfb.c
>> @@ -104,9 +104,8 @@ static int common_bind(struct common *c)
>> if (xenstore_read_fe_int(&c->xendev, "event-channel", &c->xendev.remote_port) == -1)
>> return -1;
>>
>> - c->page = xc_map_foreign_range(xen_xc, c->xendev.dom,
>> - XC_PAGE_SIZE,
>> - PROT_READ | PROT_WRITE, mfn);
>> + c->page = xc_map_foreign_pages(xen_xc, c->xendev.dom,
>> + PROT_READ | PROT_WRITE, &mfn, 1);
> This doesn't build for i386 userspace, since mfn is a uint64_t but
> xc_map_foreign_pages() wants a xen_pfn_t * (where xen_pfn_t == unsigned
> long on x86).
>
> Until now that was just a truncation which was already checked for with:
>
> uint64_t mfn;
>
> if (xenstore_read_fe_uint64(&c->xendev, "page-ref", &mfn) == -1)
> return -1;
> assert(mfn == (xen_pfn_t)mfn);
>
> I think in principal passing "(xen_pfn_t *)&mfn" would ok (since it is a
> singleton array in this case), but I was thinking of going a bit further
> and:
It is never ok to convert a pointer like this. In 32bit (little endian)
userspace, it will leave the upper half of mfn uninitialised on the stack.
~Andrew
next prev parent reply other threads:[~2015-12-09 13:56 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-03 11:21 [Qemu-devel] [Minios-devel] [PATCH v6 0/<VARIOUS>] Begin to disentangle libxenctrl and provide some stable libraries Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 0/8] " Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 1/8] xen_console: correctly cleanup primary console on teardown Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 2/8] xen: Switch to libxenevtchn interface for compat shims Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 3/8] xen: Switch to libxengnttab " Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 4/8] xen: Switch uses of xc_map_foreign_range into xc_map_foreign_pages Ian Campbell
2015-12-04 15:26 ` Stefano Stabellini
2015-12-09 13:41 ` Ian Campbell
2015-12-09 13:56 ` Andrew Cooper [this message]
2015-12-09 14:05 ` [Qemu-devel] [Xen-devel] " Ian Campbell
2015-12-11 14:26 ` [Qemu-devel] " Stefano Stabellini
2015-12-11 15:23 ` Ian Campbell
2015-12-11 16:42 ` Stefano Stabellini
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 5/8] xen: Switch uses of xc_map_foreign_{pages, bulk} to use libxenforeignmemory API Ian Campbell
2015-12-04 15:26 ` Stefano Stabellini
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 6/8] xen: Use stable library interfaces when they are available Ian Campbell
2015-12-04 15:31 ` Stefano Stabellini
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 7/8] xen: domainbuild: reopen libxenctrl interface after forking for domain watcher Ian Campbell
2015-12-03 11:23 ` [Qemu-devel] [PATCH QEMU-XEN v6 8/8] xen: make it possible to build without the Xen PV domain builder Ian Campbell
2015-12-09 12:37 ` [Qemu-devel] [Minios-devel] [PATCH v6 0/<VARIOUS>] Begin to disentangle libxenctrl and provide some stable libraries Ian Campbell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5668331C.3040200@citrix.com \
--to=andrew.cooper3@citrix.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=qemu-devel@nongnu.org \
--cc=stefano.stabellini@eu.citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xen.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).