[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202203171427.692F92D7@keescook>
Date: Thu, 17 Mar 2022 14:33:03 -0700
From: Kees Cook <keescook@...omium.org>
To: Rick Edgecombe <rick.p.edgecombe@...el.com>
Cc: dave.hansen@...el.com, len.brown@...el.com, tony.luck@...el.com,
rafael.j.wysocki@...el.com, reinette.chatre@...el.com,
dan.j.williams@...el.com, viro@...iv.linux.org.uk,
ebiederm@...ssion.com, linux-fsdevel@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/3] x86: Separate out x86_regset for 32 and 64 bit
On Thu, Mar 17, 2022 at 12:20:11PM -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. Also, change the name pattern to be like
> REGSET32_FOO, instead of REGSET_FOO32, to better emphasize that the bit
> size is the bitsize of the architecture, not the register itself.
>
> 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@...el.com>
> Acked-by: Kees Cook <keescook@...omium.org>
>
> ---
>
> v2:
> - Rename REGSET_FOO32 to REGSET32_FOO (Eric Biederman)
> - Drop Kees' Reviewed-by to Acked-by, due to changing enum value names
I think of "Ack" to mean "I am a maintainer of this area and someone can
carry this instead of it going via my tree". While I certainly poke and
ptrace and x86 a lot, I probably wouldn't Ack in this part of the
kernel. But it does seem "Reviewed-by" is a stronger signal[1].
Regardless, v2 looks good to me still. :)
Reviewed-by: Kees Cook <keescook@...omium.org>
-Kees
[1] https://www.kernel.org/doc/html/latest/process/submitting-patches.html#when-to-use-acked-by-cc-and-co-developed-by
--
Kees Cook
Powered by blists - more mailing lists