hexagon: Remove CONFIG_HEXAGON_ARCH_VERSION from uapi header
authorThomas Huth <thuth@redhat.com>
Thu, 26 Oct 2023 11:31:14 +0000 (13:31 +0200)
committerArnd Bergmann <arnd@arndb.de>
Thu, 23 Nov 2023 09:38:58 +0000 (10:38 +0100)
uapi headers should not expose CONFIG switches since they are not
available in userspace. Fix it in arch/hexagon/include/uapi/asm/user.h
by always defining the cs0 and cs1 entries instead of pad values.

Suggested-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
arch/hexagon/include/uapi/asm/user.h
arch/hexagon/kernel/ptrace.c
scripts/headers_install.sh

index 7327ec59b22f54f334b213a3155f93186d4bc019..abae6a4b58137ff693d42a69f446692a72b852d1 100644 (file)
@@ -56,15 +56,10 @@ struct user_regs_struct {
        unsigned long pc;
        unsigned long cause;
        unsigned long badva;
-#if CONFIG_HEXAGON_ARCH_VERSION < 4
-       unsigned long pad1;  /* pad out to 48 words total */
-       unsigned long pad2;  /* pad out to 48 words total */
-       unsigned long pad3;  /* pad out to 48 words total */
-#else
+       /* cs0 and cs1 are only available with HEXAGON_ARCH_VERSION >= 4 */
        unsigned long cs0;
        unsigned long cs1;
        unsigned long pad1;  /* pad out to 48 words total */
-#endif
 };
 
 #endif
index 125f19995b76e5fc45520f83c50ea566e7c09179..905b06790ab70e31e6d6557fb4a0c868efeef77e 100644 (file)
@@ -74,7 +74,7 @@ static int genregs_set(struct task_struct *target,
                   unsigned int pos, unsigned int count,
                   const void *kbuf, const void __user *ubuf)
 {
-       int ret;
+       int ret, ignore_offset;
        unsigned long bucket;
        struct pt_regs *regs = task_pt_regs(target);
 
@@ -111,12 +111,15 @@ static int genregs_set(struct task_struct *target,
 #if CONFIG_HEXAGON_ARCH_VERSION >=4
        INEXT(&regs->cs0, cs0);
        INEXT(&regs->cs1, cs1);
+       ignore_offset = offsetof(struct user_regs_struct, pad1);
+#else
+       ignore_offset = offsetof(struct user_regs_struct, cs0);
 #endif
 
        /* Ignore the rest, if needed */
        if (!ret)
                user_regset_copyin_ignore(&pos, &count, &kbuf, &ubuf,
-                       offsetof(struct user_regs_struct, pad1), -1);
+                                         ignore_offset, -1);
        else
                return ret;
 
index c3064ac310030f9428a9f94e77facd8e0a99c310..f7d9b114de8f7d1341c7665dfb04733e40d08100 100755 (executable)
@@ -74,7 +74,6 @@ arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_16K
 arch/arc/include/uapi/asm/page.h:CONFIG_ARC_PAGE_SIZE_4K
 arch/arc/include/uapi/asm/swab.h:CONFIG_ARC_HAS_SWAPE
 arch/arm/include/uapi/asm/ptrace.h:CONFIG_CPU_ENDIAN_BE8
-arch/hexagon/include/uapi/asm/user.h:CONFIG_HEXAGON_ARCH_VERSION
 arch/m68k/include/uapi/asm/ptrace.h:CONFIG_COLDFIRE
 arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_NO
 arch/nios2/include/uapi/asm/swab.h:CONFIG_NIOS2_CI_SWAB_SUPPORT