Commit d275a2d6 authored by Michael Ellerman's avatar Michael Ellerman Committed by Marcelo Henrique Cerri

UBUNTU: SAUCE: rfi-flush: Refactor the macros so the nops are defined once

CVE-2017-5754

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

To avoid a bug like the previous commit ever happening again, put the
nops in a single place.
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
parent e82cad5f
......@@ -53,16 +53,10 @@
#define EX_CTR 96
/*
* The nop instruction allows a secure memory protection instruction to be
* inserted with the rfi flush fixup.
* The nop instructions allow us to insert one or more instructions to flush the
* L1-D cache when return to userspace or a guest.
*/
#define PREPARE_RFI_TO_USER \
RFI_FLUSH_FIXUP_SECTION; \
nop; \
nop; \
nop
#define PREPARE_RFI_TO_GUEST \
#define RFI_FLUSH_SLOT \
RFI_FLUSH_FIXUP_SECTION; \
nop; \
nop; \
......@@ -86,17 +80,17 @@
#define RFI_TO_USER \
CHECK_TARGET_MSR_PR(SPRN_SRR1, 1); \
PREPARE_RFI_TO_USER; \
RFI_FLUSH_SLOT; \
rfid; \
b rfi_flush_fallback
#define RFI_TO_USER_OR_KERNEL \
PREPARE_RFI_TO_USER; \
RFI_FLUSH_SLOT; \
rfid; \
b rfi_flush_fallback
#define RFI_TO_GUEST \
PREPARE_RFI_TO_GUEST; \
RFI_FLUSH_SLOT; \
rfid; \
b rfi_flush_fallback
......@@ -106,25 +100,22 @@
#define HRFI_TO_USER \
CHECK_TARGET_MSR_PR(SPRN_HSRR1, 1); \
PREPARE_RFI_TO_USER; \
RFI_FLUSH_SLOT; \
hrfid; \
b hrfi_flush_fallback
#define HRFI_TO_USER_OR_KERNEL \
PREPARE_RFI_TO_USER; \
RFI_FLUSH_SLOT; \
hrfid; \
b hrfi_flush_fallback
#define HRFI_TO_GUEST \
PREPARE_RFI_TO_GUEST; \
RFI_FLUSH_SLOT; \
hrfid; \
b hrfi_flush_fallback
#define HRFI_TO_UNKNOWN \
RFI_FLUSH_FIXUP_SECTION; \
nop; \
nop; \
nop; \
RFI_FLUSH_SLOT; \
hrfid; \
b hrfi_flush_fallback
......
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