[PATCH v3] arch_prctl,x86 Add ARCH_[GET|SET]_CPUID for controlling the CPUID instruction
From: Kyle Huey
Date: Thu Sep 15 2016 - 19:33:59 EST
rr (http://rr-project.org/), a userspace record-and-replay reverse-
execution debugger, would like to trap and emulate the CPUID instruction.
This would allow us to a) mask away certain hardware features that rr does
not support (e.g. RDRAND) and b) enable trace portability across machines
by providing constant results.
The following changes have been made since v2.
Patch 1:
- Use of compat_sys_arch_prctl and separate do_arch_prctl_[common|64]
functions to separate generic and 64-bit only arch_prctls.
Patch 2:
- The hack to suppress the mistakenly advertised CPUID faulting support in
Xen guests is removed. Doing this for both PV and HVM guests is quite
tricky, and likely more trouble than it's worth. Instead I'll submit a
patch to Xen.
Patch 3:
- TIF_NOCPUID is now droppped on exec. I added the arch_post_exec hook
as I didn't see any existing place to run arch-specific code during
exec. The test is updated for the new exec behavior.