x86/pv: Enable pv-l1tf mitigations for dom0 by default
PATCH 1/1 x86/pv: Enable pv-l1tf mitigations for dom0 by default
At the time XSA-273 was published, shadowing dom0 had proved to be unstable, which is why dom0 was unprotected by default. The instability was identified to be problems with shadowing PV superpages, and fixed.
In hindsight, this patch should have been posted at the same time.
There is now no legitimate reason to handle dom0 differently to domu when it comes to pv-l1tf protections.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Juergen Gross <[email protected]>
This wants backporting to whichever trees have the PV superpage shadowing fixes.
--- docs/misc/xen-command-line.pandoc | 2 +- xen/arch/x86/spec_ctrl.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
docs/misc/xen-command-line.pandoc +1 -1
@@ -1616,7 +1616,7 @@ turning it off can reduce the attack surface. > `= List of [ <bool>, dom0=<bool>, domu=<bool> ]` > Default: `false` on believed-unaffected hardware, or in pv-shim mode. -> `domu` on believed-affected hardware. +> `true` on believed-affected hardware. Mitigations for L1TF / XSA-273 / CVE-2018-3620 for PV guests.
xen/arch/x86/spec_ctrl.c +3 -3
@@ -822,14 +822,14 @@ void __init init_speculation_mitigations(void)l1tf_calculations (caps);/* -* By default, enable PV domU L1TF mitigations on all L1TF-vulnerable -* hardware, except when running in shim mode. +* By default, enable PV L1TF mitigations on all L1TF-vulnerable hardware, +* except when running in shim mode. * * In shim mode, SHADOW is expected to be compiled out, and a malicious * guest kernel can only attack the shim Xen, not the host Xen. */ if ( opt_pv_l1tf_hwdom ==-1 ) - opt_pv_l1tf_hwdom =0 ; + opt_pv_l1tf_hwdom = cpu_has_bug_l1tf;if ( opt_pv_l1tf_domu ==-1 ) opt_pv_l1tf_domu = !pv_shim && cpu_has_bug_l1tf;
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 14:59, <[email protected]> wrote:
At the time XSA-273 was published, shadowing dom0 had proved to be unstable, which is why dom0 was unprotected by default. The instability was identified to be problems with shadowing PV superpages, and fixed.
In hindsight, this patch should have been posted at the same time.
There is now no legitimate reason to handle dom0 differently to domu when it comes to pv-l1tf protections.
I'm not entirely convinced by this statement: Crashing Dom0 (and hence the entire host) because of a failure to enable shadow mode on it is not a good thing imo. What's wrong with sticking to the current default, just for reasons other than the original one? Anything malicious running in Dom0 has easier (or at least different) ways of getting at the same information.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 9 lines · Jan Beulich
Quoted 9 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 14:59, <[email protected]> wrote:
At the time XSA-273 was published, shadowing dom0 had proved to be unstable, which is why dom0 was unprotected by default. The instability was identified to be problems with shadowing PV superpages, and fixed.
In hindsight, this patch should have been posted at the same time.
There is now no legitimate reason to handle dom0 differently to domu when it comes to pv-l1tf protections.
Quoted 7 lines
I'm not entirely convinced by this statement: Crashing Dom0 (and hence the entire host) because of a failure to enable shadow mode on it is not a good thing imo. What's wrong with sticking to the current default, just for reasons other than the original one? Anything malicious running in Dom0 has easier (or at least different) ways of getting at the same information.
This statement is only true of the dom0 kernel (and root userspace, given the questionable behaviour of /proc/xen/privcmd).
It does not hold for regular dom0 userspace - in particular, L1TF was discovered because of an accidental mprotect(PROT_NONE), meaning that this is a viable attack vector for a depriv qemu.
As to crashing, that is only if you compile SHADOW out, and I remain to be convinced that compiling shadow out of Xen is a viable option at the moment.
Basically, if you've got an updated dom0 kernel, you'll be fine even with this default flipped. If you've forgotten/missed that, then you're already wide open (in a lack of defence in depth way) and flipping the default here will make things blindly obvious.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 20 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 17:35, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 14:59, <[email protected]> wrote:
At the time XSA-273 was published, shadowing dom0 had proved to be unstable, which is why dom0 was unprotected by default. The instability was
identified
Quoted 6 lines
Quoted 6 lines
to be problems with shadowing PV superpages, and fixed.
In hindsight, this patch should have been posted at the same time.
There is now no legitimate reason to handle dom0 differently to domu when it comes to pv-l1tf protections.
Quoted 7 lines
I'm not entirely convinced by this statement: Crashing Dom0 (and hence the entire host) because of a failure to enable shadow mode on it is not a good thing imo. What's wrong with sticking to the current default, just for reasons other than the original one? Anything malicious running in Dom0 has easier (or at least different) ways of getting at the same information.
Quoted 6 lines
This statement is only true of the dom0 kernel (and root userspace, given the questionable behaviour of
/proc/xen/privcmd).It does not hold for regular dom0 userspace - in particular, L1TF was discovered because of an accidental
mprotect(PROT_NONE), meaning that this is a viable attack vector for a depriv qemu.
But that's an attack against its kernel, isn't it? That is, and updated Dom0 kernel would already guard against issues.
Quoted 3 lines
As to crashing, that is only if you compile SHADOW out, and I remain to be convinced that compiling shadow out of Xen is a viable option at the moment.
Or simply running out of memory.
Quoted 4 lines
Basically, if you've got an updated dom0 kernel, you'll be fine even with this default flipped. If you've forgotten/missed that, then you're already wide open (in a lack of defence in depth way) and flipping the default here will make things blindly obvious.
Well, for new versions flipping the default may indeed be acceptable based on this argument. But even then - and even more so for stable versions - the change in behavior may come as a surprise to people who have perhaps even deliberately chosen not to upgrade their kernels.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 19 lines · Jan Beulich
Quoted 19 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 17:35, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 14:59, <[email protected]> wrote:
At the time XSA-273 was published, shadowing dom0 had proved to be unstable, which is why dom0 was unprotected by default. The instability was
identified
Quoted 13 lines
Quoted 6 lines
to be problems with shadowing PV superpages, and fixed.
In hindsight, this patch should have been posted at the same time.
There is now no legitimate reason to handle dom0 differently to domu when it comes to pv-l1tf protections.
I'm not entirely convinced by this statement: Crashing Dom0 (and hence the entire host) because of a failure to enable shadow mode on it is not a good thing imo. What's wrong with sticking to the current default, just for reasons other than the original one? Anything malicious running in Dom0 has easier (or at least different) ways of getting at the same information.
Quoted 8 lines
Quoted 6 lines
This statement is only true of the dom0 kernel (and root userspace, given the questionable behaviour of
/proc/xen/privcmd).It does not hold for regular dom0 userspace - in particular, L1TF was discovered because of an accidental
mprotect(PROT_NONE), meaning that this is a viable attack vector for a depriv qemu.But that's an attack against its kernel, isn't it? That is, and updated Dom0 kernel would already guard against issues.
L1TF is always against attacker-controlled MFN's, even when the attacker is in an HVM domain.
PV-L1TF mitigations protect from any attack inside the guest, at the cost of guest performance if the kernel is out of date and not mitigating the userspace attack itself.
Quoted 4 lines
Quoted 3 lines
As to crashing, that is only if you compile SHADOW out, and I remain to be convinced that compiling shadow out of Xen is a viable option at the moment.
Or simply running out of memory.
Shadows get recycled.
Quoted 10 lines
Quoted 5 lines
Basically, if you've got an updated dom0 kernel, you'll be fine even with this default flipped. If you've forgotten/missed that, then you're already wide open (in a lack of defence in depth way) and flipping the default here will make things blindly obvious.
Well, for new versions flipping the default may indeed be acceptable based on this argument. But even then - and even more so for stable versions - the change in behavior may come as a surprise to people who have perhaps even deliberately chosen not to upgrade their kernels.
If it were not with the instability, XSA-273 would have gone out with this default.
That alone is justification for this to be backported. Arguably, we should have reissued XSA-273 after I discovered and fixed the superpage shadowing bugs.
~Andrew
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Quoted 24 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 18:19, <[email protected]> wrote:
Quoted 22 lines · Jan Beulich
Quoted 22 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 17:35, <[email protected]> wrote:
Quoted 3 lines · Jan Beulich
Quoted 3 lines
Quoted 1 line
Quoted 1 line · On 31.01.19 at 14:59, <[email protected]> wrote:
At the time XSA-273 was published, shadowing dom0 had proved to be unstable, which is why dom0 was unprotected by default. The instability was
identified
Quoted 6 lines
Quoted 6 lines
to be problems with shadowing PV superpages, and fixed.
In hindsight, this patch should have been posted at the same time.
There is now no legitimate reason to handle dom0 differently to domu when it comes to pv-l1tf protections.
Quoted 7 lines
I'm not entirely convinced by this statement: Crashing Dom0 (and hence the entire host) because of a failure to enable shadow mode on it is not a good thing imo. What's wrong with sticking to the current default, just for reasons other than the original one? Anything malicious running in Dom0 has easier (or at least different) ways of getting at the same information.
This statement is only true of the dom0 kernel (and root userspace, given the questionable behaviour of
/proc/xen/privcmd).
Quoted 8 lines
Quoted 5 lines
Quoted 3 lines
It does not hold for regular dom0 userspace - in particular, L1TF was discovered because of an accidental
mprotect(PROT_NONE), meaning that this is a viable attack vector for a depriv qemu.But that's an attack against its kernel, isn't it? That is, and updated Dom0 kernel would already guard against issues.
L1TF is always against attacker-controlled MFN's, even when the attacker is in an HVM domain.
Right, but this doesn't address the point I'm making: If the Dom0 kernel is up to date, no attack ought to be possible. And if it's not up to date, the host admin apparently doesn't care about this particular issue.
Quoted 10 lines
PV-L1TF mitigations protect from any attack inside the guest, at the cost of guest performance if the kernel is out of date and not mitigating the userspace attack itself.
Quoted 4 lines
Quoted 3 lines
As to crashing, that is only if you compile SHADOW out, and I remain to be convinced that compiling shadow out of Xen is a viable option at the moment.
Or simply running out of memory.
Shadows get recycled.
Sure; I'm talking about running out of memory while enabling shadow mode.
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
Basically, if you've got an updated dom0 kernel, you'll be fine even with this default flipped. If you've forgotten/missed that, then you're already wide open (in a lack of defence in depth way) and flipping the default here will make things blindly obvious.
Quoted 8 lines
Quoted 5 lines
Well, for new versions flipping the default may indeed be acceptable based on this argument. But even then - and even more so for stable versions - the change in behavior may come as a surprise to people who have perhaps even deliberately chosen not to upgrade their kernels.
If it were not with the instability, XSA-273 would have gone out with this default.
I'm not sure this would have been the case - the argument of avoiding a host crash would still have been one to consider. I've just checked, and I did bring up that aspect back at the time already, especially also for the !SHADOW_PAGING case (where I also continue to think it would be wrong to crash the host by default), irrespective of whether actually building that way is a viable option at the moment.
Jan
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel