Skip to content

powerpc/spufs: assorted fixes

Junrui Luo b4-sent linuxppc-dev lkml stable 2 versions – New

Get series with b4
b4 am [email protected] change-id 20260802-fixes-f33361c1b2ae

Versions newest first

  1. v2 Latest5 patches 0 repliesNew
  2. v16 patches 9 repliesSuperseded

Changes in v2 from the cover letter

- Add an Assisted-by: trailer to each patch identifying the tooling, as requested by Arnd.
- Drop 3/6 from v1 (bound NPC against local store size).
- Link to v1: https://lore.kernel.org/r/[email protected]

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/5powerpc/spufs: fix spu_context leak in coredumparch/powerpc/platforms/cell/spufs/coredump.c+5 -10 replies
2/5powerpc/spufs: don't leak kernel stack via spu_runarch/powerpc/platforms/cell/spufs/syscalls.c+1 -10 replies
3/5powerpc/spufs: check permissions in spufs_setattr()arch/powerpc/platforms/cell/spufs/inode.c+4 -00 replies
4/5powerpc/spufs: fix deadlock on gang creation failurearch/powerpc/platforms/cell/spufs/inode.c+11 -60 replies
5/5powerpc/spufs: don't hold state_mutex during user accessarch/powerpc/platforms/cell/spufs/file.c+29 -230 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/5] powerpc/spufs: assorted fixes

Five independent fixes for spufs. There is no dependency between them, so they can be applied or dropped individually.

1/5 spufs_coredump_extra_notes_write() never drops the reference taken
by coredump_next_context(), so every SPE context written into a core dump leaks a spu_context. The matching ..._size() path gets this right.

2/5 do_spu_run() copies out an uninitialized 'status' on the paths
where spufs_run_spu() returns before assigning it, leaking four bytes of kernel stack to userspace.

3/5 spufs_setattr() calls setattr_copy() without setattr_prepare().
notify_change() leaves that check to the filesystem, so mode and ownership of a context's files can be changed without the usual authorization.

4/5 spufs_create_gang() calls unuse_gang() with the parent directory's
i_rwsem held for write, and the resulting simple_recursive_removal() takes it again as I_MUTEX_CHILD. The task deadlocks against itself and leaves the spufs directory write-locked.

5/5 The mailbox read/write handlers hold ctx->state_mutex across
put_user()/get_user(), so a userfaultfd region or FUSE-backed user buffer can stall the context lock for an arbitrary time.

Patches 1-4 are tagged for stable. 5/5 is deliberately not: it changes the atomicity of multi-element mailbox transfers rather than just adding a check, so it seems better to let it soak in mainline first.

Build-tested only. I have no Cell or PS3 hardware, so none of this has been exercised at runtime.

---
Changes in v2:
- Add an Assisted-by: trailer to each patch identifying the tooling, as requested by Arnd.
- Drop 3/6 from v1 (bound NPC against local store size).
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Junrui Luo (5):
powerpc/spufs: fix spu_context leak in coredump powerpc/spufs: don't leak kernel stack via spu_run powerpc/spufs: check permissions in spufs_setattr() powerpc/spufs: fix deadlock on gang creation failure powerpc/spufs: don't hold state_mutex during user access

 arch/powerpc/platforms/cell/spufs/coredump.c |  6 +++-
 arch/powerpc/platforms/cell/spufs/file.c     | 52 ++++++++++++++++------------
 arch/powerpc/platforms/cell/spufs/inode.c    | 21 +++++++----
 arch/powerpc/platforms/cell/spufs/syscalls.c |  2 +-
 4 files changed, 50 insertions(+), 31 deletions(-)

---
base-commit: 02dc699f83d04069fdabc996fc22d47cda47a4a9
change-id: 20260802-fixes-f33361c1b2ae

Best regards,

Signature · 1 line
Junrui Luo <[email protected]>