diff mbox series

selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests

Message ID 20241107131640.650703-1-kevin.brodsky@arm.com
State Accepted
Commit db64dfffcad2992d6bfc680822bdf715335c43f1
Headers show
Series selftests/mm: Define PKEY_UNRESTRICTED for pkey_sighandler_tests | expand

Commit Message

Kevin Brodsky Nov. 7, 2024, 1:16 p.m. UTC
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(+)

Comments

Catalin Marinas Nov. 7, 2024, 6 p.m. UTC | #1
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.
Shuah Khan Nov. 7, 2024, 9:26 p.m. UTC | #2
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 Marinas Nov. 7, 2024, 9:34 p.m. UTC | #3
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 Marinas Nov. 8, 2024, 11:07 a.m. UTC | #4
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
diff mbox series

Patch

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