Misc vcpu_op() adjustments
cover Misc vcpu_op() adjustments
Andrew Cooper (2):
xen/domain: Block more speculative out-of-bound accesses xen/arm: Misc improvements to do_common_cpu_on()
xen/arch/arm/vpsci.c | 8 +++----- xen/common/compat/domain.c | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-)
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 1/2 xen/domain: Block more speculative out-of-bound accesses
c/s f8303458 restricted speculative access for do_vcpu_op(), but neglected its compat counterpart, which is reachable by guests using the 32bit ABI.
Make an identical adjustment.
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Norbert Manthey <[email protected]>
--- xen/common/compat/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
xen/common/compat/domain.c +1 -1
@@ -39,7 +39,7 @@ int compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arstruct vcpu *v;int rc =0 ; -if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) ==NULL ) +if ( (v =domain_vcpu (d, vcpuid)) ==NULL )return -ENOENT ; switch ( cmd )
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 1/2] xen/domain: Block more speculative out-of-bound accesses
Quoted 6 lines · Andrew Cooper
c/s
f8303458restricted speculative access fordo_vcpu_op(), but neglected its compat counterpart, which is reachable by guests using the 32bit ABI.Make an identical adjustment.
Signed-off-by Andrew Cooper <[email protected]>
Quoted 16 lines
---
CC: Jan Beulich <[email protected]>
CC: Wei Liu <[email protected]>
CC: Roger Pau Monné <[email protected]>
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
CC: Norbert Manthey <[email protected]>--- xen/common/compat/domain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)xen/common/compat/domain.c +0
-0
xen/common/compat/domain.c int compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) ar · line 45
Quoted 8 lines
xen/common/compat/domain.c +1
-1@@ -39,7 +39,7 @@ int compat_vcpu_op(int cmd, unsigned int vcpuid, XEN_GUEST_HANDLE_PARAM(void) arstruct vcpu *v;int rc =0 ; -if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) ==NULL ) +if ( (v =domain_vcpu (d, vcpuid)) ==NULL )return -ENOENT ; switch ( cmd )
Amazon Development Center Germany GmbH Krausenstr. 38
10117 Berlin
Geschaeftsfuehrer: Christian Schlaeger, Ralf Herbrich
Ust-ID: DE 289 237 879
Eingetragen am Amtsgericht Charlottenburg HRB 149173 B
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 1/2] xen/domain: Block more speculative out-of-bound accesses
In reply to Andrew CooperQuoted 7 lines
Quoted 1 line
Quoted 1 line · On 24.04.19 at 20:10, <[email protected]> wrote:
c/s
f8303458restricted speculative access fordo_vcpu_op(), but neglected its compat counterpart, which is reachable by guests using the 32bit ABI.Make an identical adjustment.
Signed-off-by Andrew Cooper <[email protected]>
_______________________________________________
Xen-devel mailing list
[email protected]
https://lists.xenproject.org/mailman/listinfo/xen-devel
PATCH 2/2 xen/arm: Misc improvements to do_common_cpu_on()
In reply to Andrew Cooper * Use domain_vcpu() rather than opencoding the lookup. Amongst other things, domain_vcpu() is spectre-v1-safe.
* Unlock the domain immediately after arch_set_info_guest() completes. There is no need for free_vcpu_guest_context() to be within the critical region, and moving the call simplifies the error case.
No practical change in functionaltiy.
---
CC: Stefano Stabellini <[email protected]>
CC: Julien Grall <[email protected]>
--- xen/arch/arm/vpsci.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-)
xen/arch/arm/vpsci.c +3 -5
@@ -33,7 +33,7 @@ static int do_common_cpu_on(register_t target_cpu, register_t entry_point, vcpuid =vaffinity_to_vcpuid (target_cpu); -if ( vcpuid >= d->max_vcpus || (v = d->vcpu[vcpuid]) ==NULL ) +if ( (v =domain_vcpu (d, vcpuid)) ==NULL )return PSCI_INVALID_PARAMETERS ;/* THUMB set is not allowed with 64-bit domain */
@@ -82,14 +82,12 @@ static int do_common_cpu_on(register_t target_cpu, register_t entry_point,domain_lock (d); rc =arch_set_info_guest (v, ctxt); +domain_unlock (d); +free_vcpu_guest_context (ctxt);if ( rc <0 ) - { -domain_unlock (d);return PSCI_DENIED ; - } -domain_unlock (d);vcpu_wake (v);
Signature · 7 lines
2.1.4 _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel
Re: [PATCH 2/2] xen/arm: Misc improvements to do_common_cpu_on()
Hi Andrew,
Quoted 7 lines · Andrew Cooper
* Use
domain_vcpu()rather than opencoding the lookup. Amongst other things,domain_vcpu()is spectre-v1-safe.
* Unlock the domain immediately afterarch_set_info_guest()completes. There is no need forfree_vcpu_guest_context()to be within the critical region, and moving the call simplifies the error case.No practical change in functionaltiy.
s/functionaltiy/functionality/
Quoted 2 lines
Signed-off-by Andrew Cooper <[email protected]>
I will fix up the typo and queue it in my next-4.13 branch.
Cheers,
Signature · 6 lines
Julien Grall _______________________________________________ Xen-devel mailing list [email protected] https://lists.xenproject.org/mailman/listinfo/xen-devel