]> xenbits.xensource.com Git - xen.git/commit
libxc/restore: Fix data auditing in handle_x86_pv_info()
authorAndrew Cooper <andrew.cooper3@citrix.com>
Wed, 18 Dec 2019 20:17:42 +0000 (20:17 +0000)
committerIan Jackson <ian.jackson@eu.citrix.com>
Tue, 5 May 2020 14:46:46 +0000 (15:46 +0100)
commit7d8fa6a902eccf06e31aa2433b5466a85afefe73
treedc681edd88b1fb21f8c402b799fd47d2e81dba4d
parent47772087eb799c3ffb3544c0030a6815fd15336e
libxc/restore: Fix data auditing in handle_x86_pv_info()

handle_x86_pv_info() has a subtle bug.  It uses an 'else if' chain with a
clause in the middle which doesn't exit unconditionally.  In practice, this
means that when restoring a 32bit PV guest, later sanity checks are skipped.

Rework the logic a little to be simpler.  There are exactly two valid
combinations of fields in X86_PV_INFO, so factor this out and check them all
in one go, before making adjustments to the current domain.

Once adjustments have been completed successfully, sanity check the result
against the X86_PV_INFO settings in one go, rather than piece-wise.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Ian Jackson <ian.jackson@eu.citrix.com>
(cherry picked from commit aafae0e800e9936b9eb6566e5fcdbe823625a7d1)
(cherry picked from commit 5932ee1e06047d71bcf6975e1a631e31afaf5fe2)
(cherry picked from commit 275475f1e8a772fee5b088eec1cad18fddce4a8f)
tools/libxc/xc_sr_restore_x86_pv.c