linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Sandipan Das <sandipan@linux.ibm.com>
To: Michael Ellerman <mpe@ellerman.id.au>
Cc: sachinp@linux.vnet.ibm.com, aneesh.kumar@linux.ibm.com,
	linuxppc-dev@lists.ozlabs.org
Subject: Re: [PATCH v2] selftests/powerpc: Fix pkey syscall redefinitions
Date: Mon, 3 Aug 2020 17:05:35 +0530	[thread overview]
Message-ID: <8b0e0ff9-5dad-7abb-de15-6193afe4f66b@linux.ibm.com> (raw)
In-Reply-To: <8736540z3w.fsf@mpe.ellerman.id.au>



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

  reply	other threads:[~2020-08-03 11:37 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2020-08-03 14:42   ` David Laight

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=8b0e0ff9-5dad-7abb-de15-6193afe4f66b@linux.ibm.com \
    --to=sandipan@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=mpe@ellerman.id.au \
    --cc=sachinp@linux.vnet.ibm.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 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).