Re: [PATCH] sparc64: Read qemu,hwcap-list from the OF cpu node on sun4u

From: Stian Halseth

Date: Tue Nov 17 2026 - 07:44:24 EST


Hi all,

On Tue, 2026-11-17 at 11:46 +0000, sashiko-bot@xxxxxxxxxx wrote:
>
> [Severity: High]
> This problem wasn't introduced by this patch, but can hwcap_list_caps()
> read out of bounds and loop forever [1] if the property buffer is not
> null-terminated?

Yes, and we can fix that in v2. As it stands the parser trusts the list
to end with a NUL, which is not guaranteed if a QEMU user supplies a
fw_cfg file directly.

>
> [Severity: High]
> Does setting HWCAP_SPARC_CRYPTO in sparc64_elf_hwcap on sun4u cause a
> regression where the sparc64 skcipher drivers corrupt FPU state and round
> keys across skcipher_walk_done()?
>

This might be a bit worse than I first thought. I was aware of the
self-test failures, as noted in my patch notes, but it looks like this
could also cause some data corruption. Only QEMU can hit it, since no
real sun4u CPU has the crypto opcodes.

I have not reproduced it myself, and before spending time on that,
I would like to get Eric's take on removing the glue code altogether.
If not, we could fix the glue itself, for example by dropping the FP
state before skcipher_walk_done(). IMO that would be maintaining code
that probably should be removed. Not my call, though.

Andreas, please don't apply this patch as-is for now. I will wait for
Eric's reply before proceeding.


/Stian

Attachment: signature.asc
Description: This is a digitally signed message part