From: Marcus Granado <marcus.granado@citrix.com>
To: Jan Beulich <JBeulich@suse.com>
Cc: George Dunlap <George.Dunlap@eu.citrix.com>,
xen-devel <xen-devel@lists.xensource.com>
Subject: Re: [PATCH 2/3] xenoprof: Handle 32-bit guest stacks properly in a 64-bit hypervisor
Date: Tue, 24 Jan 2012 19:27:38 +0000 [thread overview]
Message-ID: <4F1F062A.4080306@citrix.com> (raw)
In-Reply-To: <4F1D3B79020000780006E509@nat28.tlf.novell.com>
On 23/01/12 09:50, Jan Beulich wrote:
> If you're adding a compat mode guest case here, then you should
> also use compat mode accessors (compat_handle_okay(),
> __copy_from_compat_offset()), implying that you also have a local
> handle variable of the appropriate type (and perhaps moving the
> native one down into the 'else' body).
I'm trying to understand the compat handle. It is not clear to me how to
map one from head (a 64-bit pointer), since COMPAT_HANDLE seems to store
a 32-bit compat_ptr_t value in its structure. Ideally, what I would like
to do is
COMPAT_HANDLE(char) guest_head = map_guest_handle_to_compat_handle
(guest_handle_from_ptr(head, char));
or
COMPAT_HANDLE(char) guest_head = compat_handle_from_ptr(head, char));
but I can't find any equivalent functions in any header.
The following line compiles,
COMPAT_HANDLE(char) guest_head = { (full_ptr_t)head };
but it looks like, in this case, the compat handle structure in compat.h
will truncate the most significant bits from the head pointer, so
compat_handle_okay(guest_head,...) and
__copy_from_compat(...,guest_head,...) below will be using a truncated
pointer:
56 static struct frame_head *
57 dump_guest_backtrace(struct domain *d, struct vcpu *vcpu,
58 struct frame_head * head, int mode)
59 {
60 struct frame_head bufhead[2];
61
62 #ifdef CONFIG_X86_64
63 if ( is_32bit_vcpu(vcpu) )
64 {
65 COMPAT_HANDLE(char) guest_head = { (full_ptr_t)head };
66 struct frame_head_32bit bufhead32[2];
67 /* Also check accessibility of one struct frame_head
beyond */
68 if (!compat_handle_okay(guest_head, sizeof(bufhead32)))
69 return 0;
70 if (__copy_from_compat((char *)bufhead32, guest_head,
71 sizeof(bufhead32)))
72 return 0;
73 bufhead[0].ebp=(struct frame_head
*)(full_ptr_t)bufhead32[0].ebp;
74 bufhead[0].ret=bufhead32[0].ret;
75 }
76 else
77 #endif
Any advice? Maybe the best option in this case is to avoid the compat*
functions and to use the original guest* functions instead.
Thanks,
Marcus
next prev parent reply other threads:[~2012-01-24 19:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-20 18:45 [PATCH 2/3] xenoprof: Handle 32-bit guest stacks properly in a 64-bit hypervisor Marcus Granado
2012-01-23 9:50 ` Jan Beulich
2012-01-24 19:27 ` Marcus Granado [this message]
2012-01-25 7:52 ` Jan Beulich
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=4F1F062A.4080306@citrix.com \
--to=marcus.granado@citrix.com \
--cc=George.Dunlap@eu.citrix.com \
--cc=JBeulich@suse.com \
--cc=xen-devel@lists.xensource.com \
/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).