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

UBUNTU: SAUCE: rfi-flush: Rework pseries logic to be more cautious

CVE-2017-5754

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

Rather than assuming a successful return from the hcall will tell us a
valid flush type, if the hcall doesn't select one of the known flush
types use the fallback.
Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
Signed-off-by: default avatarMarcelo Henrique Cerri <marcelo.cerri@canonical.com>
parent 88424261
...@@ -505,21 +505,27 @@ static void pSeries_setup_rfi_flush(void) ...@@ -505,21 +505,27 @@ static void pSeries_setup_rfi_flush(void)
enum l1d_flush_type types; enum l1d_flush_type types;
bool enable; bool enable;
/* Default to fallback in case hcall is not available */ /* Enable by default */
types = L1D_FLUSH_FALLBACK;
enable = true; enable = true;
rc = plpar_get_cpu_characteristics(&character, &behaviour); rc = plpar_get_cpu_characteristics(&character, &behaviour);
if (rc == H_SUCCESS) { if (rc == H_SUCCESS) {
/* Default to no flush, unless firmware says otherwise */
types = L1D_FLUSH_NONE; types = L1D_FLUSH_NONE;
if (character & H_GET_CPU_CHAR_CHAR_MTTRIG2_L1_FLUSH) if (character & H_GET_CPU_CHAR_CHAR_MTTRIG2_L1_FLUSH)
types |= L1D_FLUSH_MTTRIG; types |= L1D_FLUSH_MTTRIG;
if (character & H_GET_CPU_CHAR_CHAR_ORI30_L1_FLUSH) if (character & H_GET_CPU_CHAR_CHAR_ORI30_L1_FLUSH)
types |= L1D_FLUSH_ORI; types |= L1D_FLUSH_ORI;
/* Use fallback if nothing set in hcall */
if (types == L1D_FLUSH_NONE)
types = L1D_FLUSH_FALLBACK;
if (!(behaviour & H_GET_CPU_CHAR_BEHAV_L1_FLUSH_LOW_PRIV)) if (!(behaviour & H_GET_CPU_CHAR_BEHAV_L1_FLUSH_LOW_PRIV))
enable = false; enable = false;
} else {
/* Default to fallback if case hcall is not available */
types = L1D_FLUSH_FALLBACK;
} }
setup_rfi_flush(types, enable); setup_rfi_flush(types, enable);
......
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