Commit d585250a authored by Nicholas Piggin's avatar Nicholas Piggin Committed by Marcelo Henrique Cerri

UBUNTU: SAUCE: rfi-flush: Add speculation barrier before ori 30,30,0 flush

CVE-2017-5754

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

add an ori 31,31,0 speculation barrier ahead of the ori 30,30,0 flush
type, which was found necessary to completely flush out all lines.
Signed-off-by: default avatarMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
parent 5dcadca3
...@@ -59,11 +59,13 @@ ...@@ -59,11 +59,13 @@
#define PREPARE_RFI_TO_USER \ #define PREPARE_RFI_TO_USER \
RFI_FLUSH_FIXUP_SECTION; \ RFI_FLUSH_FIXUP_SECTION; \
nop; \ nop; \
nop; \
nop nop
#define PREPARE_RFI_TO_GUEST \ #define PREPARE_RFI_TO_GUEST \
RFI_FLUSH_FIXUP_SECTION; \ RFI_FLUSH_FIXUP_SECTION; \
nop; \ nop; \
nop; \
nop nop
#ifdef CONFIG_PPC_DEBUG_RFI #ifdef CONFIG_PPC_DEBUG_RFI
......
...@@ -116,7 +116,7 @@ void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end) ...@@ -116,7 +116,7 @@ void do_feature_fixups(unsigned long value, void *fixup_start, void *fixup_end)
#ifdef CONFIG_PPC_BOOK3S_64 #ifdef CONFIG_PPC_BOOK3S_64
void do_rfi_flush_fixups(enum l1d_flush_type types) void do_rfi_flush_fixups(enum l1d_flush_type types)
{ {
unsigned int instrs[2], *dest; unsigned int instrs[3], *dest;
long *start, *end; long *start, *end;
int i; int i;
...@@ -125,14 +125,17 @@ void do_rfi_flush_fixups(enum l1d_flush_type types) ...@@ -125,14 +125,17 @@ void do_rfi_flush_fixups(enum l1d_flush_type types)
instrs[0] = 0x60000000; /* nop */ instrs[0] = 0x60000000; /* nop */
instrs[1] = 0x60000000; /* nop */ instrs[1] = 0x60000000; /* nop */
instrs[2] = 0x60000000; /* nop */
if (types & L1D_FLUSH_FALLBACK) if (types & L1D_FLUSH_FALLBACK)
/* b .+8 to fallback flush */ /* b .+8 to fallback flush */
instrs[1] = 0x48000008; instrs[1] = 0x48000008;
i = 0; i = 0;
if (types & L1D_FLUSH_ORI) if (types & L1D_FLUSH_ORI) {
instrs[i++] = 0x63de0000; /* ori 30,30,0 */ instrs[i++] = 0x63ff0000; /* ori 31,31,0 speculation barrier */
instrs[i++] = 0x63de0000; /* ori 30,30,0 L1d flush*/
}
if (types & L1D_FLUSH_MTTRIG) if (types & L1D_FLUSH_MTTRIG)
instrs[i++] = 0x7c12dba6; /* mtspr TRIG2,r0 (SPR #882) */ instrs[i++] = 0x7c12dba6; /* mtspr TRIG2,r0 (SPR #882) */
...@@ -144,6 +147,7 @@ void do_rfi_flush_fixups(enum l1d_flush_type types) ...@@ -144,6 +147,7 @@ void do_rfi_flush_fixups(enum l1d_flush_type types)
patch_instruction(dest, instrs[0]); patch_instruction(dest, instrs[0]);
patch_instruction(dest + 1, instrs[1]); patch_instruction(dest + 1, instrs[1]);
patch_instruction(dest + 2, instrs[2]);
} }
printk(KERN_DEBUG "rfi-fixups: patched %d locations\n", i); printk(KERN_DEBUG "rfi-fixups: patched %d locations\n", i);
......
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