xen: x86: copy back tsc info, not pointer to tsc info in domctl
authorIan Campbell <ian.campbell@citrix.com>
Tue, 26 May 2015 11:14:47 +0000 (12:14 +0100)
committerIan Campbell <ian.campbell@citrix.com>
Tue, 26 May 2015 13:21:04 +0000 (14:21 +0100)
In 38b37ed82705 "x86/domctl: cleanup", XEN_DOMCTL_gettscinfo was
changed to use the standard copyback mechanism.

However the output TSC Info is a guerst handle, i.e. a pointer to the
location for the information, copyback just copies the unchanged
pointer back.

Switch back to fetching the details into a local struct and explicitly
copying it back.

This caused test failures in the Cambridge instance of osstest, but
not for some reason in the production instance.

Signed-off-by: Ian Campbell <ian.campbell@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/domctl.c

index 684259bff7a6fe0f8b4141a1f558e823e109e81b..a9ccf580dc8b3ff74c9e3a3bd1f99ea020de3157 100644 (file)
@@ -703,13 +703,16 @@ long arch_do_domctl(
             ret = -EINVAL;
         else
         {
+            xen_guest_tsc_info_t info = { 0 };
+
             domain_pause(d);
-            tsc_get_info(d, &domctl->u.tsc_info.info.tsc_mode,
-                         &domctl->u.tsc_info.info.elapsed_nsec,
-                         &domctl->u.tsc_info.info.gtsc_khz,
-                         &domctl->u.tsc_info.info.incarnation);
+            tsc_get_info(d, &info.tsc_mode,
+                            &info.elapsed_nsec,
+                            &info.gtsc_khz,
+                            &info.incarnation);
             domain_unpause(d);
-            copyback = 1;
+            if ( copy_to_guest(domctl->u.tsc_info.out_info, &info, 1) )
+                ret = -EFAULT;
         }
         break;