From: Feng Wu <feng.wu@intel.com>
To: xen-devel@lists.xen.org
Cc: tim@xen.org, Feng Wu <feng.wu@intel.com>,
keir@xen.org, jbeulich@suse.com, linux@eikelenboom.it
Subject: [PATCH v4 2/2] x86/hvm: Always do SMAP check when updating secondary system time for guest
Date: Wed, 30 Jul 2014 09:35:52 +0800 [thread overview]
Message-ID: <1406684152-16820-3-git-send-email-feng.wu@intel.com> (raw)
In-Reply-To: <1406684152-16820-1-git-send-email-feng.wu@intel.com>
In this patch, we always do the SMAP check when updating secondary
system time for the guest when SMAP is enabled by it.
Reported-by: Sander Eikelenboom <linux@eikelenboom.it>
Signed-off-by: Feng Wu <feng.wu@intel.com>
---
xen/arch/x86/time.c | 10 +++++++++-
xen/include/asm-x86/domain.h | 2 +-
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/time.c b/xen/arch/x86/time.c
index a4e1656..e4627f3 100644
--- a/xen/arch/x86/time.c
+++ b/xen/arch/x86/time.c
@@ -821,17 +821,23 @@ static void __update_vcpu_system_time(struct vcpu *v, int force)
v->arch.pv_vcpu.pending_system_time = _u;
}
-bool_t update_secondary_system_time(const struct vcpu *v,
+bool_t update_secondary_system_time(struct vcpu *v,
struct vcpu_time_info *u)
{
XEN_GUEST_HANDLE(vcpu_time_info_t) user_u = v->arch.time_info_guest;
+ smap_check_policy_t saved_policy;
if ( guest_handle_is_null(user_u) )
return 1;
+ saved_policy = smap_policy_change(v, SMAP_CHECK_ENABLED);
+
/* 1. Update userspace version. */
if ( __copy_field_to_guest(user_u, u, version) == sizeof(u->version) )
+ {
+ smap_policy_change(v, saved_policy);
return 0;
+ }
wmb();
/* 2. Update all other userspace fields. */
__copy_to_guest(user_u, u, 1);
@@ -840,6 +846,8 @@ bool_t update_secondary_system_time(const struct vcpu *v,
u->version = version_update_end(u->version);
__copy_field_to_guest(user_u, u, version);
+ smap_policy_change(v, saved_policy);
+
return 1;
}
diff --git a/xen/include/asm-x86/domain.h b/xen/include/asm-x86/domain.h
index 112d0b1..83329ed 100644
--- a/xen/include/asm-x86/domain.h
+++ b/xen/include/asm-x86/domain.h
@@ -468,7 +468,7 @@ smap_check_policy_t smap_policy_change(struct vcpu *v,
#define hvm_svm hvm_vcpu.u.svm
bool_t update_runstate_area(struct vcpu *);
-bool_t update_secondary_system_time(const struct vcpu *,
+bool_t update_secondary_system_time(struct vcpu *,
struct vcpu_time_info *);
void vcpu_show_execution_state(struct vcpu *);
--
1.8.3.1
next prev parent reply other threads:[~2014-07-30 1:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-07-30 1:35 [PATCH v4 0/2] x86/HVM: Properly handle SMAP check in certain cases Feng Wu
2014-07-30 1:35 ` [PATCH v4 1/2] x86/hvm: Always do SMAP check when updating runstate_guest(v) Feng Wu
2014-07-30 8:15 ` Jan Beulich
2014-07-30 8:53 ` Wu, Feng
2014-07-30 1:35 ` Feng Wu [this message]
2014-07-30 8:24 ` [PATCH v4 0/2] x86/HVM: Properly handle SMAP check in certain cases Jan Beulich
2014-07-30 13:14 ` Sander Eikelenboom
2014-07-30 13:20 ` Wu, Feng
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=1406684152-16820-3-git-send-email-feng.wu@intel.com \
--to=feng.wu@intel.com \
--cc=jbeulich@suse.com \
--cc=keir@xen.org \
--cc=linux@eikelenboom.it \
--cc=tim@xen.org \
--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).