Skip to content

Regset cleanups

Rick Edgecombe linux-fsdevel lkml 2 versions – Applied

Status from this message: Applied to for-next/execve, thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 5 repliesApplied
  2. v13 patches 13 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/3x86: Separate out x86_regset for 32 and 64 bitarch/x86/kernel/ptrace.c+42 -242 replies
2/3x86: Improve formatting of user_regset arraysarch/x86/kernel/ptrace.c+64 -410 replies
3/3elf: Don't write past end of notes for regset gapfs/binfmt_elf.c+14 -103 replies

Reviews trailers per patch

All 3 patches have a Reviewed-by or Acked-by.

PatchKees Cook
1/3A-b R-b
2/3R-b
3/3A-b

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

Read the v2 thread

Cover letter [PATCH v2 0/3] Regset cleanups

Hi,

I’m looking for ack’s on the first two patches from Intel reviewer’s before this is ready for official submission to x86 maintainers. Patch 3 is in core code, and Kees has offered to take it separately or ack it with the feedback on the previous version. The first posting of this already got some nice community feedback. Changes from v1 are in the patches. If you are not an Intel reviewer, feel free to ignore this until it has had more review.

While working on CET ptrace support, I found some suggested cleanups [0] [1] on past postings of that patch. So this small series is doing those cleanups and some related changes.

Way back then, it was noticed that CET ptrace patches were aliasing names in the enum that indexes the regsets. It turns out this was partly because of a limitation in core dump code that reads the registers for dumping. But excluding gaps in the regset array also allows them to be smaller, so just fixing the core dump code doesn’t remove all need for the specially crafted enum. So series changes the way the enums are defined such that enum has to be less carefully crafted, and also fixes the core dump code.

Patch 1 is improving the enums in x86 ptrace code.

Patch 2 is some x86 ptrace code formatting changes suggested by Ingo. [0]

Patch 3 is the fix to the core dump code. Just to be clear, there is no actual bug fixed. It would only overflow an array if the regset views were not laid out just so. But the regsets appear to be laid out so that the brittle code is not broken, from a quick scan of the archs.

Testing consisted of doing some core dumps and seeing that notes were in the same position, and verifying that the enum’s generated the same ints using printks.

Thanks,

Rick

[0] https://lore.kernel.org/lkml/[email protected]/
[1] https://lore.kernel.org/lkml/[email protected]/

Rick Edgecombe (3):
x86: Separate out x86_regset for 32 and 64 bit
x86: Improve formatting of user_regset arrays
elf: Don't write past end of notes for regset gap

 arch/x86/kernel/ptrace.c | 171 ++++++++++++++++++++++++---------------
 fs/binfmt_elf.c          |  24 +++---
 2 files changed, 120 insertions(+), 75 deletions(-)

base-commit: 09688c0166e76ce2fb85e86b9d99be8b0084cdf9

Signature · 1 line
2.17.1