lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200212081414.7bwkndf6qxg2p35a@yavin>
Date:   Wed, 12 Feb 2020 19:14:14 +1100
From:   Aleksa Sarai <cyphar@...har.com>
To:     shuah <shuah@...nel.org>
Cc:     linux-kselftest@...r.kernel.org,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Dmitry Safonov <dima@...sta.com>
Subject: Re: Linux 5.6-rc1 kselftest build failures

On 2020-02-11, shuah <shuah@...nel.org> 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 <shuah@...nel.org>
Signed-off-by: Aleksa Sarai <cyphar@...har.com>
---
 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


Download attachment "signature.asc" of type "application/pgp-signature" (229 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ