Skip to content

m68k: Improved switch stack handling

Michael Schmitz linux-arch linux-m68k 3 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest3 patches 25 repliesIn review
  2. v33 patches 2 repliesSuperseded
  3. v21 patch 11 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3m68k: save extra registers on more syscall entry pointsarch/m68k/kernel/entry.S arch/m68k/kernel/process.c arch/m68k/kernel/syscalls/syscall.tbl+65 -40 replies
2/3m68k: correctly handle IO worker stack frame set-uparch/m68k/kernel/entry.S arch/m68k/kernel/process.c+24 -40 replies
3/3m68k: track syscalls being traced with shallow user context stackarch/m68k/include/asm/entry.h arch/m68k/include/asm/thread_info.h arch/m68k/kernel/asm-offsets.c +2 more+104 -64 replies

Reviews trailers per patch

None of the 3 patches has a Reviewed-by or Acked-by of their own; the series has one for all of them.

PatchGeert Uytterhoeven
SeriesA-b
1/3
2/3
3/3

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v4 thread

Cover letter [PATCH v4 0/3] m68k: Improved switch stack handling

m68k version of Eric's patch series 'alpha/ptrace: Improved switch_stack handling'.

Registers d6, d7, a3-a6 are not saved on the stack by default on every syscall entry by the m68k kernel. A separate switch stack frame is pushed to save those registers as needed. This leaves the majority of syscalls with only a subset of registers on the stack, and access to unsaved registers in those would expose or modify random stack addresses.

Patch 1 and 2 add a switch stack for all syscalls that were found to need one to allow ptrace access to all registers outside of syscall entry/exit tracing, as well as kernel worker threads. This ought to protect against accidents.

Patch 3 adds safety checks and debug output to m68k get_reg() and put_reg() functions. Any unsafe register access during process tracing will be prevented and reported.

Suggestions for optimizations or improvements welcome!

Cheers,

Michael