linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Linux 5.5=rc1 kselftest rseq test build failure
@ 2019-12-11  0:27 Shuah Khan
  2019-12-11 15:19 ` Mathieu Desnoyers
  0 siblings, 1 reply; 3+ messages in thread
From: Shuah Khan @ 2019-12-11  0:27 UTC (permalink / raw)
  To: Mathieu Desnoyers
  Cc: open list:KERNEL SELFTEST FRAMEWORK, Linux Kernel Mailing List,
	skh >> Shuah Khan

Hi Mathieu,

I am seeing rseq test build failure on Linux 5.5-rc1.

gcc -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./ 
param_test.c -lpthread -lrseq -o ...tools/testing/selftests/rseq/param_test
param_test.c:18:21: error: static declaration of ‘gettid’ follows 
non-static declaration
    18 | static inline pid_t gettid(void)
       |                     ^~~~~~
In file included from /usr/include/unistd.h:1170,
                  from param_test.c:11:
/usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous 
declaration of ‘gettid’ was here
    34 | extern __pid_t gettid (void) __THROW;
       |                ^~~~~~
make: *** [Makefile:28: ...tools/testing/selftests/rseq/param_test] Error 1


The following obvious change fixes it. However, there could be reason
why this was defined here. If you think this is the right fix, I can
send the patch. I started seeing this with gcc version 9.2.1 20191008

diff --git a/tools/testing/selftests/rseq/param_test.c 
b/tools/testing/selftests/rseq/param_test.c
index eec2663261f2..18a0fa1235a7 100644
--- a/tools/testing/selftests/rseq/param_test.c
+++ b/tools/testing/selftests/rseq/param_test.c
@@ -15,11 +15,6 @@
  #include <errno.h>
  #include <stddef.h>

-static inline pid_t gettid(void)
-{
-       return syscall(__NR_gettid);
-}
-

thanks,
-- Shuah

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: Linux 5.5=rc1 kselftest rseq test build failure
  2019-12-11  0:27 Linux 5.5=rc1 kselftest rseq test build failure Shuah Khan
@ 2019-12-11 15:19 ` Mathieu Desnoyers
  2019-12-11 15:45   ` Shuah Khan
  0 siblings, 1 reply; 3+ messages in thread
From: Mathieu Desnoyers @ 2019-12-11 15:19 UTC (permalink / raw)
  To: Shuah Khan; +Cc: linux-kselftest, linux-kernel

----- On Dec 10, 2019, at 7:27 PM, Shuah Khan skhan@linuxfoundation.org wrote:

> Hi Mathieu,
> 
> I am seeing rseq test build failure on Linux 5.5-rc1.
> 
> gcc -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./
> param_test.c -lpthread -lrseq -o ...tools/testing/selftests/rseq/param_test
> param_test.c:18:21: error: static declaration of ‘gettid’ follows
> non-static declaration
>    18 | static inline pid_t gettid(void)
>       |                     ^~~~~~
> In file included from /usr/include/unistd.h:1170,
>                  from param_test.c:11:
> /usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous
> declaration of ‘gettid’ was here
>    34 | extern __pid_t gettid (void) __THROW;
>       |                ^~~~~~
> make: *** [Makefile:28: ...tools/testing/selftests/rseq/param_test] Error 1
> 
> 
> The following obvious change fixes it. However, there could be reason
> why this was defined here. If you think this is the right fix, I can
> send the patch. I started seeing this with gcc version 9.2.1 20191008

This issue is caused by introduction of "gettid()" in glibc 2.30. I don't
think we want to introduce a build dependency on glibc 2.30 for kernel
selftests. Removing the gettid() symbol as you propose here will break
build environments with glibc < 2.30.

We could eventually try to figure out whether the glibc headers implement
gettid() at build time (not sure how), or we could simply rename our own
"gettid()" to "rseq_gettid()", thus removing the namespace clash with
glibc.

I can propose a patch renaming gettid() to rseq_gettid() is that approach
is OK with you.

Thanks,

Mathieu


> 
> diff --git a/tools/testing/selftests/rseq/param_test.c
> b/tools/testing/selftests/rseq/param_test.c
> index eec2663261f2..18a0fa1235a7 100644
> --- a/tools/testing/selftests/rseq/param_test.c
> +++ b/tools/testing/selftests/rseq/param_test.c
> @@ -15,11 +15,6 @@
>  #include <errno.h>
>  #include <stddef.h>
> 
> -static inline pid_t gettid(void)
> -{
> -       return syscall(__NR_gettid);
> -}
> -
> 
> thanks,
> -- Shuah

-- 
Mathieu Desnoyers
EfficiOS Inc.
http://www.efficios.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Linux 5.5=rc1 kselftest rseq test build failure
  2019-12-11 15:19 ` Mathieu Desnoyers
@ 2019-12-11 15:45   ` Shuah Khan
  0 siblings, 0 replies; 3+ messages in thread
From: Shuah Khan @ 2019-12-11 15:45 UTC (permalink / raw)
  To: Mathieu Desnoyers; +Cc: linux-kselftest, linux-kernel, Shuah Khan

On 12/11/19 8:19 AM, Mathieu Desnoyers wrote:
> ----- On Dec 10, 2019, at 7:27 PM, Shuah Khan skhan@linuxfoundation.org wrote:
> 
>> Hi Mathieu,
>>
>> I am seeing rseq test build failure on Linux 5.5-rc1.
>>
>> gcc -O2 -Wall -g -I./ -I../../../../usr/include/ -L./ -Wl,-rpath=./
>> param_test.c -lpthread -lrseq -o ...tools/testing/selftests/rseq/param_test
>> param_test.c:18:21: error: static declaration of ‘gettid’ follows
>> non-static declaration
>>     18 | static inline pid_t gettid(void)
>>        |                     ^~~~~~
>> In file included from /usr/include/unistd.h:1170,
>>                   from param_test.c:11:
>> /usr/include/x86_64-linux-gnu/bits/unistd_ext.h:34:16: note: previous
>> declaration of ‘gettid’ was here
>>     34 | extern __pid_t gettid (void) __THROW;
>>        |                ^~~~~~
>> make: *** [Makefile:28: ...tools/testing/selftests/rseq/param_test] Error 1
>>
>>
>> The following obvious change fixes it. However, there could be reason
>> why this was defined here. If you think this is the right fix, I can
>> send the patch. I started seeing this with gcc version 9.2.1 20191008
> 
> This issue is caused by introduction of "gettid()" in glibc 2.30. I don't
> think we want to introduce a build dependency on glibc 2.30 for kernel
> selftests. Removing the gettid() symbol as you propose here will break
> build environments with glibc < 2.30.
> 
> We could eventually try to figure out whether the glibc headers implement
> gettid() at build time (not sure how), or we could simply rename our own
> "gettid()" to "rseq_gettid()", thus removing the namespace clash with
> glibc.
> 
> I can propose a patch renaming gettid() to rseq_gettid() is that approach
> is OK with you.
> 

Looks like you already have a patch to do this. I see it in my Inbox.
I could take that.

thanks,
-- Shuah

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-12-11 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-11  0:27 Linux 5.5=rc1 kselftest rseq test build failure Shuah Khan
2019-12-11 15:19 ` Mathieu Desnoyers
2019-12-11 15:45   ` Shuah Khan

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