Skip to content

Commit 0f9bdfe

Browse files
Mauricio Faria de Oliveirampe
authored andcommitted
powerpc/pseries: Fix clearing of security feature flags
The H_CPU_BEHAV_* flags should be checked for in the 'behaviour' field of 'struct h_cpu_char_result' -- 'character' is for H_CPU_CHAR_* flags. Found by playing around with QEMU's implementation of the hypercall: H_CPU_CHAR=0xf000000000000000 H_CPU_BEHAV=0x0000000000000000 This clears H_CPU_BEHAV_FAVOUR_SECURITY and H_CPU_BEHAV_L1D_FLUSH_PR so pseries_setup_rfi_flush() disables 'rfi_flush'; and it also clears H_CPU_CHAR_L1D_THREAD_PRIV flag. So there is no RFI flush mitigation at all for cpu_show_meltdown() to report; but currently it does: Original kernel: # cat /sys/devices/system/cpu/vulnerabilities/meltdown Mitigation: RFI Flush Patched kernel: # cat /sys/devices/system/cpu/vulnerabilities/meltdown Not affected H_CPU_CHAR=0x0000000000000000 H_CPU_BEHAV=0xf000000000000000 This sets H_CPU_BEHAV_BNDS_CHK_SPEC_BAR so cpu_show_spectre_v1() should report vulnerable; but currently it doesn't: Original kernel: # cat /sys/devices/system/cpu/vulnerabilities/spectre_v1 Not affected Patched kernel: # cat /sys/devices/system/cpu/vulnerabilities/spectre_v1 Vulnerable Brown-paper-bag-by: Michael Ellerman <[email protected]> Fixes: f636c14 ("powerpc/pseries: Set or clear security feature flags") Signed-off-by: Mauricio Faria de Oliveira <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 95dff48 commit 0f9bdfe

File tree

1 file changed

+3
-3
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+3
-3
lines changed

arch/powerpc/platforms/pseries/setup.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,13 +484,13 @@ static void init_cpu_char_feature_flags(struct h_cpu_char_result *result)
484484
* The features below are enabled by default, so we instead look to see
485485
* if firmware has *disabled* them, and clear them if so.
486486
*/
487-
if (!(result->character & H_CPU_BEHAV_FAVOUR_SECURITY))
487+
if (!(result->behaviour & H_CPU_BEHAV_FAVOUR_SECURITY))
488488
security_ftr_clear(SEC_FTR_FAVOUR_SECURITY);
489489

490-
if (!(result->character & H_CPU_BEHAV_L1D_FLUSH_PR))
490+
if (!(result->behaviour & H_CPU_BEHAV_L1D_FLUSH_PR))
491491
security_ftr_clear(SEC_FTR_L1D_FLUSH_PR);
492492

493-
if (!(result->character & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR))
493+
if (!(result->behaviour & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR))
494494
security_ftr_clear(SEC_FTR_BNDS_CHK_SPEC_BAR);
495495
}
496496

0 commit comments

Comments
 (0)