From: Kees Cook <keescook@chromium.org>
To: Rick Edgecombe <rick.p.edgecombe@intel.com>
Cc: 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, linux-fsdevel@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/3] x86: Separate out x86_regset for 32 and 64 bit
Date: Tue, 15 Mar 2022 13:41:52 -0700 [thread overview]
Message-ID: <202203151340.7447F75BDC@keescook> (raw)
In-Reply-To: <20220315201706.7576-2-rick.p.edgecombe@intel.com>
On Tue, Mar 15, 2022 at 01:17:04PM -0700, Rick Edgecombe wrote:
> In ptrace, the x86_32_regsets and x86_64_regsets are constructed such that
> there are no gaps in the arrays. This appears to be for two reasons. One,
> the code in fill_thread_core_info() can't handle the gaps. This will be
> addressed in a future patch. And two, not having gaps shrinks the size of
> the array in memory.
>
> Both regset arrays draw their indices from a shared enum x86_regset, but 32
> bit and 64 bit don't all support the same regsets. In the case of
> IA32_EMULATION they can be compiled in at the same time. So this enum has
> to be laid out in a special way such that there are no gaps for both
> x86_32_regsets and x86_64_regsets. This involves creating aliases for
> enum’s that are only in one view or the other, or creating multiple
> versions like in the case of REGSET_IOPERM32/REGSET_IOPERM64.
>
> Simplify the construction of these arrays by just fully separating out the
> enums for 32 bit and 64 bit. Add some bitsize-free defines for
> REGSET_GENERAL and REGSET_FP since they are the only two referred to in
> bitsize generic code.
>
> This should have no functional change and is only changing how constants
> are generated and named. The enum is local to this file, so it does not
> introduce any burden on code calling from other places in the kernel now
> having to worry about whether to use a 32 bit or 64 bit enum name.
>
> [1] https://lore.kernel.org/lkml/20180717162502.32274-1-yu-cheng.yu@intel.com/
>
> Signed-off-by: Rick Edgecombe <rick.p.edgecombe@intel.com>
Have you verified there's no binary difference in machine code output?
Reviewed-by: Kees Cook <keescook@chromium.org>
--
Kees Cook
next prev parent reply other threads:[~2022-03-15 20:41 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-15 20:17 [PATCH 0/3] Regset cleanups Rick Edgecombe
2022-03-15 20:17 ` [PATCH 1/3] x86: Separate out x86_regset for 32 and 64 bit Rick Edgecombe
2022-03-15 20:41 ` Kees Cook [this message]
2022-03-15 21:53 ` Edgecombe, Rick P
2022-03-16 2:48 ` Kees Cook
2022-03-16 19:06 ` Edgecombe, Rick P
2022-03-16 19:42 ` Edgecombe, Rick P
2022-03-16 19:43 ` Kees Cook
2022-03-15 23:01 ` Eric W. Biederman
2022-03-15 23:33 ` Edgecombe, Rick P
2022-03-15 20:17 ` [PATCH 2/3] x86: Improve formatting of user_regset arrays Rick Edgecombe
2022-03-15 20:38 ` Kees Cook
2022-03-15 21:48 ` Edgecombe, Rick P
2022-03-15 20:17 ` [PATCH 3/3] elf: Don't write past end of notes for regset gap Rick Edgecombe
2022-03-15 20:37 ` Kees Cook
2022-03-15 21:48 ` Edgecombe, Rick P
2022-03-16 2:48 ` 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=202203151340.7447F75BDC@keescook \
--to=keescook@chromium.org \
--cc=dan.j.williams@intel.com \
--cc=dave.hansen@intel.com \
--cc=ebiederm@xmission.com \
--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=rick.p.edgecombe@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).