On Tue, Sep 29, 2026 at 05:27:28PM +0100, Mark Rutland wrote:
> On Tue, Sep 01, 2026 at 06:06:43PM +0100, Mark Brown wrote:
> > When they detect corruption the fp-stress test loads print load specific
> > diagnostics and exits with a failure status.  In preparation for
> > building versions intended to run as KVM guests factor the exits into
> > asm-utils-linux.S.
> > 
> > No functional change.
> 
> This is a good cleanup, but I do think it'd be worth noting that some of
> the existing asm was wrong and worked by coincidence.
> 
> I did mention that in the patches I linked you to a while back:
> 
>   
> https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?id=922d15ef46cb486a79f168949e103f6df26f4fba

Sorry, that was the wrong link; I meant to share:

  
https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?id=2db277185f5c252decdf49b25cd461782e890cd1

... which was another patch from that cleanup series:

  
https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/log/?h=arm64/selftests/cleanup

The description of the problem from the commit message was:

| The barf functions in the fp-stress sub-tests erroneously place the
| status value into x1 (rather than x0) when invoking the exit syscall,
| potentially returning a different status than expected.
| 
| By coincidence, the low 8 bits of x0 happen to be non-zero for all of
| these cases, and the exit will be treated as a failure by the fp-stress
| harness, which is the desired behaviour. Hence this doesn't lead to
| failing tests being reported as passing.
| 
| In all cases x0 contains either:
| 
| * The result of the prior write syscall made by the puts macro, which is
|   a write of the two character string "]\n".
| 
| * The result of the prior write syscall made by the putdecn() function,
|   which is a write of the single-character '\n'.
| 
| In either case, the return value of that write syscall may be a non-zero
| number of bytes written, or a negative error code. As the relevant
| strings are fewer than 256 characters, and all (positive) error codes
| are less than 256, the value in the low 8 bits of x0 will not be zero.

Mark.

Reply via email to