Message ID | a4956d838bf59b0a71a2553c5ca81131ea8b49b9.1596561758.git.sandipan@linux.ibm.com (mailing list archive) |
---|---|
State | Accepted |
Headers | show |
Series | [v4] selftests/powerpc: Fix pkey syscall redefinitions | expand |
Context | Check | Description |
---|---|---|
snowpatch_ozlabs/apply_patch | success | Successfully applied on branch powerpc/merge (14fd53d1e5ee7350564cac75e336f8c0dea13bc9) |
snowpatch_ozlabs/build-ppc64le | warning | Upstream build failed, couldn't test patch |
snowpatch_ozlabs/build-ppc64be | warning | Upstream build failed, couldn't test patch |
snowpatch_ozlabs/build-ppc64e | warning | Upstream build failed, couldn't test patch |
snowpatch_ozlabs/build-pmac32 | warning | Upstream build failed, couldn't test patch |
snowpatch_ozlabs/checkpatch | warning | total: 1 errors, 0 warnings, 0 checks, 32 lines checked |
snowpatch_ozlabs/needsstable | success | Patch fixes a commit that hasn't been released yet |
> On 04-Aug-2020, at 11:01 PM, Sandipan Das <sandipan@linux.ibm.com> wrote: > > On distros using older glibc versions, the pkey tests > encounter build failures due to redefinition of the > pkey syscall numbers. > > For compatibility, commit 743f3544fffb added a wrapper > for the gettid() syscall and included syscall.h if the > version of glibc used is older than 2.30. This leads > to different definitions of SYS_pkey_* as the ones in > the pkey test header set numeric constants where as the > ones from syscall.h reuse __NR_pkey_*. The compiler > complains about redefinitions since they are different. > > This replaces SYS_pkey_* definitions with __NR_pkey_* > such that the definitions in both syscall.h and pkeys.h > are alike. This way, if syscall.h has to be included > for compatibility reasons, builds will still succeed. > > Fixes: 743f3544fffb ("selftests/powerpc: Add wrapper for gettid") > Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com> > Suggested-by: David Laight <david.laight@aculab.com> > Suggested-by: Michael Ellerman <mpe@ellerman.id.au> > Signed-off-by: Sandipan Das <sandipan@linux.ibm.com> Tested-by: Sachin Sant <sachinp@linux.vnet.ibm.com> Thanks -Sachin
On Tue, 4 Aug 2020 23:01:37 +0530, Sandipan Das wrote: > On distros using older glibc versions, the pkey tests > encounter build failures due to redefinition of the > pkey syscall numbers. > > For compatibility, commit 743f3544fffb added a wrapper > for the gettid() syscall and included syscall.h if the > version of glibc used is older than 2.30. This leads > to different definitions of SYS_pkey_* as the ones in > the pkey test header set numeric constants where as the > ones from syscall.h reuse __NR_pkey_*. The compiler > complains about redefinitions since they are different. > > [...] Applied to powerpc/fixes. [1/1] selftests/powerpc: Fix pkey syscall redefinitions https://git.kernel.org/powerpc/c/a7aaa2f26bfd932a654706b19859e7adf802bee2 cheers
diff --git a/tools/testing/selftests/powerpc/include/pkeys.h b/tools/testing/selftests/powerpc/include/pkeys.h index 6ba95039a034..3312cb1b058d 100644 --- a/tools/testing/selftests/powerpc/include/pkeys.h +++ b/tools/testing/selftests/powerpc/include/pkeys.h @@ -31,9 +31,9 @@ #define SI_PKEY_OFFSET 0x20 -#define SYS_pkey_mprotect 386 -#define SYS_pkey_alloc 384 -#define SYS_pkey_free 385 +#define __NR_pkey_mprotect 386 +#define __NR_pkey_alloc 384 +#define __NR_pkey_free 385 #define PKEY_BITS_PER_PKEY 2 #define NR_PKEYS 32 @@ -62,17 +62,17 @@ void pkey_set_rights(int pkey, unsigned long rights) int sys_pkey_mprotect(void *addr, size_t len, int prot, int pkey) { - return syscall(SYS_pkey_mprotect, addr, len, prot, pkey); + return syscall(__NR_pkey_mprotect, addr, len, prot, pkey); } int sys_pkey_alloc(unsigned long flags, unsigned long rights) { - return syscall(SYS_pkey_alloc, flags, rights); + return syscall(__NR_pkey_alloc, flags, rights); } int sys_pkey_free(int pkey) { - return syscall(SYS_pkey_free, pkey); + return syscall(__NR_pkey_free, pkey); } int pkeys_unsupported(void)
On distros using older glibc versions, the pkey tests encounter build failures due to redefinition of the pkey syscall numbers. For compatibility, commit 743f3544fffb added a wrapper for the gettid() syscall and included syscall.h if the version of glibc used is older than 2.30. This leads to different definitions of SYS_pkey_* as the ones in the pkey test header set numeric constants where as the ones from syscall.h reuse __NR_pkey_*. The compiler complains about redefinitions since they are different. This replaces SYS_pkey_* definitions with __NR_pkey_* such that the definitions in both syscall.h and pkeys.h are alike. This way, if syscall.h has to be included for compatibility reasons, builds will still succeed. Fixes: 743f3544fffb ("selftests/powerpc: Add wrapper for gettid") Reported-by: Sachin Sant <sachinp@linux.vnet.ibm.com> Suggested-by: David Laight <david.laight@aculab.com> Suggested-by: Michael Ellerman <mpe@ellerman.id.au> Signed-off-by: Sandipan Das <sandipan@linux.ibm.com> --- Previous versions can be found at: v3: https://lore.kernel.org/linuxppc-dev/1bb744b0c7ed3985a5b73289f4de629ac0aeaf7c.1596453627.git.sandipan@linux.ibm.com/ v2: https://lore.kernel.org/linuxppc-dev/566dde119ce71f00f9642807ba30ceb7f54c9bfa.1596441105.git.sandipan@linux.ibm.com/ v1: https://lore.kernel.org/linuxppc-dev/20200803074043.466809-1-sandipan@linux.ibm.com/ Changes in v4: - Replace SYS_pkey_* with __NR_pkey_* based on suggestions from David and Michael. - Update commit message and add fixes tag. Changes in v3: - Use ifndef...endif instead of undef as suggested by Michael. Changes in v2: - Fix incorrect commit message. --- tools/testing/selftests/powerpc/include/pkeys.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)