mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-22 21:10:07 +00:00
ccf970c7a7
This patch follows commit 5554304f0
(posix: Allow glob to match dangling
symlinks [BZ #866]) by adding a compat symbol that follow previous
semantic of not following dangling symlinks and thus avoiding call
gl_lstat with GLOB_ALTDIRFUNC.
It avoids failure with old binaries that not set the alternate function
pointer for lstat (GNUmake for instance). The following scenario, for
instance, fails with current GNUmake because glibc will access unitialized
memory when calling gl_lstat:
$ cat src/t/t.c
int main ()
{
return 0;
}
$ cat Makefile
SRC = $(wildcard src/*/t.c)
OBJ = $(patsubst src/%.c, obj/%.o, $(SRC))
prog: $(OBJ)
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBS) $(OBJ) -o prog
obj/%.o: src/%.c
$(CC) $(CFLAGS) -c $< -o $@
$ make
This works as expected with the patch applied. Since it is for generic
ABI, default compat symbols are added with override for Linux due LFS.
Now we have two compat symbols for glob on Linux:
1. sysdeps/unix/sysv/linux/oldglob.c which implements glob64 with
the old dirent layout. For this implementation I also set it to
not follow dangling symlinks (which is the safest path).
2. sysdeps/unix/sysv/linux/glob{64}-lstat-compat.c which implements
the compat symbol for dangling symlinks. As for generic glob,
the implementation uses XSTAT_IS_XSTAT64 to define whether
both __glob_lstat_compat and __glob64_lstat_compat should be
different implementations. For archictures that define
XSTAT_IS_XSTAT64, __glob_lstat_compat is aliased to
__glob64_lstat_compat.
3. sysdeps/unix/sysv/linux/alpha/oldglob.c with a different glob_t
layout. As for 1. this patch changes it to not follow dangling
symlinks.
The patch also bumps _GNU_GLOB_INTERFACE_VERSION to 2 to advertise the
new semantic. On GNUmake, for instance, it will force to it use its
internal glob implementation instead and avoiding triggering the same
failure on builds against newer GLIBCs.
Checked on x86_64-linux-gnu and i686-linux-gnu. I also checked
with a build against the major ABIs required to check for the abilist.
The changes should also work on gnulib (I run gnulib-tool.py check glob
and it shown no regressions).
[BZ #22183]
* include/gnu-versions.h (_GNU_GLOB_INTERFACE_VERSION): Increase
version to 2.
* posix/Makefile (routines): Add glob-lstat-compat and
glob64-lstat-compat.
* posix/Versions (GLIBC_2.27, glob, glob64): Add symbol version.
* posix/glob-lstat-compat.c: New file.
* posix/glob64-lstat-compat.c: Likewise.
* posix/tst-glob_lstat_compat.c: Likewise.
* sysdeps/unix/sysv/linux/glob-lstat-compat.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/glob-lstat-compat.c: Likewise.
* sysdeps/unix/sysv/linux/glob64-lstat-compat.c: Likewise.
* sysdeps/unix/sysv/linux/alpha/glob.c: Remove file.
* posix/glob.c (glob_lstat): New function.
(glob): Rename to __glob and add versioned symbol to 2.27.
(glob_in_dir): Use glob_lstat.
* posix/glob64.c (glob64): Add GLOB_ATTRIBUTE.
* sysdeps/unix/sysv/linux/arm/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/glob.c (glob): Add versioned symbol for
2.27.
* sysdeps/unix/sysv/linux/glob64.c (glob64): Likewise.
* sysdeps/unix/sysv/linux/oldglob.c (GLOB_NO_LSTAT): Define.
* sysdeps/unix/sysv/linux/alpha/oldglob.c (__old_glob): Do not use
gl_lstat on glob call.
* sysdeps/unix/sysv/linux/aarch64/libc.abilist: Add GLIBC_2.27 glob
and glob64 symbols.
* sysdeps/unix/sysv/linux/alpha/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/hppa/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/i386/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/ia64/libc.abilist: 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/mips/mips64/n64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/nios2/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libc.abilist:
Likewise.
* sysdeps/unix/linux/powerpc/powerpc32/nofpu/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/powerpc/powerpc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/s390/s390-64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sh/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/sparc/sparc64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/tile/tilepro/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/64/libc.abilist: Likewise.
* sysdeps/unix/sysv/linux/x86_64/x32/libc.abilist: Likewise.
144 lines
3.4 KiB
Plaintext
144 lines
3.4 KiB
Plaintext
libc {
|
|
GLIBC_2.0 {
|
|
# functions with special/multiple interfaces
|
|
__bsd_getpgrp; __getpgid; __setpgid;
|
|
|
|
# functions with required interface outside normal name space
|
|
_exit;
|
|
|
|
# functions used in other libraries
|
|
__sched_get_priority_max; __sched_get_priority_min;
|
|
__sched_getparam; __sched_getscheduler; __sched_setscheduler;
|
|
__sched_yield; __fork; __getpid; __wait;
|
|
|
|
# functions used by libstdc++ 2.7.2
|
|
__waitpid;
|
|
|
|
# global variables
|
|
__environ; _environ;
|
|
|
|
# variables in normal name space
|
|
environ; optarg; opterr; optind; optopt;
|
|
re_max_failures; re_syntax_options;
|
|
|
|
# a*
|
|
alarm;
|
|
|
|
# c*
|
|
confstr;
|
|
|
|
# e*
|
|
execl; execle; execlp; execv; execve; execvp; fexecve;
|
|
|
|
# f*
|
|
fnmatch; fork; fpathconf; freeaddrinfo;
|
|
|
|
# g*
|
|
getaddrinfo; getdtablesize; getegid; geteuid; getgid; getopt; getopt_long;
|
|
getopt_long_only; getpgid; getpgrp; getpid; getppid; getsid; getuid; glob;
|
|
glob_pattern_p; globfree; group_member;
|
|
|
|
# n*
|
|
nanosleep;
|
|
|
|
# p*
|
|
pathconf; pause; pselect;
|
|
|
|
# r*
|
|
re_comp; re_compile_fastmap; re_compile_pattern; re_exec; re_match;
|
|
re_match_2; re_search; re_search_2; re_set_registers; re_set_syntax;
|
|
regcomp; regerror; regexec; regfree;
|
|
|
|
# s*
|
|
sched_get_priority_max; sched_get_priority_min; sched_getparam;
|
|
sched_getscheduler; sched_rr_get_interval; sched_setparam;
|
|
sched_setscheduler; sched_yield; setegid; seteuid; setgid;
|
|
setpgid; setpgrp; setsid; setuid; sleep; sysconf;
|
|
|
|
# t*
|
|
times;
|
|
|
|
# u*
|
|
uname;
|
|
|
|
# v*
|
|
vfork;
|
|
|
|
# w*
|
|
wait; wait3; wait4; waitpid;
|
|
}
|
|
GLIBC_2.1 {
|
|
# functions used in other libraries
|
|
__pread64; __pwrite64;
|
|
|
|
# g*
|
|
gai_strerror; getnameinfo; glob64; globfree64;
|
|
|
|
# p*
|
|
pread; pread64; pwrite; pwrite64;
|
|
|
|
# w*
|
|
waitid; wordexp; wordfree;
|
|
}
|
|
GLIBC_2.1.2 {
|
|
# functions used in other libraries
|
|
__vfork;
|
|
}
|
|
GLIBC_2.2 {
|
|
# p*
|
|
posix_spawn_file_actions_init; posix_spawn_file_actions_destroy;
|
|
posix_spawn_file_actions_addclose; posix_spawn_file_actions_addopen;
|
|
posix_spawn_file_actions_adddup2;
|
|
posix_spawnattr_init; posix_spawnattr_destroy;
|
|
posix_spawnattr_getsigdefault; posix_spawnattr_setsigdefault;
|
|
posix_spawnattr_getflags; posix_spawnattr_setflags;
|
|
posix_spawnattr_getpgroup; posix_spawnattr_setpgroup;
|
|
posix_spawnattr_setsigmask; posix_spawnattr_getsigmask;
|
|
posix_spawn; posix_spawnp; posix_spawnattr_getschedpolicy;
|
|
posix_spawnattr_setschedpolicy; posix_spawnattr_getschedparam;
|
|
posix_spawnattr_setschedparam;
|
|
|
|
# Used in macros.
|
|
__sysconf;
|
|
}
|
|
GLIBC_2.2.3 {
|
|
# Extended Interface.
|
|
fnmatch;
|
|
}
|
|
GLIBC_2.2.6 {
|
|
# For syscall wrapper
|
|
__nanosleep;
|
|
}
|
|
GLIBC_2.3.2 {
|
|
# Note that these symbols appear in sysdeps/unix/sysv/linux/Versions
|
|
# under GLIBC_2.0; the first instance in the script is taken as the
|
|
# default, so linux configurations put them in GLIBC_2.0 while other
|
|
# configuration put them in GLIBC_2.3.2.
|
|
getresgid; getresuid; setresgid; setresuid;
|
|
}
|
|
GLIBC_2.3.3 {
|
|
sched_getaffinity; sched_setaffinity;
|
|
}
|
|
GLIBC_2.3.4 {
|
|
regexec;
|
|
}
|
|
GLIBC_2.6 {
|
|
__sched_cpucount;
|
|
}
|
|
GLIBC_2.7 {
|
|
__sched_cpualloc; __sched_cpufree;
|
|
}
|
|
GLIBC_2.10 {
|
|
__posix_getopt;
|
|
}
|
|
GLIBC_2.11 {
|
|
execvpe;
|
|
}
|
|
GLIBC_2.27 {
|
|
glob; glob64;
|
|
}
|
|
GLIBC_PRIVATE {
|
|
__libc_fork; __libc_pread; __libc_pwrite;
|
|
}
|
|
}
|