]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commit
hypercall: Work around Clang code generation bug
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 6 Nov 2020 18:53:39 +0000 (18:53 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 6 Nov 2020 19:23:17 +0000 (19:23 +0000)
commit848c3f2dd42711c4d9fc01839d6630c115daa22f
tree0a0a67e715e03918d29b8d92dab20480b6715b40
parentf11bbff0c02e3a0b0ca01f0f3458678b7ad5173f
hypercall: Work around Clang code generation bug

_hypercall64_4() is mis-compiled by some versions of Clang (5 is ok, 9 and
later not), in a way which breaks the XSA-286 PoC.

Clang loses the association between argument 4 being in %r10 between the input
"a" (_a4) and the output "=&r" (__ign4), so while the input is handled
correctly, the clobber on the output is missed.

In the XSA-286, PoC, this causes clang to hoist the setting of DOMID_SELF out
of the loop, and the test subsequently to malfunction on debug versions of Xen
which intentionally clobber the hypercall parameters.

Rewrite the hypercall macros to a single "+r" parameter form, rather than dual
input/output form, which causes all tested versions of Clang to set up %r10 on
each loop iteration.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/include/arch/hypercall-x86_32.h
arch/x86/include/arch/hypercall-x86_64.h