powerpc/security: Fix Speculation_Store_Bypass reporting on Power10
authorMichael Ellerman <mpe@ellerman.id.au>
Wed, 17 May 2023 07:49:45 +0000 (17:49 +1000)
committerMichael Ellerman <mpe@ellerman.id.au>
Sun, 9 Jul 2023 23:47:47 +0000 (09:47 +1000)
commit5bcedc5931e7bd6928a2d8207078d4cb476b3b55
tree60bb999ae1926f75d3064b023960991a664e9e1c
parent8bbe9fee5848371d4af101be445303cac8d880c5
powerpc/security: Fix Speculation_Store_Bypass reporting on Power10

Nageswara reported that /proc/self/status was showing "vulnerable" for
the Speculation_Store_Bypass feature on Power10, eg:

  $ grep Speculation_Store_Bypass: /proc/self/status
  Speculation_Store_Bypass:       vulnerable

But at the same time the sysfs files, and lscpu, were showing "Not
affected".

This turns out to simply be a bug in the reporting of the
Speculation_Store_Bypass, aka. PR_SPEC_STORE_BYPASS, case.

When SEC_FTR_STF_BARRIER was added, so that firmware could communicate
the vulnerability was not present, the code in ssb_prctl_get() was not
updated to check the new flag.

So add the check for SEC_FTR_STF_BARRIER being disabled. Rather than
adding the new check to the existing if block and expanding the comment
to cover both cases, rewrite the three cases to be separate so they can
be commented separately for clarity.

Fixes: 84ed26fd00c5 ("powerpc/security: Add a security feature for STF barrier")
Cc: stable@vger.kernel.org # v5.14+
Reported-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
Tested-by: Nageswara R Sastry <rnsastry@linux.ibm.com>
Reviewed-by: Russell Currey <ruscur@russell.cc>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
Link: https://msgid.link/20230517074945.53188-1-mpe@ellerman.id.au
arch/powerpc/kernel/security.c