Re: [PATCH 3/6] powerpc/spufs: bound NPC against local store size

Junrui Luo <[email protected]> Tue, 4 Aug 2026 06:30:24 +0000
Newsgroups gmane.linux.ports.ppc.embedded
Message-ID <A64E7079-435A-4562-8AC9-530D37165CF5__9598.00269208557$1785825061$gmane$org@outlook.com>
On Mon, Aug 03, 2026 at 11:14:03AM +0200, Arnd Bergmann wrote:
> On Sun, Aug 2, 2026, at 17:51, Junrui Luo via B4 Relay wrote:
> > From: Junrui Luo <[email protected]>
> >
> > spu_process_callback() masks the low bits of the NPC register and uses
> > the result as an offset into the SPU local store: `ls_pointer =3D in_be=
32(ls
> > + npc)`. The following guard validates ls_pointer against LS_SIZE, but =
npc
> > itself is never bounds-checked.
> >
> > Fix by rejecting npc greater than LS_SIZE - sizeof(ls_pointer) before t=
he
> > read, mirroring the adjacent ls_pointer guard and returning the same
> > -EFAULT.
>=20
> This one seems wrong: npc is a hardware register value that can't
> go out of range, unlike the ls_pointer value. I don't think there
> is any use for the check.
>=20
>      Arnd

Thanks for the review. I didn't establish that it can actually go
out of range. Please drop this one.

Thanks,
Junrui Luo=