Page MenuHomeFreeBSD

tests/sys/kern: stress test for FP registers across sigreturn on powerpc64
Needs ReviewPublic

Authored by pkubaj on Tue, Oct 6, 2:20 PM.

Details

Reviewers
adrian
Group Reviewers
PowerPC
Summary

This is the program that found and reproduces the races fixed in
1f1043d550ea: the checker loads f14-f31 with a pattern, sends itself a
signal and stores the registers again, so the store takes the lazy
reload trap, while helper threads pinned to its CPU keep other patterns
in the hardware registers and are woken from another CPU to preempt the
checker at random points. Any mismatch means the kernel handed the
thread another thread's registers.

The register loads, the thr_kill(2) and the pipe round trip with the
helper are in assembly so that nothing touches the FP registers between
the sigreturn and the stores. It runs for ten seconds and is skipped
with fewer than two CPUs.

On a POWER9 pseries guest without 1f1043d550ea it fails with 128 of
204000 round trips corrupted; with it, it passes.

Test Plan

POWER9 pseries guest (powerpc64le, 96 vCPUs), built via tests/sys/kern/Makefile.

kernelresult
main before 1f1043d550eafailed: 128 of 204000 sigreturn round trips came back with another thread's FP registers (first: f14 expected 0xc0de00000000000e got 0xbad000040000000e)
main with 1f1043d550eapassed (3 runs; 1/1 passed under kyua)

Builds clean under the tree's -Werror flags; skipped with fewer than two CPUs.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped