<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-dev/tools/testing/selftests/powerpc/security, branch linus/master</title>
<subtitle>Linux kernel development work - see feature branches</subtitle>
<id>https://git.zx2c4.com/linux-dev/atom/tools/testing/selftests/powerpc/security?h=linus%2Fmaster</id>
<link rel='self' href='https://git.zx2c4.com/linux-dev/atom/tools/testing/selftests/powerpc/security?h=linus%2Fmaster'/>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/'/>
<updated>2022-05-22T05:59:54Z</updated>
<entry>
<title>selftests/powerpc/pmu: fix spelling mistake "mis-match" -&gt; "mismatch"</title>
<updated>2022-05-22T05:59:54Z</updated>
<author>
<name>Colin Ian King</name>
<email>colin.i.king@gmail.com</email>
</author>
<published>2022-03-19T23:20:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=7801cb1dc60f7348687ca1c3aa03a944687563f0'/>
<id>urn:sha1:7801cb1dc60f7348687ca1c3aa03a944687563f0</id>
<content type='text'>
There are a few spelling mistakes in error messages. Fix them.

Signed-off-by: Colin Ian King &lt;colin.i.king@gmail.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20220319232025.22067-1-colin.i.king@gmail.com

</content>
</entry>
<entry>
<title>selftests/powerpc: Better reporting in spectre_v2</title>
<updated>2022-05-22T05:58:28Z</updated>
<author>
<name>Russell Currey</name>
<email>ruscur@russell.cc</email>
</author>
<published>2021-06-08T06:48:09Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=48482f4dd3432e5e62873bf0f2e254cfb8ce2ac2'/>
<id>urn:sha1:48482f4dd3432e5e62873bf0f2e254cfb8ce2ac2</id>
<content type='text'>
In commit f3054ffd71b5 ("selftests/powerpc: Return skip code for
spectre_v2"), the spectre_v2 selftest is updated to be aware of cases
where the vulnerability status reported in sysfs is incorrect, skipping
the test instead.

This happens because qemu can misrepresent the mitigation status of the
host to the guest. If the count cache is disabled in the host, and this
is correctly reported to the guest, then the guest won't apply
mitigations. If the guest is then migrated to a new host where
mitigations are necessary, it is now vulnerable because it has not
applied mitigations.

Update the selftest to report when we see excessive misses, indicative of
the count cache being disabled. If software flushing is enabled, also
warn that these flushes are just wasting performance.

Signed-off-by: Russell Currey &lt;ruscur@russell.cc&gt;
[mpe: Rebase and update change log appropriately]
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20210608064809.199116-1-ruscur@russell.cc

</content>
</entry>
<entry>
<title>selftests/powerpc: Fix typo in spectre_v2</title>
<updated>2022-05-04T09:37:46Z</updated>
<author>
<name>Russell Currey</name>
<email>ruscur@russell.cc</email>
</author>
<published>2021-06-08T05:48:51Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=dcbff9ad418497c2608d4b4d9423efc8e87e130e'/>
<id>urn:sha1:dcbff9ad418497c2608d4b4d9423efc8e87e130e</id>
<content type='text'>
Signed-off-by: Russell Currey &lt;ruscur@russell.cc&gt;
Signed-off-by: Christophe Leroy &lt;christophe.leroy@csgroup.eu&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20210608054851.164659-1-ruscur@russell.cc

</content>
</entry>
<entry>
<title>selftests/powerpc/pmu: Add macros to parse event codes</title>
<updated>2022-03-01T12:38:12Z</updated>
<author>
<name>Madhavan Srinivasan</name>
<email>maddy@linux.ibm.com</email>
</author>
<published>2022-01-27T07:19:55Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=6523dce86222451e5ca2df8a46597a217084bfdf'/>
<id>urn:sha1:6523dce86222451e5ca2df8a46597a217084bfdf</id>
<content type='text'>
Each platform has raw event encoding format which specifies the bit
positions for different fields. The fields from event code gets
translated into performance monitoring mode control register (MMCRx)
settings. Patch add macros to extract individual fields from the event
code.

Add functions for sanity checks, since testcases currently are only
supported in power9 and power10.

Signed-off-by: Madhavan Srinivasan &lt;maddy@linux.ibm.com&gt;
[mpe: Read PVR directly rather than using /proc/cpuinfo]
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20220127072012.662451-4-kjain@linux.ibm.com

</content>
</entry>
<entry>
<title>selftests/powerpc: skip tests for unavailable mitigations.</title>
<updated>2021-12-16T10:31:46Z</updated>
<author>
<name>Sachin Sant</name>
<email>sachinp@linux.vnet.ibm.com</email>
</author>
<published>2021-12-13T16:42:23Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=18678591846d668649fbd4f87b4a4c470818d386'/>
<id>urn:sha1:18678591846d668649fbd4f87b4a4c470818d386</id>
<content type='text'>
Mitigation patching test iterates over a set of mitigations irrespective
of whether a certain mitigation is supported/available in the kernel.
This causes following messages on a kernel where some mitigations
are unavailable:

  Spawned threads enabling/disabling mitigations ...
  cat: entry_flush: No such file or directory
  cat: uaccess_flush: No such file or directory
  Waiting for timeout ...
  OK

This patch adds a check for available mitigations in the kernel.

Reported-by: Nageswara R Sastry &lt;rnsastry@linux.ibm.com&gt;
Signed-off-by: Sachin Sant &lt;sachinp@linux.vnet.ibm.com&gt;
Tested-by: Nageswara R Sastry &lt;rnsastry@linux.ibm.com&gt;
Reviewed-by: Russell Currey &lt;ruscur@russell.cc&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/163941374362.36967.18016981579099073379.sendpatchset@1.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.ip6.arpa

</content>
</entry>
<entry>
<title>selftests/powerpc/spectre_v2: Return skip code when miss_percent is high</title>
<updated>2021-12-09T11:41:21Z</updated>
<author>
<name>Thadeu Lima de Souza Cascardo</name>
<email>cascardo@canonical.com</email>
</author>
<published>2021-12-07T13:05:57Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3c42e9542050d49610077e083c7c3f5fd5e26820'/>
<id>urn:sha1:3c42e9542050d49610077e083c7c3f5fd5e26820</id>
<content type='text'>
A mis-match between reported and actual mitigation is not restricted to the
Vulnerable case. The guest might also report the mitigation as "Software
count cache flush" and the host will still mitigate with branch cache
disabled.

So, instead of skipping depending on the detected mitigation, simply skip
whenever the detected miss_percent is the expected one for a fully
mitigated system, that is, above 95%.

Signed-off-by: Thadeu Lima de Souza Cascardo &lt;cascardo@canonical.com&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20211207130557.40566-1-cascardo@canonical.com

</content>
</entry>
<entry>
<title>selftests/powerpc: Use date instead of EPOCHSECONDS in mitigation-patching.sh</title>
<updated>2021-10-27T11:34:02Z</updated>
<author>
<name>Russell Currey</name>
<email>ruscur@russell.cc</email>
</author>
<published>2021-10-25T10:24:36Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=cb662608e546d755e3e1b51b30a269459323bf24'/>
<id>urn:sha1:cb662608e546d755e3e1b51b30a269459323bf24</id>
<content type='text'>
The EPOCHSECONDS environment variable was added in bash 5.0 (released
2019).  Some distributions of the "stable" and "long-term" variety ship
older versions of bash than this, so swap to using the date command
instead.

"%s" was added to coreutils `date` in 1993 so we should be good, but who
knows, it is a GNU extension and not part of the POSIX spec for `date`.

Signed-off-by: Russell Currey &lt;ruscur@russell.cc&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20211025102436.19177-1-ruscur@russell.cc

</content>
</entry>
<entry>
<title>selftests/powerpc: Add test of mitigation patching</title>
<updated>2021-05-17T05:27:47Z</updated>
<author>
<name>Michael Ellerman</name>
<email>mpe@ellerman.id.au</email>
</author>
<published>2021-05-07T06:42:25Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=34f7f79827ec4db30cff9001dfba19f496473e8d'/>
<id>urn:sha1:34f7f79827ec4db30cff9001dfba19f496473e8d</id>
<content type='text'>
We recently discovered some of our mitigation patching was not safe
against other CPUs running concurrently.

Add a test which enable/disables all mitigations in a tight loop while
also running some stress load. On an unpatched system this almost always
leads to an oops and panic/reboot, but we also check if the kernel
becomes tainted in case we have a non-fatal oops.

Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20210507064225.1556312-1-mpe@ellerman.id.au
</content>
</entry>
<entry>
<title>selftests/powerpc: Add uaccess flush test</title>
<updated>2021-04-22T15:38:03Z</updated>
<author>
<name>Thadeu Lima de Souza Cascardo</name>
<email>cascardo@canonical.com</email>
</author>
<published>2021-02-25T06:19:49Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=da650ada100956b0f00aa4fe9ce33103378ce9ca'/>
<id>urn:sha1:da650ada100956b0f00aa4fe9ce33103378ce9ca</id>
<content type='text'>
Also based on the RFI and entry flush tests, it counts the L1D misses
by doing a syscall that does user access: uname, in this case.

Signed-off-by: Thadeu Lima de Souza Cascardo &lt;cascardo@canonical.com&gt;
[dja: forward port, rename function]
Signed-off-by: Daniel Axtens &lt;dja@axtens.net&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20210225061949.1213404-1-dja@axtens.net

</content>
</entry>
<entry>
<title>selftests/powerpc: Fix L1D flushing tests for Power10</title>
<updated>2021-03-24T03:09:29Z</updated>
<author>
<name>Russell Currey</name>
<email>ruscur@russell.cc</email>
</author>
<published>2021-02-23T07:02:27Z</published>
<link rel='alternate' type='text/html' href='https://git.zx2c4.com/linux-dev/commit/?id=3a72c94ebfb1f171eba0715998010678a09ec796'/>
<id>urn:sha1:3a72c94ebfb1f171eba0715998010678a09ec796</id>
<content type='text'>
The rfi_flush and entry_flush selftests work by using the PM_LD_MISS_L1
perf event to count L1D misses.  The value of this event has changed
over time:

- Power7 uses 0x400f0
- Power8 and Power9 use both 0x400f0 and 0x3e054
- Power10 uses only 0x3e054

Rather than relying on raw values, configure perf to count L1D read
misses in the most explicit way available.

This fixes the selftests to work on systems without 0x400f0 as
PM_LD_MISS_L1, and should change no behaviour for systems that the tests
already worked on.

The only potential downside is that referring to a specific perf event
requires PMU support implemented in the kernel for that platform.

Signed-off-by: Russell Currey &lt;ruscur@russell.cc&gt;
Acked-by: Daniel Axtens &lt;dja@axtens.net&gt;
Signed-off-by: Michael Ellerman &lt;mpe@ellerman.id.au&gt;
Link: https://lore.kernel.org/r/20210223070227.2916871-1-ruscur@russell.cc
</content>
</entry>
</feed>
