linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests
@ 2024-11-07 13:16 Kevin Brodsky
  2024-11-07 16:50 ` Shuah Khan
  2024-11-08 11:07 ` Catalin Marinas
  0 siblings, 2 replies; 6+ messages in thread
From: Kevin Brodsky @ 2024-11-07 13:16 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: catalin.marinas, dave.hansen, yury.khrustalev, will,
	linux-kselftest, Kevin Brodsky, Aishwarya TCV

Commit 6e182dc9f268 ("selftests/mm: Use generic pkey register
manipulation") makes use of PKEY_UNRESTRICTED in
pkey_sighandler_tests. The macro has been proposed for addition to
uapi headers [1], but the patch hasn't landed yet.

Define PKEY_UNRESTRICTED in pkey-helpers.h for the time being to fix
the build.

[1] https://lore.kernel.org/all/20241028090715.509527-2-yury.khrustalev@arm.com/

Fixes: 6e182dc9f268 ("selftests/mm: Use generic pkey register
manipulation")
Reported-by: Aishwarya TCV <aishwarya.tcv@arm.com>
Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
---

Based on arm64 for-next/pkey-signal (49f59573e9e0).

---
 tools/testing/selftests/mm/pkey-helpers.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/tools/testing/selftests/mm/pkey-helpers.h b/tools/testing/selftests/mm/pkey-helpers.h
index 9ab6a3ee153b..319f5b6b7132 100644
--- a/tools/testing/selftests/mm/pkey-helpers.h
+++ b/tools/testing/selftests/mm/pkey-helpers.h
@@ -112,6 +112,10 @@ void record_pkey_malloc(void *ptr, long size, int prot);
 #define PKEY_MASK	(PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE)
 #endif
 
+#ifndef PKEY_UNRESTRICTED
+#define PKEY_UNRESTRICTED 0x0
+#endif
+
 #ifndef set_pkey_bits
 static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags)
 {
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests
  2024-11-07 13:16 [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests Kevin Brodsky
@ 2024-11-07 16:50 ` Shuah Khan
  2024-11-07 18:00   ` Catalin Marinas
  2024-11-08 11:07 ` Catalin Marinas
  1 sibling, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2024-11-07 16:50 UTC (permalink / raw)
  To: Kevin Brodsky, linux-arm-kernel
  Cc: catalin.marinas, dave.hansen, yury.khrustalev, will,
	linux-kselftest, Aishwarya TCV, Shuah Khan

On 11/7/24 06:16, Kevin Brodsky wrote:
> Commit 6e182dc9f268 ("selftests/mm: Use generic pkey register
> manipulation") makes use of PKEY_UNRESTRICTED in
> pkey_sighandler_tests. The macro has been proposed for addition to
> uapi headers [1], but the patch hasn't landed yet.
> 
> Define PKEY_UNRESTRICTED in pkey-helpers.h for the time being to fix
> the build.

What does mean to say "time being" - can this be removed in the
future. If so please add a FIXME so this define can be removed
later.

> 
> [1] https://lore.kernel.org/all/20241028090715.509527-2-yury.khrustalev@arm.com/
> 
> Fixes: 6e182dc9f268 ("selftests/mm: Use generic pkey register
> manipulation")
> Reported-by: Aishwarya TCV <aishwarya.tcv@arm.com>
> Signed-off-by: Kevin Brodsky <kevin.brodsky@arm.com>
> ---
> 
> Based on arm64 for-next/pkey-signal (49f59573e9e0).
> 
> ---
>   tools/testing/selftests/mm/pkey-helpers.h | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/tools/testing/selftests/mm/pkey-helpers.h b/tools/testing/selftests/mm/pkey-helpers.h
> index 9ab6a3ee153b..319f5b6b7132 100644
> --- a/tools/testing/selftests/mm/pkey-helpers.h
> +++ b/tools/testing/selftests/mm/pkey-helpers.h
> @@ -112,6 +112,10 @@ void record_pkey_malloc(void *ptr, long size, int prot);
>   #define PKEY_MASK	(PKEY_DISABLE_ACCESS | PKEY_DISABLE_WRITE)
>   #endif
>   
> +#ifndef PKEY_UNRESTRICTED
> +#define PKEY_UNRESTRICTED 0x0
> +#endif

Where would this be defined in the future? I couldn't find it
in any kernel header files on linux-next.


> +
>   #ifndef set_pkey_bits
>   static inline u64 set_pkey_bits(u64 reg, int pkey, u64 flags)
>   {

thanks,
-- Shuah


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests
  2024-11-07 16:50 ` Shuah Khan
@ 2024-11-07 18:00   ` Catalin Marinas
  2024-11-07 21:26     ` Shuah Khan
  0 siblings, 1 reply; 6+ messages in thread
From: Catalin Marinas @ 2024-11-07 18:00 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Kevin Brodsky, linux-arm-kernel, dave.hansen, yury.khrustalev,
	will, linux-kselftest, Aishwarya TCV

On Thu, Nov 07, 2024 at 09:50:20AM -0700, Shuah Khan wrote:
> On 11/7/24 06:16, Kevin Brodsky wrote:
> > Commit 6e182dc9f268 ("selftests/mm: Use generic pkey register
> > manipulation") makes use of PKEY_UNRESTRICTED in
> > pkey_sighandler_tests. The macro has been proposed for addition to
> > uapi headers [1], but the patch hasn't landed yet.
> > 
> > Define PKEY_UNRESTRICTED in pkey-helpers.h for the time being to fix
> > the build.
> 
> What does mean to say "time being" - can this be removed in the
> future. If so please add a FIXME so this define can be removed
> later.

There's a dependency on this series:

https://lore.kernel.org/r/20241028090715.509527-2-yury.khrustalev@arm.com/

Which I did not notice. Typically the uapi patches are picked by Arnd
but first that series needs to be reposted with the comments addressed.

I think for now we either merge this fix from Kevin (happy to add a
FIXME comment when applying), change the kselftest to use 0 instead of
PKEY_UNRESTRICTED or revert the top two patches here:

https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=for-next/pkey-signal

I'm fine with all options really, it's not essential that we get the
kselftest patches above merged in 6.13.

-- 
Catalin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests
  2024-11-07 18:00   ` Catalin Marinas
@ 2024-11-07 21:26     ` Shuah Khan
  2024-11-07 21:34       ` Catalin Marinas
  0 siblings, 1 reply; 6+ messages in thread
From: Shuah Khan @ 2024-11-07 21:26 UTC (permalink / raw)
  To: Catalin Marinas
  Cc: Kevin Brodsky, linux-arm-kernel, dave.hansen, yury.khrustalev,
	will, linux-kselftest, Aishwarya TCV, Shuah Khan

On 11/7/24 11:00, Catalin Marinas wrote:
> On Thu, Nov 07, 2024 at 09:50:20AM -0700, Shuah Khan wrote:
>> On 11/7/24 06:16, Kevin Brodsky wrote:
>>> Commit 6e182dc9f268 ("selftests/mm: Use generic pkey register
>>> manipulation") makes use of PKEY_UNRESTRICTED in
>>> pkey_sighandler_tests. The macro has been proposed for addition to
>>> uapi headers [1], but the patch hasn't landed yet.
>>>
>>> Define PKEY_UNRESTRICTED in pkey-helpers.h for the time being to fix
>>> the build.
>>
>> What does mean to say "time being" - can this be removed in the
>> future. If so please add a FIXME so this define can be removed
>> later.
> 
> There's a dependency on this series:
> 
> https://lore.kernel.org/r/20241028090715.509527-2-yury.khrustalev@arm.com/
> 
> Which I did not notice. Typically the uapi patches are picked by Arnd
> but first that series needs to be reposted with the comments addressed.
> 
> I think for now we either merge this fix from Kevin (happy to add a
> FIXME comment when applying), change the kselftest to use 0 instead of
> PKEY_UNRESTRICTED or revert the top two patches here:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=for-next/pkey-signal
> 
> I'm fine with all options really, it's not essential that we get the
> kselftest patches above merged in 6.13.
> 

I am good with taking this patch as is with a FIXME to cleanup
later.

thanks,
-- Shuah




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests
  2024-11-07 21:26     ` Shuah Khan
@ 2024-11-07 21:34       ` Catalin Marinas
  0 siblings, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2024-11-07 21:34 UTC (permalink / raw)
  To: Shuah Khan
  Cc: Kevin Brodsky, linux-arm-kernel, dave.hansen, yury.khrustalev,
	will, linux-kselftest, Aishwarya TCV

On Thu, Nov 07, 2024 at 02:26:11PM -0700, Shuah Khan wrote:
> On 11/7/24 11:00, Catalin Marinas wrote:
> > On Thu, Nov 07, 2024 at 09:50:20AM -0700, Shuah Khan wrote:
> > > On 11/7/24 06:16, Kevin Brodsky wrote:
> > > > Commit 6e182dc9f268 ("selftests/mm: Use generic pkey register
> > > > manipulation") makes use of PKEY_UNRESTRICTED in
> > > > pkey_sighandler_tests. The macro has been proposed for addition to
> > > > uapi headers [1], but the patch hasn't landed yet.
> > > > 
> > > > Define PKEY_UNRESTRICTED in pkey-helpers.h for the time being to fix
> > > > the build.
> > > 
> > > What does mean to say "time being" - can this be removed in the
> > > future. If so please add a FIXME so this define can be removed
> > > later.
> > 
> > There's a dependency on this series:
> > 
> > https://lore.kernel.org/r/20241028090715.509527-2-yury.khrustalev@arm.com/
> > 
> > Which I did not notice. Typically the uapi patches are picked by Arnd
> > but first that series needs to be reposted with the comments addressed.
> > 
> > I think for now we either merge this fix from Kevin (happy to add a
> > FIXME comment when applying), change the kselftest to use 0 instead of
> > PKEY_UNRESTRICTED or revert the top two patches here:
> > 
> > https://git.kernel.org/pub/scm/linux/kernel/git/arm64/linux.git/log/?h=for-next/pkey-signal
> > 
> > I'm fine with all options really, it's not essential that we get the
> > kselftest patches above merged in 6.13.
> 
> I am good with taking this patch as is with a FIXME to cleanup
> later.

Thanks Shuah.

-- 
Catalin


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests
  2024-11-07 13:16 [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests Kevin Brodsky
  2024-11-07 16:50 ` Shuah Khan
@ 2024-11-08 11:07 ` Catalin Marinas
  1 sibling, 0 replies; 6+ messages in thread
From: Catalin Marinas @ 2024-11-08 11:07 UTC (permalink / raw)
  To: linux-arm-kernel, Kevin Brodsky
  Cc: Will Deacon, dave.hansen, yury.khrustalev, linux-kselftest,
	Aishwarya TCV

On Thu, 07 Nov 2024 13:16:40 +0000, Kevin Brodsky wrote:
> Commit 6e182dc9f268 ("selftests/mm: Use generic pkey register
> manipulation") makes use of PKEY_UNRESTRICTED in
> pkey_sighandler_tests. The macro has been proposed for addition to
> uapi headers [1], but the patch hasn't landed yet.
> 
> Define PKEY_UNRESTRICTED in pkey-helpers.h for the time being to fix
> the build.
> 
> [...]

Applied to arm64 (for-next/pkey-signal), thanks!

I also added a FIXME comment to remove this macro once the generic
definition lands upstream.

[1/1] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests
      https://git.kernel.org/arm64/c/db64dfffcad2

-- 
Catalin



^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-11-08 11:49 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-07 13:16 [PATCH] selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests Kevin Brodsky
2024-11-07 16:50 ` Shuah Khan
2024-11-07 18:00   ` Catalin Marinas
2024-11-07 21:26     ` Shuah Khan
2024-11-07 21:34       ` Catalin Marinas
2024-11-08 11:07 ` Catalin Marinas

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).