Commit 6bb79531 authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Stefan Bader

powerpc/64: Add macros for annotating the destination of rfid/hrfid

CVE-2017-5754

BugLink: http://bugs.launchpad.net/bugs/1756121

commit 50e51c13 upstream.

The rfid/hrfid ((Hypervisor) Return From Interrupt) instruction is
used for switching from the kernel to userspace, and from the
hypervisor to the guest kernel. However it can and is also used for
other transitions, eg. from real mode kernel code to virtual mode
kernel code, and it's not always clear from the code what the
destination context is.

To make it clearer when reading the code, add macros which encode the
expected destination context.
Signed-off-by: default avatarNicholas Piggin <npiggin@gmail.com>
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
Signed-off-by: default avatarStefan Bader <stefan.bader@canonical.com>
parent 3f69e774
......@@ -209,5 +209,11 @@ exc_##label##_book3e:
ori r3,r3,vector_offset@l; \
mtspr SPRN_IVOR##vector_number,r3;
#define RFI_TO_KERNEL \
rfi
#define RFI_TO_USER \
rfi
#endif /* _ASM_POWERPC_EXCEPTION_64E_H */
......@@ -50,6 +50,35 @@
#define EX_PPR 88 /* SMT thread status register (priority) */
#define EX_CTR 96
/* Macros for annotating the expected destination of (h)rfid */
#define RFI_TO_KERNEL \
rfid
#define RFI_TO_USER \
rfid
#define RFI_TO_USER_OR_KERNEL \
rfid
#define RFI_TO_GUEST \
rfid
#define HRFI_TO_KERNEL \
hrfid
#define HRFI_TO_USER \
hrfid
#define HRFI_TO_USER_OR_KERNEL \
hrfid
#define HRFI_TO_GUEST \
hrfid
#define HRFI_TO_UNKNOWN \
hrfid
#ifdef CONFIG_RELOCATABLE
#define __EXCEPTION_RELON_PROLOG_PSERIES_1(label, h) \
ld r12,PACAKBASE(r13); /* get high part of &label */ \
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment