All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Huth <thuth@redhat.com>
To: Arnd Bergmann <arnd@arndb.de>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Oleg Nesterov <oleg@redhat.com>,
	"linux-hexagon@vger.kernel.org" <linux-hexagon@vger.kernel.org>,
	Brian Cain <bcain@quicinc.com>
Subject: Re: [PATCH] hexagon: Remove CONFIG_HEXAGON_ARCH_VERSION from uapi header
Date: Mon, 11 Dec 2023 17:22:16 +0100	[thread overview]
Message-ID: <e137a521-c546-4747-a6f6-258a82beeffe@redhat.com> (raw)
In-Reply-To: <SN6PR02MB4205BBAD065D3063745AE0B9B883A@SN6PR02MB4205.namprd02.prod.outlook.com>

On 29/11/2023 04.42, Brian Cain wrote:
> 
> 
>> -----Original Message-----
>> From: Thomas Huth <thuth@redhat.com>
>> Sent: Thursday, October 26, 2023 6:31 AM
>> To: Arnd Bergmann <arnd@arndb.de>; linux-hexagon@vger.kernel.org; Brian
>> Cain <bcain@quicinc.com>
>> Cc: linux-kernel@vger.kernel.org; Oleg Nesterov <oleg@redhat.com>
>> Subject: [PATCH] hexagon: Remove CONFIG_HEXAGON_ARCH_VERSION from
>> uapi header
>>
>> WARNING: This email originated from outside of Qualcomm. Please be wary of
>> any links or attachments, and do not enable macros.
>>
>> 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>
>> ---
>>   Based-on: <20231025073802.117625-1-thuth@redhat.com>
>>
>>   Compile tested only (with CONFIG_HEXAGON_ARCH_VERSION set to 2
>>   and with CONFIG_HEXAGON_ARCH_VERSION set to 4)
>>
>>   arch/hexagon/include/uapi/asm/user.h | 7 +------
>>   arch/hexagon/kernel/ptrace.c         | 7 +++++--
>>   scripts/headers_install.sh           | 1 -
>>   3 files changed, 6 insertions(+), 9 deletions(-)
>>
>> diff --git a/arch/hexagon/include/uapi/asm/user.h
>> b/arch/hexagon/include/uapi/asm/user.h
>> index 7327ec59b22f..abae6a4b5813 100644
>> --- a/arch/hexagon/include/uapi/asm/user.h
>> +++ b/arch/hexagon/include/uapi/asm/user.h
>> @@ -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
>> diff --git a/arch/hexagon/kernel/ptrace.c b/arch/hexagon/kernel/ptrace.c
>> index 125f19995b76..905b06790ab7 100644
>> --- a/arch/hexagon/kernel/ptrace.c
>> +++ b/arch/hexagon/kernel/ptrace.c
>> @@ -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;
>>
>> diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
>> index c3064ac31003..f7d9b114de8f 100755
>> --- a/scripts/headers_install.sh
>> +++ b/scripts/headers_install.sh
>> @@ -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
>> --
>> 2.41.0
> 
> Acked-by: Brian Cain <bcain@quicinc.com>

Thanks!

Arnd, could you maybe take this patch through your "generic include/asm 
header files" tree?

  Thomas



      reply	other threads:[~2023-12-11 16:22 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-26 11:31 [PATCH] hexagon: Remove CONFIG_HEXAGON_ARCH_VERSION from uapi header Thomas Huth
2023-11-29  3:42 ` Brian Cain
2023-12-11 16:22   ` Thomas Huth [this message]

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=e137a521-c546-4747-a6f6-258a82beeffe@redhat.com \
    --to=thuth@redhat.com \
    --cc=arnd@arndb.de \
    --cc=bcain@quicinc.com \
    --cc=linux-hexagon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.