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>,
	Christophe Leroy <christophe.leroy@csgroup.eu>
Cc: fweimer@redhat.com, aneesh.kumar@linux.ibm.com,
	linuxram@us.ibm.com, linuxppc-dev@lists.ozlabs.org,
	bauerman@linux.ibm.com
Subject: Re: [PATCH 5/5] selftests/powerpc: Add test for pkey siginfo verification
Date: Mon, 27 Jul 2020 08:57:44 +0530	[thread overview]
Message-ID: <7c0b5b72-d82b-ac6a-8f5c-f1a7c55d14dc@linux.ibm.com> (raw)
In-Reply-To: <87zh7lg7g5.fsf@mpe.ellerman.id.au>



On 27/07/20 5:22 am, Michael Ellerman wrote:
> Christophe Leroy <christophe.leroy@csgroup.eu> writes:
>> Michael Ellerman <mpe@ellerman.id.au> a écrit :
>>> Sandipan Das <sandipan@linux.ibm.com> writes:
>>>> diff --git a/tools/testing/selftests/powerpc/mm/pkey_siginfo.c  
>>>> b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c
>>>> new file mode 100644
>>>> index 0000000000000..58605c53d495d
>>>> --- /dev/null
>>>> +++ b/tools/testing/selftests/powerpc/mm/pkey_siginfo.c
>>>> @@ -0,0 +1,332 @@
>>> ...
>>>> +
>>>> +static void *protect(void *p)
>>>> +{
>>>> +	unsigned long rights;
>>>> +	unsigned int *base;
>>>> +	size_t size;
>>>> +	int tid, i;
>>>> +
>>>> +	tid = gettid();
>>>
>>> pkey_siginfo.c: In function 'protect':
>>> pkey_siginfo.c:103:8: error: implicit declaration of function  
>>> 'gettid' [-Werror=implicit-function-declaration]
>>>   tid = gettid();
>>>         ^
>>>
>>>
>>> On Ubuntu 18.04 at least.
>>
>> See https://man7.org/linux/man-pages/man2/gettid.2.html
>>
>> Added in glibc 2.30
> 
> Thanks, this seems to work:
> 
> diff --git a/tools/testing/selftests/powerpc/include/utils.h b/tools/testing/selftests/powerpc/include/utils.h
> index 69d16875802d..71d2924f5b8b 100644
> --- a/tools/testing/selftests/powerpc/include/utils.h
> +++ b/tools/testing/selftests/powerpc/include/utils.h
> @@ -42,6 +42,16 @@ int perf_event_enable(int fd);
>  int perf_event_disable(int fd);
>  int perf_event_reset(int fd);
>  
> +#if !defined(__GLIBC_PREREQ) || !__GLIBC_PREREQ(2, 30)
> +#include <unistd.h>
> +#include <sys/syscall.h>
> +
> +static inline pid_t gettid(void)
> +{
> +	return syscall(SYS_gettid);
> +}
> +#endif
> +
>  static inline bool have_hwcap(unsigned long ftr)
>  {
>  	return ((unsigned long)get_auxv_entry(AT_HWCAP) & ftr) == ftr;
> 
> 
> cheers
> 

Thanks for catching this. Will add these changes to v2.

- Sandipan

      reply	other threads:[~2020-07-27  3:31 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-16 11:03 [PATCH 0/5] Improvements to pkey tests Sandipan Das
2020-07-16 11:03 ` [PATCH 1/5] selftests/powerpc: Move pkey helpers to headers Sandipan Das
2020-07-16 11:03 ` [PATCH 2/5] selftests/powerpc: Add pkey helpers for rights Sandipan Das
2020-07-16 11:03 ` [PATCH 3/5] selftests/powerpc: Harden test for execute-disabled pkeys Sandipan Das
2020-07-16 11:03 ` [PATCH 4/5] selftests/powerpc: Add helper to exit on failure Sandipan Das
2020-07-16 11:03 ` [PATCH 5/5] selftests/powerpc: Add test for pkey siginfo verification Sandipan Das
2020-07-26 14:05   ` Michael Ellerman
2020-07-26 14:40     ` Christophe Leroy
2020-07-26 23:52       ` Michael Ellerman
2020-07-27  3:27         ` Sandipan Das [this message]

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=7c0b5b72-d82b-ac6a-8f5c-f1a7c55d14dc@linux.ibm.com \
    --to=sandipan@linux.ibm.com \
    --cc=aneesh.kumar@linux.ibm.com \
    --cc=bauerman@linux.ibm.com \
    --cc=christophe.leroy@csgroup.eu \
    --cc=fweimer@redhat.com \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=linuxram@us.ibm.com \
    --cc=mpe@ellerman.id.au \
    /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).