linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Rick Edgecombe <rick.p.edgecombe@intel.com>
To: dave.hansen@intel.com, len.brown@intel.com, tony.luck@intel.com,
	rafael.j.wysocki@intel.com, reinette.chatre@intel.com,
	dan.j.williams@intel.com, viro@zeniv.linux.org.uk,
	ebiederm@xmission.com, keescook@chromium.org
Cc: Rick Edgecombe <rick.p.edgecombe@intel.com>,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v2 0/3] Regset cleanups
Date: Thu, 17 Mar 2022 12:20:10 -0700	[thread overview]
Message-ID: <20220317192013.13655-1-rick.p.edgecombe@intel.com> (raw)

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/20180711102035.GB8574@gmail.com/
[1] https://lore.kernel.org/lkml/A7775E11-8837-4727-921A-C88566FA01AF@amacapital.net/

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
-- 
2.17.1


             reply	other threads:[~2022-03-17 19:20 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-17 19:20 Rick Edgecombe [this message]
2022-03-17 19:20 ` [PATCH v2 1/3] x86: Separate out x86_regset for 32 and 64 bit Rick Edgecombe
2022-03-17 21:33   ` Kees Cook
2022-03-17 21:54     ` Edgecombe, Rick P
2022-03-17 19:20 ` [PATCH v2 2/3] x86: Improve formatting of user_regset arrays Rick Edgecombe
2022-03-17 19:20 ` [PATCH v2 3/3] elf: Don't write past end of notes for regset gap Rick Edgecombe
2022-03-17 21:26   ` Kees Cook
2022-03-17 21:53     ` Edgecombe, Rick P
2022-03-18 17:18   ` (subset) " Kees Cook

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220317192013.13655-1-rick.p.edgecombe@intel.com \
    --to=rick.p.edgecombe@intel.com \
    --cc=dan.j.williams@intel.com \
    --cc=dave.hansen@intel.com \
    --cc=ebiederm@xmission.com \
    --cc=keescook@chromium.org \
    --cc=len.brown@intel.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael.j.wysocki@intel.com \
    --cc=reinette.chatre@intel.com \
    --cc=tony.luck@intel.com \
    --cc=viro@zeniv.linux.org.uk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).