xen/events/fifo: ensure all bitops are properly aligned even on x86
authorDavid Vrabel <david.vrabel@citrix.com>
Thu, 31 Jul 2014 15:22:25 +0000 (16:22 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 5 Sep 2014 23:34:16 +0000 (16:34 -0700)
commit924c4521bdb0b47ec3483be157408ced6d923cde
treec5b7adc3e1cf18bf7f0a27aa68e8f3fba10eca07
parent1b313b33fa279914ba462a45f80858ed8095f8f3
xen/events/fifo: ensure all bitops are properly aligned even on x86

commit dcecb8fd93a65787130a74e61fdf29932c8d85eb upstream.

When using the FIFO-based ABI on x86_64, if the last port is at the
end of an event array page then sync_test_bit() on this port's event
word will read beyond the end of the page and in certain circumstances
this may fault.

The fault requires the following page in the kernel's direct mapping
to be not present, which would mean:

a) the array page is the last page of RAM; or

b) the following page is ballooned out /and/ it has been used for a
   foreign mapping by a kernel driver (such as netback or blkback)
   /and/ the grant has been unmapped.

Use the infrastructure added for arm64 to ensure that all bitops
operating on event words are unsigned long aligned.

Signed-off-by: David Vrabel <david.vrabel@citrix.com>
Reviewed-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/xen/events/events_fifo.c