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-next>] [day] [month] [year] [list]
Message-Id: <20220613013051.1741434-1-guoren@kernel.org>
Date:   Sun, 12 Jun 2022 21:30:51 -0400
From:   guoren@...nel.org
To:     palmer@...osinc.com, arnd@...db.de, linux@...ck-us.net,
        palmer@...belt.com, heiko@...ech.de
Cc:     linux-riscv@...ts.infradead.org, linux-arch@...r.kernel.org,
        linux-kernel@...r.kernel.org, Guo Ren <guoren@...ux.alibaba.com>,
        Eugene Syromiatnikov <esyr@...hat.com>,
        Christoph Hellwig <hch@....de>
Subject: [PATCH] uapi: Fixup strace compile error

From: Guo Ren <guoren@...ux.alibaba.com>

There is no CONFIG_64BIT in userspace, we shouldn't limit it with
__BITS_PER_LONG == 32 to break the compatibility. Just export F_*64
definitions to userspace permanently.

gcc-11 -DHAVE_CONFIG_H   -I./linux/x86_64 -I../../../src/linux/x86_64
-I./linux/generic -I../../../src/linux/generic -I. -I../../../src
-DIN_STRACE=1      -isystem /opt/kernel/include -Wall -Wextra
-Wno-missing-field-initializers -Wno-unused-parameter -Wdate-time
-Wformat-security -Wimplicit-fallthrough=5 -Winit-self -Wlogical-op
-Wmissing-prototypes -Wnested-externs -Wold-style-definition
-Wtrampolines -Wundef -Wwrite-strings -Werror   -g -O2 -c -o
libstrace_a-fetch_bpf_fprog.o `test -f 'fetch_bpf_fprog.c' || echo
'../../../src/'`fetch_bpf_fprog.c
In file included from ../../../src/defs.h:404,
                 from ../../../src/fcntl.c:12:
../../../src/xlat/fcntlcmds.h:54:7: error: ‘F_GETLK64’ undeclared here
(not in a function); did you mean ‘F_GETLK’?
   54 |  XLAT(F_GETLK64),
      |       ^~~~~~~~~
../../../src/xlat.h:64:54: note: in definition of macro ‘XLAT’
   64 | # define XLAT(val)                      { (unsigned)(val), #val
      }
      |                                                      ^~~
../../../src/xlat/fcntlcmds.h:57:7: error: ‘F_SETLK64’ undeclared here
(not in a function); did you mean ‘F_SETLK’?
   57 |  XLAT(F_SETLK64),
      |       ^~~~~~~~~
../../../src/xlat.h:64:54: note: in definition of macro ‘XLAT’
   64 | # define XLAT(val)                      { (unsigned)(val), #val
      }
      |                                                      ^~~
../../../src/xlat/fcntlcmds.h:60:7: error: ‘F_SETLKW64’ undeclared here
(not in a function); did you mean ‘F_SETLKW’?
   60 |  XLAT(F_SETLKW64),
      |       ^~~~~~~~~~
../../../src/xlat.h:64:54: note: in definition of macro ‘XLAT’
   64 | # define XLAT(val)                      { (unsigned)(val), #val
      }
      |                                                      ^~~
make[4]: *** [Makefile:5017: libstrace_a-fcntl.o] Error 1

comment by Eugene:
Actually, it's quite the opposite: "ifndef" usage made it vailable at all
times to the userspace, and this change has actually broken building strace
with the latest kernel headers[1][2].  There could be some debate whether
having these F_*64 definitions exposed to the user space 64-bit
applications, but it seems that were no harm (as they were exposed already
for quite some time), and they are useful at least for strace for compat
application tracing purposes.

Fixes: 306f7cc1e9061 "uapi: always define F_GETLK64/F_SETLK64/F_SETLKW64 in fcntl.h"
Signed-off-by: Guo Ren <guoren@...ux.alibaba.com>
Reported-by: Eugene Syromiatnikov <esyr@...hat.com>
Cc: Christoph Hellwig <hch@....de>
Cc: Arnd Bergmann <arnd@...db.de>
Cc: Heiko Stuebner <heiko@...ech.de>
Cc: Palmer Dabbelt <palmer@...osinc.com>
---
 include/uapi/asm-generic/fcntl.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/include/uapi/asm-generic/fcntl.h b/include/uapi/asm-generic/fcntl.h
index f13d37b60775..cd6bd65ec25d 100644
--- a/include/uapi/asm-generic/fcntl.h
+++ b/include/uapi/asm-generic/fcntl.h
@@ -116,13 +116,11 @@
 #define F_GETSIG	11	/* for sockets. */
 #endif
 
-#if __BITS_PER_LONG == 32 || defined(__KERNEL__)
 #ifndef F_GETLK64
 #define F_GETLK64	12	/*  using 'struct flock64' */
 #define F_SETLK64	13
 #define F_SETLKW64	14
 #endif
-#endif /* __BITS_PER_LONG == 32 || defined(__KERNEL__) */
 
 #ifndef F_SETOWN_EX
 #define F_SETOWN_EX	15
-- 
2.36.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ