2020-02-12 00:36:05

by Shuah Khan

[permalink] [raw]
Subject: Linux 5.6-rc1 kselftest build failures

The following tests fail to build on x86_64

openat2:

tools/testing/selftests/openat2'
gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined
openat2_test.c helpers.c -o tools/testing/selftests/openat2/openat2_test
In file included from /usr/include/fcntl.h:301,
from helpers.c:9:
In function ‘openat’,
inlined from ‘touchat’ at helpers.c:49:11:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:126:4: error: call to
‘__openat_missing_mode’ declared with attribute error: openat with
O_CREAT or O_TMPFILE in third argument needs 4 arguments
126 | __openat_missing_mode ();
| ^~~~~~~~~~~~~~~~~~~~~~~~

timerns:

tools/testing/selftests/timens'
gcc -Wall -Werror -pthread -lrt -ldl timens.c -o
tools/testing/selftests/timens/timens
/usr/bin/ld: /tmp/ccGy5CST.o: in function `check_config_posix_timers':
timens.c:(.text+0x65a): undefined reference to `timer_create'
collect2: error: ld returned 1 exit status

thanks,
-- Shuah


2020-02-12 08:16:04

by Aleksa Sarai

[permalink] [raw]
Subject: Re: Linux 5.6-rc1 kselftest build failures

On 2020-02-11, shuah <[email protected]> wrote:
> openat2:
>
> tools/testing/selftests/openat2'
> gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined openat2_test.c
> helpers.c -o tools/testing/selftests/openat2/openat2_test
> In file included from /usr/include/fcntl.h:301,
> from helpers.c:9:
> In function ‘openat’,
> inlined from ‘touchat’ at helpers.c:49:11:
> /usr/include/x86_64-linux-gnu/bits/fcntl2.h:126:4: error: call to
> ‘__openat_missing_mode’ declared with attribute error: openat with O_CREAT
> or O_TMPFILE in third argument needs 4 arguments
> 126 | __openat_missing_mode ();
> | ^~~~~~~~~~~~~~~~~~~~~~~~

Yeah, that's a brain-o -- it looks like you have a newer glibc than
me which gives you a warning when you don't set the mode. The fix should
be just the following:

--8<-----------------------------------------------------------------------
Subject: [PATCH] selftests: openat2: fix build error on newer glibc

It appears that newer glibcs check that openat(O_CREAT) was provided a
fourth argument (rather than passing garbage), resulting in the
following build error:

In file included from /usr/include/fcntl.h:301,
from helpers.c:9:
In function ‘openat’,
inlined from ‘touchat’ at helpers.c:49:11:
/usr/include/x86_64-linux-gnu/bits/fcntl2.h:126:4: error: call to
‘__openat_missing_mode’ declared with attribute error: openat with O_CREAT
or O_TMPFILE in third argument needs 4 arguments
126 | __openat_missing_mode ();
| ^~~~~~~~~~~~~~~~~~~~~~~~

Reported-by: Shuah Khan <[email protected]>
Signed-off-by: Aleksa Sarai <[email protected]>
---
tools/testing/selftests/openat2/helpers.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/openat2/helpers.c b/tools/testing/selftests/openat2/helpers.c
index e9a6557ab16f..5074681ffdc9 100644
--- a/tools/testing/selftests/openat2/helpers.c
+++ b/tools/testing/selftests/openat2/helpers.c
@@ -46,7 +46,7 @@ int sys_renameat2(int olddirfd, const char *oldpath,

int touchat(int dfd, const char *path)
{
- int fd = openat(dfd, path, O_CREAT);
+ int fd = openat(dfd, path, O_CREAT, 0700);
if (fd >= 0)
close(fd);
return fd;
--
2.25.0


Attachments:
(No filename) (2.28 kB)
signature.asc (235.00 B)
Download all attachments

2020-02-12 14:10:08

by Dmitry Safonov

[permalink] [raw]
Subject: Re: Linux 5.6-rc1 kselftest build failures

Hi Shuah,

On 2/12/20 12:35 AM, shuah wrote:
> The following tests fail to build on x86_64
[..]
> timerns:
>
> tools/testing/selftests/timens'
> gcc -Wall -Werror -pthread  -lrt -ldl  timens.c  -o
> tools/testing/selftests/timens/timens
> /usr/bin/ld: /tmp/ccGy5CST.o: in function `check_config_posix_timers':
> timens.c:(.text+0x65a): undefined reference to `timer_create'
> collect2: error: ld returned 1 exit status

I've just send a patch to fix it:
https://lkml.kernel.org/r/[email protected]

Could you try it?

Also, it seems that the same thing affects futex/rtc/tcp_mmap/tcp_inq tests?

While looking into this, I see there are new auto-generated lkmdtm &&
pidfd tests, is it worth to add them to .gitignore?

Thanks,
Dmitry

2020-02-12 17:40:15

by Shuah Khan

[permalink] [raw]
Subject: Re: Linux 5.6-rc1 kselftest build failures

On 2/12/20 1:14 AM, Aleksa Sarai wrote:
> On 2020-02-11, shuah <[email protected]> wrote:
>> openat2:
>>
>> tools/testing/selftests/openat2'
>> gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined openat2_test.c
>> helpers.c -o tools/testing/selftests/openat2/openat2_test
>> In file included from /usr/include/fcntl.h:301,
>> from helpers.c:9:
>> In function ‘openat’,
>> inlined from ‘touchat’ at helpers.c:49:11:
>> /usr/include/x86_64-linux-gnu/bits/fcntl2.h:126:4: error: call to
>> ‘__openat_missing_mode’ declared with attribute error: openat with O_CREAT
>> or O_TMPFILE in third argument needs 4 arguments
>> 126 | __openat_missing_mode ();
>> | ^~~~~~~~~~~~~~~~~~~~~~~~
>
> Yeah, that's a brain-o -- it looks like you have a newer glibc than
> me which gives you a warning when you don't set the mode. The fix should
> be just the following:
>

Nice. Do you mind sending a proper patch, I can pull in.

thanks,
-- Shuah

2020-02-12 18:18:29

by Shuah Khan

[permalink] [raw]
Subject: Re: Linux 5.6-rc1 kselftest build failures

On 2/12/20 7:09 AM, Dmitry Safonov wrote:
> Hi Shuah,
>
> On 2/12/20 12:35 AM, shuah wrote:
>> The following tests fail to build on x86_64
> [..]
>> timerns:
>>
>> tools/testing/selftests/timens'
>> gcc -Wall -Werror -pthread  -lrt -ldl  timens.c  -o
>> tools/testing/selftests/timens/timens
>> /usr/bin/ld: /tmp/ccGy5CST.o: in function `check_config_posix_timers':
>> timens.c:(.text+0x65a): undefined reference to `timer_create'
>> collect2: error: ld returned 1 exit status
>
> I've just send a patch to fix it:
> https://lkml.kernel.org/r/[email protected]
>
> Could you try it?

Yup. Works, responsed to the patch thread.

>
> Also, it seems that the same thing affects futex/rtc/tcp_mmap/tcp_inq tests?
>
> While looking into this, I see there are new auto-generated lkmdtm &&
> pidfd tests, is it worth to add them to .gitignore?
>

Thanks for finding. Yes please send a patch for this.

thanks,
-- Shuah

2020-02-13 07:28:43

by Aleksa Sarai

[permalink] [raw]
Subject: Re: Linux 5.6-rc1 kselftest build failures

On 2020-02-12, shuah <[email protected]> wrote:
> On 2/12/20 1:14 AM, Aleksa Sarai wrote:
> > On 2020-02-11, shuah <[email protected]> wrote:
> > > openat2:
> > >
> > > tools/testing/selftests/openat2'
> > > gcc -Wall -O2 -g -fsanitize=address -fsanitize=undefined openat2_test.c
> > > helpers.c -o tools/testing/selftests/openat2/openat2_test
> > > In file included from /usr/include/fcntl.h:301,
> > > from helpers.c:9:
> > > In function ‘openat’,
> > > inlined from ‘touchat’ at helpers.c:49:11:
> > > /usr/include/x86_64-linux-gnu/bits/fcntl2.h:126:4: error: call to
> > > ‘__openat_missing_mode’ declared with attribute error: openat with O_CREAT
> > > or O_TMPFILE in third argument needs 4 arguments
> > > 126 | __openat_missing_mode ();
> > > | ^~~~~~~~~~~~~~~~~~~~~~~~
> >
> > Yeah, that's a brain-o -- it looks like you have a newer glibc than
> > me which gives you a warning when you don't set the mode. The fix should
> > be just the following:
> >
>
> Nice. Do you mind sending a proper patch, I can pull in.

Done[1].

[1]: https://lore.kernel.org/linux-kselftest/[email protected]/

--
Aleksa Sarai
Senior Software Engineer (Containers)
SUSE Linux GmbH
<https://www.cyphar.com/>


Attachments:
(No filename) (1.28 kB)
signature.asc (235.00 B)
Download all attachments