From: "Jan Beulich" <JBeulich@suse.com>
To: Andrew Cooper <andrew.cooper3@citrix.com>
Cc: xen-devel <xen-devel@lists.xenproject.org>,
Wei Liu <wei.liu2@citrix.com>
Subject: Re: [PATCH 2/3] x86/HVM: limit writes to outgoing TSS during task switch
Date: Wed, 23 Nov 2016 01:30:19 -0700 [thread overview]
Message-ID: <583561AB020000780012125C@prv-mh.provo.novell.com> (raw)
In-Reply-To: <c580a9a2-4dec-a650-3e5f-d19dfdf88b6f@citrix.com>
>>> On 22.11.16 at 17:46, <andrew.cooper3@citrix.com> wrote:
> On 22/11/16 13:55, Jan Beulich wrote:
>> The only fields modified are EIP, EFLAGS, GPRs, and segment selectors.
>> CR3 in particular is not supposed to be updated.
>>
>> Signed-off-by: Jan Beulich <jbeulich@suse.com>
>>
>> --- a/xen/arch/x86/hvm/hvm.c
>> +++ b/xen/arch/x86/hvm/hvm.c
>> @@ -2952,7 +2952,6 @@ void hvm_task_switch(
>> if ( taskswitch_reason == TSW_iret )
>> eflags &= ~X86_EFLAGS_NT;
>>
>> - tss.cr3 = v->arch.hvm_vcpu.guest_cr[3];
>> tss.eip = regs->eip;
>> tss.eflags = eflags;
>> tss.eax = regs->eax;
>> @@ -2979,8 +2978,10 @@ void hvm_task_switch(
>> hvm_get_segment_register(v, x86_seg_ldtr, &segr);
>> tss.ldt = segr.sel;
>>
>> - rc = hvm_copy_to_guest_virt(
>> - prev_tr.base, &tss, sizeof(tss), PFEC_page_present);
>> + rc = hvm_copy_to_guest_virt(prev_tr.base + offsetof(typeof(tss), eip),
>> + &tss.eip,
>> + (void *)&tss.trace - (void *)&tss.eip,
>
> How about offsetof(typeof(tss), trace) - offsetof(typeof(tss), eip)?
>
> It avoids some casts and void pointer arithmetic.
Oh, yes, that's better.
> Either way, Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Thanks, Jan
_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel
next prev parent reply other threads:[~2016-11-23 8:30 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-22 13:51 [PATCH 0/3] x86/HVM: XSA-192 follow-ups Jan Beulich
2016-11-22 13:55 ` [PATCH 1/3] x86/HVM: limit writes to incoming TSS during task switch Jan Beulich
2016-11-22 16:32 ` Andrew Cooper
2016-11-23 8:27 ` Jan Beulich
2016-11-23 10:59 ` Andrew Cooper
2016-11-22 13:55 ` [PATCH 2/3] x86/HVM: limit writes to outgoing " Jan Beulich
2016-11-22 16:46 ` Andrew Cooper
2016-11-23 8:30 ` Jan Beulich [this message]
2016-11-22 13:56 ` [PATCH 3/3] x86/HVM: correct error code writing " Jan Beulich
2016-11-22 16:58 ` Andrew Cooper
2016-11-23 8:33 ` Jan Beulich
2016-11-23 14:14 ` [PATCH 0/3] x86/HVM: XSA-192 follow-ups Wei Liu
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=583561AB020000780012125C@prv-mh.provo.novell.com \
--to=jbeulich@suse.com \
--cc=andrew.cooper3@citrix.com \
--cc=wei.liu2@citrix.com \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.