linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Michael Ellerman <mpe@ellerman.id.au>
To: greg@kroah.com
Cc: stable@vger.kernel.org, tglx@linutronix.de, linuxppc-dev@ozlabs.org
Subject: [PATCH stable 4.16 12/14] powerpc/pseries: Fix clearing of security feature flags
Date: Wed, 23 May 2018 00:41:23 +1000	[thread overview]
Message-ID: <20180522144125.10345-13-mpe@ellerman.id.au> (raw)
In-Reply-To: <20180522144125.10345-1-mpe@ellerman.id.au>

From: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>

commit 0f9bdfe3c77091e8704d2e510eb7c2c2c6cde524 upstream.

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 <mpe@ellerman.id.au>
Fixes: f636c14790ea ("powerpc/pseries: Set or clear security feature flags")
Signed-off-by: Mauricio Faria de Oliveira <mauricfo@linux.vnet.ibm.com>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
---
 arch/powerpc/platforms/pseries/setup.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/platforms/pseries/setup.c b/arch/powerpc/platforms/pseries/setup.c
index 905e54878fed..6b2152839c48 100644
--- a/arch/powerpc/platforms/pseries/setup.c
+++ b/arch/powerpc/platforms/pseries/setup.c
@@ -484,13 +484,13 @@ static void init_cpu_char_feature_flags(struct h_cpu_char_result *result)
 	 * The features below are enabled by default, so we instead look to see
 	 * if firmware has *disabled* them, and clear them if so.
 	 */
-	if (!(result->character & H_CPU_BEHAV_FAVOUR_SECURITY))
+	if (!(result->behaviour & H_CPU_BEHAV_FAVOUR_SECURITY))
 		security_ftr_clear(SEC_FTR_FAVOUR_SECURITY);
 
-	if (!(result->character & H_CPU_BEHAV_L1D_FLUSH_PR))
+	if (!(result->behaviour & H_CPU_BEHAV_L1D_FLUSH_PR))
 		security_ftr_clear(SEC_FTR_L1D_FLUSH_PR);
 
-	if (!(result->character & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR))
+	if (!(result->behaviour & H_CPU_BEHAV_BNDS_CHK_SPEC_BAR))
 		security_ftr_clear(SEC_FTR_BNDS_CHK_SPEC_BAR);
 }
 
-- 
2.14.1

  parent reply	other threads:[~2018-05-22 14:42 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-22 14:41 [PATCH stable 4.16 00/14] powerpc backports for 4.16 Michael Ellerman
2018-05-22 14:41 ` [PATCH stable 4.16 01/14] powerpc/rfi-flush: Always enable fallback flush on pseries Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/rfi-flush: Always enable fallback flush on pseries" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 02/14] powerpc: Add security feature flags for Spectre/Meltdown Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc: Add security feature flags for Spectre/Meltdown" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 03/14] powerpc/pseries: Add new H_GET_CPU_CHARACTERISTICS flags Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/pseries: Add new H_GET_CPU_CHARACTERISTICS flags" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 04/14] powerpc/pseries: Set or clear security feature flags Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/pseries: Set or clear security feature flags" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 05/14] powerpc/powernv: Set or clear security feature flags Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/powernv: Set or clear security feature flags" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 06/14] powerpc/64s: Move cpu_show_meltdown() Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/64s: Move cpu_show_meltdown()" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 07/14] powerpc/64s: Enhance the information in cpu_show_meltdown() Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/64s: Enhance the information in cpu_show_meltdown()" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 08/14] powerpc/powernv: Use the security flags in pnv_setup_rfi_flush() Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/powernv: Use the security flags in pnv_setup_rfi_flush()" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 09/14] powerpc/pseries: Use the security flags in pseries_setup_rfi_flush() Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/pseries: Use the security flags in pseries_setup_rfi_flush()" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 10/14] powerpc/64s: Wire up cpu_show_spectre_v1() Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/64s: Wire up cpu_show_spectre_v1()" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 11/14] powerpc/64s: Wire up cpu_show_spectre_v2() Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/64s: Wire up cpu_show_spectre_v2()" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` Michael Ellerman [this message]
2018-05-23 17:23   ` Patch "powerpc/pseries: Fix clearing of security feature flags" " gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 13/14] powerpc: Move default security feature flags Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc: Move default security feature flags" has been added to the 4.16-stable tree gregkh
2018-05-22 14:41 ` [PATCH stable 4.16 14/14] powerpc/64s: Add support for a store forwarding barrier at kernel entry/exit Michael Ellerman
2018-05-23 17:23   ` Patch "powerpc/64s: Add support for a store forwarding barrier at kernel entry/exit" has been added to the 4.16-stable tree gregkh
2018-05-23 17:21 ` [PATCH stable 4.16 00/14] powerpc backports for 4.16 Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180522144125.10345-13-mpe@ellerman.id.au \
    --to=mpe@ellerman.id.au \
    --cc=greg@kroah.com \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=stable@vger.kernel.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).