* [PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions
@ 2020-08-03 7:55 Sandipan Das
2020-08-03 11:04 ` Michael Ellerman
0 siblings, 1 reply; 4+ messages in thread
From: Sandipan Das @ 2020-08-03 7:55 UTC (permalink / raw)
To: mpe; +Cc: sachinp, aneesh.kumar, linuxppc-dev
On some distros, there are conflicts w.r.t to redefinition
of pkey syscall numbers which cause build failures. This
fixes them.
Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
---
Previous versions can be found at:
v1: https://lore.kernel.org/linuxppc-dev/20200803074043.466809-1-sandipan@linux.ibm.com/
Changes in v2:
- Fix incorrect commit message.
---
tools/testing/selftests/powerpc/include/pkeys.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/testing/selftests/powerpc/include/pkeys.h b/tools/testing/selftests/powerpc/include/pkeys.h
index 6ba95039a034..26eef5c1f8ea 100644
--- a/tools/testing/selftests/powerpc/include/pkeys.h
+++ b/tools/testing/selftests/powerpc/include/pkeys.h
@@ -31,8 +31,13 @@
#define SI_PKEY_OFFSET 0x20
+#undef SYS_pkey_mprotect
#define SYS_pkey_mprotect 386
+
+#undef SYS_pkey_alloc
#define SYS_pkey_alloc 384
+
+#undef SYS_pkey_free
#define SYS_pkey_free 385
#define PKEY_BITS_PER_PKEY 2
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions
2020-08-03 7:55 [PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions Sandipan Das
@ 2020-08-03 11:04 ` Michael Ellerman
2020-08-03 11:35 ` Sandipan Das
2020-08-03 14:42 ` David Laight
0 siblings, 2 replies; 4+ messages in thread
From: Michael Ellerman @ 2020-08-03 11:04 UTC (permalink / raw)
To: Sandipan Das; +Cc: sachinp, aneesh.kumar, linuxppc-dev
Sandipan Das <sandipan@linux.ibm.com> writes:
> On some distros, there are conflicts w.r.t to redefinition
> of pkey syscall numbers which cause build failures. This
> fixes them.
>
> Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
> Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
> ---
> Previous versions can be found at:
> v1: https://lore.kernel.org/linuxppc-dev/20200803074043.466809-1-sandipan@linux.ibm.com/
>
> Changes in v2:
> - Fix incorrect commit message.
>
> ---
> tools/testing/selftests/powerpc/include/pkeys.h | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/tools/testing/selftests/powerpc/include/pkeys.h b/tools/testing/selftests/powerpc/include/pkeys.h
> index 6ba95039a034..26eef5c1f8ea 100644
> --- a/tools/testing/selftests/powerpc/include/pkeys.h
> +++ b/tools/testing/selftests/powerpc/include/pkeys.h
> @@ -31,8 +31,13 @@
>
> #define SI_PKEY_OFFSET 0x20
>
> +#undef SYS_pkey_mprotect
> #define SYS_pkey_mprotect 386
We shouldn't undef them.
They should obviously never change, but if the system headers already
have a definition then we should use that, so I think it should be:
#ifndef SYS_pkey_mprotect
#define SYS_pkey_mprotect 386
#endif
cheers
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions
2020-08-03 11:04 ` Michael Ellerman
@ 2020-08-03 11:35 ` Sandipan Das
2020-08-03 14:42 ` David Laight
1 sibling, 0 replies; 4+ messages in thread
From: Sandipan Das @ 2020-08-03 11:35 UTC (permalink / raw)
To: Michael Ellerman; +Cc: sachinp, aneesh.kumar, linuxppc-dev
On 03/08/20 4:34 pm, Michael Ellerman wrote:
> Sandipan Das <sandipan@linux.ibm.com> writes:
>> On some distros, there are conflicts w.r.t to redefinition
>> of pkey syscall numbers which cause build failures. This
>> fixes them.
>>
>> Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com>
>> Signed-off-by: Sandipan Das <sandipan@linux.ibm.com>
>> ---
>> Previous versions can be found at:
>> v1: https://lore.kernel.org/linuxppc-dev/20200803074043.466809-1-sandipan@linux.ibm.com/
>>
>> Changes in v2:
>> - Fix incorrect commit message.
>>
>> ---
>> tools/testing/selftests/powerpc/include/pkeys.h | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/tools/testing/selftests/powerpc/include/pkeys.h b/tools/testing/selftests/powerpc/include/pkeys.h
>> index 6ba95039a034..26eef5c1f8ea 100644
>> --- a/tools/testing/selftests/powerpc/include/pkeys.h
>> +++ b/tools/testing/selftests/powerpc/include/pkeys.h
>> @@ -31,8 +31,13 @@
>>
>> #define SI_PKEY_OFFSET 0x20
>>
>> +#undef SYS_pkey_mprotect
>> #define SYS_pkey_mprotect 386
>
> We shouldn't undef them.
>
> They should obviously never change, but if the system headers already
> have a definition then we should use that, so I think it should be:
>
> #ifndef SYS_pkey_mprotect
> #define SYS_pkey_mprotect 386
> #endif
>
Agreed. This had me confused.
$ grep -nr "#define __NR_pkey_" /usr/include/
/usr/include/asm-generic/unistd.h:767:#define __NR_pkey_mprotect 288
/usr/include/asm-generic/unistd.h:769:#define __NR_pkey_alloc 289
/usr/include/asm-generic/unistd.h:771:#define __NR_pkey_free 290
/usr/include/powerpc64le-linux-gnu/asm/unistd_32.h:374:#define __NR_pkey_alloc 384
/usr/include/powerpc64le-linux-gnu/asm/unistd_32.h:375:#define __NR_pkey_free 385
/usr/include/powerpc64le-linux-gnu/asm/unistd_32.h:376:#define __NR_pkey_mprotect 386
/usr/include/powerpc64le-linux-gnu/asm/unistd_64.h:365:#define __NR_pkey_alloc 384
/usr/include/powerpc64le-linux-gnu/asm/unistd_64.h:366:#define __NR_pkey_free 385
/usr/include/powerpc64le-linux-gnu/asm/unistd_64.h:367:#define __NR_pkey_mprotect 386
...
But it looks like including unistd.h from a C program picks the
right values.
- Sandipan
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions
2020-08-03 11:04 ` Michael Ellerman
2020-08-03 11:35 ` Sandipan Das
@ 2020-08-03 14:42 ` David Laight
1 sibling, 0 replies; 4+ messages in thread
From: David Laight @ 2020-08-03 14:42 UTC (permalink / raw)
To: 'Michael Ellerman', Sandipan Das
Cc: sachinp, aneesh.kumar, linuxppc-dev
> > +#undef SYS_pkey_mprotect
> > #define SYS_pkey_mprotect 386
>
> We shouldn't undef them.
>
> They should obviously never change, but if the system headers already
> have a definition then we should use that, so I think it should be:
>
> #ifndef SYS_pkey_mprotect
> #define SYS_pkey_mprotect 386
> #endif
If the definitions are identical the compiler won't complain.
So you probably actually want a matching definition so that,
provided at least one compile picks up both headers, you know
that the definitions actually match.
David
-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-08-03 14:45 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-03 7:55 [PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions Sandipan Das
2020-08-03 11:04 ` Michael Ellerman
2020-08-03 11:35 ` Sandipan Das
2020-08-03 14:42 ` David Laight
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.