Skip to contentSkip to conversation

libxc/restore: Fix data auditing in handle_x86_pv_vcpu_blob()

PATCH New Andrew Cooper 2 participants 2 messages Dec 19, 2019 – Dec 20, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 libxc/restore: Fix data auditing in handle_x86_pv_vcpu_blob()

The current logic only works by chance, in that XSAVE records also tend to be a multiple of 128. Implement the missing logic for XSAVE.

---
CC: Ian Jackson <[email protected]>
CC: Wei Liu <[email protected]>

---
 tools/libxc/xc_sr_restore_x86_pv.c | 9 +++++++++
 1 file changed, 9 insertions(+)
tools/libxc/xc_sr_restore_x86_pv.c +9 -0
index 1a26f2205f..116a004726 100644
@@ -825,6 +825,15 @@ static int handle_x86_pv_vcpu_blob(struct xc_sr_context *ctx,
         break;
 
     case REC_TYPE_X86_PV_VCPU_XSAVE:
+        if ( blobsz < 128 )
+        {
+            ERROR("%s record too short: min %zu, got %u",
+                  rec_name, sizeof(*vhdr) + 128, rec->length);
+            goto out;
+        }
+        break;
+
+    case REC_TYPE_X86_PV_VCPU_MSRS:
         if ( blobsz % sizeof(xen_domctl_vcpu_msr_t) != 0 )
         {
             ERROR("%s record payload size %zu expected to be a multiple of %zu",
Signature · 7 lines
2.11.0


_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
#1 lore raw

PATCH 1/1 libxc/restore: Fix data auditing in handle_x86_pv_vcpu_blob()

Andrew Cooper writes ("[PATCH] libxc/restore: Fix data auditing in handle_x86_pv_vcpu_blob()"):

Quoted 2 lines

The current logic only works by chance, in that XSAVE records also tend to be a multiple of 128. Implement the missing logic for XSAVE.

_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel