summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient/nfs_krpc.c
diff options
context:
space:
mode:
authorneel <neel@FreeBSD.org>2011-05-20 03:23:09 +0000
committerneel <neel@FreeBSD.org>2011-05-20 03:23:09 +0000
commit3930d0afcfdc805e3c97fcc29a2c1ffbd8b31c7c (patch)
tree773425d0412679af964bac480ea9592e3a78da5f /sys/nfsclient/nfs_krpc.c
parente24f5ed9f2b1a7f169a57fcc109ed55bd5ef8954 (diff)
downloadFreeBSD-src-3930d0afcfdc805e3c97fcc29a2c1ffbd8b31c7c.zip
FreeBSD-src-3930d0afcfdc805e3c97fcc29a2c1ffbd8b31c7c.tar.gz
Fix a long standing bug in VMXCTX_GUEST_RESTORE().
There was an assumption by the "callers" of this macro that on "return" the %rsp will be pointing to the 'vmxctx'. The macro was not doing this and thus when trying to restore host state on an error from "vmlaunch" or "vmresume" we were treating the memory locations on the host stack as 'struct vmxctx'. This led to all sorts of weird bugs like double faults or invalid instruction faults. This bug is exposed by the -O2 option used to compile the kernel module. With the -O2 flag the compiler will optimize the following piece of code: int loopstart = 1; ... if (loopstart) { loopstart = 0; vmx_launch(); } else vmx_resume(); into this: vmx_launch(); Since vmx_launch() and vmx_resume() are declared to be __dead2 functions the compiler is free to do this. The compiler has no way to know that the functions return indirectly through vmx_setjmp(). This optimization in turn leads us to trigger the bug in VMXCTX_GUEST_RESTORE(). With this change we can boot a 8.1 guest on a 9.0 host. Reported by: jhb@
Diffstat (limited to 'sys/nfsclient/nfs_krpc.c')
0 files changed, 0 insertions, 0 deletions
OpenPOWER on IntegriCloud