mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
x86/hvm: always do SMAP check when updating secondary system time for guest
In this patch, we always do the SMAP check when updating secondary system time for the guest when SMAP is enabled by it. Signed-off-by: Feng Wu <feng.wu@intel.com> Reviewed-by: Jan Beulich <jbeulich@suse.com>
This commit is contained in:
1 parent
31ae587e6f
commit
340f8cb830
2 files changed
+10
-2
No files matched your search
+9
-1
@@ -859,17 +859,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);
|
||||
@@ -878,6 +884,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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 *);
|
||||
|
||||