xen/pciback: Save xen_pci_op commands before processing it
authorKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Mon, 16 Nov 2015 17:40:48 +0000 (12:40 -0500)
committerBen Hutchings <ben@decadent.org.uk>
Fri, 22 Jan 2016 21:40:07 +0000 (21:40 +0000)
commit9cbc2b03e6d123d551db7e02c60545a1484fe5e2
tree174493600115e9307d2d283b0edf68b4e7dbaaf4
parentc25a100a2e2bf4ca34864f8123bf41e471addc49
xen/pciback: Save xen_pci_op commands before processing it

commit 8135cf8b092723dbfcc611fe6fdcb3a36c9951c5 upstream.

Double fetch vulnerabilities that happen when a variable is
fetched twice from shared memory but a security check is only
performed the first time.

The xen_pcibk_do_op function performs a switch statements on the op->cmd
value which is stored in shared memory. Interestingly this can result
in a double fetch vulnerability depending on the performed compiler
optimization.

This patch fixes it by saving the xen_pci_op command before
processing it. We also use 'barrier' to make sure that the
compiler does not perform any optimization.

This is part of XSA155.

Reviewed-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Jan Beulich <JBeulich@suse.com>
Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
drivers/xen/xen-pciback/pciback.h
drivers/xen/xen-pciback/pciback_ops.c