mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 04:50:07 +00:00
06ab719d30
This patch fixes the OFD ("file private") locks for architectures that support non-LFS flock definition (__USE_FILE_OFFSET64 not defined). The issue in this case is both F_OFD_{GETLK,SETLK,SETLKW} and F_{SET,GET}L{W}K64 expects a flock64 argument and when using old F_OFD_* flags with a non LFS flock argument the kernel might interpret the underlying data wrongly. Kernel idea originally was to avoid using such flags in non-LFS syscall, but since GLIBC uses fcntl with LFS semantic as default it is possible to provide the functionality and avoid the bogus struct kernel passing by adjusting the struct manually for the required flags. The idea follows other LFS interfaces that provide two symbols: 1. A new LFS fcntl64 is added on default ABI with the usual macros to select it for FILE_OFFSET_BITS=64. 2. The Linux non-LFS fcntl use a stack allocated struct flock64 for F_OFD_{GETLK,SETLK,SETLKW} copy the results on the user provided struct. 3. Keep a compat symbol with old broken semantic for architectures that do not define __OFF_T_MATCHES_OFF64_T. So for architectures which defines __USE_FILE_OFFSET64, fcntl64 will aliased to fcntl and no adjustment would be required. So to actually use F_OFD_* with LFS support the source must be built with LFS support (_FILE_OFFSET_BITS=64). Also F_OFD_SETLKW command is handled a cancellation point, as for F_SETLKW{64}. Checked on x86_64-linux-gnu and i686-linux-gnu. [BZ #20251] * NEWS: Mention fcntl64 addition. * csu/check_fds.c: Replace __fcntl_nocancel by __fcntl64_nocancel. * login/utmp_file.c: Likewise. * sysdeps/posix/fdopendir.c: Likewise. * sysdeps/posix/opendir.c: Likewise. * sysdeps/unix/pt-fcntl.c: Likewise. * include/fcntl.h (__libc_fcntl64, __fcntl64, __fcntl64_nocancel_adjusted): New prototype. (__fcntl_nocancel_adjusted): Remove prototype. * io/Makefile (routines): Add fcntl64. (CFLAGS-fcntl64.c): New rule. * io/Versions [GLIBC_2.28] (fcntl64): New symbol. [GLIBC_PRIVATE] (__libc_fcntl): Rename to __libc_fcntl64. * io/fcntl.h (fcntl64): Add prototype and redirect if __USE_FILE_OFFSET64 is defined. * io/fcntl64.c: New file. * manual/llio.text: Add a note for which commands fcntl acts a cancellation point. * nptl/Makefile (CFLAGS-fcntl64.c): New rule. * sysdeps/mach/hurd/fcntl.c: Alias fcntl to fcntl64 symbols. * sysdeps/mach/hurd/i386/libc.abilist [GLIBC_2.28] (fcntl, fcntl64): New symbols. * sysdeps/unix/sysv/linux/fcntl.c (__libc_fcntl): Fix F_GETLK64, F_OFD_GETLK, F_SETLK64, F_SETLKW64, F_OFD_SETLK, and F_OFD_SETLKW for non-LFS case. * sysdeps/unix/sysv/linux/fcntl64.c: New file. * sysdeps/unix/sysv/linux/fcntl_nocancel.c (__fcntl_nocancel): Rename to __fcntl64_nocancel. (__fcntl_nocancel_adjusted): Rename to __fcntl64_nocancel_adjusted. * sysdeps/unix/sysv/linux/not-cancel.h (__fcntl_nocancel): Rename to __fcntl64_nocancel. * sysdeps/unix/sysv/linux/tst-ofdlocks.c: New file. * sysdeps/unix/sysv/linux/tst-ofdlocks-compat.c: Likewise. * sysdeps/unix/sysv/linux/Makefile (tests): Add tst-ofdlocks. (tests-internal): Add tst-ofdlocks-compat. * sysdeps/unix/sysv/linux/aarch64/libc.abilist [GLIBC_2.28] (fcntl64): New symbol. * sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/ia64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/libc-le.abilist: Likewise. * sysdeps/unix/sysv/linux/riscv/rv64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/arm/libc.abilist [GLIBC_2.28] (fcntl, fcntl64): Likewise. * sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/i386/libc.abilis: Likewise. * sysdeps/unix/sysv/linux/m68k/coldfire/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/m68k/m680x0/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/microblaze/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/mips/mips64/n32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise. * sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
141 lines
2.0 KiB
Plaintext
141 lines
2.0 KiB
Plaintext
libc {
|
|
GLIBC_2.0 {
|
|
# functions used in inline functions or macros
|
|
__xstat; __fxstat; __lxstat; __xmknod; __write; __close; __fcntl;
|
|
__lseek; __open; __read;
|
|
|
|
# functions used by libstdc++ 2.7.2
|
|
__dup2; __pipe;
|
|
|
|
# a*
|
|
access;
|
|
|
|
# c*
|
|
chdir; chmod; chown; close; creat;
|
|
|
|
# d*
|
|
dup; dup2;
|
|
|
|
# e*
|
|
euidaccess;
|
|
|
|
# f*
|
|
fchdir; fchmod; fchown; fcntl; flock; fstatfs; fts_children; fts_close;
|
|
fts_open; fts_read; fts_set; ftw;
|
|
|
|
# g*
|
|
get_current_dir_name; getcwd; getwd;
|
|
|
|
# i*
|
|
isatty;
|
|
|
|
# l*
|
|
lchown; link; lockf; lseek;
|
|
|
|
# m*
|
|
mkdir; mkfifo;
|
|
|
|
# o*
|
|
open;
|
|
|
|
# p*
|
|
pipe; poll;
|
|
|
|
# r*
|
|
read; readlink; rmdir;
|
|
|
|
# s*
|
|
statfs; symlink;
|
|
|
|
# t*
|
|
ttyname; ttyname_r;
|
|
|
|
# u*
|
|
umask; unlink; utime;
|
|
|
|
# w*
|
|
write;
|
|
}
|
|
GLIBC_2.1 {
|
|
# functions used in other libraries
|
|
__xstat64; __fxstat64; __lxstat64; __poll;
|
|
|
|
# c*
|
|
creat64;
|
|
|
|
# f*
|
|
fstatfs64; fstatvfs; fstatvfs64; ftw64;
|
|
|
|
# l*
|
|
lockf64; lseek64;
|
|
|
|
# n*
|
|
nftw; nftw64;
|
|
|
|
# o*
|
|
open64;
|
|
|
|
# s*
|
|
sendfile;
|
|
statfs64; statvfs; statvfs64;
|
|
}
|
|
GLIBC_2.2 {
|
|
# p*
|
|
posix_fadvise; posix_fadvise64; posix_fallocate; posix_fallocate64;
|
|
|
|
__open64;
|
|
}
|
|
GLIBC_2.3 {
|
|
# s*
|
|
sendfile64;
|
|
}
|
|
GLIBC_2.3.2 {
|
|
# l*
|
|
lchmod;
|
|
}
|
|
GLIBC_2.3.3 {
|
|
# n*
|
|
nftw; nftw64;
|
|
}
|
|
GLIBC_2.4 {
|
|
eaccess;
|
|
|
|
faccessat;
|
|
fchmodat;
|
|
fchownat;
|
|
__fxstatat; __fxstatat64;
|
|
linkat;
|
|
mkdirat; mkfifoat; __xmknodat;
|
|
openat; openat64;
|
|
readlinkat;
|
|
symlinkat;
|
|
unlinkat;
|
|
|
|
ppoll;
|
|
}
|
|
GLIBC_2.6 {
|
|
utimensat; futimens;
|
|
}
|
|
GLIBC_2.7 {
|
|
__open_2; __open64_2; __openat_2; __openat64_2;
|
|
}
|
|
GLIBC_2.9 {
|
|
dup3; pipe2;
|
|
}
|
|
GLIBC_2.23 {
|
|
fts64_children; fts64_close; fts64_open; fts64_read; fts64_set;
|
|
}
|
|
GLIBC_2.27 {
|
|
copy_file_range;
|
|
}
|
|
GLIBC_2.28 {
|
|
fcntl64;
|
|
}
|
|
GLIBC_PRIVATE {
|
|
__libc_fcntl64;
|
|
__fcntl_nocancel;
|
|
__open64_nocancel;
|
|
__write_nocancel;
|
|
}
|
|
}
|