Thread (5 messages) 5 messages, 3 authors, 2024-07-17

Re: [PATCH v3 1/1] x86/elf: Add a new .note section containing xfeatures buffer layout info to x86 core files

From: Kees Cook <kees@kernel.org>
Date: 2024-07-17 17:16:53
Also in: linux-mm, linux-toolchains, lkml

On Wed, Jul 17, 2024 at 03:02:23PM +0530, Balasubrmanian, Vignesh wrote:
On 7/13/2024 4:12 PM, Thomas Gleixner wrote:
quoted
Caution: This message originated from an External Source. Use proper caution when opening attachments, clicking links, or responding.


On Fri, Jul 12 2024 at 15:16, Vignesh Balasubramanian wrote:
quoted
diff --git a/arch/x86/include/asm/elf.h b/arch/x86/include/asm/elf.h
index 1fb83d477..cad37090b 100644
--- a/arch/x86/include/asm/elf.h
+++ b/arch/x86/include/asm/elf.h
@@ -13,6 +13,15 @@
  #include <asm/auxvec.h>
  #include <asm/fsgsbase.h>

+struct xfeat_component {
+     u32 type;
+     u32 size;
+     u32 offset;
+     u32 flags;
+} __packed;
+
+_Static_assert(sizeof(struct xfeat_component)%4 == 0, "xfeat_component is not aligned");
This struct is only used in xstate.c and asm/elf.h is not a UAPI
header. So what's the point of declaring it in the header instead of
xtsate.c?

If this needs to provided for user space consumption, then it want's to
be in a UAPI header, no?
Our initial idea is to pass the "struct xfeat_component" through "glibc".
is "include/uapi/linux/elf.h" proper header to add this ?
I'd rather not put arch-specific things in the main UAPI elf.h file
unless there is a good reason.
I couldn't see any proper header inside "arch/x86/include/uapi/asm/".
Other architectures have arch/*/include/uapi/asm/elf.h, so it may be
time to add one for x86 too. For this to be UAPI, I would want to see
more explicit namespacing, e.g. struct x86_xfeat_component, etc.

-Kees

-- 
Kees Cook
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help