diff --git a/Makeconfig b/Makeconfig index 522182abdc..2bde0276ce 100644 --- a/Makeconfig +++ b/Makeconfig @@ -153,6 +153,11 @@ libdir = $(exec_prefix)/lib endif inst_libdir = $(install_root)$(libdir) +# Compat places to look for libraries +ifndef extra_libdir +extra_libdir = /lib:$(exec_prefix)/lib +endif + # Where to install the shared library. ifndef slibdir slibdir = $(exec_prefix)/lib @@ -635,6 +640,10 @@ else default-rpath = $(libdir) endif +ifdef extra_libdir +default-rpath += :$(extra_libdir) +endif + ifndef link-extra-libs link-extra-libs = $(LDLIBS-$(@F)) link-extra-libs-static = $(link-extra-libs) diff --git a/Makefile b/Makefile index 2e351c0321..7c7e18b1df 100644 --- a/Makefile +++ b/Makefile @@ -448,6 +448,14 @@ $(inst_includedir)/gnu/stubs.h: $(+force) install-others-nosubdir: $(installed-stubs) endif +# If we're bootstrapping, install a dummy gnu/stubs.h along with the +# other headers, so 'make install-headers' produces a useable include +# tree. Otherwise, install gnu/stubs.h later, after the rest of the +# build is done. +ifeq ($(install-bootstrap-headers),yes) +install-headers: $(inst_includedir)/gnu/stubs.h $(installed-stubs) \ + $(inst_includedir)/$(lib-names-h-abi) +endif # Since stubs.h is never needed when building the library, we simplify the # hairy installation process by producing it in place only as the last part @@ -455,6 +463,14 @@ endif # iterates over all the subdirs; subdir_install in each subdir depends on # the subdir's stubs file. Having more direct dependencies would result in # extra iterations over the list for subdirs and many recursive makes. +ifeq ($(install-bootstrap-headers),yes) +# gnu/stubs.h depends (via the subdir 'stubs' targets) on all the .o +# files in GLIBC. For bootstrapping a GCC/GLIBC pair, an empty +# gnu/stubs.h is good enough. +$(installed-stubs): include/stubs-bootstrap.h $(+force) + $(make-target-directory) + $(INSTALL_DATA) $< $@ +else $(installed-stubs): include/stubs-prologue.h subdir_install $(make-target-directory) @rm -f $(objpfx)stubs.h @@ -463,6 +479,7 @@ $(installed-stubs): include/stubs-prologue.h subdir_install then echo 'stubs.h unchanged'; \ else $(INSTALL_DATA) $(objpfx)stubs.h $@; fi rm -f $(objpfx)stubs.h +endif # This makes the Info or DVI file of the documentation from the Texinfo source. .PHONY: info dvi pdf html @@ -658,7 +675,7 @@ endif # Setting INSTALL_UNCOMPRESSED causes localedata/Makefile to # install the charmaps uncompressed, as the testroot does not # provide a gunzip program. - $(MAKE) install DESTDIR=$(objpfx)testroot.pristine \ + $(MAKE) install install_root=$(objpfx)testroot.pristine \ INSTALL_UNCOMPRESSED=yes subdirs='$(sorted-subdirs)' rm -f $(symbolic-link-list) touch $(objpfx)testroot.pristine/install.stamp diff --git a/Makerules b/Makerules index 00365bc58b..de43396b34 100644 --- a/Makerules +++ b/Makerules @@ -1016,6 +1016,9 @@ $(inst_libdir)/libc.so: $(common-objpfx)format.lds \ '$(libdir)/$(patsubst %,$(libtype.oS),$(libprefix)$(libc-name))'\ ' AS_NEEDED (' $(rtlddir)/$(rtld-installed-name) ') )' \ ) > $@.new +ifeq ($(patsubst gnu%,,$(config-os)),) + echo 'INPUT ( AS_NEEDED ( -lmachuser -lhurduser ) )' >> $@.new +endif mv -f $@.new $@ endif diff --git a/NEWS b/NEWS index 1b89f9c010..610aa5e923 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,90 @@ See the end for copying conditions. Please send GNU C library bug reports via using `glibc' in the "product" field. +Version 2.39.1 + +Deprecated and removed features, and other changes affecting compatibility: + +* __rseq_size now denotes the size of the active rseq area (20 bytes + initially), not the size of struct rseq (32 bytes initially). + +Security related changes: + +The following CVEs were fixed in this release: + + GLIBC-SA-2024-0004: + ISO-2022-CN-EXT: fix out-of-bound writes when writing escape + sequence (CVE-2024-2961) + + GLIBC-SA-2024-0005: + nscd: Stack-based buffer overflow in netgroup cache (CVE-2024-33599) + + GLIBC-SA-2024-0006: + nscd: Null pointer crash after notfound response (CVE-2024-33600) + + GLIBC-SA-2024-0007: + nscd: netgroup cache may terminate daemon on memory allocation + failure (CVE-2024-33601) + + GLIBC-SA-2024-0008: + nscd: netgroup cache assumes NSS callback uses in-buffer strings + (CVE-2024-33602) + +The following bugs are resolved with this release: + + [19622] network: Support aliasing with struct sockaddr + [30081] resolv: Do not wait for non-existing second DNS response after error + [30701] time: getutxent misbehaves on 32-bit x86 when _TIME_BITS=64 + [30994] REP MOVSB performance suffers from page aliasing on Zen 4 + [31339] libc: arm32 loader crash after cleanup in 2.36 + [31325] mips: clone3 is wrong for o32 + [31335] math: Compile glibc with -march=x86-64-v3 should disable FMA4 + multi-arch version + [31402] libc: clone (NULL, NULL, ...) clobbers %r7 register on + s390{,x} + [31479] libc: Missing #include in sched_getcpu.c may + result in a loss of rseq acceleration + [31316] build: Fails test misc/tst-dirname "Didn't expect signal from + child: got `Illegal instruction'" on non SSE CPUs + [31371] x86-64: APX and Tile registers aren't preserved in ld.so + trampoline + [31372] dynamic-link: _dl_tlsdesc_dynamic doesn't preserve all caller- + saved registers + [31429] build: Glibc failed to build with -march=x86-64-v3 + [31476] resolv: Track single-request fallback via _res._flags + [31501] dynamic-link: _dl_tlsdesc_dynamic_xsavec may clobber %rbx + [31612] libc: arc4random fails to fallback to /dev/urandom if + getrandom is not present + [31640] dynamic-link: POWER10 ld.so crashes in + elf_machine_load_address with GCC 14 + [31676] Configuring with CC="gcc -march=x86-64-v3" + --with-rtld-early-cflags=-march=x86-64 results in linker failure + [31677] nscd: nscd: netgroup cache: invalid memcpy under low + memory/storage conditions + [31678] nscd: nscd: Null pointer dereferences after failed netgroup + cache insertion + [31679] nscd: nscd: netgroup cache may terminate daemon on memory + allocation failure + [31680] nscd: nscd: netgroup cache assumes NSS callback uses in-buffer + strings + [31686] dynamic-link: Stack-based buffer overflow in + parse_tunables_string + [31695] libc: pidfd_spawn/pidfd_spawnp leak an fd if clone3 succeeds + [31719] dynamic-link: --enable-hardcoded-path-in-tests doesn't work + with -Wl,--enable-new-dtags + [31782] Test build failure with recent GCC trunk + (x86/tst-cpu-features-supports.c:69:3: error: parameter to builtin + not valid: avx5124fmaps) + [31798] pidfd_getpid.c is miscompiled by GCC 6.4 + [31867] build: "CPU ISA level is lower than required" on SSE2-free + CPUs + [31883] build: ISA level support configure check relies on bashism / + is otherwise broken for arithmetic + [31890] resolv: Allow short error responses to match any DNS query + [31965] rseq extension mechanism does not work as intended + [31968] mremap implementation in C does not handle arguments correctly + [32052] Name space violation in fortify wrappers + Version 2.39 Major new features: diff --git a/assert/assert.h b/assert/assert.h index 266a41df06..8c1cb5fd37 100644 --- a/assert/assert.h +++ b/assert/assert.h @@ -61,6 +61,8 @@ #else /* Not NDEBUG. */ +#ifndef _ASSERT_H_DECLS +#define _ASSERT_H_DECLS __BEGIN_DECLS /* This prints an "Assertion failed" message and aborts. */ @@ -81,6 +83,7 @@ extern void __assert (const char *__assertion, const char *__file, int __line) __END_DECLS +#endif /* Not _ASSERT_H_DECLS */ /* When possible, define assert so that it does not add extra parentheses around EXPR. Otherwise, those added parentheses would diff --git a/bits/socket.h b/bits/socket.h index 13de124bac..772074d52a 100644 --- a/bits/socket.h +++ b/bits/socket.h @@ -149,7 +149,7 @@ enum __socket_type #include /* Structure describing a generic socket address. */ -struct sockaddr +struct __attribute_struct_may_alias__ sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ char sa_data[14]; /* Address data. */ @@ -166,7 +166,7 @@ struct sockaddr #define _SS_PADSIZE \ (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) -struct sockaddr_storage +struct __attribute_struct_may_alias__ sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ char __ss_padding[_SS_PADSIZE]; diff --git a/config.h.in b/config.h.in index 1e647de585..3b936655e9 100644 --- a/config.h.in +++ b/config.h.in @@ -162,6 +162,9 @@ /* Mach/i386 specific: define if the `i386_set_gdt' RPC is available. */ #undef HAVE_I386_SET_GDT +/* Hurd specific; define if the `proc_getchildren_rusage' RPC is available. */ +#undef HAVE_HURD_PROC_GETCHILDREN_RUSAGE + /* Define if inlined system calls are available. */ #undef HAVE_INLINED_SYSCALLS diff --git a/elf/Makefile b/elf/Makefile index a50a988e73..3a5ec6aafc 100644 --- a/elf/Makefile +++ b/elf/Makefile @@ -1366,7 +1366,7 @@ $(objpfx)trusted-dirs.st: Makefile $(..)Makeconfig $(make-target-directory) echo "$(subst :, ,$(default-rpath) $(user-defined-trusted-dirs))" \ | $(AWK) -f gen-trusted-dirs.awk > ${@:st=T}; - echo '#define DL_DST_LIB "$(notdir $(slibdir))"' >> ${@:st=T} + echo '#define DL_DST_LIB "$(shell echo $(slibdir) | sed 's,/,,')"' >> ${@:st=T} $(move-if-change) ${@:st=T} ${@:st=h} touch $@ CPPFLAGS-dl-load.c += -I$(objpfx). -I$(csu-objpfx). @@ -2787,9 +2787,8 @@ $(objpfx)tst-ro-dynamic-mod.so: $(objpfx)tst-ro-dynamic-mod.os \ $(objpfx)tst-ro-dynamic-mod.os $(objpfx)tst-rtld-list-diagnostics.out: tst-rtld-list-diagnostics.py \ - $(..)manual/dynlink.texi $(objpfx)$(rtld-installed-name) + $(objpfx)$(rtld-installed-name) $(PYTHON) tst-rtld-list-diagnostics.py \ - --manual=$(..)manual/dynlink.texi \ "$(test-wrapper-env) $(objpfx)$(rtld-installed-name) --list-diagnostics" \ > $@; \ $(evaluate-test) diff --git a/elf/dl-cache.c b/elf/dl-cache.c index 08bc1530a8..85f3f179ed 100644 --- a/elf/dl-cache.c +++ b/elf/dl-cache.c @@ -390,52 +390,6 @@ _dl_cache_libcmp (const char *p1, const char *p2) return *p1 - *p2; } -/* Special value representing the lack of an ld.so cache. */ -static const char ld_so_cache_lacking[] = "/ld.so cache is lacking"; - -/* Return the per-application ld.so cache, relative to $ORIGIN, or NULL if - that fails for some reason. Do not return the system-wide LD_SO_CACHE - since on a foreign distro it would contain invalid information. */ -static const char * -ld_so_cache (void) -{ - static const char *loader_cache; - - if (loader_cache == NULL) - { - static const char store[] = @STORE_DIRECTORY@; - const char *origin = _dl_get_origin (); - - /* Check whether ORIGIN is something like "/gnu/store/…-foo/bin". */ - if (origin != (char *) -1 /* _dl_get_origin reported failure */ - && strncmp (store, origin, strlen (store)) == 0 - && origin[sizeof store - 1] == '/') - { - char *store_item_end = strchr (origin + sizeof store, '/'); - - if (store_item_end != NULL) - { - static const char suffix[] = "/etc/ld.so.cache"; - size_t store_item_len = store_item_end - origin; - - /* Note: We can't use 'malloc' because it can be interposed. - Likewise, 'strncpy' is not available. */ - char *cache = alloca (strlen (origin) + sizeof suffix); - - strcpy (cache, origin); - strcpy (cache + store_item_len, suffix); - - loader_cache = __strdup (cache) ?: ld_so_cache_lacking; - } - else - loader_cache = ld_so_cache_lacking; - } - else - loader_cache = ld_so_cache_lacking; - } - - return loader_cache; -} /* Look up NAME in ld.so.cache and return the file name stored there, or null if none is found. The cache is loaded if it was not already. If loading @@ -449,15 +403,12 @@ _dl_load_cache_lookup (const char *name) { /* Print a message if the loading of libs is traced. */ if (__glibc_unlikely (GLRO(dl_debug_mask) & DL_DEBUG_LIBS)) - _dl_debug_printf (" search cache=%s\n", ld_so_cache ()); - - if (__glibc_unlikely (ld_so_cache () == ld_so_cache_lacking)) - return NULL; + _dl_debug_printf (" search cache=%s\n", LD_SO_CACHE); if (cache == NULL) { /* Read the contents of the file. */ - void *file = _dl_sysdep_read_whole_file (ld_so_cache (), &cachesize, + void *file = _dl_sysdep_read_whole_file (LD_SO_CACHE, &cachesize, PROT_READ); /* We can handle three different cache file formats here: diff --git a/elf/dl-load.c b/elf/dl-load.c index 5835506d3f..6fcd96d2ae 100644 --- a/elf/dl-load.c +++ b/elf/dl-load.c @@ -1700,6 +1700,25 @@ open_verify (const char *name, int fd, __set_errno (ENOENT); return -1; } +#ifdef __arm__ + else if (!VALID_FLOAT_ABI (ehdr->e_flags)) + { + /* This is not a fatal error. On architectures where + soft-float and hard-float binaries can be run this + might happen. */ + __close_nocancel (fd); + __set_errno (ENOENT); + return -1; + } +#endif + else if (! __builtin_expect (elf_machine_matches_host (ehdr), 1)) + { + /* Another non-fatal error, let's skip right past the + the libraries obviously built for other machines. */ + __close_nocancel (fd); + __set_errno (ENOENT); + return -1; + } else if (ehdr->e_ident[EI_DATA] != byteorder) { if (BYTE_ORDER == BIG_ENDIAN) @@ -2083,6 +2102,28 @@ _dl_map_object (struct link_map *loader, const char *name, loader ?: GL(dl_ns)[LM_ID_BASE]._ns_loaded, LA_SER_LIBPATH, &found_other_class); + /* Look at the RUNPATH information for this binary. */ + if (fd == -1 && loader != NULL + && cache_rpath (loader, &loader->l_runpath_dirs, + DT_RUNPATH, "RUNPATH")) + fd = open_path (name, namelen, mode, + &loader->l_runpath_dirs, &realname, &fb, loader, + LA_SER_RUNPATH, &found_other_class); + + if (fd == -1) + { + realname = _dl_sysdep_open_object (name, namelen, &fd); + if (realname != NULL) + { + fd = open_verify (realname, fd, + &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded, + LA_SER_CONFIG, mode, &found_other_class, + false); + if (fd == -1) + free (realname); + } + } + #ifdef USE_LDCONFIG if (fd == -1 && (__glibc_likely ((mode & __RTLD_SECURE) == 0) @@ -2141,28 +2182,6 @@ _dl_map_object (struct link_map *loader, const char *name, } #endif - /* Look at the RUNPATH information for this binary. */ - if (fd == -1 && loader != NULL - && cache_rpath (loader, &loader->l_runpath_dirs, - DT_RUNPATH, "RUNPATH")) - fd = open_path (name, namelen, mode, - &loader->l_runpath_dirs, &realname, &fb, loader, - LA_SER_RUNPATH, &found_other_class); - - if (fd == -1) - { - realname = _dl_sysdep_open_object (name, namelen, &fd); - if (realname != NULL) - { - fd = open_verify (realname, fd, - &fb, loader ?: GL(dl_ns)[nsid]._ns_loaded, - LA_SER_CONFIG, mode, &found_other_class, - false); - if (fd == -1) - free (realname); - } - } - /* Finally, try the default path. */ if (fd == -1 && ((l = loader ?: GL(dl_ns)[nsid]._ns_loaded) == NULL diff --git a/elf/dl-tls.c b/elf/dl-tls.c index 7b3dd9ab60..670dbc42fc 100644 --- a/elf/dl-tls.c +++ b/elf/dl-tls.c @@ -819,7 +819,14 @@ _dl_update_slotinfo (unsigned long int req_modid, size_t new_gen) dtv entry free it. Note: this is not AS-safe. */ /* XXX Ideally we will at some point create a memory pool. */ - free (dtv[modid].pointer.to_free); + /* Avoid calling free on a null pointer. Some mallocs + incorrectly use dynamic TLS, and depending on how the + free function was compiled, it could call + __tls_get_addr before the null pointer check in the + free implementation. Checking here papers over at + least some dynamic TLS usage by interposed mallocs. */ + if (dtv[modid].pointer.to_free != NULL) + free (dtv[modid].pointer.to_free); dtv[modid].pointer.val = TLS_DTV_UNALLOCATED; dtv[modid].pointer.to_free = NULL; diff --git a/elf/ldconfig.c b/elf/ldconfig.c index b64c54b53e..560ff052e0 100644 --- a/elf/ldconfig.c +++ b/elf/ldconfig.c @@ -55,6 +55,17 @@ #define PACKAGE _libc_intl_domainname +/* Get the generated information about the trusted/standard directories. */ +#include "trusted-dirs.h" + +static const char system_dirs[] = SYSTEM_DIRS; +static const size_t system_dirs_len[] = +{ + SYSTEM_DIRS_LEN +}; +#define nsystem_dirs_len \ + (sizeof (system_dirs_len) / sizeof (system_dirs_len[0])) + /* List of directories to handle. */ struct dir_entry { @@ -448,6 +459,25 @@ chroot_stat (const char *real_path, const char *path, struct stat *st) return ret; } +static const char * const ld_sonames[] = +{ + "ld-kfreebsd-x86-64.so.1", + "ld-linux-aarch64.so.1", + "ld-linux-aarch64_be.so.1", + "ld-linux-armhf.so.3", + "ld-linux-ia64.so.2", + "ld-linux-mipsn8.so.1", + "ld-linux-riscv64-lp64.so.1" + "ld-linux-riscv64-lp64d.so.1" + "ld-linux-x32.so.2", + "ld-linux-x86-64.so.2", + "ld-linux.so.2", + "ld-linux.so.3", + "ld.so.1", + "ld64.so.1", + "ld64.so.2", +}; + /* Create a symbolic link from soname to libname in directory path. */ static void create_links (const char *real_path, const char *path, const char *libname, @@ -458,6 +488,7 @@ create_links (const char *real_path, const char *path, const char *libname, struct stat stat_lib, stat_so, lstat_so; int do_link = 1; int do_remove = 1; + int i; /* XXX: The logics in this function should be simplified. */ /* Get complete path. */ @@ -486,6 +517,18 @@ create_links (const char *real_path, const char *path, const char *libname, error (0, 0, _("Can't stat %s\n"), full_libname); return; } + + /* Do not change the symlink pointer to the dynamic linker except for + non-existing symlinks, as it might break multiarch systems. */ + for (i = 0; i < sizeof (ld_sonames) / sizeof (ld_sonames[0]); i++) + if (__glibc_unlikely(!strcmp(soname, ld_sonames[i]))) + { + if (opt_verbose) + error (0, 0, _("%s is the dynamic linker, ignoring\n"), + full_libname); + do_link = 0; + } + if (stat_lib.st_dev == stat_so.st_dev && stat_lib.st_ino == stat_so.st_ino) /* Link is already correct. */ @@ -1296,12 +1339,19 @@ main (int argc, char **argv) if (!opt_only_cline) { + const char *strp = system_dirs; + size_t idx = 0; + parse_conf (config_file, true); /* Always add the standard search paths. */ - add_system_dir (SLIBDIR); - if (strcmp (SLIBDIR, LIBDIR)) - add_system_dir (LIBDIR); + do + { + add_system_dir (strp); + strp += system_dirs_len[idx] + 1; + idx++; + } + while (idx < nsystem_dirs_len); } const char *aux_cache_file = _PATH_LDCONFIG_AUX_CACHE; diff --git a/elf/ldd.bash.in b/elf/ldd.bash.in index d6b640df66..5dea16a4f4 100644 --- a/elf/ldd.bash.in +++ b/elf/ldd.bash.in @@ -150,17 +150,18 @@ for file do echo "ldd: ${file}:" $"not regular file" >&2 result=1 elif test -r "$file"; then - test -x "$file" || echo 'ldd:' $"\ -warning: you do not have execution permission for" "\`$file'" >&2 RTLD= ret=1 for rtld in ${RTLDLIST}; do if test -x $rtld; then - verify_out=`${rtld} --verify "$file"` - ret=$? - case $ret in - [02]) RTLD=${rtld}; break;; - esac + dummy=`$rtld --version 2>&1` + if test $? = 0; then + verify_out=`${rtld} --verify "$file"` + ret=$? + case $ret in + [02]) RTLD=${rtld}; break;; + esac + fi fi done case $ret in diff --git a/gmon/gmon.c b/gmon/gmon.c index 6439ed1caa..402a66de01 100644 --- a/gmon/gmon.c +++ b/gmon/gmon.c @@ -390,8 +390,11 @@ write_gmon (void) if (fd == -1) { + do fd = __open_nocancel ("gmon.out", O_CREAT | O_TRUNC | O_WRONLY | O_NOFOLLOW | O_CLOEXEC, 0666); + while (fd < 0 && errno == EINTR); + if (fd < 0) { char buf[300]; diff --git a/htl/Versions b/htl/Versions index 710051756a..02192ad184 100644 --- a/htl/Versions +++ b/htl/Versions @@ -3,6 +3,16 @@ libc { GLIBC_2.12 { pthread_self; __pthread_self; + pthread_attr_getdetachstate; + pthread_attr_getinheritsched; + pthread_attr_getschedparam; + pthread_attr_getschedpolicy; + pthread_attr_setdetachstate; + pthread_attr_setinheritsched; + pthread_attr_setschedpolicy; + pthread_equal; + pthread_getschedparam; + pthread_setschedparam; } GLIBC_2.21 { @@ -38,6 +48,7 @@ libc { __pthread_cleanup_stack; __pthread_total; ___pthread_self; + __pthread_init_thread; } } diff --git a/hurd/Makefile b/hurd/Makefile index 7138e3a6ae..8736d56572 100644 --- a/hurd/Makefile +++ b/hurd/Makefile @@ -29,11 +29,11 @@ inline-headers = hurd.h $(addprefix hurd/,fd.h signal.h \ # The RPC interfaces go in a separate library. interface-library := libhurduser user-interfaces := $(addprefix hurd/,\ - auth startup \ + auth auth_request auth_reply startup \ process process_request \ msg msg_reply msg_request \ - exec exec_startup crash interrupt \ - fs fsys io io_reply io_request \ + exec exec_experimental exec_startup crash interrupt \ + fs fs_experimental fsys io io_reply io_request \ term tioctl socket ifsock \ login password pfinet pci \ ) @@ -56,6 +56,7 @@ routines = hurdstartup hurdinit \ ports-get ports-set hurdports hurdmsg \ errno-loc \ hurdlock \ + sysvshm \ $(sig) $(dtable) $(inlines) \ fd-cleanup port-cleanup report-wait xattr sig = hurdsig hurdfault siginfo hurd-raise preempt-sig \ diff --git a/hurd/Versions b/hurd/Versions index 439e8abf32..d3410232e7 100644 --- a/hurd/Versions +++ b/hurd/Versions @@ -117,6 +117,10 @@ libc { # functions used in macros & inline functions __errno_location; } + GLIBC_2.21 { + # "quasi-internal" functions + _hurd_exec_file_name; + } GLIBC_2.26 { # "quasi-internal" functions _hurd_exec_paths; diff --git a/hurd/hurd/fd.h b/hurd/hurd/fd.h index 1616c635d5..7bdb4d0ea9 100644 --- a/hurd/hurd/fd.h +++ b/hurd/hurd/fd.h @@ -300,8 +300,6 @@ __hurd_at_flags (int *at_flags, int *flags) *flags &= ~O_NOLINK; *at_flags &= ~AT_SYMLINK_FOLLOW; - if (*at_flags & AT_NO_AUTOMOUNT) - *flags |= O_NOTRANS; *at_flags &= ~AT_NO_AUTOMOUNT; if (*at_flags != 0) diff --git a/hurd/hurdexec.c b/hurd/hurdexec.c index 3178f70075..3da2df83bb 100644 --- a/hurd/hurdexec.c +++ b/hurd/hurdexec.c @@ -25,9 +25,12 @@ #include #include #include +#include #include #include +#include + /* Overlay TASK, executing FILE with arguments ARGV and environment ENVP. If TASK == mach_task_self (), some ports are dealloc'd by the exec server. ARGV and ENVP are terminated by NULL pointers. @@ -39,6 +42,13 @@ _hurd_exec (task_t task, file_t file, return _hurd_exec_paths (task, file, NULL, NULL, argv, envp); } +error_t +__hurd_exec_file_name (task_t task, file_t file, const char *filename, + char *const argv[], char *const envp[]) +{ + return _hurd_exec_paths (task, file, filename, filename, argv, envp); +} + link_warning (_hurd_exec, "_hurd_exec is deprecated, use _hurd_exec_paths instead"); @@ -128,7 +138,6 @@ _hurd_exec_paths (task_t task, file_t file, ss = _hurd_self_sigstate (); retry: - assert (! __spin_lock_locked (&ss->critical_section_lock)); __spin_lock (&ss->critical_section_lock); _hurd_sigstate_lock (ss); @@ -442,6 +451,18 @@ retry: portnames, nportnames); /* Fall back for backwards compatibility. This can just be removed when __file_exec goes away. */ + if (err == MIG_BAD_ID) + err = __file_exec_file_name (file, task, flags, + path ? path : "", + args, argslen, env, envlen, + dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize, + ports, MACH_MSG_TYPE_COPY_SEND, + _hurd_nports, + ints, INIT_INT_MAX, + please_dealloc, pdp - please_dealloc, + portnames, nportnames); + /* Fall back for backwards compatibility. This can just be removed + when __file_exec goes away. */ if (err == MIG_BAD_ID) err = __file_exec (file, task, flags, args, argslen, env, envlen, @@ -490,3 +511,9 @@ retry: return err; } libc_hidden_def (_hurd_exec_paths) +extern error_t _hurd_exec_file_name (task_t task, + file_t file, + const char *filename, + char *const argv[], + char *const envp[]); +versioned_symbol (libc, __hurd_exec_file_name, _hurd_exec_file_name, GLIBC_2_21); diff --git a/hurd/hurdsig.c b/hurd/hurdsig.c index 882a03471d..1d732508f4 100644 --- a/hurd/hurdsig.c +++ b/hurd/hurdsig.c @@ -1611,28 +1611,53 @@ _hurdsig_init (const int *intarray, size_t intarraysize) static void reauth_proc (mach_port_t new) { - mach_port_t ref, ignore; + error_t err; + mach_port_t ref, newproc; ref = __mach_reply_port (); - if (! HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC], + err = HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC], __proc_reauthenticate (port, ref, - MACH_MSG_TYPE_MAKE_SEND) - || __auth_user_authenticate (new, ref, - MACH_MSG_TYPE_MAKE_SEND, - &ignore)) - && ignore != MACH_PORT_NULL) - __mach_port_deallocate (__mach_task_self (), ignore); + MACH_MSG_TYPE_MAKE_SEND)); + if (err) + { + __mach_port_destroy (__mach_task_self (), ref); + return; + } + + err = __auth_user_authenticate (new, ref, + MACH_MSG_TYPE_MAKE_SEND, + &newproc); __mach_port_destroy (__mach_task_self (), ref); + if (err) + return; + + if (newproc == MACH_PORT_NULL) + { + /* Old versions of the proc server did not recreate the process + port when reauthenticating, and passed MACH_PORT_NULL through + the auth server. That must be what we're dealing with. */ + + /* Set the owner of the process here too. */ + __mutex_lock (&_hurd_id.lock); + if (!_hurd_check_ids ()) + HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC], + __proc_setowner (port, + (_hurd_id.gen.nuids + ? _hurd_id.gen.uids[0] : 0), + !_hurd_id.gen.nuids)); + __mutex_unlock (&_hurd_id.lock); + + return; + } + + err = __proc_reauthenticate_complete (newproc); + if (err) + { + __mach_port_deallocate (__mach_task_self (), newproc); + return; + } - /* Set the owner of the process here too. */ - __mutex_lock (&_hurd_id.lock); - if (!_hurd_check_ids ()) - HURD_PORT_USE (&_hurd_ports[INIT_PORT_PROC], - __proc_setowner (port, - (_hurd_id.gen.nuids - ? _hurd_id.gen.uids[0] : 0), - !_hurd_id.gen.nuids)); - __mutex_unlock (&_hurd_id.lock); + _hurd_port_set (&_hurd_ports[INIT_PORT_PROC], newproc); (void) &reauth_proc; /* Silence compiler warning. */ } diff --git a/hurd/sysvshm.c b/hurd/sysvshm.c new file mode 100644 index 0000000000..8557d68d6c --- /dev/null +++ b/hurd/sysvshm.c @@ -0,0 +1,97 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + + +/* Description of an shm attachment. */ +struct sysvshm_attach +{ + /* Linked list. */ + struct sysvshm_attach *next; + + /* Map address. */ + void *addr; + + /* Map size. */ + size_t size; +}; + +/* List of attachments. */ +static struct sysvshm_attach *attach_list; + +/* A lock to protect the linked list of shared memory attachments. */ +static unsigned int sysvshm_lock = LLL_LOCK_INITIALIZER; + + +/* Adds a segment attachment. */ +error_t +__sysvshm_add (void *addr, size_t size) +{ + struct sysvshm_attach *shm; + + shm = malloc (sizeof (*shm)); + if (!shm) + return errno; + + __mutex_lock (&sysvshm_lock); + shm->addr = addr; + shm->size = size; + shm->next = attach_list; + attach_list = shm; + __mutex_unlock (&sysvshm_lock); + + return 0; +} + +/* Removes a segment attachment. Returns its size if found, or EINVAL + otherwise. */ +error_t +__sysvshm_remove (void *addr, size_t *size) +{ + struct sysvshm_attach *shm; + struct sysvshm_attach **pshm = &attach_list; + + __mutex_lock (&sysvshm_lock); + shm = attach_list; + while (shm) + { + shm = *pshm; + if (shm->addr == addr) + { + *pshm = shm->next; + *size = shm->size; + __mutex_unlock (&sysvshm_lock); + free (shm); + return 0; + } + pshm = &shm->next; + shm = shm->next; + } + __mutex_unlock (&sysvshm_lock); + return EINVAL; +} diff --git a/hurd/sysvshm.h b/hurd/sysvshm.h new file mode 100644 index 0000000000..1204db8339 --- /dev/null +++ b/hurd/sysvshm.h @@ -0,0 +1,47 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + +/* The area (from top to bottom) that is used for private keys. These + are all keys that have the second highest bit set. */ +#define SHM_PRIV_KEY_START INT_MAX +#define SHM_PRIV_KEY_END ((INT_MAX / 2) + 1) + +#define SHM_PREFIX "sysvshm-" +#define SHM_DIR _PATH_DEV "shm/" + +/* The maximum number of characters in a shared memory segment file name. + 32 is the max number of characters in a 128 bit number in hex. */ +#if __WORDSIZE > 128 +#error Need to increase SHM_NAMEMAX. +#else +#define SHM_NAMEMAX (sizeof (SHM_PREFIX) - 1 + 32 + 1) +#endif + +/* Use this with printf and its variants. */ +#define SHM_NAMEPRI SHM_PREFIX "%0x" + + +/* Adds a segment attachment. */ +error_t __sysvshm_add (void *addr, size_t size); + +/* Removes a segment attachment. Returns its size if found, or EINVAL + otherwise. */ +error_t __sysvshm_remove (void *addr, size_t *size); diff --git a/hurd/thread-cancel.c b/hurd/thread-cancel.c index faa923febe..5e3629c97e 100644 --- a/hurd/thread-cancel.c +++ b/hurd/thread-cancel.c @@ -42,7 +42,6 @@ hurd_thread_cancel (thread_t thread) return 0; } - assert (! __spin_lock_locked (&ss->critical_section_lock)); __spin_lock (&ss->critical_section_lock); __spin_lock (&ss->lock); err = __thread_suspend (thread); @@ -82,7 +81,6 @@ hurd_check_cancel (void) int cancel; __spin_lock (&ss->lock); - assert (! __spin_lock_locked (&ss->critical_section_lock)); cancel = ss->cancel; ss->cancel = 0; __spin_unlock (&ss->lock); diff --git a/hurd/xattr.c b/hurd/xattr.c index 0715ad7b02..2d83edf2fe 100644 --- a/hurd/xattr.c +++ b/hurd/xattr.c @@ -50,7 +50,15 @@ _hurd_xattr_get (io_t port, const char *name, void *value, size_t *size) else if (value) { if (*size < sizeof st.st_author) - return ERANGE; + { + if (*size > 0) + return ERANGE; + else + { + *size = sizeof st.st_author; + return 0; + } + } memcpy (value, &st.st_author, sizeof st.st_author); } *size = sizeof st.st_author; @@ -61,15 +69,33 @@ _hurd_xattr_get (io_t port, const char *name, void *value, size_t *size) { char *buf = value; mach_msg_type_number_t bufsz = value ? *size : 0; - error_t err = __file_get_translator (port, &buf, &bufsz); + struct stat64 st; + error_t err; + + err = __io_stat (port, &st); + if (err) + return err; + if ((st.st_mode & S_IPTRANS) == 0) + return ENODATA; + + err = __file_get_translator (port, &buf, &bufsz); if (err) return err; - if (value != NULL && *size < bufsz) + + if (*size < bufsz) { if (buf != value) __munmap (buf, bufsz); - return ERANGE; + + if (*size > 0) + return ERANGE; + else + { + *size = bufsz; + return 0; + } } + if (buf != value && bufsz > 0) { if (value != NULL) @@ -149,10 +175,9 @@ _hurd_xattr_set (io_t port, const char *name, const void *value, size_t size, if (err) return err; if (bufsz > 0) - { - __munmap (buf, bufsz); - return ENODATA; - } + __munmap (buf, bufsz); + else + return ENODATA; } return __file_set_translator (port, FS_TRANS_SET | ((flags & XATTR_CREATE) @@ -193,7 +218,7 @@ _hurd_xattr_list (io_t port, void *buffer, size_t *size) if (st.st_mode & S_IPTRANS) add ("gnu.translator"); - if (buffer != NULL && total > *size) + if (*size > 0 && total > *size) return ERANGE; *size = total; return 0; diff --git a/include/features.h b/include/features.h index fc164d332a..19b46d4fdc 100644 --- a/include/features.h +++ b/include/features.h @@ -409,10 +409,9 @@ # define __USE_GNU 1 #endif -#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 -# if !defined __OPTIMIZE__ || __OPTIMIZE__ <= 0 -# warning _FORTIFY_SOURCE requires compiling with optimization (-O) -# elif !__GNUC_PREREQ (4, 1) +#if defined _FORTIFY_SOURCE && _FORTIFY_SOURCE > 0 \ + && defined __OPTIMIZE__ && __OPTIMIZE__ > 0 +# if !__GNUC_PREREQ (4, 1) # warning _FORTIFY_SOURCE requires GCC 4.1 or later # elif _FORTIFY_SOURCE > 2 && (__glibc_clang_prereq (9, 0) \ || __GNUC_PREREQ (12, 0)) diff --git a/include/libc-symbols.h b/include/libc-symbols.h index e21bb599b3..e47d071958 100644 --- a/include/libc-symbols.h +++ b/include/libc-symbols.h @@ -208,12 +208,12 @@ #define __make_section_unallocated(section_string) \ asm (".section " section_string "\n\t.previous"); -/* Tacking on "\n\t#" to the section name makes gcc put it's bogus +/* Tacking on "\n#APP\n\t#" to the section name makes gcc put it's bogus section attributes on what looks like a comment to the assembler. */ #ifdef HAVE_SECTION_QUOTES -# define __sec_comment "\"\n\t#\"" +# define __sec_comment "\"\n#APP\n\t#\"" #else -# define __sec_comment "\n\t#" +# define __sec_comment "\n#APP\n\t#" #endif #define link_warning(symbol, msg) \ __make_section_unallocated (".gnu.warning." #symbol) \ diff --git a/include/stubs-bootstrap.h b/include/stubs-bootstrap.h new file mode 100644 index 0000000000..8d962019e2 --- /dev/null +++ b/include/stubs-bootstrap.h @@ -0,0 +1,12 @@ +/* Placeholder stubs.h file for bootstrapping. + + When bootstrapping a GCC/GLIBC pair, GCC requires that the GLIBC + headers be installed, but we can't fully build GLIBC without that + GCC. So we run the command: + + make install-headers install-bootstrap-headers=yes + + to install the headers GCC needs, but avoid building certain + difficult headers. The header depends, via the + GLIBC subdir 'stubs' make targets, on every .o file in GLIBC, but + an empty stubs.h like this will do fine for GCC. */ diff --git a/include/stubs-prologue.h b/include/stubs-prologue.h index 0577bc6a5f..cf8eba0165 100644 --- a/include/stubs-prologue.h +++ b/include/stubs-prologue.h @@ -8,7 +8,7 @@ every time called, usually setting errno to ENOSYS. */ #ifdef _LIBC - #error Applications may not define the macro _LIBC +# error Applications may not define the macro _LIBC #endif @ Placeholder line so we remember to keep the preceding blank line here. diff --git a/inet/netinet/in.h b/inet/netinet/in.h index fa57b61079..f684be5beb 100644 --- a/inet/netinet/in.h +++ b/inet/netinet/in.h @@ -244,7 +244,7 @@ extern const struct in6_addr in6addr_loopback; /* ::1 */ /* Structure describing an Internet socket address. */ -struct sockaddr_in +struct __attribute_struct_may_alias__ sockaddr_in { __SOCKADDR_COMMON (sin_); in_port_t sin_port; /* Port number. */ @@ -257,9 +257,11 @@ struct sockaddr_in - sizeof (struct in_addr)]; }; -#if !__USE_KERNEL_IPV6_DEFS +#if __USE_KERNEL_IPV6_DEFS +struct __attribute_struct_may_alias__ sockaddr_in6; +#else /* Ditto, for IPv6. */ -struct sockaddr_in6 +struct __attribute_struct_may_alias__ sockaddr_in6 { __SOCKADDR_COMMON (sin6_); in_port_t sin6_port; /* Transport layer port # */ diff --git a/intl/locale.alias b/intl/locale.alias index 4e952d5b72..21baef05be 100644 --- a/intl/locale.alias +++ b/intl/locale.alias @@ -43,8 +43,8 @@ danish da_DK.ISO-8859-1 dansk da_DK.ISO-8859-1 deutsch de_DE.ISO-8859-1 dutch nl_NL.ISO-8859-1 -eesti et_EE.ISO-8859-1 -estonian et_EE.ISO-8859-1 +eesti et_EE.ISO-8859-15 +estonian et_EE.ISO-8859-15 finnish fi_FI.ISO-8859-1 french fr_FR.ISO-8859-1 galego gl_ES.ISO-8859-1 @@ -72,7 +72,7 @@ nynorsk nn_NO.ISO-8859-1 polish pl_PL.ISO-8859-2 portuguese pt_PT.ISO-8859-1 romanian ro_RO.ISO-8859-2 -russian ru_RU.ISO-8859-5 +russian ru_RU.KOI8-R slovak sk_SK.ISO-8859-2 slovene sl_SI.ISO-8859-2 slovenian sl_SI.ISO-8859-2 diff --git a/io/bits/poll2.h b/io/bits/poll2.h index 6152a8c5e4..efc8b85403 100644 --- a/io/bits/poll2.h +++ b/io/bits/poll2.h @@ -43,7 +43,7 @@ poll (struct pollfd *__fds, nfds_t __nfds, int __timeout) #ifdef __USE_GNU -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS extern int __REDIRECT (__ppoll64_alias, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, const __sigset_t *__ss), __ppoll64); diff --git a/io/fcntl.h b/io/fcntl.h index 9cee0b5900..666b7e5eb6 100644 --- a/io/fcntl.h +++ b/io/fcntl.h @@ -172,7 +172,7 @@ typedef __pid_t pid_t; This function is a cancellation point and therefore not marked with __THROW. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS # ifndef __USE_FILE_OFFSET64 extern int fcntl (int __fd, int __cmd, ...); # else @@ -185,7 +185,7 @@ extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64); # ifdef __USE_LARGEFILE64 extern int fcntl64 (int __fd, int __cmd, ...); # endif -#else /* __USE_TIME_BITS64 */ +#else /* __USE_TIME64_REDIRECTS */ # ifdef __REDIRECT extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...), __fcntl_time64); diff --git a/io/fts.h b/io/fts.h index 61f95bb441..97a031ebbd 100644 --- a/io/fts.h +++ b/io/fts.h @@ -187,7 +187,7 @@ FTSENT *fts_read (FTS *); int fts_set (FTS *, FTSENT *, int) __THROW; #else # ifdef __REDIRECT -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS FTSENT *__REDIRECT (fts_children, (FTS *, int), fts64_children); int __REDIRECT (fts_close, (FTS *), fts64_close); FTS *__REDIRECT (fts_open, (char * const *, int, @@ -206,7 +206,7 @@ int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), __fts64_set_time64); # endif # else -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS # define fts_children fts64_children # define fts_close fts64_close # define fts_open fts64_open @@ -217,7 +217,7 @@ int __REDIRECT_NTH (fts_set, (FTS *, FTSENT *, int), # endif #endif #ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS FTSENT64 *fts64_children (FTS64 *, int); int fts64_close (FTS64 *); FTS64 *fts64_open (char * const *, int, diff --git a/io/ftw.h b/io/ftw.h index e4d1b84d53..39cf595b27 100644 --- a/io/ftw.h +++ b/io/ftw.h @@ -137,7 +137,7 @@ extern int ftw (const char *__dir, __ftw_func_t __func, int __descriptors) __nonnull ((1, 2)); #else # ifdef __REDIRECT -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, int __descriptors), ftw64) __nonnull ((1, 2)); # else @@ -146,7 +146,7 @@ extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, __nonnull ((1, 2)); # endif # else -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS # define ftw ftw64 # else # define ftw __ftw64_time64 @@ -154,7 +154,7 @@ extern int __REDIRECT (ftw, (const char *__dir, __ftw_func_t __func, # endif #endif #ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int ftw64 (const char *__dir, __ftw64_func_t __func, int __descriptors) __nonnull ((1, 2)); # else @@ -180,7 +180,7 @@ extern int nftw (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # else # ifdef __REDIRECT -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, int __descriptors, int __flag), nftw64) __nonnull ((1, 2)); @@ -190,7 +190,7 @@ extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, __nonnull ((1, 2)); # endif # else -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS # define nftw nftw64 # else # define nftw __nftw64_time64 @@ -198,7 +198,7 @@ extern int __REDIRECT (nftw, (const char *__dir, __nftw_func_t __func, # endif # endif # ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int nftw64 (const char *__dir, __nftw64_func_t __func, int __descriptors, int __flag) __nonnull ((1, 2)); # else diff --git a/io/sys/poll.h b/io/sys/poll.h index 7858fad6b9..c324ff5dad 100644 --- a/io/sys/poll.h +++ b/io/sys/poll.h @@ -66,7 +66,7 @@ extern int ppoll (struct pollfd *__fds, nfds_t __nfds, const __sigset_t *__ss) __fortified_attr_access (__write_only__, 1, 2); -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # ifdef __REDIRECT extern int __REDIRECT (ppoll, (struct pollfd *__fds, nfds_t __nfds, const struct timespec *__timeout, diff --git a/io/sys/stat.h b/io/sys/stat.h index 1fa6d6e62e..3b4ba80132 100644 --- a/io/sys/stat.h +++ b/io/sys/stat.h @@ -209,7 +209,7 @@ extern int stat (const char *__restrict __file, that file descriptor FD is open on and put them in BUF. */ extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2)); #else -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (stat, (const char *__restrict __file, struct stat *__restrict __buf), @@ -236,7 +236,7 @@ extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64) # endif #endif #ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int stat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2)); @@ -265,7 +265,7 @@ extern int fstatat (int __fd, const char *__restrict __file, struct stat *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); # else -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, struct stat *__restrict __buf, @@ -287,7 +287,7 @@ extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file, # endif # ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int fstatat64 (int __fd, const char *__restrict __file, struct stat64 *__restrict __buf, int __flag) __THROW __nonnull ((2, 3)); @@ -313,7 +313,7 @@ extern int __REDIRECT_NTH (fstatat64, (int __fd, extern int lstat (const char *__restrict __file, struct stat *__restrict __buf) __THROW __nonnull ((1, 2)); # else -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # ifdef __REDIRECT_NTH extern int __REDIRECT_NTH (lstat, (const char *__restrict __file, @@ -334,7 +334,7 @@ extern int __REDIRECT_NTH (lstat, # endif # endif # ifdef __USE_LARGEFILE64 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int lstat64 (const char *__restrict __file, struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2)); @@ -427,7 +427,7 @@ extern int mkfifoat (int __fd, const char *__path, __mode_t __mode) #endif #ifdef __USE_ATFILE -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Set file access and modification times relative to directory file descriptor. */ extern int utimensat (int __fd, const char *__path, @@ -447,7 +447,7 @@ extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path, #endif #ifdef __USE_XOPEN2K8 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Set file access and modification times of the file associated with FD. */ extern int futimens (int __fd, const struct timespec __times[2]) __THROW; diff --git a/io/utime.h b/io/utime.h index c5eacedd6a..1c7587d9c1 100644 --- a/io/utime.h +++ b/io/utime.h @@ -35,7 +35,7 @@ __BEGIN_DECLS /* Structure describing file times. */ struct utimbuf { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS __time64_t actime; /* Access time. */ __time64_t modtime; /* Modification time. */ #else @@ -46,7 +46,7 @@ struct utimbuf /* Set the access and modification times of FILE to those given in *FILE_TIMES. If FILE_TIMES is NULL, set them to the current time. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int utime (const char *__file, const struct utimbuf *__file_times) __THROW __nonnull ((1)); diff --git a/libio/bits/stdio2.h b/libio/bits/stdio2.h index f9e8d37610..0dc4e87c65 100644 --- a/libio/bits/stdio2.h +++ b/libio/bits/stdio2.h @@ -195,24 +195,24 @@ __fortify_function __wur __fortified_attr_access (__write_only__, 1, 2) __nonnull ((3)) char * fgets (char *__restrict __s, int __n, FILE *__restrict __stream) { - size_t sz = __glibc_objsize (__s); - if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) + size_t __sz = __glibc_objsize (__s); + if (__glibc_safe_or_unknown_len (__n, sizeof (char), __sz)) return __fgets_alias (__s, __n, __stream); - if (__glibc_unsafe_len (__n, sizeof (char), sz)) - return __fgets_chk_warn (__s, sz, __n, __stream); - return __fgets_chk (__s, sz, __n, __stream); + if (__glibc_unsafe_len (__n, sizeof (char), __sz)) + return __fgets_chk_warn (__s, __sz, __n, __stream); + return __fgets_chk (__s, __sz, __n, __stream); } __fortify_function __wur __nonnull ((4)) size_t fread (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) { - size_t sz = __glibc_objsize0 (__ptr); - if (__glibc_safe_or_unknown_len (__n, __size, sz)) + size_t __sz = __glibc_objsize0 (__ptr); + if (__glibc_safe_or_unknown_len (__n, __size, __sz)) return __fread_alias (__ptr, __size, __n, __stream); - if (__glibc_unsafe_len (__n, __size, sz)) - return __fread_chk_warn (__ptr, sz, __size, __n, __stream); - return __fread_chk (__ptr, sz, __size, __n, __stream); + if (__glibc_unsafe_len (__n, __size, __sz)) + return __fread_chk_warn (__ptr, __sz, __size, __n, __stream); + return __fread_chk (__ptr, __sz, __size, __n, __stream); } #ifdef __USE_GNU @@ -220,12 +220,12 @@ __fortify_function __wur __fortified_attr_access (__write_only__, 1, 2) __nonnull ((3)) char * fgets_unlocked (char *__restrict __s, int __n, FILE *__restrict __stream) { - size_t sz = __glibc_objsize (__s); - if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) + size_t __sz = __glibc_objsize (__s); + if (__glibc_safe_or_unknown_len (__n, sizeof (char), __sz)) return __fgets_unlocked_alias (__s, __n, __stream); - if (__glibc_unsafe_len (__n, sizeof (char), sz)) - return __fgets_unlocked_chk_warn (__s, sz, __n, __stream); - return __fgets_unlocked_chk (__s, sz, __n, __stream); + if (__glibc_unsafe_len (__n, sizeof (char), __sz)) + return __fgets_unlocked_chk_warn (__s, __sz, __n, __stream); + return __fgets_unlocked_chk (__s, __sz, __n, __stream); } #endif @@ -235,8 +235,8 @@ __fortify_function __wur __nonnull ((4)) size_t fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, FILE *__restrict __stream) { - size_t sz = __glibc_objsize0 (__ptr); - if (__glibc_safe_or_unknown_len (__n, __size, sz)) + size_t __sz = __glibc_objsize0 (__ptr); + if (__glibc_safe_or_unknown_len (__n, __size, __sz)) { # ifdef __USE_EXTERN_INLINES if (__builtin_constant_p (__size) @@ -261,9 +261,9 @@ fread_unlocked (void *__restrict __ptr, size_t __size, size_t __n, # endif return __fread_unlocked_alias (__ptr, __size, __n, __stream); } - if (__glibc_unsafe_len (__n, __size, sz)) - return __fread_unlocked_chk_warn (__ptr, sz, __size, __n, __stream); - return __fread_unlocked_chk (__ptr, sz, __size, __n, __stream); + if (__glibc_unsafe_len (__n, __size, __sz)) + return __fread_unlocked_chk_warn (__ptr, __sz, __size, __n, __stream); + return __fread_unlocked_chk (__ptr, __sz, __size, __n, __stream); } #endif diff --git a/locale/Makefile b/locale/Makefile index 0da4e1c958..2810f28605 100644 --- a/locale/Makefile +++ b/locale/Makefile @@ -160,9 +160,7 @@ localepath = "$(complocaledir):$(i18ndir)" # -Iprograms doesn't really belong here, but this gets it at the head # of the list instead of the tail, where CPPFLAGS-$(lib) gets added. # We need it before the standard -I's to see programs/config.h first. -# Define 'LOCALEDIR' for use in 'compute_locale_search_path'. locale-CPPFLAGS = -DCOMPLOCALEDIR='"$(complocaledir)"' \ - -DLOCALEDIR='"$(libdir)/locale"' \ -DLOCALE_ALIAS_PATH='"$(localedir)"' \ -Iprograms diff --git a/locale/newlocale.c b/locale/newlocale.c index 538bbac233..6d95e029a0 100644 --- a/locale/newlocale.c +++ b/locale/newlocale.c @@ -29,7 +29,6 @@ /* Lock for protecting global data. */ __libc_rwlock_define (extern , __libc_setlocale_lock attribute_hidden) -extern error_t compute_locale_search_path (char **, size_t *); /* Use this when we come along an error. */ #define ERROR_RETURN \ @@ -48,6 +47,7 @@ __newlocale (int category_mask, const char *locale, locale_t base) locale_t result_ptr; char *locale_path; size_t locale_path_len; + const char *locpath_var; int cnt; size_t names_len; @@ -101,8 +101,17 @@ __newlocale (int category_mask, const char *locale, locale_t base) locale_path = NULL; locale_path_len = 0; - if (compute_locale_search_path (&locale_path, &locale_path_len) != 0) - return NULL; + locpath_var = getenv ("LOCPATH"); + if (locpath_var != NULL && locpath_var[0] != '\0') + { + if (__argz_create_sep (locpath_var, ':', + &locale_path, &locale_path_len) != 0) + return NULL; + + if (__argz_add_sep (&locale_path, &locale_path_len, + _nl_default_locale_path, ':') != 0) + return NULL; + } /* Get the names for the locales we are interested in. We either allow a composite name or a single name. */ diff --git a/locale/programs/ld-collate.c b/locale/programs/ld-collate.c index 5048adbd9f..29731c562f 100644 --- a/locale/programs/ld-collate.c +++ b/locale/programs/ld-collate.c @@ -3515,8 +3515,20 @@ error while adding equivalent collating symbol")); } else if (arg != NULL) { + void *ptr = NULL; symstr = arg->val.str.startmb; symlen = arg->val.str.lenmb; + if (state != 5 + && find_entry (&charmap->char_table, symstr, symlen, &ptr) != 0 + && (repertoire == NULL || + find_entry (&repertoire->char_table, symstr, symlen, &ptr) != 0) + && find_entry (&collate->elem_table, symstr, symlen, &ptr) != 0 + && find_entry (&collate->sym_table, symstr, symlen, &ptr) != 0) + { + if (verbose) + lr_error (ldfile, _("%s: symbol `%.*s' not known"), + "LC_COLLATE", (int) symlen, symstr); + } } else { diff --git a/locale/programs/ld-identification.c b/locale/programs/ld-identification.c index f4fe40959b..f148593556 100644 --- a/locale/programs/ld-identification.c +++ b/locale/programs/ld-identification.c @@ -144,6 +144,9 @@ No definition for %s category found"), "LC_IDENTIFICATION"); #cat); \ identification->cat = ""; \ } +#define TEST_ELEM_OPT(cat) \ + if (identification->cat == NULL) \ + identification->cat = ""; \ TEST_ELEM (title); TEST_ELEM (source); @@ -154,9 +157,9 @@ No definition for %s category found"), "LC_IDENTIFICATION"); TEST_ELEM (fax); TEST_ELEM (language); TEST_ELEM (territory); - TEST_ELEM (audience); - TEST_ELEM (application); - TEST_ELEM (abbreviation); + TEST_ELEM_OPT (audience); + TEST_ELEM_OPT (application); + TEST_ELEM_OPT (abbreviation); TEST_ELEM (revision); TEST_ELEM (date); diff --git a/locale/programs/locale.c b/locale/programs/locale.c index c7ee1874e8..018e5a54dd 100644 --- a/locale/programs/locale.c +++ b/locale/programs/locale.c @@ -797,11 +797,15 @@ static void show_locale_vars (void) { const char *lcall = getenv ("LC_ALL") ?: ""; + const char *language = getenv ("LANGUAGE") ?: ""; const char *lang = getenv ("LANG") ?: ""; /* LANG has to be the first value. */ print_assignment ("LANG", lang, false); + if (getenv ("POSIXLY_CORRECT") == NULL) + printf ("LANGUAGE=%s\n", language); + /* Now all categories in an unspecified order. */ for (size_t cat_no = 0; cat_no < NCATEGORIES; ++cat_no) if (cat_no != LC_ALL) diff --git a/locale/setlocale.c b/locale/setlocale.c index afaa8b483e..7bd27e5398 100644 --- a/locale/setlocale.c +++ b/locale/setlocale.c @@ -213,60 +213,12 @@ setdata (int category, struct __locale_data *data) } } -/* Return in *LOCALE_PATH and *LOCALE_PATH_LEN the locale data search path as - an argz list. Return ENOMEN on error, zero otherwise. */ -error_t -compute_locale_search_path (char **locale_path, size_t *locale_path_len) -{ - char* guix_locpath_var = getenv ("GUIX_LOCPATH"); - char *locpath_var = getenv ("LOCPATH"); - - if (guix_locpath_var != NULL && guix_locpath_var[0] != '\0') - { - /* Entries in 'GUIX_LOCPATH' take precedence over 'LOCPATH'. These - entries are systematically prefixed with "/X.Y" where "X.Y" is the - libc version. */ - if (__argz_add_sep (locale_path, locale_path_len, - guix_locpath_var, ':') != 0 - || __argz_suffix_entries (locale_path, locale_path_len, - "/" VERSION) != 0) - goto bail_out; - } - - if (locpath_var != NULL && locpath_var[0] != '\0') - { - if (__argz_add_sep (locale_path, locale_path_len, - locpath_var, ':') != 0) - goto bail_out; - - } - - /* Append the system default locale directory. */ - if (__argz_add_sep (locale_path, locale_path_len, - _nl_default_locale_path, ':') != 0) - goto bail_out; - - /* Last, unconditionally append our own locale directory, which should - contain data for C.UTF-8. */ - if (__argz_add_sep (locale_path, locale_path_len, - LOCALEDIR "/" VERSION, ':') != 0) - goto bail_out; - - return 0; - - bail_out: - free (*locale_path); - *locale_path = NULL; - *locale_path_len = 0; - - return ENOMEM; -} - char * setlocale (int category, const char *locale) { char *locale_path; size_t locale_path_len; + const char *locpath_var; char *composite; /* Sanity check for CATEGORY argument. */ @@ -297,10 +249,17 @@ setlocale (int category, const char *locale) locale_path = NULL; locale_path_len = 0; - if (compute_locale_search_path (&locale_path, &locale_path_len) != 0) + locpath_var = getenv ("LOCPATH"); + if (locpath_var != NULL && locpath_var[0] != '\0') { - __libc_rwlock_unlock (__libc_setlocale_lock); - return NULL; + if (__argz_create_sep (locpath_var, ':', + &locale_path, &locale_path_len) != 0 + || __argz_add_sep (&locale_path, &locale_path_len, + _nl_default_locale_path, ':') != 0) + { + __libc_rwlock_unlock (__libc_setlocale_lock); + return NULL; + } } if (category == LC_ALL) diff --git a/locale/tst-locale-locpath.sh b/locale/tst-locale-locpath.sh index 527732953d..b2bd26e55d 100644 --- a/locale/tst-locale-locpath.sh +++ b/locale/tst-locale-locpath.sh @@ -54,6 +54,7 @@ EOF cat > "$testroot/stdout-expected" <> LOCALES; \ - done - $(make-target-directory) - $(INSTALL_DATA) LOCALES $@ - INSTALL-SUPPORTED-LOCALE-ARCHIVE=$(addprefix install-archive-, $(SUPPORTED-LOCALES)) INSTALL-SUPPORTED-LOCALE-FILES=$(addprefix install-files-, $(SUPPORTED-LOCALES)) diff --git a/localedata/SUPPORTED b/localedata/SUPPORTED index a2f3132480..974d91c3d3 100644 --- a/localedata/SUPPORTED +++ b/localedata/SUPPORTED @@ -137,9 +137,11 @@ en_BW/ISO-8859-1 \ en_CA.UTF-8/UTF-8 \ en_CA/ISO-8859-1 \ en_DK.UTF-8/UTF-8 \ +en_DK.ISO-8859-15/ISO-8859-15 \ en_DK/ISO-8859-1 \ en_GB.UTF-8/UTF-8 \ en_GB/ISO-8859-1 \ +en_GB.ISO-8859-15/ISO-8859-15 \ en_HK.UTF-8/UTF-8 \ en_HK/ISO-8859-1 \ en_IE.UTF-8/UTF-8 \ @@ -157,6 +159,7 @@ en_SG.UTF-8/UTF-8 \ en_SG/ISO-8859-1 \ en_US.UTF-8/UTF-8 \ en_US/ISO-8859-1 \ +en_US.ISO-8859-15/ISO-8859-15 \ en_ZA.UTF-8/UTF-8 \ en_ZA/ISO-8859-1 \ en_ZM/UTF-8 \ @@ -211,6 +214,9 @@ et_EE.ISO-8859-15/ISO-8859-15 \ eu_ES.UTF-8/UTF-8 \ eu_ES/ISO-8859-1 \ eu_ES@euro/ISO-8859-15 \ +eu_FR.UTF-8/UTF-8 \ +eu_FR/ISO-8859-1 \ +eu_FR@euro/ISO-8859-15 \ fa_IR/UTF-8 \ ff_SN/UTF-8 \ fi_FI.UTF-8/UTF-8 \ @@ -260,8 +266,8 @@ hif_FJ/UTF-8 \ hne_IN/UTF-8 \ hr_HR.UTF-8/UTF-8 \ hr_HR/ISO-8859-2 \ -hsb_DE/ISO-8859-2 \ hsb_DE.UTF-8/UTF-8 \ +hsb_DE/ISO-8859-2 \ ht_HT/UTF-8 \ hu_HU.UTF-8/UTF-8 \ hu_HU/ISO-8859-2 \ @@ -280,19 +286,20 @@ it_IT.UTF-8/UTF-8 \ it_IT/ISO-8859-1 \ it_IT@euro/ISO-8859-15 \ iu_CA/UTF-8 \ -ja_JP.EUC-JP/EUC-JP \ ja_JP.UTF-8/UTF-8 \ +ja_JP.EUC-JP/EUC-JP \ ka_GE.UTF-8/UTF-8 \ ka_GE/GEORGIAN-PS \ kab_DZ/UTF-8 \ kk_KZ.UTF-8/UTF-8 \ kk_KZ/PT154 \ +kk_KZ.RK1048/RK1048 \ kl_GL.UTF-8/UTF-8 \ kl_GL/ISO-8859-1 \ km_KH/UTF-8 \ kn_IN/UTF-8 \ -ko_KR.EUC-KR/EUC-KR \ ko_KR.UTF-8/UTF-8 \ +ko_KR.EUC-KR/EUC-KR \ kok_IN/UTF-8 \ ks_IN/UTF-8 \ ks_IN@devanagari/UTF-8 \ @@ -383,9 +390,10 @@ raj_IN/UTF-8 \ rif_MA/UTF-8 \ ro_RO.UTF-8/UTF-8 \ ro_RO/ISO-8859-2 \ -ru_RU.KOI8-R/KOI8-R \ ru_RU.UTF-8/UTF-8 \ +ru_RU.KOI8-R/KOI8-R \ ru_RU/ISO-8859-5 \ +ru_RU.CP1251/CP1251 \ ru_UA.UTF-8/UTF-8 \ ru_UA/KOI8-U \ rw_RW/UTF-8 \ @@ -429,6 +437,7 @@ sv_FI/ISO-8859-1 \ sv_FI@euro/ISO-8859-15 \ sv_SE.UTF-8/UTF-8 \ sv_SE/ISO-8859-1 \ +sv_SE.ISO-8859-15/ISO-8859-15 \ sw_KE/UTF-8 \ sw_TZ/UTF-8 \ syr/UTF-8 \ @@ -470,9 +479,9 @@ uz_UZ/ISO-8859-1 \ uz_UZ@cyrillic/UTF-8 \ ve_ZA/UTF-8 \ vi_VN/UTF-8 \ +wa_BE.UTF-8/UTF-8 \ wa_BE/ISO-8859-1 \ wa_BE@euro/ISO-8859-15 \ -wa_BE.UTF-8/UTF-8 \ wae_CH/UTF-8 \ wal_ET/UTF-8 \ wo_SN/UTF-8 \ @@ -484,17 +493,17 @@ yo_NG/UTF-8 \ yue_HK/UTF-8 \ yuw_PG/UTF-8 \ zgh_MA/UTF-8 \ +zh_CN.UTF-8/UTF-8 \ zh_CN.GB18030/GB18030 \ zh_CN.GBK/GBK \ -zh_CN.UTF-8/UTF-8 \ zh_CN/GB2312 \ zh_HK.UTF-8/UTF-8 \ zh_HK/BIG5-HKSCS \ zh_SG.UTF-8/UTF-8 \ zh_SG.GBK/GBK \ zh_SG/GB2312 \ -zh_TW.EUC-TW/EUC-TW \ zh_TW.UTF-8/UTF-8 \ +zh_TW.EUC-TW/EUC-TW \ zh_TW/BIG5 \ zu_ZA.UTF-8/UTF-8 \ zu_ZA/ISO-8859-1 \ diff --git a/localedata/locales/ar_SA b/localedata/locales/ar_SA index 6c6f6b37fc..b072757a4d 100644 --- a/localedata/locales/ar_SA +++ b/localedata/locales/ar_SA @@ -47,223 +47,8 @@ END LC_CTYPE % Set up the LC_COLLATE category LC_COLLATE - - -order_start forward; forward - - - - - - - - - - - - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - ; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - IGNORE - IGNORE - IGNORE - IGNORE - IGNORE - IGNORE - IGNORE - IGNORE - IGNORE -order_end - - +% Copy the template from ISO/IEC 14651 +copy "iso14651_t1" END LC_COLLATE diff --git a/localedata/locales/en_DK b/localedata/locales/en_DK index 1632bbd670..e88987fa4c 100644 --- a/localedata/locales/en_DK +++ b/localedata/locales/en_DK @@ -63,27 +63,11 @@ copy "en_GB" END LC_CTYPE LC_MONETARY -int_curr_symbol "DKK " -currency_symbol "kr." -mon_decimal_point "," -mon_thousands_sep "." -mon_grouping 3 -positive_sign "" -negative_sign "-" -int_frac_digits 2 -frac_digits 2 -p_cs_precedes 1 -p_sep_by_space 0 -n_cs_precedes 1 -n_sep_by_space 0 -p_sign_posn 1 -n_sign_posn 1 +copy "da_DK" END LC_MONETARY LC_NUMERIC -decimal_point "," -thousands_sep "." -grouping 3 +copy "da_DK" END LC_NUMERIC LC_TIME @@ -153,7 +137,7 @@ copy "da_DK" END LC_MEASUREMENT LC_NAME -name_fmt "%d%t%g%t%m%t%f" +copy "da_DK" END LC_NAME LC_ADDRESS diff --git a/localedata/locales/es_MX b/localedata/locales/es_MX index ffdf5a0ac0..de6387f07c 100644 --- a/localedata/locales/es_MX +++ b/localedata/locales/es_MX @@ -66,7 +66,7 @@ LC_MONETARY int_curr_symbol "MXN " currency_symbol "$" mon_decimal_point "." -mon_thousands_sep "," +mon_thousands_sep " " mon_grouping 3 positive_sign "" negative_sign "-" diff --git a/localedata/locales/eu_FR b/localedata/locales/eu_FR new file mode 100644 index 0000000000..5c681db9f5 --- /dev/null +++ b/localedata/locales/eu_FR @@ -0,0 +1,83 @@ +comment_char % +escape_char / +% +% Basque Language Locale for France +% Language: eu +% Territory: FR +% Revision: 1.0 +% Date: 2004-06-24 +% Users: general +% Charset: ISO-8859-1 +% Distribution and use is free, also +% for commercial purposes. + +LC_IDENTIFICATION +title "Basque locale for France" +source "Christian Perrier and the Debian Project" +address "" +contact "Christian Perrier" +email "bubulle@debian.org" +tel "" +fax "" +language "Basque" +territory "France" +revision "1.0" +date "2004-06-24" +% +category "i18n:2012";LC_IDENTIFICATION +category "i18n:2012";LC_CTYPE +category "i18n:2012";LC_COLLATE +category "i18n:2012";LC_TIME +category "i18n:2012";LC_NUMERIC +category "i18n:2012";LC_MONETARY +category "i18n:2012";LC_MESSAGES +category "i18n:2012";LC_PAPER +category "i18n:2012";LC_NAME +category "i18n:2012";LC_ADDRESS +category "i18n:2012";LC_TELEPHONE + +END LC_IDENTIFICATION + +LC_COLLATE +copy "iso14651_t1" +END LC_COLLATE + +LC_CTYPE +copy "i18n" +END LC_CTYPE + +LC_MESSAGES +copy "eu_ES" +END LC_MESSAGES + +LC_MONETARY +copy "fr_FR" +END LC_MONETARY + +LC_NUMERIC +copy "fr_FR" +END LC_NUMERIC + +LC_TIME +copy "eu_ES" +END LC_TIME + +LC_PAPER +copy "fr_FR" +END LC_PAPER + +LC_TELEPHONE +copy "fr_FR" +END LC_TELEPHONE + +LC_MEASUREMENT +copy "fr_FR" +END LC_MEASUREMENT + +LC_NAME +copy "eu_ES" +END LC_NAME + +LC_ADDRESS +copy "fr_FR" +END LC_ADDRESS diff --git a/localedata/locales/eu_FR@euro b/localedata/locales/eu_FR@euro new file mode 100644 index 0000000000..fa19c272d4 --- /dev/null +++ b/localedata/locales/eu_FR@euro @@ -0,0 +1,83 @@ +comment_char % +escape_char / +% +% Basque Language Locale for France +% Language: eu +% Territory: FR +% Revision: 1.0 +% Date: 2004-06-24 +% Users: general +% Charset: ISO-8859-15 +% Distribution and use is free, also +% for commercial purposes. + +LC_IDENTIFICATION +title "Basque locale for France" +source "Christian Perrier and the Debian Project" +address "" +contact "Christian Perrier" +email "bubulle@debian.org" +tel "" +fax "" +language "Basque" +territory "France" +revision "1.0" +date "2004-06-24" +% +category "i18n:2012";LC_IDENTIFICATION +category "i18n:2012";LC_CTYPE +category "i18n:2012";LC_COLLATE +category "i18n:2012";LC_TIME +category "i18n:2012";LC_NUMERIC +category "i18n:2012";LC_MONETARY +category "i18n:2012";LC_MESSAGES +category "i18n:2012";LC_PAPER +category "i18n:2012";LC_NAME +category "i18n:2012";LC_ADDRESS +category "i18n:2012";LC_TELEPHONE + +END LC_IDENTIFICATION + +LC_COLLATE +copy "iso14651_t1" +END LC_COLLATE + +LC_CTYPE +copy "i18n" +END LC_CTYPE + +LC_MESSAGES +copy "eu_ES" +END LC_MESSAGES + +LC_MONETARY +copy "fr_FR" +END LC_MONETARY + +LC_NUMERIC +copy "fr_FR" +END LC_NUMERIC + +LC_TIME +copy "eu_ES" +END LC_TIME + +LC_PAPER +copy "fr_FR" +END LC_PAPER + +LC_TELEPHONE +copy "fr_FR" +END LC_TELEPHONE + +LC_MEASUREMENT +copy "fr_FR" +END LC_MEASUREMENT + +LC_NAME +copy "eu_ES" +END LC_NAME + +LC_ADDRESS +copy "fr_FR" +END LC_ADDRESS diff --git a/localedata/locales/fo_FO b/localedata/locales/fo_FO index f1f787241c..3e9816edd2 100644 --- a/localedata/locales/fo_FO +++ b/localedata/locales/fo_FO @@ -98,8 +98,8 @@ mon "januar";/ "oktober";/ "november";/ "desember" -d_t_fmt "%a %d %b %Y %T" -date_fmt "%a %d %b %Y %T %Z" +d_t_fmt "%a. %d. %b. %Y %T %Z" +date_fmt "%1 tann %-e. %B %Y klokkan %T (UTC%z)" d_fmt "%d//%m-%Y" t_fmt "%T" am_pm "";"" diff --git a/localedata/locales/fr_BE b/localedata/locales/fr_BE index f35a788a65..761e8e6957 100644 --- a/localedata/locales/fr_BE +++ b/localedata/locales/fr_BE @@ -141,7 +141,7 @@ copy "i18n" END LC_MEASUREMENT LC_NAME -name_fmt "%d%t%g%t%m%t%f" +copy "fr_FR" END LC_NAME LC_ADDRESS @@ -151,6 +151,8 @@ country_ab2 "BE" country_ab3 "BEL" country_num 056 country_car "B" +country_post "BE" +country_isbn "979-10" lang_name "français" lang_ab "fr" lang_term "fra" diff --git a/localedata/locales/fr_CH b/localedata/locales/fr_CH index 690a04b763..d1883b87b0 100644 --- a/localedata/locales/fr_CH +++ b/localedata/locales/fr_CH @@ -124,7 +124,7 @@ copy "i18n" END LC_MEASUREMENT LC_NAME -name_fmt "%d%t%g%t%m%t%f" +copy "fr_FR" END LC_NAME LC_ADDRESS @@ -134,6 +134,8 @@ country_ab2 "CH" country_ab3 "CHE" country_num 756 country_car "CH" +country_post "CH" +country_isbn "979-10" lang_name "français" lang_ab "fr" lang_term "fra" diff --git a/localedata/locales/fr_FR b/localedata/locales/fr_FR index 6f733fa035..1f1393d7ac 100644 --- a/localedata/locales/fr_FR +++ b/localedata/locales/fr_FR @@ -159,6 +159,11 @@ END LC_MEASUREMENT LC_NAME name_fmt "%d%t%g%t%m%t%f" +name_gen "" +name_mr "M." +name_mrs "Mme" +name_miss "Mlle" +name_ms "" END LC_NAME LC_ADDRESS @@ -167,6 +172,7 @@ country_name "France" country_ab2 "FR" country_ab3 "FRA" country_num 250 +country_post "FR" country_isbn "979-10" country_car "F" lang_name "français" diff --git a/localedata/locales/fr_LU b/localedata/locales/fr_LU index 31af42f20a..585da3ee69 100644 --- a/localedata/locales/fr_LU +++ b/localedata/locales/fr_LU @@ -140,7 +140,7 @@ copy "i18n" END LC_MEASUREMENT LC_NAME -name_fmt "%d%t%g%t%m%t%f" +copy "fr_FR" END LC_NAME LC_ADDRESS @@ -150,6 +150,8 @@ country_ab2 "LU" country_ab3 "LUX" country_num 442 country_car "L" +country_post "LU" +country_isbn "979-10" lang_name "français" lang_ab "fr" lang_term "fra" diff --git a/localedata/locales/ku_TR b/localedata/locales/ku_TR index 19bf4a9964..246a3e973a 100644 --- a/localedata/locales/ku_TR +++ b/localedata/locales/ku_TR @@ -20,6 +20,8 @@ escape_char / % Date: 2003-07-27 % Users: general % History: +% 0.2 2005-04-24 Erdal Ronahî +% Fix LC_CTYPE and LC_NAME sections. Remove dotless i from LC_COLLATE LC_IDENTIFICATION title "Kurdish (latin) locale for Türkiye" @@ -31,8 +33,8 @@ tel "" fax "" language "Kurdish" territory "Türkiye" -revision "0.1" -date "2003-07-27" +revision "0.2" +date "2005-04-24" category "i18n:2012";LC_IDENTIFICATION category "i18n:2012";LC_CTYPE @@ -108,35 +110,35 @@ copy "tr_TR" END LC_NUMERIC LC_TIME -abday "yêk";"dus";/ - "sês";"çar";/ - "pên";"înî";/ - "sep" -day "yêksêm";/ - "dusêm";/ - "sêsêm";/ - "çarsêm";/ - "pêncsêm";/ - "înî";/ - "sept" +abday "Yş";"Dş";/ + "Sş";"Çş";/ + "Pş";"În";/ + "Ş" +day "Yekşem";/ + "Duşem";/ + "Sêşem";/ + "Çarşem";/ + "Pêncşem";/ + "În";/ + "Şemî" abmon "Çil";"Sib";/ "Ada";"Nîs";/ "Gul";"Hez";/ "Tîr";"Teb";/ "Îlo";"Cot";/ "Mij";"Kan" -mon "Çile";/ - "Sibat";/ - "Adar";/ - "Nîsan";/ - "Gulan";/ - "Hezîran";/ - "Tîrmeh";/ - "Tebax";/ - "Îlon";/ - "Cotmeh";/ - "Mijdar";/ - "Kanûn" +mon "çile";/ + "sibat";/ + "adar";/ + "nîsan";/ + "gulan";/ + "hezîran";/ + "tîrmeh";/ + "tebax";/ + "îlon";/ + "cotmeh";/ + "mijdar";/ + "kanûn" d_t_fmt "%A %d %B %Y %T %Z" d_fmt "%d//%m//%Y" t_fmt "%T" @@ -170,11 +172,11 @@ END LC_MEASUREMENT LC_NAME name_fmt "%d%t%g%t%m%t%f" % TODO -name_gen "Sayın" -name_mr "M." -name_mrs "Jne" -name_ms "Jne" -name_miss "Kçk" +name_gen "Barêz" +name_mr "Barêz" +name_mrs "Barêz" +name_ms "Barêz" +name_miss "Barêz" END LC_NAME LC_ADDRESS diff --git a/localedata/locales/sl_SI b/localedata/locales/sl_SI index ca65ab92e4..06ac67da58 100644 --- a/localedata/locales/sl_SI +++ b/localedata/locales/sl_SI @@ -51,2067 +51,31 @@ category "i18n:2012";LC_MEASUREMENT END LC_IDENTIFICATION LC_COLLATE +copy "iso14651_t1" -% Base collation scheme: 1994-03-22 +collating-symbol +collating-symbol +collating-symbol -% Ordering algorithm: -% 1. Spaces and hyphen (but not soft -% hyphen) before punctuation -% characters, punctuation characters -% before numbers, -% numbers before letters. -% 2. Letters with diacritical marks are -% members of equivalence classes -% 3. A distinction is made with regards -% to case as noted below. -% 4. Special characters are ignored -% when comparing letters, but then -% they are considered -% 5. The alphabets are sorted in order -% of first appearance in ISO 10646: -% Latin, Greek, Cyrillic, etc. -% -% According to Greek specifications, -% the steps 2. and 3. above are reversed -% for the Greek script +reorder-after + -% collating symbols +reorder-after + -% The collating symbol naming is -% mostly taken from ISO 10646-1, -% for example the case and accent -% names are from this standard. +reorder-after + -collating-symbol -collating-symbol -collating-symbol -collating-symbol + ;;;IGNORE + ;;;IGNORE -% and -% are for cases like Danish -% and Spanish being treated -% as one letter. + ;;;IGNORE + ;;;IGNORE -% The ...... collating -% symbols have defined weights as -% the last character in a group of -% Latin letters. They are used -% to specify deltas by locales using -% a locale as the default ordering -% and by "replace-after" statements -% specifying the changed placement -% in an ordering of a character. + ;;;IGNORE + ;;;IGNORE -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol - -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol -collating-symbol - -% letter;accent;case;specials - -order_start forward;backward/ - ;forward;position - -% or letters first: - - - - - - -% Accents: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ;;;IGNORE - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; -<"=> IGNORE;IGNORE;IGNORE;<"=> - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; -UNDEFINED IGNORE;IGNORE;IGNORE - - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - "";"";"";IGNORE - "";"";"";IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - "";"";"";IGNORE - "";"";"";IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - "";"";"";IGNORE - "";"";"";IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - "";"";"";IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - "";"";"";IGNORE - "";"";"";IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;;;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - ;IGNORE;IGNORE;IGNORE - -% Arabic collating - - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - IGNORE;IGNORE;IGNORE; - - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - - IGNORE;IGNORE;;IGNORE - IGNORE;IGNORE;;IGNORE - IGNORE;IGNORE;;IGNORE - IGNORE;IGNORE;;IGNORE - IGNORE;IGNORE;;IGNORE - IGNORE;IGNORE;;IGNORE - IGNORE;IGNORE;;IGNORE - IGNORE;IGNORE;;IGNORE - IGNORE;IGNORE;;IGNORE - - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - "";"";"";IGNORE - -% katakana/hiragana sorting -% base is katakana, as this is present in most charsets -% normal before voiced before semi-voiced -% small vocals before normal vocals -% katakana before hiragana - - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - ;;IGNORE;IGNORE - -order_end +reorder-end END LC_COLLATE diff --git a/localedata/locales/ssy_ER b/localedata/locales/ssy_ER index 05d94c9f10..43a16e0f54 100644 --- a/localedata/locales/ssy_ER +++ b/localedata/locales/ssy_ER @@ -106,7 +106,7 @@ country_ab3 "ERI" country_num 232 country_car "ER" % country_isbn unknown, Need ISO 2108 -# https://en.wikipedia.org/wiki/Saho_language has "Saaho" as the endonym but CLDR has "Saho" +% https://en.wikipedia.org/wiki/Saho_language has "Saaho" as the endonym but CLDR has "Saho" lang_name "Saho" lang_ab "" lang_term "ssy" diff --git a/localedata/locales/zh_TW b/localedata/locales/zh_TW index a816368235..12519c3f70 100644 --- a/localedata/locales/zh_TW +++ b/localedata/locales/zh_TW @@ -114,13 +114,13 @@ mon "一月";"二月";"三月";/ "十月";"十一月";"十二月" % d_t_fmt: "%Y%m%d (%A) %H
%M%S" -d_t_fmt "西元%Y年%m月%d日 (%A) %H時/ +d_t_fmt "%Y年%m月%d日 (%A) %H時/ %M分%S秒" date_fmt "西元%Y年%m月%d日 (%A) %H時/ %M分%S秒 %Z" -d_fmt "西元%Y年%m月%d日" +d_fmt "%Y年%m月%d日" t_fmt "%H時%M分%S秒" diff --git a/mach/Versions b/mach/Versions index 07fee039fb..72e9d557db 100644 --- a/mach/Versions +++ b/mach/Versions @@ -57,7 +57,6 @@ libc { } GLIBC_2.21 { __mach_host_self_; - mach_print; } GLIBC_2.32 { mach_print; diff --git a/malloc/Makefile b/malloc/Makefile index c83ade5f10..9bda4aff8e 100644 --- a/malloc/Makefile +++ b/malloc/Makefile @@ -24,60 +24,97 @@ include ../Makeconfig dist-headers := malloc.h headers := $(dist-headers) obstack.h mcheck.h -tests := mallocbug tst-malloc tst-valloc tst-calloc tst-obstack \ - tst-malloc-check tst-mallocfork tst-trim1 \ - tst-malloc-usable tst-realloc tst-reallocarray tst-posix_memalign \ - tst-pvalloc tst-pvalloc-fortify tst-memalign tst-mallopt \ - tst-malloc-backtrace tst-malloc-thread-exit \ - tst-malloc-thread-fail tst-malloc-fork-deadlock \ - tst-mallocfork2 \ - tst-mallocfork3 \ - tst-interpose-nothread \ - tst-interpose-thread \ - tst-alloc_buffer \ - tst-free-errno \ - tst-malloc-tcache-leak \ - tst-malloc_info tst-mallinfo2 \ - tst-malloc-too-large \ - tst-malloc-stats-cancellation \ - tst-tcfree1 tst-tcfree2 tst-tcfree3 \ - tst-safe-linking \ - tst-mallocalign1 \ - tst-memalign-2 \ - tst-memalign-3 \ - tst-aligned-alloc +tests := \ + mallocbug \ + tst-aligned-alloc \ + tst-aligned-alloc-random \ + tst-aligned-alloc-random-thread \ + tst-aligned-alloc-random-thread-cross \ + tst-alloc_buffer \ + tst-calloc \ + tst-free-errno \ + tst-interpose-nothread \ + tst-interpose-thread \ + tst-malloc \ + tst-malloc-alternate-path \ + tst-malloc-backtrace \ + tst-malloc-check \ + tst-malloc-fork-deadlock \ + tst-malloc-random \ + tst-malloc-stats-cancellation \ + tst-malloc-tcache-leak \ + tst-malloc-thread-exit \ + tst-malloc-thread-fail \ + tst-malloc-too-large \ + tst-malloc-usable \ + tst-malloc_info tst-mallinfo2 \ + tst-mallocalign1 \ + tst-mallocfork \ + tst-mallocfork2 \ + tst-mallocfork3 \ + tst-mallopt \ + tst-memalign \ + tst-memalign-2 \ + tst-memalign-3 \ + tst-obstack \ + tst-posix_memalign \ + tst-pvalloc \ + tst-pvalloc-fortify \ + tst-realloc \ + tst-reallocarray \ + tst-safe-linking \ + tst-tcfree1 tst-tcfree2 tst-tcfree3 \ + tst-trim1 \ + tst-valloc \ +# tests tests-static := \ - tst-interpose-static-nothread \ - tst-interpose-static-thread \ - tst-aligned-alloc-static + tst-aligned-alloc-static \ + tst-interpose-static-nothread \ + tst-interpose-static-thread \ +# tests-static # Test for the malloc_set_state symbol removed in glibc 2.25. ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes) -tests += tst-mallocstate tst-compathooks-off tst-compathooks-on +tests += \ + tst-compathooks-off \ + tst-compathooks-on \ + tst-mallocstate \ +# tests endif tests-internal := tst-scratch_buffer # The dynarray framework is only available inside glibc. tests-internal += \ - tst-dynarray \ - tst-dynarray-fail \ - tst-dynarray-at-fail \ + tst-dynarray \ + tst-dynarray-at-fail \ + tst-dynarray-fail \ +# tests-internal -tests += tst-malloc-usable-tunables tst-mxfast +tests += \ + tst-malloc-usable-tunables \ + tst-mxfast \ +# tests tests += $(tests-static) test-srcs = tst-mtrace # These tests either are run with MALLOC_CHECK_=3 by default or do not work # with MALLOC_CHECK_=3 because they expect a specific failure. -tests-exclude-malloc-check = tst-malloc-check tst-malloc-usable \ - tst-mxfast tst-safe-linking \ - tst-compathooks-off tst-compathooks-on tst-memalign-2 tst-memalign-3 \ - tst-mallocfork2 \ - tst-mallocfork3 \ - tst-malloc-tcache-leak +tests-exclude-malloc-check = \ + tst-compathooks-off \ + tst-compathooks-on \ + tst-malloc-check \ + tst-malloc-tcache-leak \ + tst-malloc-usable \ + tst-mallocfork2 \ + tst-mallocfork3 \ + tst-memalign-2 \ + tst-memalign-3 \ + tst-mxfast \ + tst-safe-linking \ +# tests-exclude-malloc-check # Run all tests with MALLOC_CHECK_=3 tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \ @@ -87,18 +124,19 @@ tests-malloc-check = $(filter-out $(tests-exclude-malloc-check) \ # the Transparent Huge Pages support (1) or automatic huge page support (2). # We need exclude some tests that define the ENV vars. tests-exclude-hugetlb1 = \ - tst-compathooks-off \ - tst-compathooks-on \ - tst-interpose-nothread \ - tst-interpose-thread \ - tst-interpose-static-nothread \ - tst-interpose-static-thread \ - tst-malloc-usable \ - tst-malloc-usable-tunables \ - tst-mallocstate \ - tst-malloc-tcache-leak \ - tst-mallocfork2 \ - tst-mallocfork3 + tst-compathooks-off \ + tst-compathooks-on \ + tst-interpose-nothread \ + tst-interpose-static-nothread \ + tst-interpose-static-thread \ + tst-interpose-thread \ + tst-malloc-tcache-leak \ + tst-malloc-usable \ + tst-malloc-usable-tunables \ + tst-mallocfork2 \ + tst-mallocfork3 \ + tst-mallocstate \ +# tests-exclude-hugetlb1 # The tst-free-errno relies on the used malloc page size to mmap an # overlapping region. tests-exclude-hugetlb2 = \ @@ -114,22 +152,27 @@ ifeq ($(have-GLIBC_2.23)$(build-shared),yesyes) # Tests that don't play well with mcheck. They are either bugs in mcheck or # the tests expect specific internal behavior that is changed due to linking to # libmcheck.a. -tests-exclude-mcheck = tst-mallocstate \ - tst-safe-linking \ - tst-malloc-backtrace \ - tst-malloc-fork-deadlock \ - tst-malloc-stats-cancellation \ - tst-malloc-tcache-leak \ - tst-malloc-thread-exit \ - tst-malloc-thread-fail \ - tst-malloc-usable-tunables \ - tst-malloc_info \ - tst-compathooks-off tst-compathooks-on \ - tst-memalign-2 \ - tst-memalign-3 \ - tst-mxfast \ - tst-mallocfork2 \ - tst-mallocfork3 +tests-exclude-mcheck = \ + tst-aligned-alloc-random-thread \ + tst-aligned-alloc-random-thread-cross \ + tst-compathooks-off \ + tst-compathooks-on \ + tst-malloc-backtrace \ + tst-malloc-fork-deadlock \ + tst-malloc-stats-cancellation \ + tst-malloc-tcache-leak \ + tst-malloc-thread-exit \ + tst-malloc-thread-fail \ + tst-malloc-usable-tunables \ + tst-malloc_info \ + tst-mallocfork2 \ + tst-mallocfork3 \ + tst-mallocstate \ + tst-memalign-2 \ + tst-memalign-3 \ + tst-mxfast \ + tst-safe-linking \ +# tests-exclude-mcheck tests-mcheck = $(filter-out $(tests-exclude-mcheck) $(tests-static), $(tests)) endif @@ -157,12 +200,18 @@ extra-libs-others = $(extra-libs) # Helper objects for some tests. extra-test-objs += \ + tst-aligned_alloc-lib.so \ tst-interpose-aux-nothread.o \ tst-interpose-aux-thread.o \ +# extra-test-objs test-extras = \ tst-interpose-aux-nothread \ tst-interpose-aux-thread \ +# test-extras + +modules-names = \ + tst-aligned_alloc-lib libmemusage-routines = memusage libmemusage-inhibit-o = $(filter-out .os,$(object-suffixes)) @@ -218,10 +267,6 @@ address-width=18 endif endif -# Unless we get a test for the availability of libgd which also works -# for cross-compiling we disable the memusagestat generation in this -# situation. -ifneq ($(cross-compiling),yes) # If the gd library is available we build the `memusagestat' program. ifneq ($(LIBGD),no) others: $(objpfx)memusage @@ -237,7 +282,6 @@ extra-objs += memusagestat.o # is to presume that the standard system headers will be ok for this file. $(objpfx)memusagestat.o: sysincludes = # nothing endif -endif # Another goal which can be used to override the configure decision. .PHONY: do-memusagestat @@ -370,3 +414,13 @@ tst-mallocstate-malloc-check-ENV = LD_PRELOAD=$(objpfx)libc_malloc_debug.so # libc_malloc_debug.so. $(objpfx)tst-mallocstate: $(objpfx)libc_malloc_debug.so $(objpfx)tst-mallocstate-malloc-check: $(objpfx)libc_malloc_debug.so + +$(objpfx)tst-aligned-alloc-random.out: $(objpfx)tst-aligned_alloc-lib.so +$(objpfx)tst-aligned-alloc-random-thread.out: $(objpfx)tst-aligned_alloc-lib.so +$(objpfx)tst-aligned-alloc-random-thread-cross.out: $(objpfx)tst-aligned_alloc-lib.so +$(objpfx)tst-malloc-random.out: $(objpfx)tst-aligned_alloc-lib.so + +tst-aligned-alloc-random-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so +tst-aligned-alloc-random-thread-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so +tst-aligned-alloc-random-thread-cross-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so +tst-malloc-random-ENV = LD_PRELOAD=$(objpfx)tst-aligned_alloc-lib.so diff --git a/malloc/memusage.c b/malloc/memusage.c index e8ae80dc74..f80225b95a 100644 --- a/malloc/memusage.c +++ b/malloc/memusage.c @@ -172,7 +172,7 @@ update_data (struct header *result, size_t len, size_t old_len) start_sp = __thread_stack_pointer (); uintptr_t sp = __thread_stack_pointer (); -#ifdef _STACK_GROWS_UP +#if _STACK_GROWS_UP /* This can happen in threads where we didn't catch the thread's stack early enough. */ if (__glibc_unlikely (sp < start_sp)) diff --git a/malloc/tst-aligned-alloc-random-thread-cross.c b/malloc/tst-aligned-alloc-random-thread-cross.c new file mode 100644 index 0000000000..360ecc56ee --- /dev/null +++ b/malloc/tst-aligned-alloc-random-thread-cross.c @@ -0,0 +1,19 @@ +/* multi-threaded memory allocation and cross-thread deallocation test. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ +#define CROSS_THREAD_DEALLOC +#include "tst-aligned-alloc-random-thread.c" diff --git a/malloc/tst-aligned-alloc-random-thread.c b/malloc/tst-aligned-alloc-random-thread.c new file mode 100644 index 0000000000..e95f79250a --- /dev/null +++ b/malloc/tst-aligned-alloc-random-thread.c @@ -0,0 +1,145 @@ +/* multi-threaded memory allocation/deallocation test. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#ifndef ITERATIONS +# define ITERATIONS 16 +#endif + +#ifndef NUM_THREADS +# define NUM_THREADS 8 +#endif + +#ifndef NUM_ALLOCATIONS +# define NUM_ALLOCATIONS 2048 +#endif + +static pthread_barrier_t barrier; + +__thread unsigned int seed; + +typedef struct +{ + int id; + pthread_t thread; +} thread; + +thread threads[NUM_THREADS]; + +void *allocations[NUM_THREADS][NUM_ALLOCATIONS]; + +void +run_thread_dealloc (int id) +{ + for (int i = 0; i < NUM_ALLOCATIONS; i++) + { + free (allocations[id][i]); + allocations[id][i] = NULL; + } +} + +void +run_thread_alloc (int id) +{ + size_t msb, size; + for (int i = 0; i < NUM_ALLOCATIONS; i++) + { + msb = 1 << rand_r (&seed) % 16; + size = msb + rand_r (&seed) % msb; + allocations[id][i] = malloc (size); + TEST_VERIFY_EXIT (allocations[id][i] != NULL); + } +} + +void * +run_allocations (void *arg) +{ + int id = *((int *) arg); + seed = time (NULL) + id; + + /* Stage 1: First half o the threads allocating memory and the second + * half waiting for them to finish + */ + if (id < NUM_THREADS / 2) + run_thread_alloc (id); + + xpthread_barrier_wait (&barrier); + + /* Stage 2: Half of the threads allocationg memory and the other + * half deallocating: + * - In the non cross-thread dealloc scenario the first half will be + * deallocating the memory allocated by themselves in stage 1 and the + * second half will be allocating memory. + * - In the cross-thread dealloc scenario the first half will continue + * to allocate memory and the second half will deallocate the memory + * allocated by the first half in stage 1. + */ + if (id < NUM_THREADS / 2) +#ifndef CROSS_THREAD_DEALLOC + run_thread_dealloc (id); +#else + run_thread_alloc (id + NUM_THREADS / 2); +#endif + else +#ifndef CROSS_THREAD_DEALLOC + run_thread_alloc (id); +#else + run_thread_dealloc (id - NUM_THREADS / 2); +#endif + + xpthread_barrier_wait (&barrier); + + // Stage 3: Second half of the threads deallocating and the first half + // waiting for them to finish. + if (id >= NUM_THREADS / 2) + run_thread_dealloc (id); + + return NULL; +} + +static int +do_test (void) +{ + xpthread_barrier_init (&barrier, NULL, NUM_THREADS); + + for (int i = 0; i < ITERATIONS; i++) + { + for (int t = 0; t < NUM_THREADS; t++) + { + threads[t].id = t; + threads[t].thread + = xpthread_create (NULL, run_allocations, &threads[t].id); + } + + for (int t = 0; t < NUM_THREADS; t++) + xpthread_join (threads[t].thread); + } + + return 0; +} + +#include diff --git a/malloc/tst-aligned-alloc-random.c b/malloc/tst-aligned-alloc-random.c new file mode 100644 index 0000000000..f2825ce38f --- /dev/null +++ b/malloc/tst-aligned-alloc-random.c @@ -0,0 +1,43 @@ +/* Test for randomized malloc that calls aligned_alloc + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include + +static int +do_test (void) +{ + void *p1; + int i; + + srandom (time (NULL)); + + for (i = 0; i < 1024; i++) + { + size_t size = random () & 0xffff; + + p1 = malloc (size); + TEST_VERIFY (p1 != NULL); + } + + return 0; +} + + +#include diff --git a/malloc/tst-aligned_alloc-lib.c b/malloc/tst-aligned_alloc-lib.c new file mode 100644 index 0000000000..9ef1f839c1 --- /dev/null +++ b/malloc/tst-aligned_alloc-lib.c @@ -0,0 +1,73 @@ +/* Module used for improved aligned_alloc testing. + Copyright (C) 2024 Free Software Foundation, Inc. + Copyright The GNU Toolchain Authors. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation; either version 2.1 of the + License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; see the file COPYING.LIB. If + not, see . */ + +#include +#include +#include + +extern void *__libc_malloc (size_t size); +extern void *__libc_calloc (size_t n, size_t size); + +__thread unsigned int seed = 0; + +int aligned_alloc_count = 0; +int libc_malloc_count = 0; +int libc_calloc_count = 0; + +static void * +get_random_alloc (size_t size) +{ + void *retval; + size_t align; + struct timespec tp; + + if (seed == 0) + { + clock_gettime (CLOCK_REALTIME, &tp); + seed = tp.tv_nsec; + } + + switch (rand_r (&seed) % 3) + { + case 1: + /* Get a random alignment value. Biased towards the smaller + * values up to 16384. Must be a power of 2. */ + align = 1 << rand_r (&seed) % 15; + retval = aligned_alloc (align, size); + aligned_alloc_count++; + break; + case 2: + retval = __libc_calloc (1, size); + libc_calloc_count++; + break; + default: + retval = __libc_malloc (size); + libc_malloc_count++; + break; + } + + return retval; +} + +void * +__random_malloc (size_t size) +{ + return get_random_alloc (size); +} +strong_alias (__random_malloc, malloc) diff --git a/malloc/tst-malloc-alternate-path.c b/malloc/tst-malloc-alternate-path.c new file mode 100644 index 0000000000..43ae916815 --- /dev/null +++ b/malloc/tst-malloc-alternate-path.c @@ -0,0 +1,72 @@ +/* Test that malloc uses mmap when sbrk or brk fails. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This test sets up an obstruction to ensure that brk/sbrk fails to + grow the heap, then verifies that malloc uses mmap for allocations + instead. */ + +#include +#include +#include +#include +#include +#include +#include + +#define LARGE_SIZE (10 * (1 << 20)) // 10 MB +static long page_size; + +static int +do_test (void) +{ + /* Get current program break. */ + void *current_brk = sbrk (0); + + page_size = sysconf (_SC_PAGESIZE); + + /* Round up to the next page boundary. */ + void *next_page_boundary = PTR_ALIGN_UP (current_brk, page_size); + + /* Place a mapping using mmap at the next page boundary. */ + void *obstruction_addr + = mmap (next_page_boundary, page_size, PROT_READ, + MAP_PRIVATE | MAP_ANONYMOUS | MAP_FIXED, -1, 0); + + /* Check if memory obstruction is set up correctly. */ + TEST_VERIFY_EXIT (obstruction_addr == next_page_boundary); + + /* Try to extend the heap beyond the obstruction using sbrk */ + int *ptr = sbrk (page_size); + TEST_VERIFY_EXIT (ptr == (void *) -1); + + /* Attempt multiple small allocations using malloc. */ + for (size_t i = 0; i < page_size / alignof (max_align_t); i++) + { + TEST_VERIFY (malloc (alignof (max_align_t))); + } + + /* Attempt to allocate a large block of memory using malloc. */ + TEST_VERIFY_EXIT (malloc (LARGE_SIZE) != NULL); + + /* Check if malloc changed current program break. */ + TEST_VERIFY_EXIT (current_brk == sbrk (0)); + + return 0; +} + +#include diff --git a/malloc/tst-malloc-random.c b/malloc/tst-malloc-random.c new file mode 100644 index 0000000000..762b70c918 --- /dev/null +++ b/malloc/tst-malloc-random.c @@ -0,0 +1,20 @@ +/* Test malloc with random calls to aligned_alloc and calloc. + + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include "tst-malloc.c" diff --git a/malloc/tst-malloc.c b/malloc/tst-malloc.c index a7491d3d00..f7a6e4654c 100644 --- a/malloc/tst-malloc.c +++ b/malloc/tst-malloc.c @@ -18,7 +18,9 @@ #include #include #include +#include #include +#include static int errors = 0; @@ -35,6 +37,8 @@ do_test (void) void *p, *q; int save; + srandom (time (NULL)); + errno = 0; DIAG_PUSH_NEEDS_COMMENT; diff --git a/manual/stdbit.texi b/manual/stdbit.texi index 6c75ed9a20..fe41c671d8 100644 --- a/manual/stdbit.texi +++ b/manual/stdbit.texi @@ -32,13 +32,7 @@ and @code{unsigned long long int}. In addition, there is a corresponding type-generic macro (not listed below), named the same as the functions but without any suffix such as @samp{_uc}. The type-generic macro can only be used with an argument of an unsigned -integer type with a width of 8, 16, 32 or 64 bits, or when using -a compiler with support for -@uref{https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html,@code{__builtin_stdc_bit_ceil}}, -etc.@:, built-in functions such as GCC 14.1 or later -any unsigned integer type those built-in functions support. -In GCC 14.1 that includes support for @code{unsigned __int128} and -@code{unsigned _BitInt(@var{n})} if supported by the target. +integer type with a width of 8, 16, 32 or 64 bits. @deftypefun {unsigned int} stdc_leading_zeros_uc (unsigned char @var{x}) @deftypefunx {unsigned int} stdc_leading_zeros_us (unsigned short @var{x}) diff --git a/misc/Makefile b/misc/Makefile index c273ec6974..235fc7eacb 100644 --- a/misc/Makefile +++ b/misc/Makefile @@ -251,6 +251,8 @@ tests := \ tst-mntent-blank-passno \ tst-mntent-escape \ tst-mntent2 \ + tst-mremap1 \ + tst-mremap2 \ tst-preadvwritev \ tst-preadvwritev2 \ tst-preadvwritev64 \ diff --git a/misc/getttyent.c b/misc/getttyent.c index 508d296291..92d92b026f 100644 --- a/misc/getttyent.c +++ b/misc/getttyent.c @@ -66,7 +66,7 @@ __getttyent (void) static struct ttyent tty; int c; char *p; -#define MAXLINELENGTH 512 +#define MAXLINELENGTH 100 static char line[MAXLINELENGTH]; if (!tf && !__setttyent()) diff --git a/misc/madvise.c b/misc/madvise.c index 7cdeb4111e..f91790ced3 100644 --- a/misc/madvise.c +++ b/misc/madvise.c @@ -32,4 +32,4 @@ __madvise (void *addr, size_t len, int advice) libc_hidden_def (__madvise) weak_alias (__madvise, madvise) -stub_warning (madvise) +/* stub_warning (madvise) */ diff --git a/misc/sys/cdefs.h b/misc/sys/cdefs.h index 520231dbea..399ee7d24c 100644 --- a/misc/sys/cdefs.h +++ b/misc/sys/cdefs.h @@ -720,4 +720,13 @@ _Static_assert (0, "IEEE 128-bits long double requires redirection on this platf # define __attribute_returns_twice__ /* Ignore. */ #endif +/* Mark struct types as aliasable. Restricted to compilers that + support forward declarations of structs in the presence of the + attribute. */ +#if __GNUC_PREREQ (7, 1) || defined __clang__ +# define __attribute_struct_may_alias__ __attribute__ ((__may_alias__)) +#else +# define __attribute_struct_may_alias__ +#endif + #endif /* sys/cdefs.h */ diff --git a/misc/sys/ioctl.h b/misc/sys/ioctl.h index 3f2338ddd3..ea6583e122 100644 --- a/misc/sys/ioctl.h +++ b/misc/sys/ioctl.h @@ -38,7 +38,7 @@ __BEGIN_DECLS /* Perform the I/O control operation specified by REQUEST on FD. One argument may follow; its presence and type depend on REQUEST. Return value depends on REQUEST. Usually -1 indicates error. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int ioctl (int __fd, unsigned long int __request, ...) __THROW; #else # ifdef __REDIRECT diff --git a/misc/sys/select.h b/misc/sys/select.h index e6a0c1b8b2..2e45e94bc1 100644 --- a/misc/sys/select.h +++ b/misc/sys/select.h @@ -98,7 +98,7 @@ __BEGIN_DECLS This function is a cancellation point and therefore not marked with __THROW. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int select (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, @@ -123,7 +123,7 @@ extern int __REDIRECT (select, This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pselect (int __nfds, fd_set *__restrict __readfds, fd_set *__restrict __writefds, fd_set *__restrict __exceptfds, diff --git a/misc/tst-mremap1.c b/misc/tst-mremap1.c new file mode 100644 index 0000000000..0469991a6c --- /dev/null +++ b/misc/tst-mremap1.c @@ -0,0 +1,46 @@ +/* Test mremap with MREMAP_MAYMOVE. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include + +static int +do_test (void) +{ + size_t old_size = getpagesize (); + char *old_addr = xmmap (NULL, old_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1); + old_addr[0] = 1; + old_addr[old_size - 1] = 2; + + /* Test MREMAP_MAYMOVE. */ + size_t new_size = old_size + old_size; + char *new_addr = mremap (old_addr, old_size, new_size, MREMAP_MAYMOVE); + TEST_VERIFY_EXIT (new_addr != MAP_FAILED); + new_addr[0] = 1; + new_addr[new_size - 1] = 2; + xmunmap (new_addr, new_size); + + return 0; +} + +#include diff --git a/misc/tst-mremap2.c b/misc/tst-mremap2.c new file mode 100644 index 0000000000..45be7f0369 --- /dev/null +++ b/misc/tst-mremap2.c @@ -0,0 +1,54 @@ +/* Test mremap with MREMAP_FIXED. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include + +static int +do_test (void) +{ + size_t old_size = getpagesize (); + size_t new_size = old_size + old_size; + char *old_addr = xmmap (NULL, old_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1); + old_addr[0] = 1; + old_addr[old_size - 1] = 2; + + char *fixed_addr = xmmap (NULL, new_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1); + fixed_addr[0] = 1; + fixed_addr[new_size - 1] = 2; + + /* Test MREMAP_FIXED. */ + char *new_addr = mremap (old_addr, old_size, new_size, + MREMAP_FIXED | MREMAP_MAYMOVE, + fixed_addr); + if (new_addr == MAP_FAILED) + return mremap_failure_exit (errno); + new_addr[0] = 1; + new_addr[new_size - 1] = 2; + xmunmap (new_addr, new_size); + + return 0; +} + +#include diff --git a/misc/tst-preadvwritev2-common.c b/misc/tst-preadvwritev2-common.c index b5f19f002c..8e04ff7282 100644 --- a/misc/tst-preadvwritev2-common.c +++ b/misc/tst-preadvwritev2-common.c @@ -34,8 +34,11 @@ #ifndef RWF_APPEND # define RWF_APPEND 0 #endif +#ifndef RWF_NOAPPEND +# define RWF_NOAPPEND 0 +#endif #define RWF_SUPPORTED (RWF_HIPRI | RWF_DSYNC | RWF_SYNC | RWF_NOWAIT \ - | RWF_APPEND) + | RWF_APPEND | RWF_NOAPPEND) /* Generic uio_lim.h does not define IOV_MAX. */ #ifndef IOV_MAX diff --git a/nscd/nscd.h b/nscd/nscd.h index 6529d5123c..4363b8d193 100644 --- a/nscd/nscd.h +++ b/nscd/nscd.h @@ -160,11 +160,11 @@ struct database_dyn /* Paths of the file for the persistent storage. */ -#define _PATH_NSCD_PASSWD_DB "/var/db/nscd/passwd" -#define _PATH_NSCD_GROUP_DB "/var/db/nscd/group" -#define _PATH_NSCD_HOSTS_DB "/var/db/nscd/hosts" -#define _PATH_NSCD_SERVICES_DB "/var/db/nscd/services" -#define _PATH_NSCD_NETGROUP_DB "/var/db/nscd/netgroup" +#define _PATH_NSCD_PASSWD_DB "/var/cache/nscd/passwd" +#define _PATH_NSCD_GROUP_DB "/var/cache/nscd/group" +#define _PATH_NSCD_HOSTS_DB "/var/cache/nscd/hosts" +#define _PATH_NSCD_SERVICES_DB "/var/cache/nscd/services" +#define _PATH_NSCD_NETGROUP_DB "/var/cache/nscd/netgroup" /* Path used when not using persistent storage. */ #define _PATH_NSCD_XYZ_DB_TMP "/var/run/nscd/dbXXXXXX" diff --git a/nss/Makefile b/nss/Makefile index 9331b3308c..56dc74b60e 100644 --- a/nss/Makefile +++ b/nss/Makefile @@ -345,7 +345,7 @@ xtests := \ tst-getaddrinfo5 \ # xtests -tests-container := \ +tests := \ tst-initgroups1 \ tst-initgroups2 \ tst-nss-compat1 \ @@ -384,7 +384,7 @@ tests += tst-cancel-getpwuid_r endif # Specify rules for the nss_* modules. We have some services. -services := files db compat +services := files compat extra-libs = $(services:%=libnss_%) # These libraries will be built in the `others' pass rather than diff --git a/nss/nss_files/files-hosts.c b/nss/nss_files/files-hosts.c index 7094adf5ee..de56d56f0a 100644 --- a/nss/nss_files/files-hosts.c +++ b/nss/nss_files/files-hosts.c @@ -493,7 +493,7 @@ _nss_files_gethostbyname4_r (const char *name, struct gaih_addrtuple **pat, else { *errnop = errno; - *herrnop = NO_DATA; + *herrnop = HOST_NOT_FOUND; } return status; diff --git a/nss/nss_files/files-parse.c b/nss/nss_files/files-parse.c index 182aa82e08..0bcfe1a9fb 100644 --- a/nss/nss_files/files-parse.c +++ b/nss/nss_files/files-parse.c @@ -21,6 +21,7 @@ #include #include #include +#include #include /* These symbols are defined by the including source file: @@ -156,7 +157,12 @@ strtou32 (const char *nptr, char **endptr, int base) # define INT_FIELD(variable, terminator_p, swallow, base, convert) \ { \ char *endp; \ - variable = convert (strtou32 (line, &endp, base)); \ + unsigned long long tmp; \ + /* Prevent from 32-bit overflow. */ \ + tmp = __strtoull_internal (line, &endp, base, 0); \ + if (tmp > UINT_MAX) \ + return 0; \ + variable = convert ((unsigned long int)tmp); \ if (endp == line) \ return 0; \ else if (terminator_p (*endp)) \ @@ -171,10 +177,15 @@ strtou32 (const char *nptr, char **endptr, int base) # define INT_FIELD_MAYBE_NULL(variable, terminator_p, swallow, base, convert, default) \ { \ char *endp; \ + unsigned long long tmp; \ if (*line == '\0') \ /* We expect some more input, so don't allow the string to end here. */ \ return 0; \ - variable = convert (strtou32 (line, &endp, base)); \ + /* Prevent from 32-bit overflow. */ \ + tmp = __strtoull_internal (line, &endp, base, 0); \ + if (tmp > UINT_MAX) \ + return 0; \ + variable = convert ((unsigned long int)tmp); \ if (endp == line) \ variable = default; \ if (terminator_p (*endp)) \ diff --git a/nss/tst-nss-test3.c b/nss/tst-nss-test3.c index ca4dfd4914..f16640d19f 100644 --- a/nss/tst-nss-test3.c +++ b/nss/tst-nss-test3.c @@ -16,6 +16,7 @@ License along with the GNU C Library; if not, see . */ +#include #include #include #include @@ -107,11 +108,15 @@ do_test (void) int i; struct group *g = NULL; +#ifndef CLONE_NEWNS + __nss_configure_lookup ("group", "test1"); +#else /* Previously we used __nss_configure_lookup to isolate the test from the host environment and to get it to lookup from our new test1 NSS service module, but now this test is run in a different root filesystem via the test-container support and we directly configure the use of the test1 NSS service. */ +#endif setgrent (); diff --git a/posix/glob.h b/posix/glob.h index 3406662840..b6bba0fbcd 100644 --- a/posix/glob.h +++ b/posix/glob.h @@ -150,7 +150,7 @@ extern int glob (const char *__restrict __pattern, int __flags, /* Free storage allocated in PGLOB by a previous `glob' call. */ extern void globfree (glob_t *__pglob) __THROW; #else -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS extern int __REDIRECT_NTHNL (glob, (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), @@ -170,7 +170,7 @@ extern void __REDIRECT_NTH (globfree, (glob_t *__pglob), globfree64); #endif #ifdef __USE_LARGEFILE64 -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS extern int __REDIRECT_NTHNL (glob64, (const char *__restrict __pattern, int __flags, int (*__errfunc) (const char *, int), diff --git a/posix/posix_madvise.c b/posix/posix_madvise.c index 4c44595a5d..7b8252afe9 100644 --- a/posix/posix_madvise.c +++ b/posix/posix_madvise.c @@ -27,4 +27,4 @@ posix_madvise (void *addr, size_t len, int advice) { return ENOSYS; } -stub_warning (posix_madvise) +/* stub_warning (posix_madvise) */ diff --git a/posix/sched.h b/posix/sched.h index 3eac206f35..49f504a488 100644 --- a/posix/sched.h +++ b/posix/sched.h @@ -74,7 +74,7 @@ extern int sched_get_priority_max (int __algorithm) __THROW; extern int sched_get_priority_min (int __algorithm) __THROW; /* Get the SCHED_RR interval for the named process. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW; #else # ifdef __REDIRECT_NTH diff --git a/posix/sys/wait.h b/posix/sys/wait.h index edbb7b4392..1f44ee1145 100644 --- a/posix/sys/wait.h +++ b/posix/sys/wait.h @@ -139,7 +139,7 @@ struct rusage; nil, store information about the child's resource usage there. If the WUNTRACED bit is set in OPTIONS, return status for stopped children; otherwise don't. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern __pid_t wait3 (int *__stat_loc, int __options, struct rusage * __usage) __THROWNL; # else @@ -154,7 +154,7 @@ extern __pid_t __REDIRECT_NTHNL (wait3, (int *__stat_loc, int __options, #endif #ifdef __USE_MISC -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* PID is like waitpid. Other args are like wait3. */ extern __pid_t wait4 (__pid_t __pid, int *__stat_loc, int __options, struct rusage *__usage) __THROWNL; diff --git a/posix/tst-spawn2.c b/posix/tst-spawn2.c index bb507204a2..b2bad3f1f7 100644 --- a/posix/tst-spawn2.c +++ b/posix/tst-spawn2.c @@ -26,6 +26,7 @@ #include #include +#include #include int @@ -38,38 +39,53 @@ do_test (void) char * const args[] = { 0 }; PID_T_TYPE pid = -1; - int ret = POSIX_SPAWN (&pid, program, 0, 0, args, environ); - if (ret != ENOENT) - { - errno = ret; - FAIL_EXIT1 ("posix_spawn: %m"); - } - - /* POSIX states the value returned on pid variable in case of an error - is not specified. GLIBC will update the value iff the child - execution is successful. */ - if (pid != -1) - FAIL_EXIT1 ("posix_spawn returned pid != -1 (%i)", (int) pid); - - /* Check if no child is actually created. */ - TEST_COMPARE (WAITID (P_ALL, 0, NULL, WEXITED), -1); - TEST_COMPARE (errno, ECHILD); - - /* Same as before, but with posix_spawnp. */ - char *args2[] = { (char*) program, 0 }; - - ret = POSIX_SPAWNP (&pid, args2[0], 0, 0, args2, environ); - if (ret != ENOENT) - { - errno = ret; - FAIL_EXIT1 ("posix_spawnp: %m"); - } - - if (pid != -1) - FAIL_EXIT1 ("posix_spawnp returned pid != -1 (%i)", (int) pid); - - TEST_COMPARE (WAITID (P_ALL, 0, NULL, WEXITED), -1); - TEST_COMPARE (errno, ECHILD); + { + struct support_descriptors *descrs = support_descriptors_list (); + + int ret = POSIX_SPAWN (&pid, program, 0, 0, args, environ); + if (ret != ENOENT) + { + errno = ret; + FAIL_EXIT1 ("posix_spawn: %m"); + } + + /* POSIX states the value returned on pid variable in case of an error + is not specified. GLIBC will update the value iff the child + execution is successful. */ + if (pid != -1) + FAIL_EXIT1 ("posix_spawn returned pid != -1 (%i)", (int) pid); + + /* Check if no child is actually created. */ + TEST_COMPARE (WAITID (P_ALL, 0, NULL, WEXITED), -1); + TEST_COMPARE (errno, ECHILD); + + /* Also check if there is no leak descriptors. */ + support_descriptors_check (descrs); + support_descriptors_free (descrs); + } + + { + /* Same as before, but with posix_spawnp. */ + char *args2[] = { (char*) program, 0 }; + + struct support_descriptors *descrs = support_descriptors_list (); + + int ret = POSIX_SPAWNP (&pid, args2[0], 0, 0, args2, environ); + if (ret != ENOENT) + { + errno = ret; + FAIL_EXIT1 ("posix_spawnp: %m"); + } + + if (pid != -1) + FAIL_EXIT1 ("posix_spawnp returned pid != -1 (%i)", (int) pid); + + TEST_COMPARE (WAITID (P_ALL, 0, NULL, WEXITED), -1); + TEST_COMPARE (errno, ECHILD); + + support_descriptors_check (descrs); + support_descriptors_free (descrs); + } return 0; } diff --git a/resolv/Makefile b/resolv/Makefile index 5f44f5896b..abff7fc007 100644 --- a/resolv/Makefile +++ b/resolv/Makefile @@ -106,6 +106,8 @@ tests += \ tst-resolv-nondecimal \ tst-resolv-res_init-multi \ tst-resolv-search \ + tst-resolv-semi-failure \ + tst-resolv-short-response \ tst-resolv-trailing \ # This test calls __res_context_send directly, which is not exported @@ -299,6 +301,10 @@ $(objpfx)tst-resolv-nondecimal: $(objpfx)libresolv.so $(shared-thread-library) $(objpfx)tst-resolv-qtypes: $(objpfx)libresolv.so $(shared-thread-library) $(objpfx)tst-resolv-rotate: $(objpfx)libresolv.so $(shared-thread-library) $(objpfx)tst-resolv-search: $(objpfx)libresolv.so $(shared-thread-library) +$(objpfx)tst-resolv-semi-failure: $(objpfx)libresolv.so \ + $(shared-thread-library) +$(objpfx)tst-resolv-short-response: $(objpfx)libresolv.so \ + $(shared-thread-library) $(objpfx)tst-resolv-trailing: $(objpfx)libresolv.so $(shared-thread-library) $(objpfx)tst-resolv-threads: $(objpfx)libresolv.so $(shared-thread-library) $(objpfx)tst-resolv-txnid-collision: $(objpfx)libresolv.a \ diff --git a/resolv/netdb.h b/resolv/netdb.h index 14228b0d95..b7f473fafe 100644 --- a/resolv/netdb.h +++ b/resolv/netdb.h @@ -701,7 +701,7 @@ extern int getaddrinfo_a (int __mode, struct gaicb *__list[__restrict_arr], extern int gai_suspend (const struct gaicb *const __list[], int __ent, const struct timespec *__timeout); -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # if defined(__REDIRECT) extern int __REDIRECT (gai_suspend, (const struct gaicb *const __list[], int __ent, diff --git a/resolv/res_send.c b/resolv/res_send.c index fb0217204a..9c77613f37 100644 --- a/resolv/res_send.c +++ b/resolv/res_send.c @@ -947,9 +947,11 @@ send_dg(res_state statp, seconds /= statp->nscount; if (seconds <= 0) seconds = 1; - bool single_request_reopen = (statp->options & RES_SNGLKUPREOP) != 0; - bool single_request = (((statp->options & RES_SNGLKUP) != 0) - | single_request_reopen); + bool single_request_reopen = ((statp->options & RES_SNGLKUPREOP) + || (statp->_flags & RES_F_SNGLKUPREOP)); + bool single_request = ((statp->options & RES_SNGLKUP) + || (statp->_flags & RES_F_SNGLKUP) + || single_request_reopen); int save_gotsomewhere = *gotsomewhere; int retval; @@ -1006,14 +1008,14 @@ send_dg(res_state statp, have received the first answer. */ if (!single_request) { - statp->options |= RES_SNGLKUP; + statp->_flags |= RES_F_SNGLKUP; single_request = true; *gotsomewhere = save_gotsomewhere; goto retry; } else if (!single_request_reopen) { - statp->options |= RES_SNGLKUPREOP; + statp->_flags |= RES_F_SNGLKUPREOP; single_request_reopen = true; *gotsomewhere = save_gotsomewhere; __res_iclose (statp, false); @@ -1197,19 +1199,30 @@ send_dg(res_state statp, } /* Check for the correct header layout and a matching - question. */ + question. Some recursive resolvers send REFUSED + without copying back the question section + (producing a response that is only HFIXEDSZ bytes + long). Skip query matching in this case. */ + bool thisansp_error = (anhp->rcode == SERVFAIL || + anhp->rcode == NOTIMP || + anhp->rcode == REFUSED); + bool skip_query_match = (*thisresplenp == HFIXEDSZ + && ntohs (anhp->qdcount) == 0 + && thisansp_error); int matching_query = 0; /* Default to no matching query. */ if (!recvresp1 && anhp->id == hp->id - && __libc_res_queriesmatch (buf, buf + buflen, - *thisansp, - *thisansp + *thisanssizp)) + && (skip_query_match + || __libc_res_queriesmatch (buf, buf + buflen, + *thisansp, + *thisansp + *thisanssizp))) matching_query = 1; if (!recvresp2 && anhp->id == hp2->id - && __libc_res_queriesmatch (buf2, buf2 + buflen2, - *thisansp, - *thisansp + *thisanssizp)) + && (skip_query_match + || __libc_res_queriesmatch (buf2, buf2 + buflen2, + *thisansp, + *thisansp + *thisanssizp))) matching_query = 2; if (matching_query == 0) /* Spurious UDP packet. Drop it and continue @@ -1219,15 +1232,13 @@ send_dg(res_state statp, goto wait; } - if (anhp->rcode == SERVFAIL || - anhp->rcode == NOTIMP || - anhp->rcode == REFUSED) { + if (thisansp_error) { next_ns: if (recvresp1 || (buf2 != NULL && recvresp2)) { *resplen2 = 0; return resplen; } - if (buf2 != NULL) + if (buf2 != NULL && !single_request) { /* No data from the first reply. */ resplen = 0; diff --git a/resolv/resolv-internal.h b/resolv/resolv-internal.h index 24b164f6b5..944af3ee76 100644 --- a/resolv/resolv-internal.h +++ b/resolv/resolv-internal.h @@ -26,6 +26,8 @@ #define RES_F_VC 0x00000001 /* Socket is TCP. */ #define RES_F_CONN 0x00000002 /* Socket is connected. */ #define RES_F_EDNS0ERR 0x00000004 /* EDNS0 caused errors. */ +#define RES_F_SNGLKUP 0x00200000 /* Private version of RES_SNGLKUP. */ +#define RES_F_SNGLKUPREOP 0x00400000 /* Private version of RES_SNGLKUPREOP. */ /* The structure HEADER is normally aligned on a word boundary. In some code, we need to access this structure when it may be aligned diff --git a/resolv/tst-resolv-semi-failure.c b/resolv/tst-resolv-semi-failure.c new file mode 100644 index 0000000000..aa9798b5a7 --- /dev/null +++ b/resolv/tst-resolv-semi-failure.c @@ -0,0 +1,133 @@ +/* Test parallel failure/success responses (bug 30081). + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include + +/* The rcode in the initial response. */ +static volatile int rcode; + +/* Whether to fail the initial A query (!fail_aaaa) or the initial + AAAA query (fail_aaaa). */ +static volatile bool fail_aaaa; + +static void +response (const struct resolv_response_context *ctx, + struct resolv_response_builder *b, + const char *qname, uint16_t qclass, uint16_t qtype) +{ + /* Handle the failing query. */ + if ((fail_aaaa && qtype == T_AAAA) && ctx->server_index == 0) + { + struct resolv_response_flags flags = {.rcode = rcode}; + resolv_response_init (b, flags); + return; + } + + /* Otherwise produce a response. */ + resolv_response_init (b, (struct resolv_response_flags) {}); + resolv_response_add_question (b, qname, qclass, qtype); + resolv_response_section (b, ns_s_an); + resolv_response_open_record (b, qname, qclass, qtype, 0); + switch (qtype) + { + case T_A: + { + char ipv4[4] = {192, 0, 2, 17}; + resolv_response_add_data (b, &ipv4, sizeof (ipv4)); + } + break; + case T_AAAA: + { + char ipv6[16] + = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; + resolv_response_add_data (b, &ipv6, sizeof (ipv6)); + } + break; + default: + FAIL_EXIT1 ("unexpected TYPE%d query", qtype); + } + resolv_response_close_record (b); +} + +static void +check_one (void) +{ + + /* The buggy 1-second query timeout results in 30 seconds of delay, + which triggers are test timeout failure. */ + for (int i = 0; i < 30; ++i) + { + static const struct addrinfo hints = + { + .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_STREAM, + }; + struct addrinfo *ai; + int ret = getaddrinfo ("www.example", "80", &hints, &ai); + const char *expected; + if (ret == 0 && ai->ai_next != NULL) + expected = ("address: STREAM/TCP 192.0.2.17 80\n" + "address: STREAM/TCP 2001:db8::1 80\n"); + else + /* Only one response because the AAAA lookup failure is + treated as an ignoreable error. */ + expected = "address: STREAM/TCP 192.0.2.17 80\n"; + check_addrinfo ("www.example", ai, ret, expected); + if (ret == 0) + freeaddrinfo (ai); + } +} + +static int +do_test (void) +{ + for (int do_single_lookup = 0; do_single_lookup < 2; ++do_single_lookup) + { + struct resolv_test *aux = resolv_test_start + ((struct resolv_redirect_config) + { + .response_callback = response, + }); + + if (do_single_lookup) + _res.options |= RES_SNGLKUP; + + for (int do_fail_aaaa = 0; do_fail_aaaa < 2; ++do_fail_aaaa) + { + fail_aaaa = do_fail_aaaa; + + rcode = 2; /* SERVFAIL. */ + check_one (); + + rcode = 4; /* NOTIMP. */ + check_one (); + + rcode = 5; /* REFUSED. */ + check_one (); + } + + resolv_test_end (aux); + } + + return 0; +} + +#include diff --git a/resolv/tst-resolv-short-response.c b/resolv/tst-resolv-short-response.c new file mode 100644 index 0000000000..9b06b0c176 --- /dev/null +++ b/resolv/tst-resolv-short-response.c @@ -0,0 +1,126 @@ +/* Test for spurious timeouts with short 12-byte responses (bug 31890). + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include + +/* The rcode in the initial response. */ +static volatile int rcode; + +static void +response (const struct resolv_response_context *ctx, + struct resolv_response_builder *b, + const char *qname, uint16_t qclass, uint16_t qtype) +{ + switch (ctx->server_index) + { + case 0: + /* First server times out. */ + { + struct resolv_response_flags flags = {.rcode = rcode}; + resolv_response_init (b, flags); + } + break; + case 1: + /* Second server sends reply. */ + resolv_response_init (b, (struct resolv_response_flags) {}); + resolv_response_add_question (b, qname, qclass, qtype); + resolv_response_section (b, ns_s_an); + resolv_response_open_record (b, qname, qclass, qtype, 0); + switch (qtype) + { + case T_A: + { + char ipv4[4] = {192, 0, 2, 17}; + resolv_response_add_data (b, &ipv4, sizeof (ipv4)); + } + break; + case T_AAAA: + { + char ipv6[16] + = {0x20, 0x01, 0xd, 0xb8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}; + resolv_response_add_data (b, &ipv6, sizeof (ipv6)); + } + break; + default: + FAIL_EXIT1 ("unexpected TYPE%d query", qtype); + } + resolv_response_close_record (b); + break; + default: + FAIL_EXIT1 ("unexpected query to server %d", ctx->server_index); + } +} + +static void +check_one (void) +{ + + /* The buggy 1-second query timeout results in 30 seconds of delay, + which triggers a test timeout failure. */ + for (int i = 0; i < 10; ++i) + { + check_hostent ("www.example", gethostbyname ("www.example"), + "name: www.example\n" + "address: 192.0.2.17\n"); + check_hostent ("www.example", gethostbyname2 ("www.example", AF_INET6), + "name: www.example\n" + "address: 2001:db8::1\n"); + static const struct addrinfo hints = + { + .ai_family = AF_UNSPEC, + .ai_socktype = SOCK_STREAM, + }; + struct addrinfo *ai; + int ret = getaddrinfo ("www.example", "80", &hints, &ai); + check_addrinfo ("www.example", ai, ret, + "address: STREAM/TCP 192.0.2.17 80\n" + "address: STREAM/TCP 2001:db8::1 80\n"); + if (ret == 0) + freeaddrinfo (ai); + } +} + +static int +do_test (void) +{ + struct resolv_test *aux = resolv_test_start + ((struct resolv_redirect_config) + { + .response_callback = response, + }); + + _res.options |= RES_SNGLKUP; + + rcode = 2; /* SERVFAIL. */ + check_one (); + + rcode = 4; /* NOTIMP. */ + check_one (); + + rcode = 5; /* REFUSED. */ + check_one (); + + resolv_test_end (aux); + + return 0; +} + +#include diff --git a/resource/sys/resource.h b/resource/sys/resource.h index a5634ba715..b0bf751e92 100644 --- a/resource/sys/resource.h +++ b/resource/sys/resource.h @@ -88,7 +88,7 @@ extern int setrlimit64 (__rlimit_resource_t __resource, and put it in *USAGE. Returns 0 for success, -1 for failure. */ extern int getrusage (__rusage_who_t __who, struct rusage *__usage) __THROW; -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # if defined(__REDIRECT_NTH) extern int __REDIRECT_NTH (getrusage, (__rusage_who_t __who, struct rusage *__usage), diff --git a/rt/aio.h b/rt/aio.h index 37d19abf16..e71435733f 100644 --- a/rt/aio.h +++ b/rt/aio.h @@ -193,7 +193,7 @@ extern __ssize_t __REDIRECT_NTH (aio_return, (struct aiocb *__aiocbp), extern int __REDIRECT_NTH (aio_cancel, (int __fildes, struct aiocb *__aiocbp), aio_cancel64); -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS extern int __REDIRECT_NTH (aio_suspend, (const struct aiocb *const __list[], int __nent, const struct timespec *__restrict __timeout), @@ -215,7 +215,7 @@ extern int __REDIRECT_NTH (aio_fsync, # define aio_error aio_error64 # define aio_return aio_return64 # define aio_cancel aio_cancel64 -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # define aio_suspend __aio_suspend_time64 # else # define aio_suspend aio_suspend64 diff --git a/rt/mqueue.h b/rt/mqueue.h index 787cc36df2..fd6fff4bb2 100644 --- a/rt/mqueue.h +++ b/rt/mqueue.h @@ -71,7 +71,7 @@ extern int mq_send (mqd_t __mqdes, const char *__msg_ptr, size_t __msg_len, unsigned int __msg_prio) __nonnull ((2)); #ifdef __USE_XOPEN2K -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Receive the oldest from highest priority messages in message queue MQDES, stop waiting if ABS_TIMEOUT expires. */ extern ssize_t mq_timedreceive (mqd_t __mqdes, char *__restrict __msg_ptr, diff --git a/scripts/check-local-headers.sh b/scripts/check-local-headers.sh index 5d3e61f889..ad23840333 100755 --- a/scripts/check-local-headers.sh +++ b/scripts/check-local-headers.sh @@ -33,7 +33,7 @@ exec ${AWK} -v includedir="$includedir" ' BEGIN { status = 0 exclude = "^" includedir \ - "/(.*-.*-.*/|.*-.*/|)(asm[-/]|arch|linux/|selinux/|mach/|mach_debug/|device/|hurd/(((hurd|ioctl)_types|paths)\\.h|ioctls\\.defs|ihash\\.h|version\\.h)|gd|nss3/|nspr4?/|c\\+\\+/|sys/(capability|sdt(|-config))\\.h|libaudit\\.h)" + "/(.*-.*-.*/|.*-.*/|)(asm[-/]|arch|linux/|selinux/|mach/|mach_debug/|device/|hurd/(((hurd|ioctl)_types|paths)\\.h|ioctls\\.defs|ihash\\.h|version\\.h)|gd|nss3/|nspr4?/|c\\+\\+/|sys/(capability|sdt(|-config))\\.h|libaudit\\.h|audit(_logging|-records)\\.h)" } /^[^ ]/ && $1 ~ /.*:/ { obj = $1 } { diff --git a/scripts/localplt.awk b/scripts/localplt.awk index fe79ca01ab..621ae7d8e8 100644 --- a/scripts/localplt.awk +++ b/scripts/localplt.awk @@ -10,7 +10,8 @@ BEGIN { } FILENAME != lastfile { - if (lastfile && jmprel_offset == 0 && rela_offset == 0 && rel_offset == 0) { + if (lastfile && jmprel_offset == 0 && rela_offset == 0 && rel_offset == 0 \ + && relr_offset == 0) { print FILENAME ": *** failed to find expected output (readelf -WSdr)"; result = 2; } @@ -22,6 +23,7 @@ FILENAME != lastfile { jmprel_offset = 0; rela_offset = 0; rel_offset = 0; + relr_offset = 0; pltrelsz = -1; delete section_offset_by_address; } @@ -77,6 +79,8 @@ in_relocs && relocs_offset == rel_offset && NF >= 5 { } } +# No need to handle DT_RELR (all packed relocations are relative). + in_relocs { next } $1 == "Relocation" && $2 == "section" && $5 == "offset" { @@ -121,4 +125,14 @@ $2 == "(REL)" { } next } + +$2 == "(RELR)" { + relr_addr = strtonum($3); + if (relr_addr in section_offset_by_address) { + relr_offset = section_offset_by_address[relr_addr]; + } else { + print FILENAME ": *** DT_RELR does not match any section's address"; + result = 2; + } +} END { exit(result) } diff --git a/signal/signal.h b/signal/signal.h index f37499ce60..8e07b041b1 100644 --- a/signal/signal.h +++ b/signal/signal.h @@ -269,7 +269,7 @@ extern int sigwaitinfo (const sigset_t *__restrict __set, This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int sigtimedwait (const sigset_t *__restrict __set, siginfo_t *__restrict __info, const struct timespec *__restrict __timeout) diff --git a/socket/bits/socket2.h b/socket/bits/socket2.h index a88cb64370..71f8d9c741 100644 --- a/socket/bits/socket2.h +++ b/socket/bits/socket2.h @@ -33,12 +33,12 @@ extern ssize_t __REDIRECT (__recv_chk_warn, __fortify_function ssize_t recv (int __fd, void *__buf, size_t __n, int __flags) { - size_t sz = __glibc_objsize0 (__buf); - if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) + size_t __sz = __glibc_objsize0 (__buf); + if (__glibc_safe_or_unknown_len (__n, sizeof (char), __sz)) return __recv_alias (__fd, __buf, __n, __flags); - if (__glibc_unsafe_len (__n, sizeof (char), sz)) - return __recv_chk_warn (__fd, __buf, __n, sz, __flags); - return __recv_chk (__fd, __buf, __n, sz, __flags); + if (__glibc_unsafe_len (__n, sizeof (char), __sz)) + return __recv_chk_warn (__fd, __buf, __n, __sz, __flags); + return __recv_chk (__fd, __buf, __n, __sz, __flags); } extern ssize_t __recvfrom_chk (int __fd, void *__restrict __buf, size_t __n, @@ -61,11 +61,11 @@ __fortify_function ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, int __flags, __SOCKADDR_ARG __addr, socklen_t *__restrict __addr_len) { - size_t sz = __glibc_objsize0 (__buf); - if (__glibc_safe_or_unknown_len (__n, sizeof (char), sz)) + size_t __sz = __glibc_objsize0 (__buf); + if (__glibc_safe_or_unknown_len (__n, sizeof (char), __sz)) return __recvfrom_alias (__fd, __buf, __n, __flags, __addr, __addr_len); - if (__glibc_unsafe_len (__n, sizeof (char), sz)) - return __recvfrom_chk_warn (__fd, __buf, __n, sz, __flags, __addr, + if (__glibc_unsafe_len (__n, sizeof (char), __sz)) + return __recvfrom_chk_warn (__fd, __buf, __n, __sz, __flags, __addr, __addr_len); - return __recvfrom_chk (__fd, __buf, __n, sz, __flags, __addr, __addr_len); + return __recvfrom_chk (__fd, __buf, __n, __sz, __flags, __addr, __addr_len); } diff --git a/socket/sys/socket.h b/socket/sys/socket.h index 366eaab845..463cf3291b 100644 --- a/socket/sys/socket.h +++ b/socket/sys/socket.h @@ -170,7 +170,7 @@ extern ssize_t recvfrom (int __fd, void *__restrict __buf, size_t __n, This function is a cancellation point and therefore not marked with __THROW. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern ssize_t sendmsg (int __fd, const struct msghdr *__message, int __flags); #else @@ -191,7 +191,7 @@ extern ssize_t __sendmsg64 (int __fd, const struct msghdr *__message, This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int sendmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags); # else @@ -204,7 +204,7 @@ extern int __sendmmsg64 (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags); # define sendmmsg __sendmmsg64 # endif -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ #endif /* __USE_GNU */ /* Receive a message as described by MESSAGE from socket FD. @@ -212,7 +212,7 @@ extern int __sendmmsg64 (int __fd, struct mmsghdr *__vmessages, This function is a cancellation point and therefore not marked with __THROW. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern ssize_t recvmsg (int __fd, struct msghdr *__message, int __flags); #else # ifdef __REDIRECT @@ -231,7 +231,7 @@ extern ssize_t __recvmsg64 (int __fd, struct msghdr *__message, int __flags); This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int recvmmsg (int __fd, struct mmsghdr *__vmessages, unsigned int __vlen, int __flags, struct timespec *__tmo); @@ -251,7 +251,7 @@ extern int __REDIRECT (recvmmsg, (int __fd, struct mmsghdr *__vmessages, /* Put the current value for socket FD's option OPTNAME at protocol level LEVEL into OPTVAL (which is *OPTLEN bytes long), and set *OPTLEN to the value's actual length. Returns 0 on success, -1 for errors. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int getsockopt (int __fd, int __level, int __optname, void *__restrict __optval, socklen_t *__restrict __optlen) __THROW; @@ -273,7 +273,7 @@ extern int __getsockopt64 (int __fd, int __level, int __optname, /* Set socket FD's option OPTNAME at protocol level LEVEL to *OPTVAL (which is OPTLEN bytes long). Returns 0 on success, -1 for errors. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int setsockopt (int __fd, int __level, int __optname, const void *__optval, socklen_t __optlen) __THROW; #else diff --git a/socket/sys/un.h b/socket/sys/un.h index bf03b7d6ce..ff9cbd6efa 100644 --- a/socket/sys/un.h +++ b/socket/sys/un.h @@ -26,7 +26,7 @@ __BEGIN_DECLS /* Structure describing the address of an AF_LOCAL (aka AF_UNIX) socket. */ -struct sockaddr_un +struct __attribute_struct_may_alias__ sockaddr_un { __SOCKADDR_COMMON (sun_); char sun_path[108]; /* Path name. */ diff --git a/stdio-common/Makefile b/stdio-common/Makefile index e312565f3b..e916cca3ff 100644 --- a/stdio-common/Makefile +++ b/stdio-common/Makefile @@ -318,7 +318,7 @@ generated += \ # generated endif # $(run-built-tests) -tests-special += $(objpfx)tst-errno-manual.out +# tests-special += $(objpfx)tst-errno-manual.out include ../Rules diff --git a/stdlib/arc4random.c b/stdlib/arc4random.c index 3ae8fc1302..7818cb9cf6 100644 --- a/stdlib/arc4random.c +++ b/stdlib/arc4random.c @@ -51,7 +51,7 @@ __arc4random_buf (void *p, size_t n) n -= l; continue; /* Interrupted by a signal; keep going. */ } - else if (l == -ENOSYS) + else if (l < 0 && errno == ENOSYS) break; /* No syscall, so fallback to /dev/urandom. */ arc4random_getrandom_failure (); } diff --git a/stdlib/bits/stdlib.h b/stdlib/bits/stdlib.h index 1c7191ba57..32f7ef5020 100644 --- a/stdlib/bits/stdlib.h +++ b/stdlib/bits/stdlib.h @@ -36,16 +36,16 @@ extern char *__REDIRECT_NTH (__realpath_chk_warn, __fortify_function __wur char * __NTH (realpath (const char *__restrict __name, char *__restrict __resolved)) { - size_t sz = __glibc_objsize (__resolved); + size_t __sz = __glibc_objsize (__resolved); - if (sz == (size_t) -1) + if (__sz == (size_t) -1) return __realpath_alias (__name, __resolved); #if defined _LIBC_LIMITS_H_ && defined PATH_MAX - if (__glibc_unsafe_len (PATH_MAX, sizeof (char), sz)) - return __realpath_chk_warn (__name, __resolved, sz); + if (__glibc_unsafe_len (PATH_MAX, sizeof (char), __sz)) + return __realpath_chk_warn (__name, __resolved, __sz); #endif - return __realpath_chk (__name, __resolved, sz); + return __realpath_chk (__name, __resolved, __sz); } diff --git a/stdlib/tst-swapcontext2.c b/stdlib/tst-swapcontext2.c index f679755649..a9c1dc827c 100644 --- a/stdlib/tst-swapcontext2.c +++ b/stdlib/tst-swapcontext2.c @@ -85,7 +85,7 @@ do_test (void) { /* ____longjmp_chk has */ #if 0 -#ifdef _STACK_GROWS_DOWN +#if _STACK_GROWS_DOWN #define called_from(this, saved) ((this) < (saved)) #else #define called_from(this, saved) ((this) > (saved)) @@ -98,7 +98,7 @@ do_test (void) /* Arrange stacks for uctx_func1 and uctx_func2 so that called_from is true when setjmp is called from uctx_func1 and longjmp is called from uctx_func2. */ -#ifdef _STACK_GROWS_DOWN +#if _STACK_GROWS_DOWN # define UCTX_FUNC1_STACK 1 # define UCTX_FUNC2_STACK 0 #else diff --git a/string/Makefile b/string/Makefile index 313f291498..1dff405c27 100644 --- a/string/Makefile +++ b/string/Makefile @@ -51,7 +51,6 @@ routines := \ argz-next \ argz-replace \ argz-stringify \ - argz-suffix \ basename \ bcopy \ bzero \ @@ -185,6 +184,7 @@ tests := \ test-strncpy \ test-strndup \ test-strnlen \ + test-strnlen-nonarray \ test-strpbrk \ test-strrchr \ test-strspn \ @@ -236,7 +236,10 @@ tests-unsupported += $(tests-translation) endif # This test allocates a lot of memory and can run for a long time. -xtests = tst-strcoll-overflow +xtests += tst-strcoll-overflow + +# This test runs for a long time. +xtests += test-strncmp-nonarray # This test needs libdl. ifeq (yes,$(build-shared)) diff --git a/string/argz-suffix.c b/string/argz-suffix.c deleted file mode 100644 index e61f3d93e1..0000000000 --- a/string/argz-suffix.c +++ /dev/null @@ -1,58 +0,0 @@ -/* Copyright (C) 2015 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ludovic Courtès . - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -#include -#include -#include -#include - - -error_t -__argz_suffix_entries (char **argz, size_t *argz_len, const char *suffix) - -{ - size_t suffix_len = strlen (suffix); - size_t count = __argz_count (*argz, *argz_len); - size_t new_argz_len = *argz_len + count * suffix_len; - if (new_argz_len == 0) - return 0; - char *new_argz = malloc (new_argz_len); - - if (new_argz) - { - char *p = new_argz, *entry; - - for (entry = *argz; - entry != NULL; - entry = argz_next (*argz, *argz_len, entry)) - { - p = stpcpy (p, entry); - p = stpcpy (p, suffix); - p++; - } - - free (*argz); - *argz = new_argz; - *argz_len = new_argz_len; - - return 0; - } - else - return ENOMEM; -} -weak_alias (__argz_suffix_entries, argz_suffix_entries) diff --git a/string/argz.h b/string/argz.h index 2d3e9f8cdf..49e85a09ec 100644 --- a/string/argz.h +++ b/string/argz.h @@ -108,16 +108,6 @@ extern error_t argz_replace (char **__restrict __argz, const char *__restrict __str, const char *__restrict __with, unsigned int *__restrict __replace_count); - -/* Suffix each entry of ARGZ & ARGZ_LEN with SUFFIX. Return 0 on success, - and ENOMEN if memory cannot be allocated. */ -extern error_t __argz_suffix_entries (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __suffix); -extern error_t argz_suffix_entries (char **__restrict __argz, - size_t *__restrict __argz_len, - const char *__restrict __suffix); - /* Returns the next entry in ARGZ & ARGZ_LEN after ENTRY, or NULL if there are no more. If entry is NULL, then the first entry is returned. This diff --git a/string/test-Xncmp-nonarray.c b/string/test-Xncmp-nonarray.c new file mode 100644 index 0000000000..9f3a3ca75d --- /dev/null +++ b/string/test-Xncmp-nonarray.c @@ -0,0 +1,183 @@ +/* Test non-array inputs to string comparison functions. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This skeleton file is included from string/test-strncmp-nonarray.c and + wcsmbs/test-wcsncmp-nonarray.c to test that reading of the arrays stops + at the first null character. + + TEST_IDENTIFIER must be the test function identifier. TEST_NAME is + the same as a string. + + CHAR must be defined as the character type. */ + +#include +#include +#include +#include +#include +#include +#include + +/* Much shorter than test-Xnlen-nonarray.c because of deeply nested loops. */ +enum { buffer_length = 80 }; + +/* The test buffer layout follows what is described test-Xnlen-nonarray.c, + except that there two buffers, left and right. The variables + a_count, zero_count, start_offset are all duplicated. */ + +/* Return the maximum string length for a string that starts at + start_offset. */ +static int +string_length (int a_count, int start_offset) +{ + if (start_offset == buffer_length || start_offset >= a_count) + return 0; + else + return a_count - start_offset; +} + +/* This is the valid maximum length argument computation for + strnlen/wcsnlen. See text-Xnlen-nonarray.c. */ +static int +maximum_length (int start_offset, int zero_count) +{ + if (start_offset == buffer_length) + return 0; + else if (zero_count > 0) + /* Effectively unbounded, but we need to stop fairly low, + otherwise testing takes too long. */ + return buffer_length + 32; + else + return buffer_length - start_offset; +} + +typedef __typeof (TEST_IDENTIFIER) *proto_t; + +#define TEST_MAIN +#include "test-string.h" + +IMPL (TEST_IDENTIFIER, 1) + +static int +test_main (void) +{ + TEST_VERIFY_EXIT (sysconf (_SC_PAGESIZE) >= buffer_length); + test_init (); + + struct support_next_to_fault left_ntf + = support_next_to_fault_allocate (buffer_length * sizeof (CHAR)); + CHAR *left_buffer = (CHAR *) left_ntf.buffer; + struct support_next_to_fault right_ntf + = support_next_to_fault_allocate (buffer_length * sizeof (CHAR)); + CHAR *right_buffer = (CHAR *) right_ntf.buffer; + + FOR_EACH_IMPL (impl, 0) + { + printf ("info: testing %s\n", impl->name); + for (size_t i = 0; i < buffer_length; ++i) + left_buffer[i] = 'A'; + + for (int left_zero_count = 0; left_zero_count <= buffer_length; + ++left_zero_count) + { + if (left_zero_count > 0) + left_buffer[buffer_length - left_zero_count] = 0; + int left_a_count = buffer_length - left_zero_count; + for (size_t i = 0; i < buffer_length; ++i) + right_buffer[i] = 'A'; + for (int right_zero_count = 0; right_zero_count <= buffer_length; + ++right_zero_count) + { + if (right_zero_count > 0) + right_buffer[buffer_length - right_zero_count] = 0; + int right_a_count = buffer_length - right_zero_count; + for (int left_start_offset = 0; + left_start_offset <= buffer_length; + ++left_start_offset) + { + CHAR *left_start_pointer = left_buffer + left_start_offset; + int left_maxlen + = maximum_length (left_start_offset, left_zero_count); + int left_length + = string_length (left_a_count, left_start_offset); + for (int right_start_offset = 0; + right_start_offset <= buffer_length; + ++right_start_offset) + { + CHAR *right_start_pointer + = right_buffer + right_start_offset; + int right_maxlen + = maximum_length (right_start_offset, right_zero_count); + int right_length + = string_length (right_a_count, right_start_offset); + + /* Maximum length is modelled after strnlen/wcsnlen, + and must be valid for both pointer arguments at + the same time. */ + int maxlen = MIN (left_maxlen, right_maxlen); + + for (int length_argument = 0; length_argument <= maxlen; + ++length_argument) + { + if (test_verbose) + { + printf ("left: zero_count=%d" + " a_count=%d start_offset=%d\n", + left_zero_count, left_a_count, + left_start_offset); + printf ("right: zero_count=%d" + " a_count=%d start_offset=%d\n", + right_zero_count, right_a_count, + right_start_offset); + printf ("length argument: %d\n", + length_argument); + } + + /* Effective lengths bounded by length argument. + The effective length determines the + outcome of the comparison. */ + int left_effective + = MIN (left_length, length_argument); + int right_effective + = MIN (right_length, length_argument); + if (left_effective == right_effective) + TEST_COMPARE (CALL (impl, + left_start_pointer, + right_start_pointer, + length_argument), 0); + else if (left_effective < right_effective) + TEST_COMPARE (CALL (impl, + left_start_pointer, + right_start_pointer, + length_argument) < 0, 1); + else + TEST_COMPARE (CALL (impl, + left_start_pointer, + right_start_pointer, + length_argument) > 0, 1); + } + } + } + } + } + } + + return 0; +} + +#include diff --git a/string/test-Xnlen-nonarray.c b/string/test-Xnlen-nonarray.c new file mode 100644 index 0000000000..499bef2041 --- /dev/null +++ b/string/test-Xnlen-nonarray.c @@ -0,0 +1,133 @@ +/* Test non-array inputs to string length functions. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* This skeleton file is included from string/test-strnlen-nonarray.c + and wcsmbs/test-wcsnlen-nonarray.c to test that reading of the array + stops at the first null character. + + TEST_IDENTIFIER must be the test function identifier. TEST_NAME is + the same as a string. + + CHAR must be defined as the character type. */ + +#include +#include +#include +#include +#include +#include +#include + +typedef __typeof (TEST_IDENTIFIER) *proto_t; + +#define TEST_MAIN +#include "test-string.h" + +IMPL (TEST_IDENTIFIER, 1) + +static int +test_main (void) +{ + enum { buffer_length = 256 }; + TEST_VERIFY_EXIT (sysconf (_SC_PAGESIZE) >= buffer_length); + + test_init (); + + /* Buffer layout: There are a_count 'A' character followed by + zero_count null character, for a total of buffer_length + character: + + AAAAA...AAAAA 00000 ... 00000 (unmapped page follows) + \ / \ / + (a_count) (zero_count) + \___ (buffer_length) ___/ + ^ + | + start_offset + + The buffer length does not change, but a_count (and thus _zero) + and start_offset vary. + + If start_offset == buffer_length, only 0 is a valid length + argument. The result is 0. + + Otherwwise, if zero_count > 0 (if there a null characters in the + buffer), then any length argument is valid. If start_offset < + a_count (i.e., there is a non-null character at start_offset), the + result is the minimum of a_count - start_offset and the length + argument. Otherwise the result is 0. + + Otherwise, there are no null characters before the unmapped page. + The length argument must not be greater than buffer_length - + start_offset, and the result is the length argument. */ + + struct support_next_to_fault ntf + = support_next_to_fault_allocate (buffer_length * sizeof (CHAR)); + CHAR *buffer = (CHAR *) ntf.buffer; + + FOR_EACH_IMPL (impl, 0) + { + printf ("info: testing %s\n", impl->name); + for (size_t i = 0; i < buffer_length; ++i) + buffer[i] = 'A'; + + for (int zero_count = 0; zero_count <= buffer_length; ++zero_count) + { + if (zero_count > 0) + buffer[buffer_length - zero_count] = 0; + int a_count = buffer_length - zero_count; + for (int start_offset = 0; start_offset <= buffer_length; + ++start_offset) + { + CHAR *start_pointer = buffer + start_offset; + if (start_offset == buffer_length) + TEST_COMPARE (CALL (impl, buffer + start_offset, 0), 0); + else if (zero_count > 0) + for (int length_argument = 0; + length_argument <= 2 * buffer_length; + ++length_argument) + { + if (test_verbose) + printf ("zero_count=%d a_count=%d start_offset=%d" + " length_argument=%d\n", + zero_count, a_count, start_offset, + length_argument); + if (start_offset < a_count) + TEST_COMPARE (CALL (impl, start_pointer, length_argument), + MIN (a_count - start_offset, + length_argument)); + else + TEST_COMPARE (CALL (impl, start_pointer, length_argument), + 0); + } + else + for (int length_argument = 0; + length_argument <= buffer_length - start_offset; + ++length_argument) + TEST_COMPARE (CALL (impl, start_pointer, length_argument), + length_argument); + } + } + } + + support_next_to_fault_free (&ntf); + + return 0; +} + +#include diff --git a/string/test-strncmp-nonarray.c b/string/test-strncmp-nonarray.c new file mode 100644 index 0000000000..581e52d01b --- /dev/null +++ b/string/test-strncmp-nonarray.c @@ -0,0 +1,4 @@ +#define TEST_IDENTIFIER strncmp +#define TEST_NAME "strncmp" +typedef char CHAR; +#include "test-Xncmp-nonarray.c" diff --git a/string/test-strnlen-nonarray.c b/string/test-strnlen-nonarray.c new file mode 100644 index 0000000000..0ad05756d9 --- /dev/null +++ b/string/test-strnlen-nonarray.c @@ -0,0 +1,4 @@ +#define TEST_IDENTIFIER strnlen +#define TEST_NAME "strnlen" +typedef char CHAR; +#include "test-Xnlen-nonarray.c" diff --git a/support/test-driver.c b/support/test-driver.c index f4c3e4d666..04ceebc08f 100644 --- a/support/test-driver.c +++ b/support/test-driver.c @@ -155,6 +155,7 @@ main (int argc, char **argv) { CMDLINE_OPTIONS TEST_DEFAULT_OPTIONS + { 0, } }; test_config.options = &options; #endif diff --git a/support/timespec.h b/support/timespec.h index 42f32bcc2c..5ccc7163a5 100644 --- a/support/timespec.h +++ b/support/timespec.h @@ -35,7 +35,7 @@ make_timespec (time_t s, long int ns) enum { TIMESPEC_HZ = 1000000000 }; -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS struct timespec timespec_add (struct timespec, struct timespec) __attribute__((const)); struct timespec timespec_sub (struct timespec, struct timespec) diff --git a/support/xtime.h b/support/xtime.h index 5200eef2e0..9961899634 100644 --- a/support/xtime.h +++ b/support/xtime.h @@ -30,7 +30,7 @@ __BEGIN_DECLS /* The following functions call the corresponding libc functions and terminate the process on error. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS void xclock_gettime (clockid_t clock, struct timespec *ts); void xclock_settime (clockid_t clock, const struct timespec *ts); #else diff --git a/support/xunistd.h b/support/xunistd.h index b5e8c2f420..13be9a46a3 100644 --- a/support/xunistd.h +++ b/support/xunistd.h @@ -36,7 +36,7 @@ pid_t xwaitpid (pid_t, int *status, int flags); void xpipe (int[2]); void xdup2 (int, int); int xopen (const char *path, int flags, mode_t); -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS # ifdef __USE_FILE_OFFSET64 void xstat (const char *path, struct stat *); void xlstat (const char *path, struct stat *); diff --git a/sysdeps/generic/mremap-failure.h b/sysdeps/generic/mremap-failure.h new file mode 100644 index 0000000000..bc0d476368 --- /dev/null +++ b/sysdeps/generic/mremap-failure.h @@ -0,0 +1,25 @@ +/* mremap failure handling. Generic version. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +/* Return exit value on mremap failure with errno ERR. */ + +static int +mremap_failure_exit (int err) +{ + return EXIT_FAILURE; +} diff --git a/sysdeps/generic/paths.h b/sysdeps/generic/paths.h index 893b4c2286..4e641c97a4 100644 --- a/sysdeps/generic/paths.h +++ b/sysdeps/generic/paths.h @@ -51,7 +51,7 @@ #define _PATH_MAN "/usr/share/man" #define _PATH_MEM "/dev/mem" #define _PATH_MNTTAB "/etc/fstab" -#define _PATH_MOUNTED "/var/run/mtab" +#define _PATH_MOUNTED "/etc/mtab" #define _PATH_NOLOGIN "/etc/nologin" #define _PATH_PRESERVE "/var/lib" #define _PATH_RWHODIR "/var/spool/rwho" @@ -68,7 +68,7 @@ /* Provide trailing slash, since mostly used for building pathnames. */ #define _PATH_DEV "/dev/" #define _PATH_TMP "/tmp/" -#define _PATH_VARDB "/var/db/" +#define _PATH_VARDB "/var/lib/misc/" #define _PATH_VARRUN "/var/run/" #define _PATH_VARTMP "/var/tmp/" diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile index c89eb8ed1c..3f70561446 100644 --- a/sysdeps/gnu/Makefile +++ b/sysdeps/gnu/Makefile @@ -50,3 +50,7 @@ sysdep_headers += bits/ipc-perm.h \ bits/types/struct_msqid_ds.h \ bits/types/struct_shmid_ds.h endif + +ifeq ($(subdir),socket) +sysdep_headers += net/ethernet.h net/if_arp.h net/if_ether.h +endif diff --git a/sysdeps/unix/sysv/linux/net/ethernet.h b/sysdeps/gnu/net/ethernet.h similarity index 97% rename from sysdeps/unix/sysv/linux/net/ethernet.h rename to sysdeps/gnu/net/ethernet.h index 3f58506a01..7c5c10992a 100644 --- a/sysdeps/unix/sysv/linux/net/ethernet.h +++ b/sysdeps/gnu/net/ethernet.h @@ -24,7 +24,7 @@ #include #include -#include /* IEEE 802.3 Ethernet constants */ +#include /* IEEE 802.3 Ethernet constants */ __BEGIN_DECLS diff --git a/sysdeps/unix/sysv/linux/net/if_arp.h b/sysdeps/gnu/net/if_arp.h similarity index 100% rename from sysdeps/unix/sysv/linux/net/if_arp.h rename to sysdeps/gnu/net/if_arp.h diff --git a/sysdeps/mach/hurd/net/if_ether.h b/sysdeps/gnu/net/if_ether.h similarity index 64% rename from sysdeps/mach/hurd/net/if_ether.h rename to sysdeps/gnu/net/if_ether.h index 1464eb7d1a..d7cb43d327 100644 --- a/sysdeps/mach/hurd/net/if_ether.h +++ b/sysdeps/gnu/net/if_ether.h @@ -28,18 +28,21 @@ #define ETH_ZLEN 60 /* Min. octets in frame sans FCS */ #define ETH_DATA_LEN 1500 /* Max. octets in payload */ #define ETH_FRAME_LEN 1514 /* Max. octets in frame sans FCS */ +#define ETH_FCS_LEN 4 /* Octets in the FCS */ /* * These are the defined Ethernet Protocol ID's. */ #define ETH_P_LOOP 0x0060 /* Ethernet Loopback packet */ -#define ETH_P_ECHO 0x0200 /* Ethernet Echo packet */ -#define ETH_P_PUP 0x0400 /* Xerox PUP packet */ +#define ETH_P_PUP 0x0200 /* Xerox PUP packet */ +#define ETH_P_PUPAT 0x0201 /* Xerox PUP Addr Trans packet */ #define ETH_P_IP 0x0800 /* Internet Protocol packet */ #define ETH_P_X25 0x0805 /* CCITT X.25 */ #define ETH_P_ARP 0x0806 /* Address Resolution packet */ #define ETH_P_BPQ 0x08FF /* G8BPQ AX.25 Ethernet Packet [ NOT AN OFFICIALLY REGISTERED ID ] */ +#define ETH_P_IEEEPUP 0x0a00 /* Xerox IEEE802.3 PUP packet */ +#define ETH_P_IEEEPUPAT 0x0a01 /* Xerox IEEE802.3 PUP Addr Trans packet */ #define ETH_P_DEC 0x6000 /* DEC Assigned proto */ #define ETH_P_DNA_DL 0x6001 /* DEC DNA Dump/Load */ #define ETH_P_DNA_RC 0x6002 /* DEC DNA Remote Console */ @@ -51,8 +54,26 @@ #define ETH_P_RARP 0x8035 /* Reverse Addr Res packet */ #define ETH_P_ATALK 0x809B /* Appletalk DDP */ #define ETH_P_AARP 0x80F3 /* Appletalk AARP */ +#define ETH_P_8021Q 0x8100 /* 802.1Q VLAN Extended Header */ #define ETH_P_IPX 0x8137 /* IPX over DIX */ #define ETH_P_IPV6 0x86DD /* IPv6 over bluebook */ +#define ETH_P_PAUSE 0x8808 /* IEEE Pause frames. See 802.3 31B */ +#define ETH_P_SLOW 0x8809 /* Slow Protocol. See 802.3ad 43B */ +#define ETH_P_WCCP 0x883E /* Web-cache coordination protocol + * defined in draft-wilson-wrec-wccp-v2-00.txt */ +#define ETH_P_PPP_DISC 0x8863 /* PPPoE discovery messages */ +#define ETH_P_PPP_SES 0x8864 /* PPPoE session messages */ +#define ETH_P_MPLS_UC 0x8847 /* MPLS Unicast traffic */ +#define ETH_P_MPLS_MC 0x8848 /* MPLS Multicast traffic */ +#define ETH_P_ATMMPOA 0x884c /* MultiProtocol Over ATM */ +#define ETH_P_ATMFATE 0x8884 /* Frame-based ATM Transport + * over Ethernet + */ +#define ETH_P_PAE 0x888E /* Port Access Entity (IEEE 802.1X) */ +#define ETH_P_AOE 0x88A2 /* ATA over Ethernet */ +#define ETH_P_TIPC 0x88CA /* TIPC */ +#define ETH_P_FCOE 0x8906 /* Fibre Channel over Ethernet */ +#define ETH_P_EDSA 0xDADA /* Ethertype DSA [ NOT AN OFFICIALLY REGISTERED ID ] */ /* * Non DIX types. Won't clash for 1500 types. @@ -67,8 +88,18 @@ #define ETH_P_WAN_PPP 0x0007 /* Dummy type for WAN PPP frames*/ #define ETH_P_PPP_MP 0x0008 /* Dummy type for PPP MP frames */ #define ETH_P_LOCALTALK 0x0009 /* Localtalk pseudo type */ +#define ETH_P_CAN 0x000C /* Controller Area Network */ #define ETH_P_PPPTALK 0x0010 /* Dummy type for Atalk over PPP*/ #define ETH_P_TR_802_2 0x0011 /* 802.2 frames */ +#define ETH_P_MOBITEX 0x0015 /* Mobitex (kaz@cafe.net) */ +#define ETH_P_CONTROL 0x0016 /* Card specific control frames */ +#define ETH_P_IRDA 0x0017 /* Linux-IrDA */ +#define ETH_P_ECONET 0x0018 /* Acorn Econet */ +#define ETH_P_HDLC 0x0019 /* HDLC frames */ +#define ETH_P_ARCNET 0x001A /* 1A for ArcNet :-) */ +#define ETH_P_DSA 0x001B /* Distributed Switch Arch. */ +#define ETH_P_TRAILER 0x001C /* Trailer switch tagging */ +#define ETH_P_PHONET 0x00F5 /* Nokia Phonet frames */ /* * This is an Ethernet frame header. @@ -79,6 +110,6 @@ struct ethhdr unsigned char h_dest[ETH_ALEN]; /* destination eth addr */ unsigned char h_source[ETH_ALEN]; /* source ether addr */ unsigned short int h_proto; /* packet type ID field */ -}; +} __attribute__((packed)); #endif /* net/if_ether.h */ diff --git a/sysdeps/unix/sysv/linux/net/if_ppp.h b/sysdeps/gnu/net/if_ppp.h similarity index 100% rename from sysdeps/unix/sysv/linux/net/if_ppp.h rename to sysdeps/gnu/net/if_ppp.h diff --git a/sysdeps/unix/sysv/linux/netinet/if_ether.h b/sysdeps/gnu/netinet/if_ether.h similarity index 98% rename from sysdeps/unix/sysv/linux/netinet/if_ether.h rename to sysdeps/gnu/netinet/if_ether.h index 344dd8fc00..a523bd163a 100644 --- a/sysdeps/unix/sysv/linux/netinet/if_ether.h +++ b/sysdeps/gnu/netinet/if_ether.h @@ -21,8 +21,7 @@ #include #include -/* Get definitions from kernel header file. */ -#include +#include #ifdef __USE_MISC /* diff --git a/sysdeps/hppa/Makefile b/sysdeps/hppa/Makefile index b1c238d5b2..73567432df 100644 --- a/sysdeps/hppa/Makefile +++ b/sysdeps/hppa/Makefile @@ -22,6 +22,7 @@ LDFLAGS-c_pic.os += -Wl,--unique=.text* ifeq ($(subdir),elf) CFLAGS-rtld.c += -mdisable-fpregs +CFLAGS-dl-reloc.c += --param inline-unit-growth=100 sysdep-dl-routines += dl-symaddr dl-fptr # dl-fptr.c needs a complete rewrite to fix ISO C aliasing violations. CFLAGS-dl-fptr.c = -Wno-error diff --git a/sysdeps/htl/pt-attr-getdetachstate.c b/sysdeps/htl/pt-attr-getdetachstate.c index 8b077e38f3..da27398260 100644 --- a/sysdeps/htl/pt-attr-getdetachstate.c +++ b/sysdeps/htl/pt-attr-getdetachstate.c @@ -17,6 +17,7 @@ . */ #include +#include #include int @@ -26,4 +27,8 @@ __pthread_attr_getdetachstate (const pthread_attr_t *attr, int *detachstate) return 0; } -weak_alias (__pthread_attr_getdetachstate, pthread_attr_getdetachstate); +versioned_symbol (libc, __pthread_attr_getdetachstate, pthread_attr_getdetachstate, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_attr_getdetachstate, pthread_attr_getdetachstate, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-attr-getinheritsched.c b/sysdeps/htl/pt-attr-getinheritsched.c index 078face3eb..ba02e202c3 100644 --- a/sysdeps/htl/pt-attr-getinheritsched.c +++ b/sysdeps/htl/pt-attr-getinheritsched.c @@ -17,6 +17,7 @@ . */ #include +#include #include int @@ -26,4 +27,8 @@ __pthread_attr_getinheritsched (const pthread_attr_t *attr, int *inheritsched) return 0; } -weak_alias (__pthread_attr_getinheritsched, pthread_attr_getinheritsched); +versioned_symbol (libc, __pthread_attr_getinheritsched, pthread_attr_getinheritsched, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_attr_getinheritsched, pthread_attr_getinheritsched, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-attr-getschedparam.c b/sysdeps/htl/pt-attr-getschedparam.c index 3fa001871e..35eeedc442 100644 --- a/sysdeps/htl/pt-attr-getschedparam.c +++ b/sysdeps/htl/pt-attr-getschedparam.c @@ -19,6 +19,7 @@ #include #include #include +#include #include @@ -30,4 +31,8 @@ __pthread_attr_getschedparam (const pthread_attr_t *attr, return 0; } -weak_alias (__pthread_attr_getschedparam, pthread_attr_getschedparam); +versioned_symbol (libc, __pthread_attr_getschedparam, pthread_attr_getschedparam, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_attr_getschedparam, pthread_attr_getschedparam, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-attr-getschedpolicy.c b/sysdeps/htl/pt-attr-getschedpolicy.c index 8b4cc7ce48..5deaf01c5e 100644 --- a/sysdeps/htl/pt-attr-getschedpolicy.c +++ b/sysdeps/htl/pt-attr-getschedpolicy.c @@ -17,6 +17,7 @@ . */ #include +#include #include int @@ -26,4 +27,8 @@ __pthread_attr_getschedpolicy (const pthread_attr_t *attr, int *policy) return 0; } -weak_alias (__pthread_attr_getschedpolicy, pthread_attr_getschedpolicy); +versioned_symbol (libc, __pthread_attr_getschedpolicy, pthread_attr_getschedpolicy, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_attr_getschedpolicy, pthread_attr_getschedpolicy, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-attr-setdetachstate.c b/sysdeps/htl/pt-attr-setdetachstate.c index b40557f816..26b6f91dc6 100644 --- a/sysdeps/htl/pt-attr-setdetachstate.c +++ b/sysdeps/htl/pt-attr-setdetachstate.c @@ -17,6 +17,7 @@ . */ #include +#include #include int @@ -35,4 +36,8 @@ __pthread_attr_setdetachstate (pthread_attr_t *attr, int detachstate) return 0; } -weak_alias (__pthread_attr_setdetachstate, pthread_attr_setdetachstate); +versioned_symbol (libc, __pthread_attr_setdetachstate, pthread_attr_setdetachstate, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_attr_setdetachstate, pthread_attr_setdetachstate, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-attr-setinheritsched.c b/sysdeps/htl/pt-attr-setinheritsched.c index 533b805b12..4ad0bb1dec 100644 --- a/sysdeps/htl/pt-attr-setinheritsched.c +++ b/sysdeps/htl/pt-attr-setinheritsched.c @@ -17,6 +17,7 @@ . */ #include +#include #include int @@ -35,4 +36,8 @@ __pthread_attr_setinheritsched (pthread_attr_t *attr, int inheritsched) return 0; } -weak_alias (__pthread_attr_setinheritsched, pthread_attr_setinheritsched); +versioned_symbol (libc, __pthread_attr_setinheritsched, pthread_attr_setinheritsched, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_attr_setinheritsched, pthread_attr_setinheritsched, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-attr-setschedpolicy.c b/sysdeps/htl/pt-attr-setschedpolicy.c index d8086e8316..9648c774d0 100644 --- a/sysdeps/htl/pt-attr-setschedpolicy.c +++ b/sysdeps/htl/pt-attr-setschedpolicy.c @@ -17,6 +17,7 @@ . */ #include +#include #include int @@ -39,4 +40,8 @@ __pthread_attr_setschedpolicy (pthread_attr_t *attr, int policy) return 0; } -weak_alias (__pthread_attr_setschedpolicy, pthread_attr_setschedpolicy); +versioned_symbol (libc, __pthread_attr_setschedpolicy, pthread_attr_setschedpolicy, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_attr_setschedpolicy, pthread_attr_setschedpolicy, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-equal.c b/sysdeps/htl/pt-equal.c index 6411110608..7727cca370 100644 --- a/sysdeps/htl/pt-equal.c +++ b/sysdeps/htl/pt-equal.c @@ -17,6 +17,7 @@ . */ #include +#include #include /* Return true if __T1 and __T2 both name the same thread. Otherwise, @@ -27,4 +28,8 @@ __pthread_equal (pthread_t __t1, pthread_t __t2) return __t1 == __t2; } -weak_alias (__pthread_equal, pthread_equal); +versioned_symbol (libc, __pthread_equal, pthread_equal, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_equal, pthread_equal, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-getschedparam.c b/sysdeps/htl/pt-getschedparam.c index 8ec3d54bd4..0c6a2d0ab3 100644 --- a/sysdeps/htl/pt-getschedparam.c +++ b/sysdeps/htl/pt-getschedparam.c @@ -17,6 +17,7 @@ . */ #include +#include #include int @@ -28,4 +29,8 @@ __pthread_getschedparam (pthread_t thread, int *policy, return 0; } -weak_alias (__pthread_getschedparam, pthread_getschedparam); +versioned_symbol (libc, __pthread_getschedparam, pthread_getschedparam, GLIBC_2_21); + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_getschedparam, pthread_getschedparam, GLIBC_2_12); +#endif diff --git a/sysdeps/htl/pt-setschedparam.c b/sysdeps/htl/pt-setschedparam.c index aea4e7b0e4..5594c9f390 100644 --- a/sysdeps/htl/pt-setschedparam.c +++ b/sysdeps/htl/pt-setschedparam.c @@ -17,6 +17,7 @@ . */ #include +#include #include int @@ -26,5 +27,9 @@ __pthread_setschedparam (pthread_t thread, int policy, return ENOSYS; } -weak_alias (__pthread_setschedparam, pthread_setschedparam); +versioned_symbol (libc, __pthread_setschedparam, pthread_setschedparam, GLIBC_2_21); stub_warning (pthread_setschedparam) + +#if OTHER_SHLIB_COMPAT (libpthread, GLIBC_2_12, GLIBC_2_21) +compat_symbol (libc, __pthread_setschedparam, pthread_setschedparam, GLIBC_2_12); +#endif diff --git a/sysdeps/i386/fpu/w_exp10_compat.c b/sysdeps/i386/fpu/w_exp10_compat.c index b53455386e..49a0e03385 100644 --- a/sysdeps/i386/fpu/w_exp10_compat.c +++ b/sysdeps/i386/fpu/w_exp10_compat.c @@ -1,3 +1,8 @@ /* i386 provides an optimized __ieee754_exp10. */ -#define NO_COMPAT_NEEDED 1 -#include +#ifdef SHARED +# define NO_COMPAT_NEEDED 1 +# include +#else +# include +# include +#endif diff --git a/sysdeps/i386/fpu/w_fmod_compat.c b/sysdeps/i386/fpu/w_fmod_compat.c index 5ac9995ffd..528bfc2a13 100644 --- a/sysdeps/i386/fpu/w_fmod_compat.c +++ b/sysdeps/i386/fpu/w_fmod_compat.c @@ -7,8 +7,9 @@ # define LIBM_SVID_COMPAT 1 # undef compat_symbol # define compat_symbol(a, b, c, d) -#endif -#include -#ifdef SHARED +# include libm_alias_double (__fmod_compat, fmod) +#else +#include +#include #endif diff --git a/sysdeps/i386/fpu/w_fmodf_compat.c b/sysdeps/i386/fpu/w_fmodf_compat.c index cc417e07d3..5a61693e51 100644 --- a/sysdeps/i386/fpu/w_fmodf_compat.c +++ b/sysdeps/i386/fpu/w_fmodf_compat.c @@ -7,8 +7,9 @@ # define LIBM_SVID_COMPAT 1 # undef compat_symbol # define compat_symbol(a, b, c, d) -#endif -#include -#ifdef SHARED +# include libm_alias_float (__fmod_compat, fmod) +#else +#include +#include #endif diff --git a/sysdeps/ieee754/float128/s_isnanf128.c b/sysdeps/ieee754/float128/s_isnanf128.c index 59f71533ce..b73a4e80d7 100644 --- a/sysdeps/ieee754/float128/s_isnanf128.c +++ b/sysdeps/ieee754/float128/s_isnanf128.c @@ -11,7 +11,11 @@ #include "../ldbl-128/s_isnanl.c" #if !IS_IN (libm) #include +#ifdef SHARED hidden_ver (__isnanf128_impl, __isnanf128) +#else +strong_alias (__isnanf128_impl, __isnanf128) +#endif _weak_alias (__isnanf128_impl, isnanl) versioned_symbol (libc, __isnanf128_impl, __isnanf128, GLIBC_2_34); #if (SHLIB_COMPAT (libc, FLOAT128_VERSION_M, GLIBC_2_34)) diff --git a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c index 11b42d04ba..80137847d3 100644 --- a/sysdeps/ieee754/ldbl-64-128/s_copysignl.c +++ b/sysdeps/ieee754/ldbl-64-128/s_copysignl.c @@ -1,10 +1,10 @@ #include #include -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED # undef libm_alias_ldouble # define libm_alias_ldouble(from, to) #endif #include -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED long_double_symbol (libc, __copysignl, copysignl); #endif diff --git a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c index 73ac41e40c..f5f7d349f7 100644 --- a/sysdeps/ieee754/ldbl-64-128/s_frexpl.c +++ b/sysdeps/ieee754/ldbl-64-128/s_frexpl.c @@ -1,10 +1,10 @@ #include #include -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED # undef libm_alias_ldouble # define libm_alias_ldouble(from, to) #endif #include -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED long_double_symbol (libc, __frexpl, frexpl); #endif diff --git a/sysdeps/ieee754/ldbl-64-128/s_modfl.c b/sysdeps/ieee754/ldbl-64-128/s_modfl.c index 7d7aeae111..ba3d31334a 100644 --- a/sysdeps/ieee754/ldbl-64-128/s_modfl.c +++ b/sysdeps/ieee754/ldbl-64-128/s_modfl.c @@ -1,10 +1,10 @@ #include #include -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED # undef libm_alias_ldouble # define libm_alias_ldouble(from, to) #endif #include -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED long_double_symbol (libc, __modfl, modfl); #endif diff --git a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c index 1afbe7d8ad..932cc4341c 100644 --- a/sysdeps/ieee754/ldbl-opt/s_ldexpl.c +++ b/sysdeps/ieee754/ldbl-opt/s_ldexpl.c @@ -17,13 +17,13 @@ License along with the GNU C Library; if not, see . */ -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED # define declare_mgen_alias(f,t) #endif #include #include -#if IS_IN (libc) +#if IS_IN (libc) && defined SHARED long_double_symbol (libc, __ldexpl, ldexpl); long_double_symbol (libc, __wrap_scalbnl, scalbnl); #endif diff --git a/sysdeps/m68k/dl-machine.h b/sysdeps/m68k/dl-machine.h index 4bbf1ba5b9..e36a81bfa4 100644 --- a/sysdeps/m68k/dl-machine.h +++ b/sysdeps/m68k/dl-machine.h @@ -313,6 +313,8 @@ elf_machine_lazy_rel (struct link_map *map, struct r_scope_elem *scope[], Elf32_Addr *const reloc_addr = (void *) (l_addr + reloc->r_offset); if (ELF32_R_TYPE (reloc->r_info) == R_68K_JMP_SLOT) *reloc_addr += l_addr; + else if (ELF32_R_TYPE (reloc->r_info) == R_68K_NONE) + return; else _dl_reloc_bad_type (map, ELF32_R_TYPE (reloc->r_info), 1); } diff --git a/sysdeps/m68k/framestate.c b/sysdeps/m68k/framestate.c new file mode 100644 index 0000000000..139597f9cb --- /dev/null +++ b/sysdeps/m68k/framestate.c @@ -0,0 +1,2 @@ + + diff --git a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c index 0d3e718626..350f2e4b4d 100644 --- a/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c +++ b/sysdeps/m68k/m680x0/fpu/w_exp10_compat.c @@ -1,3 +1,8 @@ /* m68k provides an optimized __ieee754_exp10. */ -#define NO_COMPAT_NEEDED 1 -#include +#ifdef SHARED +# define NO_COMPAT_NEEDED 1 +# include +#else +# include +# include +#endif diff --git a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c index 527d4fbed2..57f38091e6 100644 --- a/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c +++ b/sysdeps/m68k/m680x0/fpu/w_fmod_compat.c @@ -7,8 +7,9 @@ # define LIBM_SVID_COMPAT 1 # undef compat_symbol # define compat_symbol(a, b, c, d) -#endif #include -#ifdef SHARED libm_alias_double (__fmod_compat, fmod) +#else +#include +#include #endif diff --git a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c index 5043586b91..88db07f443 100644 --- a/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c +++ b/sysdeps/m68k/m680x0/fpu/w_fmodf_compat.c @@ -7,8 +7,9 @@ # define LIBM_SVID_COMPAT 1 # undef compat_symbol # define compat_symbol(a, b, c, d) -#endif -#include -#ifdef SHARED +# include libm_alias_float (__fmod_compat, fmod) +#else +#include +#include #endif diff --git a/sysdeps/m68k/unwind-pe.c b/sysdeps/m68k/unwind-pe.c new file mode 100644 index 0000000000..068bdaca29 --- /dev/null +++ b/sysdeps/m68k/unwind-pe.c @@ -0,0 +1,6 @@ +#include +#include + +#define _LIBC_DEFINITIONS +#define NO_BASE_OF_ENCODED_VALUE +#include "unwind-pe.h" diff --git a/sysdeps/mach/Makefile b/sysdeps/mach/Makefile index 7ee71af759..fb8472ebba 100644 --- a/sysdeps/mach/Makefile +++ b/sysdeps/mach/Makefile @@ -35,7 +35,7 @@ endif # because it's different in Darwin and the conditional crap is # too much trouble. This should suffice for getting the mach/Makefile # rules invoked when they need to be. -mach-before-compile := $(mach-objpfx)mach-shortcuts.h \ +mach-before-compile := $(mach-objpfx)mach-shortcuts.h $(mach-objpfx)mach/mach_interface.h \ $(patsubst %,$(mach-objpfx)mach/mach_%.h,\ port host) diff --git a/sysdeps/mach/hurd/Makefile b/sysdeps/mach/hurd/Makefile index 698729a8a6..e1cc31de1f 100644 --- a/sysdeps/mach/hurd/Makefile +++ b/sysdeps/mach/hurd/Makefile @@ -94,7 +94,7 @@ $(common-objpfx)errnos.d: $(mach-errnos-deps) echo >> $@t mv -f $@t $@ -$(hurd)/bits/errno.h: $(common-objpfx)stamp-errnos ; +$(hurd)/bits/errno-disabled.h: $(common-objpfx)stamp-errnos ; $(common-objpfx)stamp-errnos: $(hurd)/errnos.awk $(errno.texinfo) \ $(mach-errnos-deps) $(common-objpfx)errnos.d mkdir -p $(hurd-objpfx)bits @@ -228,7 +228,7 @@ sysdep_headers += nfs/nfs.h endif ifeq ($(subdir),socket) -sysdep_headers += net/ethernet.h net/if_arp.h net/if_ether.h net/route.h +sysdep_headers += net/route.h endif ifeq ($(subdir),nis) diff --git a/sysdeps/mach/hurd/bind.c b/sysdeps/mach/hurd/bind.c index c492c7c5c7..689059fa6e 100644 --- a/sysdeps/mach/hurd/bind.c +++ b/sysdeps/mach/hurd/bind.c @@ -48,7 +48,7 @@ __bind (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len) return -1; /* Create a new, unlinked node in the target directory. */ - err = __dir_mkfile (dir, O_CREAT, 0666 & ~_hurd_umask, &node); + err = __dir_mkfile (dir, O_CREAT, 0666, &node); if (! err) { @@ -76,11 +76,16 @@ __bind (int fd, __CONST_SOCKADDR_ARG addrarg, socklen_t len) err = EGRATUITOUS; if (! err) { - /* Link the node, now a socket with proper mode, into the - target directory. */ - err = __dir_link (dir, node, n, 1); - if (err == EEXIST) - err = EADDRINUSE; + /* Fix the access mode before showing the file. */ + err = __file_chmod (node, 0666 & ~_hurd_umask); + if (! err) + { + /* Link the node, now a socket with proper mode, into the + target directory. */ + err = __dir_link (dir, node, n, 1); + if (err == EEXIST) + err = EADDRINUSE; + } if (err) __mach_port_deallocate (__mach_task_self (), aport); } diff --git a/sysdeps/mach/hurd/bits/errno.h b/sysdeps/mach/hurd/bits/errno.h index 3b54f5855e..eb5943f9c2 100644 --- a/sysdeps/mach/hurd/bits/errno.h +++ b/sysdeps/mach/hurd/bits/errno.h @@ -112,7 +112,9 @@ enum __error_t_codes EILSEQ = 0x4000006a, /* Invalid or incomplete multibyte or wide character */ EBACKGROUND = 0x40000064, /* Inappropriate operation for background process */ EDIED = 0x40000065, /* Translator died */ +#if 0 ED = 0x40000066, /* ? */ +#endif EGREGIOUS = 0x40000067, /* You really blew it this time */ EIEIO = 0x40000068, /* Computer bought the farm */ EGRATUITOUS = 0x40000069, /* Gratuitous error */ @@ -310,7 +312,9 @@ enum __error_t_codes #define EILSEQ 0x4000006a #define EBACKGROUND 0x40000064 #define EDIED 0x40000065 +#if 0 #define ED 0x40000066 +#endif #define EGREGIOUS 0x40000067 #define EIEIO 0x40000068 #define EGRATUITOUS 0x40000069 diff --git a/sysdeps/mach/hurd/bits/ioctls.h b/sysdeps/mach/hurd/bits/ioctls.h index a5716f127e..5b94528352 100644 --- a/sysdeps/mach/hurd/bits/ioctls.h +++ b/sysdeps/mach/hurd/bits/ioctls.h @@ -274,11 +274,13 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 }; #define FIOSETOWN _IOW('f', 124, int) /* set owner */ #define FIOGETOWN _IOR('f', 123, int) /* get owner */ +#if 0 /* socket i/o controls */ #define SIOCSHIWAT _IOW('s', 0, int) /* set high watermark */ #define SIOCGHIWAT _IOR('s', 1, int) /* get high watermark */ #define SIOCSLOWAT _IOW('s', 2, int) /* set low watermark */ #define SIOCGLOWAT _IOR('s', 3, int) /* get low watermark */ +#endif #define SIOCATMARK _IOR('s', 7, int) /* at oob mark? */ #define SIOCSPGRP _IOW('s', 8, int) /* set process group */ #define SIOCGPGRP _IOR('s', 9, int) /* get process group */ @@ -306,12 +308,16 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 }; #define SIOCGIFMETRIC _IOWR('i',23, struct ifreq_int) /* get IF metric */ #define SIOCSIFMETRIC _IOW('i',24, struct ifreq_int) /* set IF metric */ #define SIOCDIFADDR _IOW('i',25, struct ifreq) /* delete IF addr */ +#if 0 #define SIOCAIFADDR _IOW('i',26, struct ifaliasreq) /* add/chg IF alias */ +#endif +#if 0 #define SIOCSARP _IOW('i', 30, struct arpreq) /* set arp entry */ #define OSIOCGARP _IOWR('i',31, struct arpreq) /* get arp entry */ #define SIOCGARP _IOWR('i',38, struct arpreq) /* get arp entry */ #define SIOCDARP _IOW('i', 32, struct arpreq) /* delete arp entry */ +#endif #define SIOCGIFMTU _IOWR('i', 51, struct ifreq_int)/* get IF mtu */ #define SIOCSIFMTU _IOW('i', 52, struct ifreq_int) /* set IF mtu */ @@ -333,7 +339,9 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 }; # define OTIOCGETD _IOR('t', 0, int) /* get line discipline */ # define OTIOCSETD _IOW('t', 1, int) /* set line discipline */ #endif +#if 0 #define TIOCHPCL _IO('t', 2) /* hang up on last close */ +#endif #define TIOCGETP _IOR('t', 8,struct sgttyb)/* get parameters -- gtty */ #define TIOCSETP _IOW('t', 9,struct sgttyb)/* set parameters -- stty */ #define TIOCSETN _IOW('t',10,struct sgttyb)/* as above, but no flushtty*/ @@ -386,6 +394,7 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 }; #define PENDIN 0x20000000 /* tp->t_rawq needs reread */ #define DECCTQ 0x40000000 /* only ^Q starts after ^S */ #define NOFLSH 0x80000000 /* no output flush on signal */ +#if 0 #define TIOCLBIS _IOW('t', 127, int) /* bis local mode bits */ #define TIOCLBIC _IOW('t', 126, int) /* bic local mode bits */ #define TIOCLSET _IOW('t', 125, int) /* set entire local mode word */ @@ -411,6 +420,7 @@ enum __ioctl_datum { IOC_8, IOC_16, IOC_32, IOC_64 }; #define OTTYDISC 0 #define NETLDISC 1 #define NTTYDISC 2 +#endif /* From 4.4 . */ #ifdef USE_OLD_TTY diff --git a/sysdeps/mach/hurd/bits/posix_opt.h b/sysdeps/mach/hurd/bits/posix_opt.h index f0a2cb6fd9..03d8cd64dc 100644 --- a/sysdeps/mach/hurd/bits/posix_opt.h +++ b/sysdeps/mach/hurd/bits/posix_opt.h @@ -68,8 +68,8 @@ /* X/Open thread realtime support is not supported. */ #undef _XOPEN_REALTIME_THREADS -/* XPG4.2 shared memory is not supported. */ -#undef _XOPEN_SHM +/* XPG4.2 shared memory is supported. */ +#define _XOPEN_SHM 1 /* Tell we have POSIX threads. */ #define _POSIX_THREADS 200809L diff --git a/sysdeps/mach/hurd/bits/socket.h b/sysdeps/mach/hurd/bits/socket.h index 3e72f9fa93..0abae18b23 100644 --- a/sysdeps/mach/hurd/bits/socket.h +++ b/sysdeps/mach/hurd/bits/socket.h @@ -95,8 +95,8 @@ enum __socket_type #define PF_LAT 14 /* DEC Local Area Transport protocol. */ #define PF_HYLINK 15 /* NSC Hyperchannel protocol. */ #define PF_APPLETALK 16 /* Don't use this. */ -#define PF_ROUTE 17 /* Internal Routing Protocol. */ -#define PF_LINK 18 /* Link layer interface. */ +/* #define PF_ROUTE 17 Internal Routing Protocol. */ +/* #define PF_LINK 18 Link layer interface. */ #define PF_XTP 19 /* eXpress Transfer Protocol (no AF). */ #define PF_COIP 20 /* Connection-oriented IP, aka ST II. */ #define PF_CNT 21 /* Computer Network Technology. */ @@ -128,8 +128,8 @@ enum __socket_type #define AF_LAT PF_LAT #define AF_HYLINK PF_HYLINK #define AF_APPLETALK PF_APPLETALK -#define AF_ROUTE PF_ROUTE -#define AF_LINK PF_LINK +/* #define AF_ROUTE PF_ROUTE */ +/* #define AF_LINK PF_LINK */ #ifdef __USE_MISC # define pseudo_AF_XTP PF_XTP #endif @@ -153,7 +153,7 @@ enum __socket_type #include /* Structure describing a generic socket address. */ -struct sockaddr +struct __attribute_struct_may_alias__ sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ char sa_data[14]; /* Address data. */ @@ -170,7 +170,7 @@ struct sockaddr #define _SS_PADSIZE \ (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) -struct sockaddr_storage +struct __attribute_struct_may_alias__ sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ char __ss_padding[_SS_PADSIZE]; diff --git a/sysdeps/mach/hurd/configure b/sysdeps/mach/hurd/configure index 33d3e1fc0f..855fd7762a 100644 --- a/sysdeps/mach/hurd/configure +++ b/sysdeps/mach/hurd/configure @@ -45,6 +45,180 @@ if test "x$libc_cv_hurd_version" != xok; then as_fn_error $? "Hurd headers not installed or too old" "$LINENO" 5 fi + + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +printf %s "checking for grep that handles long lines and -e... " >&6; } +if test ${ac_cv_path_GREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in grep ggrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_GREP" || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +printf "%s\n" "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +printf %s "checking for egrep... " >&6; } +if test ${ac_cv_path_EGREP+y} +then : + printf %s "(cached) " >&6 +else $as_nop + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + case $as_dir in #((( + '') as_dir=./ ;; + */) ;; + *) as_dir=$as_dir/ ;; + esac + for ac_prog in egrep + do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir$ac_prog$ac_exec_ext" + as_fn_executable_p "$ac_path_EGREP" || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + printf %s 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + printf "%s\n" 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +printf "%s\n" "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for proc_getchildren_rusage in process.defs" >&5 +printf %s "checking for proc_getchildren_rusage in process.defs... " >&6; } +if test ${libc_cv_hurd_rpc_proc_getchildren_rusage+y} +then : + printf %s "(cached) " >&6 +else $as_nop + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "proc_getchildren_rusage" >/dev/null 2>&1 +then : + libc_cv_hurd_rpc_proc_getchildren_rusage=yes +else $as_nop + libc_cv_hurd_rpc_proc_getchildren_rusage=no +fi +rm -rf conftest* + +fi +{ printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_hurd_rpc_proc_getchildren_rusage" >&5 +printf "%s\n" "$libc_cv_hurd_rpc_proc_getchildren_rusage" >&6; } +if test $libc_cv_hurd_rpc_proc_getchildren_rusage = yes; then + printf "%s\n" "#define HAVE_HURD_PROC_GETCHILDREN_RUSAGE 1" >>confdefs.h + +fi + + if test -n "$sysheaders"; then CPPFLAGS=$OLD_CPPFLAGS fi @@ -52,3 +226,4 @@ fi # Hurd has libpthread as a separate library. pthread_in_libc=no +use_ldconfig=yes diff --git a/sysdeps/mach/hurd/configure.ac b/sysdeps/mach/hurd/configure.ac index 82d085af33..a348cde625 100644 --- a/sysdeps/mach/hurd/configure.ac +++ b/sysdeps/mach/hurd/configure.ac @@ -23,9 +23,30 @@ if test "x$libc_cv_hurd_version" != xok; then AC_MSG_ERROR(Hurd headers not installed or too old) fi +dnl +dnl hurd_RPC_CHECK(interface.defs, rpc_method, define) +dnl +dnl Check if rpc_method RPC is defined by interface.defs +dnl and define `define`. +dnl +AC_DEFUN([hurd_RPC_CHECK], [dnl +AC_CACHE_CHECK(for $2 in $1, libc_cv_hurd_rpc_$2, [dnl +AC_EGREP_HEADER($2, hurd/$1, + libc_cv_hurd_rpc_$2=yes, + libc_cv_hurd_rpc_$2=no)]) +if test $libc_cv_hurd_rpc_$2 = yes; then + AC_DEFINE([$3]) +fi +]) + +hurd_RPC_CHECK(process.defs, proc_getchildren_rusage, + HAVE_HURD_PROC_GETCHILDREN_RUSAGE) + if test -n "$sysheaders"; then CPPFLAGS=$OLD_CPPFLAGS fi # Hurd has libpthread as a separate library. pthread_in_libc=no + +use_ldconfig=yes diff --git a/sysdeps/mach/hurd/dl-sysdep.c b/sysdeps/mach/hurd/dl-sysdep.c index 43129a1e74..6e2013f51d 100644 --- a/sysdeps/mach/hurd/dl-sysdep.c +++ b/sysdeps/mach/hurd/dl-sysdep.c @@ -66,6 +66,8 @@ void *_dl_random attribute_relro = NULL; struct hurd_startup_data *_dl_hurd_data; +uintptr_t __stack_chk_guard attribute_relro; + ElfW(Addr) _dl_sysdep_start (void **start_argptr, diff --git a/sysdeps/mach/hurd/ftok.c b/sysdeps/mach/hurd/ftok.c new file mode 100644 index 0000000000..4ca1daf55c --- /dev/null +++ b/sysdeps/mach/hurd/ftok.c @@ -0,0 +1,41 @@ +/* Copyright (C) 1995, 1996, 2000, 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + Contributed by Ulrich Drepper , August 1995. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include + + +/* In the Hurd, we use the second-to-most-significant bit as flag for + private keys. We use a different order of the components so that + the biggest one---the inode number---is affected by this. */ + +key_t +ftok (const char *pathname, int proj_id) +{ + struct stat64 st; + key_t key; + + if (__stat64 (pathname, &st) < 0) + return (key_t) -1; + + key = ((st.st_dev & 0xff) | ((proj_id & 0xff) << 8) + | ((st.st_ino & 0x3fff) << 16)); + + return key; +} diff --git a/sysdeps/mach/hurd/getrusage.c b/sysdeps/mach/hurd/getrusage.c index 7be4dd1793..8151c297e1 100644 --- a/sysdeps/mach/hurd/getrusage.c +++ b/sysdeps/mach/hurd/getrusage.c @@ -75,9 +75,13 @@ __getrusage (enum __rusage_who who, struct rusage *usage) break; case RUSAGE_CHILDREN: - /* XXX Not implemented yet. However, zero out USAGE to be - consistent with the wait3 and wait4 functions. */ +#ifdef HAVE_HURD_PROC_GETCHILDREN_RUSAGE + err = __USEPORT (PROC, __proc_getchildren_rusage (port, usage)); + if (err) + return __hurd_fail (err); +#else memset (usage, 0, sizeof (struct rusage)); +#endif break; diff --git a/sysdeps/mach/hurd/htl/pt-pthread_self.c b/sysdeps/mach/hurd/htl/pt-pthread_self.c index 04fa283aab..d11d0ec676 100644 --- a/sysdeps/mach/hurd/htl/pt-pthread_self.c +++ b/sysdeps/mach/hurd/htl/pt-pthread_self.c @@ -17,6 +17,14 @@ . */ #include +#include -__thread struct __pthread *___pthread_self; +/* Initial thread structure used before libpthread is initialized, so various + * functions can already work at least basically. */ +struct __pthread __pthread_init_thread = { + .thread = 1, +}; +libc_hidden_def (__pthread_init_thread) + +__thread struct __pthread *___pthread_self = &__pthread_init_thread; libc_hidden_tls_def (___pthread_self) diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.c b/sysdeps/mach/hurd/htl/pt-sysdep.c index 270e77531e..73b13823bb 100644 --- a/sysdeps/mach/hurd/htl/pt-sysdep.c +++ b/sysdeps/mach/hurd/htl/pt-sysdep.c @@ -26,10 +26,6 @@ #include #include -/* Initial thread structure used temporarily during initialization, so various - * functions can already work at least basically. */ -static struct __pthread init_thread; - static void reset_pthread_total (void) { @@ -51,10 +47,6 @@ _init_routine (void *stack) /* Already initialized */ return; - /* Initialize early thread structure. */ - init_thread.thread = 1; - ___pthread_self = &init_thread; - /* Initialize the library. */ ___pthread_init (); @@ -107,9 +99,9 @@ _init_routine (void *stack) #endif /* Copy over the thread-specific state */ - assert (!init_thread.thread_specifics); + assert (!__pthread_init_thread.thread_specifics); memcpy (&thread->static_thread_specifics, - &init_thread.static_thread_specifics, + &__pthread_init_thread.static_thread_specifics, sizeof (thread->static_thread_specifics)); ___pthread_self = thread; diff --git a/sysdeps/mach/hurd/htl/pt-sysdep.h b/sysdeps/mach/hurd/htl/pt-sysdep.h index 09d9547a8e..8e94395be7 100644 --- a/sysdeps/mach/hurd/htl/pt-sysdep.h +++ b/sysdeps/mach/hurd/htl/pt-sysdep.h @@ -34,6 +34,8 @@ extern __thread struct __pthread *___pthread_self; libc_hidden_tls_proto (___pthread_self) +extern struct __pthread __pthread_init_thread; +libc_hidden_proto (__pthread_init_thread) #ifdef DEBUG #define _pthread_self() \ diff --git a/sysdeps/mach/hurd/i386/ld.abilist b/sysdeps/mach/hurd/i386/ld.abilist index ebba31f770..bba7078aa0 100644 --- a/sysdeps/mach/hurd/i386/ld.abilist +++ b/sysdeps/mach/hurd/i386/ld.abilist @@ -17,3 +17,4 @@ GLIBC_2.2.6 abort F GLIBC_2.3 ___tls_get_addr F GLIBC_2.3 __tls_get_addr F GLIBC_2.34 __rtld_version_placeholder F +GLIBC_2.4 __stack_chk_guard D 0x4 diff --git a/sysdeps/mach/hurd/i386/libc.abilist b/sysdeps/mach/hurd/i386/libc.abilist index 39744f633e..bb25691747 100644 --- a/sysdeps/mach/hurd/i386/libc.abilist +++ b/sysdeps/mach/hurd/i386/libc.abilist @@ -29,7 +29,17 @@ GLIBC_2.11 mkostemps64 F GLIBC_2.11 mkstemps F GLIBC_2.11 mkstemps64 F GLIBC_2.12 __pthread_self F +GLIBC_2.12 pthread_attr_getdetachstate F +GLIBC_2.12 pthread_attr_getinheritsched F +GLIBC_2.12 pthread_attr_getschedparam F +GLIBC_2.12 pthread_attr_getschedpolicy F +GLIBC_2.12 pthread_attr_setdetachstate F +GLIBC_2.12 pthread_attr_setinheritsched F +GLIBC_2.12 pthread_attr_setschedpolicy F +GLIBC_2.12 pthread_equal F +GLIBC_2.12 pthread_getschedparam F GLIBC_2.12 pthread_self F +GLIBC_2.12 pthread_setschedparam F GLIBC_2.13 __fentry__ F GLIBC_2.14 syncfs F GLIBC_2.15 __fdelt_chk F @@ -341,7 +351,6 @@ GLIBC_2.2.6 __mach_msg_destroy F GLIBC_2.2.6 __mach_port_allocate F GLIBC_2.2.6 __mach_port_deallocate F GLIBC_2.2.6 __mach_port_insert_right F -GLIBC_2.21 __mach_print F GLIBC_2.2.6 __mach_reply_port F GLIBC_2.2.6 __mach_task_self_ D 0x4 GLIBC_2.2.6 __mach_thread_self F @@ -610,7 +619,7 @@ GLIBC_2.2.6 _libc_intl_domainname D 0x5 GLIBC_2.2.6 _longjmp F GLIBC_2.2.6 _mcleanup F GLIBC_2.2.6 _mcount F -GLIBC_2.2.6 _nl_default_dirname D 0xe +GLIBC_2.2.6 _nl_default_dirname D 0x12 GLIBC_2.2.6 _nl_domain_bindings D 0x4 GLIBC_2.2.6 _nl_msg_cat_cntr D 0x4 GLIBC_2.2.6 _null_auth D 0xc @@ -1976,6 +1985,7 @@ GLIBC_2.2.6 xprt_register F GLIBC_2.2.6 xprt_unregister F GLIBC_2.21 __mach_host_self_ D 0x4 GLIBC_2.21 __pthread_get_cleanup_stack F +GLIBC_2.21 _hurd_exec_file_name F GLIBC_2.21 pthread_attr_destroy F GLIBC_2.21 pthread_attr_getdetachstate F GLIBC_2.21 pthread_attr_getinheritsched F diff --git a/sysdeps/mach/hurd/ifaddrs.c b/sysdeps/mach/hurd/ifaddrs.c new file mode 100644 index 0000000000..dfb7a304e0 --- /dev/null +++ b/sysdeps/mach/hurd/ifaddrs.c @@ -0,0 +1,310 @@ +/* getifaddrs -- get names and addresses of all network interfaces + Copyright (C) 2013-2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +/* Create a linked list of `struct ifaddrs' structures, one for each + network interface on the host machine. If successful, store the + list in *IFAP and return 0. On errors, return -1 and set `errno'. */ +int +__getifaddrs (struct ifaddrs **ifap) +{ + /* XXX: Hackish. This assumes pfinet parameter style, and that the same + pfinet is on /servers/socket/2 and /servers/socket/26. + + To be replaced by something like a netlink protocol, or fix ifreq into + using sockaddr_storage (but break existing compiled programs using it). */ + + file_t node; + char *argz = 0, *cur; + mach_msg_type_number_t argz_len = 0; + unsigned naddrs; + const char *ifa_name = NULL; + char *addr, *cidr_a; + int cidr; + + node = __file_name_lookup (_SERVERS_SOCKET "/2", 0, 0666); + + if (node == MACH_PORT_NULL) + return -1; + + __file_get_fs_options (node, &argz, &argz_len); + + __mach_port_deallocate (__mach_task_self (), node); + + /* XXX: Two hardcoded for lo */ + naddrs = 2; + + for (cur = argz; cur < argz + argz_len; cur = cur + strlen (cur) + 1) + { + if (!strncmp (cur, "--address=", 10)) + naddrs++; + else if (!strncmp (cur, "--address6=", 11)) + naddrs++; + } + + { + struct + { + struct ifaddrs ia; + struct sockaddr_storage addr, netmask, broadaddr; + char name[IF_NAMESIZE]; + } *storage; + int i; + struct sockaddr_in *sin; + struct sockaddr_in6 *sin6; + + storage = malloc (naddrs * sizeof storage[0]); + if (storage == NULL) + { + __munmap (argz, argz_len); + return -1; + } + + i = 0; + + /* XXX: Hardcoded lo interface */ + ifa_name = "lo"; + + /* 127.0.0.1/8 */ + storage[i].ia.ifa_next = &storage[i + 1].ia; + storage[i].ia.ifa_name = strncpy (storage[i].name, ifa_name, sizeof (storage[i].name)); + + storage[i].ia.ifa_addr = (struct sockaddr *) &storage[i].addr; + sin = ((struct sockaddr_in *) &storage[i].addr); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_port = 0; + sin->sin_addr.s_addr = htonl (INADDR_LOOPBACK); + + storage[i].ia.ifa_netmask = (struct sockaddr *) &storage[i].netmask; + sin = ((struct sockaddr_in *) &storage[i].netmask); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_port = 0; + sin->sin_addr.s_addr = htonl (IN_CLASSA_NET); + + storage[i].ia.ifa_broadaddr = (struct sockaddr *) &storage[i].addr; + + storage[i].ia.ifa_flags = IFF_UP | IFF_LOOPBACK | IFF_RUNNING; + + storage[i].ia.ifa_data = NULL; /* Nothing here for now. */ + + i++; + + /* ::1/128 */ + storage[i].ia.ifa_next = &storage[i + 1].ia; + storage[i].ia.ifa_name = strncpy (storage[i].name, ifa_name, sizeof (storage[i].name)); + + storage[i].ia.ifa_addr = (struct sockaddr *) &storage[i].addr; + sin6 = ((struct sockaddr_in6 *) &storage[i].addr); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_port = 0; + sin6->sin6_flowinfo = 0; + inet_pton (AF_INET6, "::1", &sin6->sin6_addr); + sin6->sin6_scope_id = 0; + + storage[i].ia.ifa_netmask = (struct sockaddr *) &storage[i].netmask; + sin6 = ((struct sockaddr_in6 *) &storage[i].netmask); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_port = 0; + sin6->sin6_flowinfo = 0; + inet_pton (AF_INET6, "ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff", &sin6->sin6_addr); + sin6->sin6_scope_id = 0; + + storage[i].ia.ifa_broadaddr = NULL; + + storage[i].ia.ifa_flags = IFF_UP | IFF_LOOPBACK | IFF_RUNNING; + + storage[i].ia.ifa_data = NULL; /* Nothing here for now. */ + + for (cur = argz; cur < argz + argz_len; cur = cur + strlen (cur) + 1) + { + if (!strncmp (cur, "--interface=", 12)) + { + ifa_name = cur + 12; + continue; + } + + else if (!strncmp (cur, "--address=", 10)) + { + i++; + /* IPv4 address */ + addr = cur + 10; + + storage[i].ia.ifa_next = &storage[i + 1].ia; + storage[i].ia.ifa_name = strncpy (storage[i].name, ifa_name, sizeof (storage[i].name)); + + storage[i].ia.ifa_addr = (struct sockaddr *) &storage[i].addr; + sin = ((struct sockaddr_in *) &storage[i].addr); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_port = 0; + inet_pton (AF_INET, addr, &sin->sin_addr); + + storage[i].ia.ifa_netmask = NULL; + storage[i].ia.ifa_broadaddr = NULL; + + storage[i].ia.ifa_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING | IFF_MULTICAST; + storage[i].ia.ifa_data = NULL; /* Nothing here for now. */ + } + + else if (!strncmp (cur, "--netmask=", 10)) + { + /* IPv4 netmask */ + addr = cur + 10; + + storage[i].ia.ifa_netmask = (struct sockaddr *) &storage[i].netmask; + sin = ((struct sockaddr_in *) &storage[i].netmask); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_port = 0; + inet_pton (AF_INET, addr, &sin->sin_addr); + + storage[i].ia.ifa_broadaddr = (struct sockaddr *) &storage[i].broadaddr; + sin = ((struct sockaddr_in *) &storage[i].broadaddr); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_port = 0; + sin->sin_addr.s_addr = + ((struct sockaddr_in *) &storage[i].addr)->sin_addr.s_addr + | ~(((struct sockaddr_in *) &storage[i].netmask)->sin_addr.s_addr); + } + + else if (!strncmp (cur, "--peer=", 7)) + { + /* IPv4 peer */ + addr = cur + 7; + + storage[i].ia.ifa_dstaddr = (struct sockaddr *) &storage[i].broadaddr; + sin = ((struct sockaddr_in *) &storage[i].broadaddr); + sin->sin_family = AF_INET; + sin->sin_len = sizeof(*sin); + sin->sin_port = 0; + inet_pton (AF_INET, addr, &sin->sin_addr); + + storage[i].ia.ifa_flags &= ~IFF_BROADCAST; + storage[i].ia.ifa_flags |= IFF_POINTOPOINT; + } + + else if (!strncmp (cur, "--address6=", 11)) + { + i++; + /* IPv6 address */ + addr = cur + 11; + cidr_a = strchr (addr, '/'); + if (!cidr_a) + { + /* No CIDR length?! Assume 64. */ + addr = __strdup (addr); + cidr = 64; + } + else + { + addr = __strndup (addr, cidr_a - addr); + cidr = atoi (cidr_a + 1); + } + + storage[i].ia.ifa_next = &storage[i + 1].ia; + storage[i].ia.ifa_name = strncpy (storage[i].name, ifa_name, sizeof (storage[i].name)); + + storage[i].ia.ifa_addr = (struct sockaddr *) &storage[i].addr; + sin6 = ((struct sockaddr_in6 *) &storage[i].addr); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_port = 0; + sin6->sin6_flowinfo = 0; + inet_pton (AF_INET6, addr, &sin6->sin6_addr); + sin6->sin6_scope_id = 0; + + storage[i].ia.ifa_netmask = (struct sockaddr *) &storage[i].netmask; + sin6 = ((struct sockaddr_in6 *) &storage[i].netmask); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_port = 0; + sin6->sin6_flowinfo = 0; + sin6->sin6_addr.s6_addr32[0] = htonl (cidr >= 32 ? 0xffffffffUL : cidr <= 0 ? 0 : ~((1UL << ( 32 - cidr)) - 1)); + sin6->sin6_addr.s6_addr32[1] = htonl (cidr >= 64 ? 0xffffffffUL : cidr <= 32 ? 0 : ~((1UL << ( 64 - cidr)) - 1)); + sin6->sin6_addr.s6_addr32[2] = htonl (cidr >= 96 ? 0xffffffffUL : cidr <= 64 ? 0 : ~((1UL << ( 96 - cidr)) - 1)); + sin6->sin6_addr.s6_addr32[3] = htonl (cidr >= 128 ? 0xffffffffUL : cidr <= 96 ? 0 : ~((1UL << (128 - cidr)) - 1)); + sin6->sin6_scope_id = 0; + + storage[i].ia.ifa_broadaddr = NULL; + storage[i].ia.ifa_flags = IFF_UP | IFF_BROADCAST | IFF_RUNNING | IFF_MULTICAST; + storage[i].ia.ifa_data = NULL; /* Nothing here for now. */ + free (addr); + } + + else if (!strncmp (cur, "--peer6=", 8)) + { + /* IPv6 peer */ + addr = cur + 8; + + storage[i].ia.ifa_dstaddr = (struct sockaddr *) &storage[i].broadaddr; + sin6 = ((struct sockaddr_in6 *) &storage[i].broadaddr); + sin6->sin6_family = AF_INET6; + sin6->sin6_len = sizeof(*sin6); + sin6->sin6_port = 0; + sin6->sin6_flowinfo = 0; + inet_pton (AF_INET6, addr, &sin6->sin6_addr); + sin6->sin6_scope_id = 0; + + storage[i].ia.ifa_flags &= ~IFF_BROADCAST; + storage[i].ia.ifa_flags |= IFF_POINTOPOINT; + } + } + + storage[i].ia.ifa_next = NULL; + + *ifap = &storage[0].ia; + } + + __munmap (argz, argz_len); + + return 0; +} +weak_alias (__getifaddrs, getifaddrs) +libc_hidden_def (__getifaddrs) +#ifndef getifaddrs +libc_hidden_weak (getifaddrs) +#endif + +void +__freeifaddrs (struct ifaddrs *ifa) +{ + free (ifa); +} +weak_alias (__freeifaddrs, freeifaddrs) +libc_hidden_def (__freeifaddrs) +libc_hidden_weak (freeifaddrs) diff --git a/sysdeps/mach/hurd/jmp-unwind.c b/sysdeps/mach/hurd/jmp-unwind.c index 35b496114a..f500741530 100644 --- a/sysdeps/mach/hurd/jmp-unwind.c +++ b/sysdeps/mach/hurd/jmp-unwind.c @@ -47,9 +47,8 @@ _longjmp_unwind (jmp_buf env, int val) /* All access to SS->active_resources must take place inside a critical section where signal handlers cannot run. */ - __spin_lock (&ss->lock); - assert (! __spin_lock_locked (&ss->critical_section_lock)); __spin_lock (&ss->critical_section_lock); + __spin_lock (&ss->lock); /* Remove local signal preemptors being unwound past. */ while (ss->preemptors diff --git a/sysdeps/mach/hurd/lsetxattr.c b/sysdeps/mach/hurd/lsetxattr.c index 3f5d335a1a..49487f78fb 100644 --- a/sysdeps/mach/hurd/lsetxattr.c +++ b/sysdeps/mach/hurd/lsetxattr.c @@ -32,5 +32,5 @@ lsetxattr (const char *path, const char *name, const void *value, size_t size, return -1; err = _hurd_xattr_set (port, name, value, size, flags); __mach_port_deallocate (__mach_task_self (), port); - return err ? __hurd_fail (err) : size; + return __hurd_fail (err); } diff --git a/sysdeps/mach/hurd/net/ethernet.h b/sysdeps/mach/hurd/net/ethernet.h deleted file mode 100644 index c630e7cf87..0000000000 --- a/sysdeps/mach/hurd/net/ethernet.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Copyright (C) 1997-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Based on the FreeBSD version of this file. Curiously, that file - lacks a copyright in the header. */ - -#ifndef __NET_ETHERNET_H -#define __NET_ETHERNET_H 1 - -#include -#include -#include -#include /* IEEE 802.3 Ethernet constants */ - -__BEGIN_DECLS - -/* This is a name for the 48 bit ethernet address available on many - systems. */ -struct ether_addr -{ - uint8_t ether_addr_octet[ETH_ALEN]; -}; - -/* 10Mb/s ethernet header */ -struct ether_header -{ - uint8_t ether_dhost[ETH_ALEN]; /* destination eth addr */ - uint8_t ether_shost[ETH_ALEN]; /* source ether addr */ - uint16_t ether_type; /* packet type ID field */ -}; - -/* Ethernet protocol ID's */ -#define ETHERTYPE_PUP 0x0200 /* Xerox PUP */ -#define ETHERTYPE_IP 0x0800 /* IP */ -#define ETHERTYPE_ARP 0x0806 /* Address resolution */ -#define ETHERTYPE_REVARP 0x8035 /* Reverse ARP */ - -#define ETHER_ADDR_LEN ETH_ALEN /* size of ethernet addr */ -#define ETHER_TYPE_LEN 2 /* bytes in type field */ -#define ETHER_CRC_LEN 4 /* bytes in CRC field */ -#define ETHER_HDR_LEN ETH_HLEN /* total octets in header */ -#define ETHER_MIN_LEN (ETH_ZLEN + ETH_CRC_LEN) /* min packet length */ -#define ETHER_MAX_LEN (ETH_FRAME_LEN + ETH_CRC_LEN) /* max packet length */ - -/* make sure ethernet length is valid */ -#define ETHER_IS_VALID_LEN(foo) \ - ((foo) >= ETHER_MIN_LEN && (foo) <= ETHER_MAX_LEN) - -/* - * The ETHERTYPE_NTRAILER packet types starting at ETHERTYPE_TRAIL have - * (type-ETHERTYPE_TRAIL)*512 bytes of data followed - * by an ETHER type (as given above) and then the (variable-length) header. - */ -#define ETHERTYPE_TRAIL 0x1000 /* Trailer packet */ -#define ETHERTYPE_NTRAILER 16 - -#define ETHERMTU ETH_DATA_LEN -#define ETHERMIN (ETHER_MIN_LEN-ETHER_HDR_LEN-ETHER_CRC_LEN) - -__END_DECLS - -#endif /* net/ethernet.h */ diff --git a/sysdeps/mach/hurd/net/if_arp.h b/sysdeps/mach/hurd/net/if_arp.h deleted file mode 100644 index f5da712379..0000000000 --- a/sysdeps/mach/hurd/net/if_arp.h +++ /dev/null @@ -1,144 +0,0 @@ -/* Definitions for Address Resolution Protocol. - Copyright (C) 1997-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Based on the 4.4BSD and Linux version of this file. */ - -#ifndef _NET_IF_ARP_H - -#define _NET_IF_ARP_H 1 -#include - -#include -#include -#include - -__BEGIN_DECLS - -/* Some internals from deep down in the kernel. */ -#define MAX_ADDR_LEN 7 - - -/* This structure defines an ethernet arp header. */ - -/* ARP protocol opcodes. */ -#define ARPOP_REQUEST 1 /* ARP request. */ -#define ARPOP_REPLY 2 /* ARP reply. */ -#define ARPOP_RREQUEST 3 /* RARP request. */ -#define ARPOP_RREPLY 4 /* RARP reply. */ - -/* See RFC 826 for protocol description. ARP packets are variable - in size; the arphdr structure defines the fixed-length portion. - Protocol type values are the same as those for 10 Mb/s Ethernet. - It is followed by the variable-sized fields ar_sha, arp_spa, - arp_tha and arp_tpa in that order, according to the lengths - specified. Field names used correspond to RFC 826. */ - -struct arphdr - { - unsigned short int ar_hrd; /* Format of hardware address. */ - unsigned short int ar_pro; /* Format of protocol address. */ - unsigned char ar_hln; /* Length of hardware address. */ - unsigned char ar_pln; /* Length of protocol address. */ - unsigned short int ar_op; /* ARP opcode (command). */ -#if 0 - /* Ethernet looks like this : This bit is variable sized - however... */ - unsigned char __ar_sha[ETH_ALEN]; /* Sender hardware address. */ - unsigned char __ar_sip[4]; /* Sender IP address. */ - unsigned char __ar_tha[ETH_ALEN]; /* Target hardware address. */ - unsigned char __ar_tip[4]; /* Target IP address. */ -#endif - }; - - -/* ARP protocol HARDWARE identifiers. */ -#define ARPHRD_NETROM 0 /* From KA9Q: NET/ROM pseudo. */ -#define ARPHRD_ETHER 1 /* Ethernet 10Mbps. */ -#define ARPHRD_EETHER 2 /* Experimental Ethernet. */ -#define ARPHRD_AX25 3 /* AX.25 Level 2. */ -#define ARPHRD_PRONET 4 /* PROnet token ring. */ -#define ARPHRD_CHAOS 5 /* Chaosnet. */ -#define ARPHRD_IEEE802 6 /* IEEE 802.2 Ethernet/TR/TB. */ -#define ARPHRD_ARCNET 7 /* ARCnet. */ -#define ARPHRD_APPLETLK 8 /* APPLEtalk. */ -#define ARPHRD_DLCI 15 /* Frame Relay DLCI. */ -#define ARPHRD_METRICOM 23 /* Metricom STRIP (new IANA id). */ - -/* Dummy types for non ARP hardware */ -#define ARPHRD_SLIP 256 -#define ARPHRD_CSLIP 257 -#define ARPHRD_SLIP6 258 -#define ARPHRD_CSLIP6 259 -#define ARPHRD_RSRVD 260 /* Notional KISS type. */ -#define ARPHRD_ADAPT 264 -#define ARPHRD_ROSE 270 -#define ARPHRD_X25 271 /* CCITT X.25. */ -#define ARPHRD_PPP 512 -#define ARPHRD_HDLC 513 /* (Cisco) HDLC. */ -#define ARPHRD_LAPB 516 /* LAPB. */ - -#define ARPHRD_TUNNEL 768 /* IPIP tunnel. */ -#define ARPHRD_TUNNEL6 769 /* IPIP6 tunnel. */ -#define ARPHRD_FRAD 770 /* Frame Relay Access Device. */ -#define ARPHRD_SKIP 771 /* SKIP vif. */ -#define ARPHRD_LOOPBACK 772 /* Loopback device. */ -#define ARPHRD_LOCALTLK 773 /* Localtalk device. */ -#define ARPHRD_FDDI 774 /* Fiber Distributed Data Interface. */ -#define ARPHRD_BIF 775 /* AP1000 BIF. */ -#define ARPHRD_SIT 776 /* sit0 device - IPv6-in-IPv4. */ - - -/* ARP ioctl request. */ -struct arpreq - { - struct sockaddr arp_pa; /* Protocol address. */ - struct sockaddr arp_ha; /* Hardware address. */ - int arp_flags; /* Flags. */ - struct sockaddr arp_netmask; /* Netmask (only for proxy arps). */ - char arp_dev[16]; - }; - -/* ARP Flag values. */ -#define ATF_COM 0x02 /* Completed entry (ha valid). */ -#define ATF_PERM 0x04 /* Permanent entry. */ -#define ATF_PUBL 0x08 /* Publish entry. */ -#define ATF_USETRAILERS 0x10 /* Has requested trailers. */ -#define ATF_NETMASK 0x20 /* Want to use a netmask (only - for proxy entries). */ -#define ATF_DONTPUB 0x40 /* Don't answer this addresses. */ -#define ATF_MAGIC 0x80 /* Automatically added entry. */ - - -/* Support for the user space arp daemon, arpd. */ -#define ARPD_UPDATE 0x01 -#define ARPD_LOOKUP 0x02 -#define ARPD_FLUSH 0x03 - -struct arpd_request - { - unsigned short int req; /* Request type. */ - uint32_t ip; /* IP address of entry. */ - unsigned long int dev; /* Device entry is tied to. */ - unsigned long int stamp; - unsigned long int updated; - unsigned char ha[MAX_ADDR_LEN]; /* Hardware address. */ - }; - -__END_DECLS - -#endif /* net/if_arp.h */ diff --git a/sysdeps/mach/hurd/recvmsg.c b/sysdeps/mach/hurd/recvmsg.c index 3e875f864a..96346689c1 100644 --- a/sysdeps/mach/hurd/recvmsg.c +++ b/sysdeps/mach/hurd/recvmsg.c @@ -24,6 +24,123 @@ #include #include +static unsigned +contains_uid (unsigned int n, __uid_t uids[n], __uid_t uid) +{ + unsigned i; + + for (i = 0; i < n; i++) + if (uids[i] == uid) + return 1; + return 0; +} + +static unsigned +contains_gid (unsigned int n, __gid_t gids[n], __gid_t gid) +{ + unsigned i; + + for (i = 0; i < n; i++) + if (gids[i] == gid) + return 1; + return 0; +} + +/* Check the passed credentials. */ +static error_t +check_auth (mach_port_t rendezvous, + __pid_t pid, + __uid_t uid, __uid_t euid, + __gid_t gid, + int ngroups, __gid_t groups[ngroups]) +{ + error_t err; + mach_msg_type_number_t neuids = CMGROUP_MAX, nauids = CMGROUP_MAX; + mach_msg_type_number_t negids = CMGROUP_MAX, nagids = CMGROUP_MAX; + __uid_t euids_buf[neuids], auids_buf[nauids]; + __gid_t egids_buf[negids], agids_buf[nagids]; + __uid_t *euids = euids_buf, *auids = auids_buf; + __gid_t *egids = egids_buf, *agids = agids_buf; + + struct procinfo *pi = NULL; + mach_msg_type_number_t pi_size = 0; + int flags = PI_FETCH_TASKINFO; + char *tw = NULL; + mach_msg_type_number_t tw_size = 0; + unsigned i; + + err = __mach_port_mod_refs (mach_task_self (), rendezvous, + MACH_PORT_RIGHT_SEND, 1); + if (err) + goto out; + + do + err = __USEPORT + (AUTH, __auth_server_authenticate (port, + rendezvous, MACH_MSG_TYPE_COPY_SEND, + MACH_PORT_NULL, 0, + &euids, &neuids, &auids, &nauids, + &egids, &negids, &agids, &nagids)); + while (err == EINTR); + if (err) + goto out; + + /* Check whether this process indeed has these IDs */ + if ( !contains_uid (neuids, euids, uid) + && !contains_uid (nauids, auids, uid) + || !contains_uid (neuids, euids, euid) + && !contains_uid (nauids, auids, euid) + || !contains_gid (negids, egids, gid) + && !contains_gid (nagids, agids, gid) + ) + { + err = EIO; + goto out; + } + + /* Check groups */ + for (i = 0; i < ngroups; i++) + if ( !contains_gid (negids, egids, groups[i]) + && !contains_gid (nagids, agids, groups[i])) + { + err = EIO; + goto out; + } + + /* Check PID */ + /* XXX: Using proc_getprocinfo until + proc_user_authenticate proc_server_authenticate is implemented + */ + /* Get procinfo to check the owner. Maybe he faked the pid, but at least we + check the owner. */ + err = __USEPORT (PROC, __proc_getprocinfo (port, pid, &flags, + (procinfo_t *)&pi, + &pi_size, &tw, &tw_size)); + if (err) + goto out; + + if ( !contains_uid (neuids, euids, pi->owner) + && !contains_uid (nauids, auids, pi->owner)) + err = EIO; + +out: + __mach_port_deallocate (__mach_task_self (), rendezvous); + if (euids != euids_buf) + __vm_deallocate (__mach_task_self(), (vm_address_t) euids, neuids * sizeof(uid_t)); + if (auids != auids_buf) + __vm_deallocate (__mach_task_self(), (vm_address_t) auids, nauids * sizeof(uid_t)); + if (egids != egids_buf) + __vm_deallocate (__mach_task_self(), (vm_address_t) egids, negids * sizeof(uid_t)); + if (agids != agids_buf) + __vm_deallocate (__mach_task_self(), (vm_address_t) agids, nagids * sizeof(uid_t)); + if (tw_size) + __vm_deallocate (__mach_task_self(), (vm_address_t) tw, tw_size); + if (pi_size) + __vm_deallocate (__mach_task_self(), (vm_address_t) pi, pi_size); + + return err; +} + /* Receive a message as described by MESSAGE from socket FD. Returns the number of bytes read or -1 for errors. */ ssize_t @@ -216,6 +333,21 @@ __libc_recvmsg (int fd, struct msghdr *message, int flags) newfds++; } } + else if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDS) + { + /* SCM_CREDS support. */ + /* Check received credentials */ + struct cmsgcred *ucredp = (struct cmsgcred *) CMSG_DATA(cmsg); + + err = check_auth (ports[i], + ucredp->cmcred_pid, + ucredp->cmcred_uid, ucredp->cmcred_euid, + ucredp->cmcred_gid, + ucredp->cmcred_ngroups, ucredp->cmcred_groups); + if (err) + goto cleanup; + i++; + } } for (i = 0; i < nports; i++) @@ -246,6 +378,11 @@ cleanup: __mach_port_deallocate (__mach_task_self (), ports[ii]); } } + else if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDS) + { + __mach_port_deallocate (__mach_task_self (), ports[ii]); + ii++; + } } } diff --git a/sysdeps/mach/hurd/sendmsg.c b/sysdeps/mach/hurd/sendmsg.c index 434815ed7c..3eaaa3d2d1 100644 --- a/sysdeps/mach/hurd/sendmsg.c +++ b/sysdeps/mach/hurd/sendmsg.c @@ -19,11 +19,13 @@ #include #include #include +#include #include #include #include #include +#include #include #include "hurd/hurdsocket.h" @@ -110,6 +112,8 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags) if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_RIGHTS) nports += (cmsg->cmsg_len - CMSG_ALIGN (sizeof (struct cmsghdr))) / sizeof (int); + else if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDS) + nports++; if (nports) ports = __alloca (nports * sizeof (mach_port_t)); @@ -144,6 +148,38 @@ __libc_sendmsg (int fd, const struct msghdr *message, int flags) goto out; } } + else if (cmsg->cmsg_level == SOL_SOCKET && cmsg->cmsg_type == SCM_CREDS) + { + /* SCM_CREDS support: send credentials. */ + mach_port_t rendezvous = __mach_reply_port (), reply; + struct cmsgcred *ucredp; + + err = __mach_port_insert_right (mach_task_self (), rendezvous, + rendezvous, MACH_MSG_TYPE_MAKE_SEND); + ports[nports++] = rendezvous; + if (err) + goto out; + + ucredp = (struct cmsgcred *) CMSG_DATA(cmsg); + /* Fill in credentials data */ + ucredp->cmcred_pid = __getpid(); + ucredp->cmcred_uid = __getuid(); + ucredp->cmcred_euid = __geteuid(); + ucredp->cmcred_gid = __getgid(); + ucredp->cmcred_ngroups = + __getgroups (sizeof (ucredp->cmcred_groups) / sizeof (gid_t), + ucredp->cmcred_groups); + + /* And make auth server authenticate us. */ + reply = __mach_reply_port(); + err = __USEPORT + (AUTH, __auth_user_authenticate_request (port, + reply, MACH_MSG_TYPE_MAKE_SEND_ONCE, + rendezvous, MACH_MSG_TYPE_MAKE_SEND)); + __mach_port_deallocate (__mach_task_self (), reply); + if (err) + goto out; + } } if (addr) diff --git a/sysdeps/mach/hurd/shmat.c b/sysdeps/mach/hurd/shmat.c new file mode 100644 index 0000000000..d6e310e66d --- /dev/null +++ b/sysdeps/mach/hurd/shmat.c @@ -0,0 +1,82 @@ +/* SysV shmat for Hurd. + Copyright (C) 2005-2015 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sysvshm.h" + +/* Attach the shared memory segment associated with SHMID to the data + segment of the calling process. SHMADDR and SHMFLG determine how + and where the segment is attached. */ +void * +__shmat (int shmid, const void *shmaddr, int shmflg) +{ + error_t err; + char filename[sizeof (SHM_DIR) - 1 + SHM_NAMEMAX]; + int fd; + void *addr; + struct stat statbuf; + int res; + + sprintf (filename, SHM_DIR SHM_NAMEPRI, shmid); + fd = __open (filename, (shmflg & SHM_RDONLY) ? O_RDONLY : O_RDWR); + if (fd < 0) + { + if (errno == ENOENT) + errno = EINVAL; + return (void *) -1; + } + + res = __fstat (fd, &statbuf); + if (res < 0) + { + err = errno; + __close (fd); + errno = err; + return (void *) -1; + } + + addr = __mmap ((void *) shmaddr, statbuf.st_size, + PROT_READ | ((shmflg & SHM_RDONLY) ? 0 : PROT_WRITE), + MAP_SHARED, fd, 0); + __close (fd); + if (addr == MAP_FAILED) + return (void *) -1; + + err = __sysvshm_add (addr, statbuf.st_size); + if (err) + { + __munmap (addr, statbuf.st_size); + errno = err; + return (void *) -1; + } + + return addr; +} + +weak_alias(__shmat, shmat) diff --git a/sysdeps/mach/hurd/shmctl.c b/sysdeps/mach/hurd/shmctl.c new file mode 100644 index 0000000000..d5e6bbea45 --- /dev/null +++ b/sysdeps/mach/hurd/shmctl.c @@ -0,0 +1,132 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sysvshm.h" + +/* Provide operations to control over shared memory segments. */ +int +__shmctl (int id, int cmd, struct shmid_ds *buf) +{ + error_t err = 0; + int fd; + int res; + char filename[sizeof (SHM_DIR) - 1 + SHM_NAMEMAX]; + struct stat statbuf; + + sprintf (filename, SHM_DIR SHM_NAMEPRI, id); + /* SysV requires read access for IPC_STAT. */ + fd = __open (filename, O_NORW); + if (fd < 0) + { + if (errno == ENOENT) + errno = EINVAL; + return -1; + } + + res = __fstat (fd, &statbuf); + if (res < 0) + { + err = errno; + __close (fd); + errno = err; + return -1; + } + + switch (cmd) + { + case IPC_STAT: + + buf->shm_perm.__key = id; + buf->shm_perm.uid = statbuf.st_uid; + buf->shm_perm.gid = statbuf.st_gid; + + /* We do not support the creator. */ + buf->shm_perm.cuid = statbuf.st_uid; + buf->shm_perm.cgid = statbuf.st_gid; + + /* We just want the protection bits. */ + buf->shm_perm.mode = statbuf.st_mode & 0777; + /* Hopeless. We do not support a sequence number. */ + buf->shm_perm.__seq = statbuf.st_ino; + buf->shm_segsz = statbuf.st_size; + + /* Hopeless. We do not support any of these. */ + buf->shm_atime = statbuf.st_atime; + buf->shm_dtime = statbuf.st_mtime; + /* Well, this comes at least close. */ + buf->shm_ctime = statbuf.st_ctime; + + /* We do not support the PID. */ + buf->shm_cpid = 0; + buf->shm_lpid = 0; + + if (statbuf.st_mode & S_IMMAP0) + buf->shm_nattch = 0; + else + /* 42 is the answer. Of course this is bogus, but for most + applications, this should be fine. */ + buf->shm_nattch = 42; + + break; + + case IPC_SET: + if (statbuf.st_uid != buf->shm_perm.uid + || statbuf.st_gid != buf->shm_perm.gid) + { + res = __fchown (fd, + (statbuf.st_uid != buf->shm_perm.uid) + ? buf->shm_perm.uid : -1, + (statbuf.st_gid != buf->shm_perm.gid) + ? buf->shm_perm.gid : -1); + if (res < 0) + err = errno; + } + + if (!err && statbuf.st_mode & 0777 != buf->shm_perm.mode & 0777) + { + res = __fchmod (fd, (statbuf.st_mode & ~0777) + | (buf->shm_perm.mode & 0777)); + if (res < 0) + err = errno; + } + break; + + case IPC_RMID: + res = __unlink (filename); + /* FIXME: Check error (mapping ENOENT to EINVAL). */ + break; + + default: + err = EINVAL; + } + + __close (fd); + errno = err; + return err ? -1 : 0; +} + +weak_alias(__shmctl, shmctl) diff --git a/sysdeps/mach/hurd/shmdt.c b/sysdeps/mach/hurd/shmdt.c new file mode 100644 index 0000000000..cdafef0200 --- /dev/null +++ b/sysdeps/mach/hurd/shmdt.c @@ -0,0 +1,51 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "sysvshm.h" + +/* Detach shared memory segment starting at address specified by + SHMADDR from the caller's data segment. */ +int +__shmdt (const void *shmaddr) +{ + error_t err; + size_t size; + + err = __sysvshm_remove ((void *) shmaddr, &size); + if (err) + { + errno = err; + return -1; + } + + __munmap ((void *) shmaddr, size); + return 0; +} + +weak_alias(__shmdt, shmdt) diff --git a/sysdeps/mach/hurd/shmget.c b/sysdeps/mach/hurd/shmget.c new file mode 100644 index 0000000000..79646e5fee --- /dev/null +++ b/sysdeps/mach/hurd/shmget.c @@ -0,0 +1,242 @@ +/* Copyright (C) 2005 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, write to the Free + Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include "sysvshm.h" + +/* Create a new shared memory segment file without linking it into the + filesystem. Return the directory and file ports in R_DIR and R_FILE. */ +static error_t +create_shm_file (size_t size, int flags, file_t *r_dir, file_t *r_file) +{ + error_t err; + file_t dir; + file_t file; + + flags &= 0777; + + /* Get a port to the directory that will contain the file. */ + dir = __file_name_lookup (SHM_DIR, 0, 0); + if (dir == MACH_PORT_NULL) + return errno; + + /* Create an unnamed file in the directory. */ + err = __dir_mkfile (dir, O_RDWR, flags, &file); + if (err) + { + __mach_port_deallocate (__mach_task_self (), dir); + return err; + } + + err = __file_set_size (file, size); + if (err) + { + __mach_port_deallocate (__mach_task_self (), file); + __mach_port_deallocate (__mach_task_self (), dir); + + return err; + } + + *r_dir = dir; + *r_file = file; + + return 0; +} + + +/* Open the shared memory segment *R_KEY and return a file descriptor + to it in R_FD. If KEY is IPC_PRIVATE, use a private key and return + it in R_KEY. */ +static error_t +get_exclusive (int shmflags, size_t size, key_t *r_key, int *r_fd) +{ + error_t err; + file_t dir; + file_t file; + char filename[SHM_NAMEMAX]; + key_t key = *r_key; + bool is_private; + + /* Create the shared memory segment. */ + err = create_shm_file (size, shmflags, &dir, &file); + if (err) + return err; + + if (key == IPC_PRIVATE) + { + is_private = true; + key = SHM_PRIV_KEY_START; + + /* Try to link the shared memory segment into the filesystem + (exclusively). Private segments have negative keys. */ + do + { + sprintf (filename, SHM_NAMEPRI, key); + err = __dir_link (dir, file, filename, 1); + if (!err) + { + /* We are done. */ + *r_key = key; + break; + } + else if (err == EEXIST) + { + /* Check if we ran out of keys. If not, try again with new + key. */ + if (key == SHM_PRIV_KEY_END) + err = ENOSPC; + else + err = 0; + + key--; + } + } + while (!err); + } + else + { + /* Try to link the shared memory segment into the filesystem + (exclusively) under the given key. */ + sprintf (filename, SHM_NAMEPRI, key); + err = __dir_link (dir, file, filename, 1); + } + + __mach_port_deallocate (__mach_task_self (), dir); + + if (!err) + { + int fd; + + /* Get a file descriptor for that port. */ + fd = _hurd_intern_fd (file, O_RDWR, 1); /* dealloc on error */ + if (fd < 0) + err = errno; + else + *r_fd = fd; + } + + return err; +} + + +/* Open the shared memory segment KEY (creating it if it doesn't yet + exist) and return a file descriptor to it in R_FD. */ +static error_t +get_shared (int shmflags, size_t size, key_t key, int *r_fd) +{ + error_t err = 0; + char filename[sizeof (SHM_DIR) - 1 + SHM_NAMEMAX]; + int fd = -1; + sprintf (filename, SHM_DIR SHM_NAMEPRI, key); + + do + { + fd = __open (filename, O_NORW, shmflags & 0777); + + if (fd < 0 && errno != ENOENT) + /* We give up. */ + return errno; + else if (fd >= 0) + { + int res; + struct stat statbuf; + + /* Check the size (we only need to do this if we did not + create the shared memory segment file ourselves). */ + res = __fstat (fd, &statbuf); + if (res < 0) + { + err = errno; + __close (fd); + return err; + } + + if (statbuf.st_size < size) + { + __close (fd); + return EINVAL; + } + } + else + { + /* The memory segment doesn't exist. */ + if (shmflags & IPC_CREAT) + { + /* Try to create it exclusively. */ + err = get_exclusive (shmflags, size, &key, &fd); + if (err == EEXIST) + /* If somebody created it in the meanwhile, just try again. */ + err = 0; + } + else + err = ENOENT; + } + } + while (fd < 0 && !err); + + if (!err) + *r_fd = fd; + else + *r_fd = -1; + + return err; +} + +/* Return an identifier for an shared memory segment of at least size + SIZE which is associated with KEY. */ +int +__shmget (key_t key, size_t size, int shmflags) +{ + error_t err; + int fd; + + if (key == IPC_PRIVATE || shmflags & IPC_EXCL) + /* An exclusive shared memory segment must be created. */ + err = get_exclusive (shmflags, size, &key, &fd); + else + err = get_shared (shmflags, size, key, &fd); + + if (err) + { + errno = err; + return -1; + } + + /* From here, we can't fail. That's important, as otherwise we + would need to unlink the file if we created it (in that case, the + code above would have to be changed to pass a "created" flag down + to the caller). */ + + __close (fd); + + return key; +} + +weak_alias(__shmget, shmget) diff --git a/sysdeps/mach/hurd/spawni.c b/sysdeps/mach/hurd/spawni.c index a0d2e28c8e..739f905c68 100644 --- a/sysdeps/mach/hurd/spawni.c +++ b/sysdeps/mach/hurd/spawni.c @@ -30,6 +30,7 @@ #include #include #include +#include #include #include #include "spawn_int.h" @@ -333,7 +334,6 @@ __spawni (pid_t *pid, const char *file, ss = _hurd_self_sigstate (); retry: - assert (! __spin_lock_locked (&ss->critical_section_lock)); __spin_lock (&ss->critical_section_lock); _hurd_sigstate_lock (ss); @@ -679,11 +679,29 @@ retry: ref, MACH_MSG_TYPE_MAKE_SEND, &newproc); __mach_port_destroy (__mach_task_self (), ref); - if (!err) - { - __mach_port_deallocate (__mach_task_self (), proc); - proc = newproc; - } + if (err) + goto out; + if (newproc == MACH_PORT_NULL) + { + /* Old versions of the proc server did not recreate the process + port when reauthenticating, and passed MACH_PORT_NULL through + the auth server. That must be what we're dealing with. Just + keep the existing proc port in this case. */ + } + else + { + err = __proc_reauthenticate_complete (newproc); + if (err) + { + __mach_port_deallocate (__mach_task_self (), newproc); + goto out; + } + else + { + __mach_port_deallocate (__mach_task_self (), proc); + proc = newproc; + } + } if (!err) err = reauthenticate (INIT_PORT_CRDIR, &rcrdir); @@ -833,6 +851,18 @@ retry: ints, INIT_INT_MAX, NULL, 0, NULL, 0); + /* Fallback for backwards compatibility. This can just be removed + when __file_exec goes away. */ + if (err == MIG_BAD_ID) + err = __file_exec_file_name + (file, task, + __sigismember (&_hurdsig_traced, SIGKILL) ? EXEC_SIGTRAP : 0, + relpath, args, argslen, env, envlen, + dtable, MACH_MSG_TYPE_COPY_SEND, dtablesize, + ports, MACH_MSG_TYPE_COPY_SEND, _hurd_nports, + ints, INIT_INT_MAX, + NULL, 0, NULL, 0); + /* Fallback for backwards compatibility. This can just be removed when __file_exec goes away. */ if (err == MIG_BAD_ID) diff --git a/sysdeps/mach/hurd/times.c b/sysdeps/mach/hurd/times.c index dba442d3d9..54ce6f99bd 100644 --- a/sysdeps/mach/hurd/times.c +++ b/sysdeps/mach/hurd/times.c @@ -32,6 +32,13 @@ clock_from_time_value (const time_value_t *t) return t->seconds * 100 + t->microseconds / 10000; } +#ifdef HAVE_HURD_PROC_GETCHILDREN_RUSAGE +static inline clock_t +clock_from_timeval (const struct timeval *t) { + return t->tv_sec * 1000000 + t->tv_usec; +} +#endif + /* Store the CPU time used by this process and all its dead children (and their dead children) in BUFFER. Return the elapsed real time, or (clock_t) -1 for errors. @@ -62,8 +69,17 @@ __times (struct tms *tms) tms->tms_stime = (clock_from_time_value (&bi.system_time) + clock_from_time_value (&tti.system_time)); - /* XXX This can't be implemented until getrusage(RUSAGE_CHILDREN) can be. */ +#ifdef HAVE_HURD_PROC_GETCHILDREN_RUSAGE + struct rusage child_rusage; + err = __USEPORT (PROC, __proc_getchildren_rusage (port, &child_rusage)); + if (err) + return __hurd_fail (err); + + tms->tms_cutime = clock_from_timeval (&child_rusage.ru_utime); + tms->tms_cstime = clock_from_timeval (&child_rusage.ru_stime); +#else tms->tms_cutime = tms->tms_cstime = 0; +#endif __host_get_time (__mach_host_self (), &now); diff --git a/sysdeps/mach/hurd/x86_64/ld.abilist b/sysdeps/mach/hurd/x86_64/ld.abilist index 2297a5f354..65813436f4 100644 --- a/sysdeps/mach/hurd/x86_64/ld.abilist +++ b/sysdeps/mach/hurd/x86_64/ld.abilist @@ -8,6 +8,7 @@ GLIBC_2.38 __open64 F GLIBC_2.38 __pread64 F GLIBC_2.38 __read F GLIBC_2.38 __sbrk F +GLIBC_2.38 __stack_chk_guard D 0x8 GLIBC_2.38 __tls_get_addr F GLIBC_2.38 __write F GLIBC_2.38 __writev F diff --git a/sysdeps/mach/hurd/x86_64/libc.abilist b/sysdeps/mach/hurd/x86_64/libc.abilist index 7c685645bb..a4f67ed24e 100644 --- a/sysdeps/mach/hurd/x86_64/libc.abilist +++ b/sysdeps/mach/hurd/x86_64/libc.abilist @@ -572,6 +572,7 @@ GLIBC_2.38 _hurd_dtable_lock D 0x28 GLIBC_2.38 _hurd_dtablesize D 0x4 GLIBC_2.38 _hurd_exception2signal F GLIBC_2.38 _hurd_exec F +GLIBC_2.38 _hurd_exec_file_name F GLIBC_2.38 _hurd_exec_paths F GLIBC_2.38 _hurd_fd_error F GLIBC_2.38 _hurd_fd_error_signal F @@ -607,7 +608,7 @@ GLIBC_2.38 _libc_intl_domainname D 0x5 GLIBC_2.38 _longjmp F GLIBC_2.38 _mcleanup F GLIBC_2.38 _mcount F -GLIBC_2.38 _nl_default_dirname D 0xe +GLIBC_2.38 _nl_default_dirname D 0x12 GLIBC_2.38 _nl_domain_bindings D 0x8 GLIBC_2.38 _nl_msg_cat_cntr D 0x4 GLIBC_2.38 _obstack_allocated_p F diff --git a/sysdeps/mach/libc-lock.h b/sysdeps/mach/libc-lock.h index 63427f7767..b1179d29a6 100644 --- a/sysdeps/mach/libc-lock.h +++ b/sysdeps/mach/libc-lock.h @@ -146,15 +146,15 @@ typedef struct __libc_lock_recursive_opaque__ __libc_lock_recursive_t; __libc_lock_unlock_recursive (NAME) /* XXX for now */ -#define __libc_rwlock_define __libc_lock_define -#define __libc_rwlock_define_initialized __libc_lock_define_initialized -#define __libc_rwlock_init __libc_lock_init -#define __libc_rwlock_fini __libc_lock_fini -#define __libc_rwlock_rdlock __libc_lock_lock -#define __libc_rwlock_wrlock __libc_lock_lock -#define __libc_rwlock_tryrdlock __libc_lock_trylock -#define __libc_rwlock_trywrlock __libc_lock_trylock -#define __libc_rwlock_unlock __libc_lock_unlock +#define __libc_rwlock_define __libc_lock_define_recursive +#define __libc_rwlock_define_initialized __libc_lock_define_initialized_recursive +#define __libc_rwlock_init __libc_lock_init_recursive +#define __libc_rwlock_fini __libc_lock_fini_recursive +#define __libc_rwlock_rdlock __libc_lock_lock_recursive +#define __libc_rwlock_wrlock __libc_lock_lock_recursive +#define __libc_rwlock_tryrdlock __libc_lock_trylock_recursive +#define __libc_rwlock_trywrlock __libc_lock_trylock_recursive +#define __libc_rwlock_unlock __libc_lock_unlock_recursive struct __libc_cleanup_frame { diff --git a/sysdeps/mips/dl-debug.h b/sysdeps/mips/dl-debug.h index 284c2e89d5..8c3c39452a 100644 --- a/sysdeps/mips/dl-debug.h +++ b/sysdeps/mips/dl-debug.h @@ -33,7 +33,8 @@ elf_setup_debug_entry (struct link_map *l, struct r_debug *r) ptr += l->l_info[DT_MIPS (RLD_MAP_REL)]->d_un.d_val; *(ElfW(Addr) *) ptr = (ElfW(Addr)) r; } - else if (l->l_info[DT_MIPS (RLD_MAP)] != NULL) + else if (l->l_info[DT_MIPS (RLD_MAP)] != NULL && + (l)->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) *(ElfW(Addr) *) (l->l_info[DT_MIPS (RLD_MAP)]->d_un.d_ptr) = (ElfW(Addr)) r; } diff --git a/sysdeps/nptl/dl-tls_init_tp.c b/sysdeps/nptl/dl-tls_init_tp.c index 092c274f36..7803e19fd1 100644 --- a/sysdeps/nptl/dl-tls_init_tp.c +++ b/sysdeps/nptl/dl-tls_init_tp.c @@ -45,8 +45,6 @@ rtld_mutex_dummy (pthread_mutex_t *lock) #endif const unsigned int __rseq_flags; -const unsigned int __rseq_size attribute_relro; -const ptrdiff_t __rseq_offset attribute_relro; void __tls_pre_init_tp (void) @@ -104,12 +102,7 @@ __tls_init_tp (void) bool do_rseq = true; do_rseq = TUNABLE_GET (rseq, int, NULL); if (rseq_register_current_thread (pd, do_rseq)) - { - /* We need a writable view of the variables. They are in - .data.relro and are not yet write-protected. */ - extern unsigned int size __asm__ ("__rseq_size"); - size = sizeof (pd->rseq_area); - } + _rseq_size = RSEQ_AREA_SIZE_INITIAL_USED; #ifdef RSEQ_SIG /* This should be a compile-time constant, but the current @@ -117,8 +110,7 @@ __tls_init_tp (void) all targets support __thread_pointer, so set __rseq_offset only if the rseq registration may have happened because RSEQ_SIG is defined. */ - extern ptrdiff_t offset __asm__ ("__rseq_offset"); - offset = (char *) &pd->rseq_area - (char *) __thread_pointer (); + _rseq_offset = (char *) &pd->rseq_area - (char *) __thread_pointer (); #endif } diff --git a/sysdeps/nptl/pthread.h b/sysdeps/nptl/pthread.h index 1607fdf29a..3d4f4a756c 100644 --- a/sysdeps/nptl/pthread.h +++ b/sysdeps/nptl/pthread.h @@ -223,7 +223,7 @@ extern int pthread_join (pthread_t __th, void **__thread_return); the thread in *THREAD_RETURN, if THREAD_RETURN is not NULL. */ extern int pthread_tryjoin_np (pthread_t __th, void **__thread_return) __THROW; -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Make calling thread wait for termination of the thread TH, but only until TIMEOUT. The exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN is not NULL. @@ -796,7 +796,7 @@ extern int pthread_mutex_lock (pthread_mutex_t *__mutex) #ifdef __USE_XOPEN2K /* Wait until lock becomes available, or specified time passes. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_mutex_timedlock (pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -813,7 +813,7 @@ extern int __REDIRECT_NTHNL (pthread_mutex_timedlock, #endif #ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_mutex_clocklock (pthread_mutex_t *__restrict __mutex, clockid_t __clockid, const struct timespec *__restrict @@ -982,7 +982,7 @@ extern int pthread_rwlock_tryrdlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire read lock for RWLOCK or return after specified time. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_rwlock_timedrdlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -1000,7 +1000,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedrdlock, # endif # ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_rwlock_clockrdlock (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid, const struct timespec *__restrict @@ -1029,7 +1029,7 @@ extern int pthread_rwlock_trywrlock (pthread_rwlock_t *__rwlock) # ifdef __USE_XOPEN2K /* Try to acquire write lock for RWLOCK or return after specified time. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_rwlock_timedwrlock (pthread_rwlock_t *__restrict __rwlock, const struct timespec *__restrict __abstime) __THROWNL __nonnull ((1, 2)); @@ -1047,7 +1047,7 @@ extern int __REDIRECT_NTHNL (pthread_rwlock_timedwrlock, # endif # ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_rwlock_clockwrlock (pthread_rwlock_t *__restrict __rwlock, clockid_t __clockid, const struct timespec *__restrict @@ -1141,7 +1141,7 @@ extern int pthread_cond_wait (pthread_cond_t *__restrict __cond, This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_cond_timedwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, const struct timespec *__restrict __abstime) @@ -1167,7 +1167,7 @@ extern int __REDIRECT (pthread_cond_timedwait, This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int pthread_cond_clockwait (pthread_cond_t *__restrict __cond, pthread_mutex_t *__restrict __mutex, __clockid_t __clock_id, diff --git a/sysdeps/nptl/pthreadP.h b/sysdeps/nptl/pthreadP.h index 30e8a2d177..aec36422f2 100644 --- a/sysdeps/nptl/pthreadP.h +++ b/sysdeps/nptl/pthreadP.h @@ -232,8 +232,8 @@ libc_hidden_proto (__pthread_current_priority) /* This will not catch all invalid descriptors but is better than nothing. And if the test triggers the thread descriptor is guaranteed to be invalid. */ -#define INVALID_TD_P(pd) __builtin_expect ((pd)->tid <= 0, 0) -#define INVALID_NOT_TERMINATED_TD_P(pd) __builtin_expect ((pd)->tid < 0, 0) +#define INVALID_TD_P(pd) __builtin_expect (!pd || ((pd)->tid <= 0), 0) +#define INVALID_NOT_TERMINATED_TD_P(pd) __builtin_expect (!pd || ((pd)->tid < 0), 0) extern void __pthread_unwind (__pthread_unwind_buf_t *__buf) __cleanup_fct_attribute __attribute ((__noreturn__)) diff --git a/sysdeps/powerpc/bits/floatn.h b/sysdeps/powerpc/bits/floatn.h index 3eb0b55dd3..8a9b24eb58 100644 --- a/sysdeps/powerpc/bits/floatn.h +++ b/sysdeps/powerpc/bits/floatn.h @@ -26,7 +26,7 @@ floating-point type with the IEEE 754 binary128 format, and this glibc includes corresponding *f128 interfaces for it. */ #if defined _ARCH_PWR8 && defined __LITTLE_ENDIAN__ && (_CALL_ELF == 2) \ - && defined __FLOAT128__ && !defined __NO_LONG_DOUBLE_MATH + && defined __FLOAT128__ && !defined __NO_LONG_DOUBLE_MATH && !defined(__CUDACC__) && !defined(__ICC) # define __HAVE_FLOAT128 1 #else # define __HAVE_FLOAT128 0 diff --git a/sysdeps/pthread/semaphore.h b/sysdeps/pthread/semaphore.h index c75ca4ce6d..8a09633699 100644 --- a/sysdeps/pthread/semaphore.h +++ b/sysdeps/pthread/semaphore.h @@ -59,7 +59,7 @@ extern int sem_wait (sem_t *__sem) __nonnull ((1)); This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int sem_timedwait (sem_t *__restrict __sem, const struct timespec *__restrict __abstime) __nonnull ((1, 2)); @@ -77,7 +77,7 @@ extern int __REDIRECT (sem_timedwait, #endif #ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int sem_clockwait (sem_t *__restrict __sem, clockid_t clock, const struct timespec *__restrict __abstime) diff --git a/sysdeps/pthread/threads.h b/sysdeps/pthread/threads.h index c5410b5c3a..7cade24e1f 100644 --- a/sysdeps/pthread/threads.h +++ b/sysdeps/pthread/threads.h @@ -90,7 +90,7 @@ extern thrd_t thrd_current (void); __TIME_POINT. The current thread may resume if receives a signal. In that case, if __REMAINING is not NULL, the remaining time is stored in the object pointed by it. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int thrd_sleep (const struct timespec *__time_point, struct timespec *__remaining); #else @@ -143,7 +143,7 @@ extern int mtx_lock (mtx_t *__mutex); /* Block the current thread until the mutex pointed by __MUTEX is unlocked or time pointed by __TIME_POINT is reached. In case the mutex is unlock, the current thread will not be blocked. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int mtx_timedlock (mtx_t *__restrict __mutex, const struct timespec *__restrict __time_point); #else @@ -194,7 +194,7 @@ extern int cnd_wait (cnd_t *__cond, mtx_t *__mutex); /* Block current thread on the condition variable until condition variable pointed by __COND is signaled or time pointed by __TIME_POINT is reached. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int cnd_timedwait (cnd_t *__restrict __cond, mtx_t *__restrict __mutex, const struct timespec *__restrict __time_point); diff --git a/sysdeps/s390/wcsncmp-vx.S b/sysdeps/s390/wcsncmp-vx.S index bf6dfa6bc2..8b081567a2 100644 --- a/sysdeps/s390/wcsncmp-vx.S +++ b/sysdeps/s390/wcsncmp-vx.S @@ -59,14 +59,7 @@ ENTRY(WCSNCMP_Z13) sllg %r4,%r4,2 /* Convert character-count to byte-count. */ locgrne %r4,%r1 /* Use max byte-count, if bit 0/1 was one. */ - /* Check first character without vector load. */ - lghi %r5,4 /* current_len = 4 bytes. */ - /* Check s1/2[0]. */ - lt %r0,0(%r2) - l %r1,0(%r3) - je .Lend_cmp_one_char - crjne %r0,%r1,.Lend_cmp_one_char - + lghi %r5,0 /* current_len = 0 bytes. */ .Lloop: vlbb %v17,0(%r5,%r3),6 /* Load s2 to block boundary. */ vlbb %v16,0(%r5,%r2),6 /* Load s1 to block boundary. */ @@ -167,7 +160,6 @@ ENTRY(WCSNCMP_Z13) srl %r4,2 /* And convert it to character-index. */ vlgvf %r0,%v16,0(%r4) /* Load character-values. */ vlgvf %r1,%v17,0(%r4) -.Lend_cmp_one_char: cr %r0,%r1 je .Lend_equal lghi %r2,1 diff --git a/sysdeps/unix/bsd/unlockpt.c b/sysdeps/unix/bsd/unlockpt.c index 8f6c40633c..83a8a653fb 100644 --- a/sysdeps/unix/bsd/unlockpt.c +++ b/sysdeps/unix/bsd/unlockpt.c @@ -27,7 +27,7 @@ int unlockpt (int fd) { - char buf[sizeof (_PATH_TTY) + 2]; + char buf[1024]; /* XXX */ /* BSD doesn't have a lock, but it does have `revoke'. */ if (__ptsname_r (fd, buf, sizeof (buf))) diff --git a/sysdeps/unix/sysv/linux/Makefile b/sysdeps/unix/sysv/linux/Makefile index 415aa1f14d..7e7243b659 100644 --- a/sysdeps/unix/sysv/linux/Makefile +++ b/sysdeps/unix/sysv/linux/Makefile @@ -205,6 +205,7 @@ tests += \ tst-getauxval \ tst-gettid \ tst-gettid-kill \ + tst-linux-mremap1 \ tst-memfd_create \ tst-misalign-clone \ tst-mlock2 \ @@ -437,10 +438,7 @@ endif ifeq ($(subdir),socket) sysdep_headers += \ bits/socket-constants.h \ - net/ethernet.h \ - net/if_arp.h \ net/if_packet.h \ - net/if_ppp.h \ net/if_shaper.h \ net/if_slip.h \ net/ppp-comp.h \ @@ -615,6 +613,10 @@ tests += \ endif ifeq ($(subdir),elf) +dl-routines += \ + dl-rseq-symbols \ + # dl-routines + sysdep-rtld-routines += \ dl-brk \ dl-getcwd \ diff --git a/sysdeps/unix/sysv/linux/____longjmp_chk.c b/sysdeps/unix/sysv/linux/____longjmp_chk.c index 0896dc5755..3c66a4638e 100644 --- a/sysdeps/unix/sysv/linux/____longjmp_chk.c +++ b/sysdeps/unix/sysv/linux/____longjmp_chk.c @@ -23,7 +23,7 @@ #include #include -#ifdef _STACK_GROWS_DOWN +#if _STACK_GROWS_DOWN #define called_from(this, saved) ((this) < (saved)) #else #define called_from(this, saved) ((this) > (saved)) diff --git a/sysdeps/unix/sysv/linux/alpha/dl-support.c b/sysdeps/unix/sysv/linux/alpha/dl-support.c deleted file mode 100644 index 290217671c..0000000000 --- a/sysdeps/unix/sysv/linux/alpha/dl-support.c +++ /dev/null @@ -1,2 +0,0 @@ -#include "dl-auxv.h" -#include diff --git a/sysdeps/unix/sysv/linux/alpha/fts.c b/sysdeps/unix/sysv/linux/alpha/fts.c new file mode 100644 index 0000000000..d0c62e6195 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/fts.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/alpha/fts64.c b/sysdeps/unix/sysv/linux/alpha/fts64.c new file mode 100644 index 0000000000..2472f8bf75 --- /dev/null +++ b/sysdeps/unix/sysv/linux/alpha/fts64.c @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/alpha/ioperm.c b/sysdeps/unix/sysv/linux/alpha/ioperm.c index b1b373bbff..db9e5a26fc 100644 --- a/sysdeps/unix/sysv/linux/alpha/ioperm.c +++ b/sysdeps/unix/sysv/linux/alpha/ioperm.c @@ -176,13 +176,13 @@ static struct { static inline void stb_mb(unsigned char val, unsigned long addr) { - __asm__("stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val)); + __asm__(".arch ev6; stb %1,%0; mb" : "=m"(*(vucp)addr) : "r"(val)); } static inline void stw_mb(unsigned short val, unsigned long addr) { - __asm__("stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val)); + __asm__(".arch ev6; stw %1,%0; mb" : "=m"(*(vusp)addr) : "r"(val)); } static inline void @@ -349,7 +349,7 @@ inline_bwx_inb (unsigned long int port) unsigned long int addr = dense_port_to_cpu_addr (port); unsigned char r; - __asm__ ("ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr)); + __asm__ (".arch ev6; ldbu %0,%1" : "=r"(r) : "m"(*(vucp)addr)); return r; } @@ -359,7 +359,7 @@ inline_bwx_inw (unsigned long int port) unsigned long int addr = dense_port_to_cpu_addr (port); unsigned short r; - __asm__ ("ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr)); + __asm__ (".arch ev6; ldwu %0,%1" : "=r"(r) : "m"(*(vusp)addr)); return r; } diff --git a/sysdeps/unix/sysv/linux/alpha/makecontext.S b/sysdeps/unix/sysv/linux/alpha/makecontext.S index 1fefc37554..4596d6e0e8 100644 --- a/sysdeps/unix/sysv/linux/alpha/makecontext.S +++ b/sysdeps/unix/sysv/linux/alpha/makecontext.S @@ -138,10 +138,14 @@ weak_alias (__makecontext, makecontext) .align 4 .ent __startcontext + cfi_startproc __startcontext: .frame $31, 0, $31, 0 .prologue 0 + /* Mark ra as undefined in order to stop unwinding here. */ + cfi_undefined(ra) + jsr $26, ($27), 0 ldgp $29, 0($26) mov $9, $16 @@ -160,4 +164,5 @@ __startcontext: halt + cfi_endproc .end __startcontext diff --git a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h index 255feaa8cb..89534fea85 100644 --- a/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/arm/bits/struct_stat.h @@ -28,7 +28,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -83,13 +83,13 @@ struct stat # else __ino64_t st_ino; /* File serial number. */ # endif -#endif /* __USE_TIME_BITS64 */ +#endif /* __USE_TIME64_REDIRECTS */ }; #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -125,7 +125,7 @@ struct stat64 unsigned long int st_ctimensec; /* Nsecs of last status change. */ # endif __ino64_t st_ino; /* File serial number. */ -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/arm/kernel-features.h b/sysdeps/unix/sysv/linux/arm/kernel-features.h index f17c2f9e68..2e2eb3ecea 100644 --- a/sysdeps/unix/sysv/linux/arm/kernel-features.h +++ b/sysdeps/unix/sysv/linux/arm/kernel-features.h @@ -23,7 +23,7 @@ /* The ARM kernel before 3.14.3 may or may not support futex_atomic_cmpxchg_inatomic, depending on kernel configuration. */ -#if __LINUX_KERNEL_VERSION < 0x030E03 +#if __LINUX_KERNEL_VERSION < 0x020620 # undef __ASSUME_SET_ROBUST_LIST #endif diff --git a/sysdeps/unix/sysv/linux/arm/libc_sigaction.c b/sysdeps/unix/sysv/linux/arm/libc_sigaction.c index 9700231272..97970978a9 100644 --- a/sysdeps/unix/sysv/linux/arm/libc_sigaction.c +++ b/sysdeps/unix/sysv/linux/arm/libc_sigaction.c @@ -22,15 +22,10 @@ extern void __default_rt_sa_restorer (void); #define SET_SA_RESTORER(kact, act) \ ({ \ - if ((kact)->sa_flags & SA_RESTORER) \ - (kact)->sa_restorer = (act)->sa_restorer; \ - else \ - { \ - (kact)->sa_restorer = ((kact)->sa_flags & SA_SIGINFO) \ - ? __default_rt_sa_restorer \ - : __default_sa_restorer; \ - (kact)->sa_flags |= SA_RESTORER; \ - } \ + (kact)->sa_restorer = ((kact)->sa_flags & SA_SIGINFO) \ + ? __default_rt_sa_restorer \ + : __default_sa_restorer; \ + (kact)->sa_flags |= SA_RESTORER; \ }) #define RESET_SA_RESTORER(act, kact) \ diff --git a/sysdeps/unix/sysv/linux/bits/socket-constants.h b/sysdeps/unix/sysv/linux/bits/socket-constants.h index d997dbf594..b2102d3abf 100644 --- a/sysdeps/unix/sysv/linux/bits/socket-constants.h +++ b/sysdeps/unix/sysv/linux/bits/socket-constants.h @@ -64,7 +64,7 @@ # define SO_TIMESTAMPNS_NEW 64 # define SO_TIMESTAMPING_NEW 65 -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # define SO_RCVTIMEO SO_RCVTIMEO_NEW # define SO_SNDTIMEO SO_SNDTIMEO_NEW # define SO_TIMESTAMP SO_TIMESTAMP_NEW diff --git a/sysdeps/unix/sysv/linux/bits/socket.h b/sysdeps/unix/sysv/linux/bits/socket.h index 0d86feb4ca..6dab283a2e 100644 --- a/sysdeps/unix/sysv/linux/bits/socket.h +++ b/sysdeps/unix/sysv/linux/bits/socket.h @@ -180,7 +180,7 @@ typedef __socklen_t socklen_t; #include /* Structure describing a generic socket address. */ -struct sockaddr +struct __attribute_struct_may_alias__ sockaddr { __SOCKADDR_COMMON (sa_); /* Common data: address family and length. */ char sa_data[14]; /* Address data. */ @@ -193,7 +193,7 @@ struct sockaddr #define _SS_PADSIZE \ (_SS_SIZE - __SOCKADDR_COMMON_SIZE - sizeof (__ss_aligntype)) -struct sockaddr_storage +struct __attribute_struct_may_alias__ sockaddr_storage { __SOCKADDR_COMMON (ss_); /* Address family, etc. */ char __ss_padding[_SS_PADSIZE]; diff --git a/sysdeps/unix/sysv/linux/bits/time.h b/sysdeps/unix/sysv/linux/bits/time.h index b70ba58a7d..cab4057971 100644 --- a/sysdeps/unix/sysv/linux/bits/time.h +++ b/sysdeps/unix/sysv/linux/bits/time.h @@ -77,7 +77,7 @@ __BEGIN_DECLS /* Tune a POSIX clock. */ extern int clock_adjtime (__clockid_t __clock_id, struct timex *__utx) __THROW __nonnull((2)); -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # if defined(__REDIRECT_NTH) extern int __REDIRECT_NTH (clock_adjtime, (__clockid_t __clock_id, struct timex *__utx), diff --git a/sysdeps/unix/sysv/linux/bits/timex.h b/sysdeps/unix/sysv/linux/bits/timex.h index 398d8094f2..03ccde6d0a 100644 --- a/sysdeps/unix/sysv/linux/bits/timex.h +++ b/sysdeps/unix/sysv/linux/bits/timex.h @@ -25,7 +25,7 @@ struct timex { -# if defined __USE_TIME_BITS64 || (__TIMESIZE == 64 && __WORDSIZE == 32) +# if defined __USE_TIME64_REDIRECTS || (__TIMESIZE == 64 && __WORDSIZE == 32) unsigned int modes; /* mode selector */ int :32; /* pad */ long long offset; /* time offset (usec) */ diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h index fae50281c7..86296ca922 100644 --- a/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h +++ b/sysdeps/unix/sysv/linux/bits/types/struct_msqid_ds.h @@ -26,7 +26,7 @@ The type `struct msg' is opaque. */ struct msqid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm msg_perm; /* structure describing operation permission */ diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h index 3c277ed1d8..2ac89b3ce4 100644 --- a/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/bits/types/struct_semid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm sem_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h index 09de0b4e3a..1012ed0317 100644 --- a/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h +++ b/sysdeps/unix/sysv/linux/bits/types/struct_shmid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm shm_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/bits/uio-ext.h b/sysdeps/unix/sysv/linux/bits/uio-ext.h index 7854cccef3..ead7a09156 100644 --- a/sysdeps/unix/sysv/linux/bits/uio-ext.h +++ b/sysdeps/unix/sysv/linux/bits/uio-ext.h @@ -47,6 +47,7 @@ extern ssize_t process_vm_writev (pid_t __pid, const struct iovec *__lvec, #define RWF_SYNC 0x00000004 /* per-IO O_SYNC. */ #define RWF_NOWAIT 0x00000008 /* per-IO nonblocking mode. */ #define RWF_APPEND 0x00000010 /* per-IO O_APPEND. */ +#define RWF_NOAPPEND 0x00000020 /* per-IO negation of O_APPEND */ __END_DECLS diff --git a/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h index 4b4822d6d0..47a9f0aaff 100644 --- a/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/csky/bits/struct_stat.h @@ -43,7 +43,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -88,7 +88,7 @@ struct stat #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/dl-rseq-symbols.S b/sysdeps/unix/sysv/linux/dl-rseq-symbols.S new file mode 100644 index 0000000000..b4bba06a99 --- /dev/null +++ b/sysdeps/unix/sysv/linux/dl-rseq-symbols.S @@ -0,0 +1,64 @@ +/* Define symbols used by rseq. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +#if __WORDSIZE == 64 +#define RSEQ_OFFSET_SIZE 8 +#else +#define RSEQ_OFFSET_SIZE 4 +#endif + +/* Some targets define a macro to denote the zero register. */ +#undef zero + +/* Define 2 symbols: '__rseq_size' is public const and '_rseq_size' (an + alias of '__rseq_size') is hidden and writable for internal use by the + dynamic linker which will initialize the value both symbols point to + before copy relocations take place. */ + + .globl __rseq_size + .type __rseq_size, %object + .size __rseq_size, 4 + .hidden _rseq_size + .globl _rseq_size + .type _rseq_size, %object + .size _rseq_size, 4 + .section .data.rel.ro + .balign 4 +__rseq_size: +_rseq_size: + .zero 4 + +/* Define 2 symbols: '__rseq_offset' is public const and '_rseq_offset' (an + alias of '__rseq_offset') is hidden and writable for internal use by the + dynamic linker which will initialize the value both symbols point to + before copy relocations take place. */ + + .globl __rseq_offset + .type __rseq_offset, %object + .size __rseq_offset, RSEQ_OFFSET_SIZE + .hidden _rseq_offset + .globl _rseq_offset + .type _rseq_offset, %object + .size _rseq_offset, RSEQ_OFFSET_SIZE + .section .data.rel.ro + .balign RSEQ_OFFSET_SIZE +__rseq_offset: +_rseq_offset: + .zero RSEQ_OFFSET_SIZE diff --git a/sysdeps/unix/sysv/linux/dl-sysdep.c b/sysdeps/unix/sysv/linux/dl-sysdep.c index e1b14e9eb3..a8ec2d7c18 100644 --- a/sysdeps/unix/sysv/linux/dl-sysdep.c +++ b/sysdeps/unix/sysv/linux/dl-sysdep.c @@ -40,6 +40,7 @@ #include #include #include +#include #include #include diff --git a/sysdeps/unix/sysv/linux/features-time64.h b/sysdeps/unix/sysv/linux/features-time64.h index dd3442c2ea..8d573cd23e 100644 --- a/sysdeps/unix/sysv/linux/features-time64.h +++ b/sysdeps/unix/sysv/linux/features-time64.h @@ -24,9 +24,8 @@ # if _TIME_BITS == 64 # if ! defined (_FILE_OFFSET_BITS) || _FILE_OFFSET_BITS != 64 # error "_TIME_BITS=64 is allowed only with _FILE_OFFSET_BITS=64" -# elif __TIMESIZE == 32 -# define __USE_TIME_BITS64 1 # endif +# define __USE_TIME_BITS64 1 # elif _TIME_BITS == 32 # if __TIMESIZE > 32 # error "_TIME_BITS=32 is not compatible with __TIMESIZE > 32" @@ -34,4 +33,10 @@ # else # error Invalid _TIME_BITS value (can only be 32 or 64-bit) # endif +#elif __TIMESIZE == 64 +# define __USE_TIME_BITS64 1 +#endif + +#if defined __USE_TIME_BITS64 && __TIMESIZE == 32 +# define __USE_TIME64_REDIRECTS 1 #endif diff --git a/sysdeps/unix/sysv/linux/getrlimit64.c b/sysdeps/unix/sysv/linux/getrlimit64.c index 754877769f..451cef4cad 100644 --- a/sysdeps/unix/sysv/linux/getrlimit64.c +++ b/sysdeps/unix/sysv/linux/getrlimit64.c @@ -36,40 +36,7 @@ int __getrlimit64 (enum __rlimit_resource resource, struct rlimit64 *rlimits) { -#ifdef __NR_prlimit64 - int res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, NULL, rlimits); - if (res == 0 || errno != ENOSYS) - return res; -#endif - -/* The fallback code only makes sense if the platform supports either - __NR_ugetrlimit and/or __NR_getrlimit. */ -#if defined (__NR_ugetrlimit) || defined (__NR_getrlimit) -# ifndef __NR_ugetrlimit -# define __NR_ugetrlimit __NR_getrlimit -# endif -# if __RLIM_T_MATCHES_RLIM64_T -# define rlimits32 (*rlimits) -# else - struct rlimit rlimits32; -# endif - - if (INLINE_SYSCALL_CALL (ugetrlimit, resource, &rlimits32) < 0) - return -1; - -# if !__RLIM_T_MATCHES_RLIM64_T - if (rlimits32.rlim_cur == RLIM_INFINITY) - rlimits->rlim_cur = RLIM64_INFINITY; - else - rlimits->rlim_cur = rlimits32.rlim_cur; - if (rlimits32.rlim_max == RLIM_INFINITY) - rlimits->rlim_max = RLIM64_INFINITY; - else - rlimits->rlim_max = rlimits32.rlim_max; -# endif /* !__RLIM_T_MATCHES_RLIM64_T */ -#endif /* defined (__NR_ugetrlimit) || defined (__NR_getrlimit) */ - - return 0; + return INLINE_SYSCALL_CALL (prlimit64, 0, resource, NULL, rlimits); } libc_hidden_def (__getrlimit64) diff --git a/sysdeps/unix/sysv/linux/hppa/bits/socket-constants.h b/sysdeps/unix/sysv/linux/hppa/bits/socket-constants.h index 58b523d03a..80a76a17dc 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/socket-constants.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/socket-constants.h @@ -54,7 +54,7 @@ # define SO_TIMESTAMPNS_NEW 0x4039 # define SO_TIMESTAMPING_NEW 0x403A -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # define SO_RCVTIMEO SO_RCVTIMEO_NEW # define SO_SNDTIMEO SO_SNDTIMEO_NEW # define SO_TIMESTAMP SO_TIMESTAMP_NEW diff --git a/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h index 069efdbc55..09ea40054b 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/struct_stat.h @@ -28,7 +28,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -83,13 +83,13 @@ struct stat # else __ino64_t st_ino; /* File serial number. */ # endif -#endif /* __USE_TIME_BITS64 */ +#endif /* __USE_TIME64_REDIRECTS */ }; #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -125,7 +125,7 @@ struct stat64 unsigned long int st_ctimensec; /* Nsecs of last status change. */ # endif __ino64_t st_ino; /* File serial number. */ -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_msqid_ds.h index 2bc7cac06d..4995e0a4a5 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_msqid_ds.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_msqid_ds.h @@ -26,7 +26,7 @@ The type `struct msg' is opaque. */ struct msqid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm msg_perm; /* structure describing operation permission */ diff --git a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h index dd8fbebcf4..df88949dc2 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_semid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm sem_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_shmid_ds.h index 58ac572b6e..cb3b0303aa 100644 --- a/sysdeps/unix/sysv/linux/hppa/bits/types/struct_shmid_ds.h +++ b/sysdeps/unix/sysv/linux/hppa/bits/types/struct_shmid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm shm_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/i386/dl-cache.h b/sysdeps/unix/sysv/linux/i386/dl-cache.h new file mode 100644 index 0000000000..766bba4265 --- /dev/null +++ b/sysdeps/unix/sysv/linux/i386/dl-cache.h @@ -0,0 +1 @@ +#include diff --git a/sysdeps/unix/sysv/linux/i386/getcontext.S b/sysdeps/unix/sysv/linux/i386/getcontext.S index 9c1ca3c263..aa9d54fb1b 100644 --- a/sysdeps/unix/sysv/linux/i386/getcontext.S +++ b/sysdeps/unix/sysv/linux/i386/getcontext.S @@ -25,7 +25,13 @@ ENTRY(__getcontext) /* Load address of the context data structure. */ movl 4(%esp), %eax - /* Save the preserved register values and the return address. */ + /* Return value of getcontext. EAX is the only register whose + value is not preserved. */ + movl $0, oEAX(%eax) + + /* Save the 32-bit register values and the return address. */ + movl %ecx, oECX(%eax) + movl %edx, oEDX(%eax) movl %edi, oEDI(%eax) movl %esi, oESI(%eax) movl %ebp, oEBP(%eax) diff --git a/sysdeps/unix/sysv/linux/i386/setcontext.S b/sysdeps/unix/sysv/linux/i386/setcontext.S index b6d827d11f..6cf5192bdc 100644 --- a/sysdeps/unix/sysv/linux/i386/setcontext.S +++ b/sysdeps/unix/sysv/linux/i386/setcontext.S @@ -64,19 +64,22 @@ ENTRY(__setcontext) cfi_offset (esi, oESI) cfi_offset (ebp, oEBP) cfi_offset (ebx, oEBX) + cfi_offset (edx, oEDX) + cfi_offset (ecx, oECX) movl oESP(%eax), %esp /* Push the return address on the new stack so we can return there. */ pushl %ecx - /* Load the values of all the preserved registers (except ESP). */ + /* Load the values of all the 32-bit registers (except ESP). + Since we are loading from EAX, it must be last. */ movl oEDI(%eax), %edi movl oESI(%eax), %esi movl oEBP(%eax), %ebp movl oEBX(%eax), %ebx - - /* All done, return 0 for success. */ - xorl %eax, %eax + movl oEDX(%eax), %edx + movl oECX(%eax), %ecx + movl oEAX(%eax), %eax /* End FDE here, we fall into another context. */ cfi_endproc diff --git a/sysdeps/unix/sysv/linux/i386/swapcontext.S b/sysdeps/unix/sysv/linux/i386/swapcontext.S index bb736ae7d2..f41aa07e61 100644 --- a/sysdeps/unix/sysv/linux/i386/swapcontext.S +++ b/sysdeps/unix/sysv/linux/i386/swapcontext.S @@ -25,7 +25,13 @@ ENTRY(__swapcontext) /* Load address of the context data structure we save in. */ movl 4(%esp), %eax - /* Save the preserved register values and the return address. */ + /* Return value of swapcontext. EAX is the only register whose + value is not preserved. */ + movl $0, oEAX(%eax) + + /* Save the 32-bit register values and the return address. */ + movl %ecx, oECX(%eax) + movl %edx, oEDX(%eax) movl %edi, oEDI(%eax) movl %esi, oESI(%eax) movl %ebp, oEBP(%eax) @@ -84,14 +90,15 @@ ENTRY(__swapcontext) /* Push the return address on the new stack so we can return there. */ pushl %ecx - /* Load the values of all the preserved registers (except ESP). */ + /* Load the values of all the 32-bit registers (except ESP). + Since we are loading from EAX, it must be last. */ movl oEDI(%eax), %edi movl oESI(%eax), %esi movl oEBP(%eax), %ebp movl oEBX(%eax), %ebx - - /* All done, return 0 for success. */ - xorl %eax, %eax + movl oEDX(%eax), %edx + movl oECX(%eax), %ecx + movl oEAX(%eax), %eax /* The following 'ret' will pop the address of the code and jump to it. */ diff --git a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym index 1dfe03d2cc..b11a5509cd 100644 --- a/sysdeps/unix/sysv/linux/i386/ucontext_i.sym +++ b/sysdeps/unix/sysv/linux/i386/ucontext_i.sym @@ -21,6 +21,9 @@ oESI mreg (ESI) oEBP mreg (EBP) oESP mreg (ESP) oEBX mreg (EBX) +oEDX mreg (EDX) +oECX mreg (ECX) +oEAX mreg (EAX) oEIP mreg (EIP) oFPREGS mcontext (fpregs) oSIGMASK ucontext (uc_sigmask) diff --git a/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h b/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h index 3b1db157bc..b7f20189b1 100644 --- a/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/m68k/bits/struct_stat.h @@ -25,7 +25,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -80,13 +80,13 @@ struct stat # else __ino64_t st_ino; /* File serial number. */ # endif -#endif /* __USE_TIME_BITS64 */ +#endif /* __USE_TIME64_REDIRECTS */ }; #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -122,7 +122,7 @@ struct stat64 unsigned long int st_ctimensec; /* Nsecs of last status change. */ # endif __ino64_t st_ino; /* File serial number. */ -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h b/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h index 0f4693fb1f..ff1e269f14 100644 --- a/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/microblaze/bits/struct_stat.h @@ -26,7 +26,7 @@ #ifndef __USE_FILE_OFFSET64 struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -64,7 +64,7 @@ struct stat # endif unsigned int __glibc_reserved4; unsigned int __glibc_reserved5; -#endif /* __USE_TIME_BITS64 */ +#endif /* __USE_TIME64_REDIRECTS */ }; #else /* __USE_FILE_OFFSET64 */ /* MS: If __USE_FILE_OFFSET64 is setup then struct stat should match stat64 @@ -74,7 +74,7 @@ struct stat * create one ifdef to separate stats structures. */ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else unsigned long long st_dev; /* Device. */ @@ -112,14 +112,14 @@ struct stat # endif unsigned int __glibc_reserved4; unsigned int __glibc_reserved5; -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif /* __USE_FILE_OFFSET64 */ #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else unsigned long long st_dev; /* Device. */ @@ -157,7 +157,7 @@ struct stat64 # endif unsigned int __glibc_reserved4; unsigned int __glibc_reserved5; -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/mips/bits/socket-constants.h b/sysdeps/unix/sysv/linux/mips/bits/socket-constants.h index c6908a2793..77ffc8b890 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/socket-constants.h +++ b/sysdeps/unix/sysv/linux/mips/bits/socket-constants.h @@ -54,7 +54,7 @@ # define SO_TIMESTAMPNS_NEW 64 # define SO_TIMESTAMPING_NEW 65 -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # define SO_RCVTIMEO SO_RCVTIMEO_NEW # define SO_SNDTIMEO SO_SNDTIMEO_NEW # define SO_TIMESTAMP SO_TIMESTAMP_NEW diff --git a/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h b/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h index 277ebad9b6..50a4b367f6 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/mips/bits/struct_stat.h @@ -29,7 +29,7 @@ /* Structure describing file characteristics. */ struct stat { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else unsigned long int st_dev; @@ -82,13 +82,13 @@ struct stat __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ # endif long int st_pad5[14]; -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; # ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else unsigned long int st_dev; @@ -123,7 +123,7 @@ struct stat64 long int st_pad3; __blkcnt64_t st_blocks; /* Number of 512-byte blocks allocated. */ long int st_pad4[14]; -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; # endif /* __USE_LARGEFILE64 */ @@ -131,7 +131,7 @@ struct stat64 struct stat { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; @@ -189,7 +189,7 @@ struct stat #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; @@ -224,7 +224,7 @@ struct stat64 unsigned int st_pad3; __blkcnt64_t st_blocks; int st_pad4[14]; -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/mips/bits/types/struct_msqid_ds.h index 4e8bd51b0a..09c53648b7 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/types/struct_msqid_ds.h +++ b/sysdeps/unix/sysv/linux/mips/bits/types/struct_msqid_ds.h @@ -26,7 +26,7 @@ The type `struct msg' is opaque. */ struct msqid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm msg_perm; /* structure describing operation permission */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h index d1a30e3164..0746684a7d 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/mips/bits/types/struct_semid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm sem_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/mips/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/mips/bits/types/struct_shmid_ds.h index 8771164b57..c665af1874 100644 --- a/sysdeps/unix/sysv/linux/mips/bits/types/struct_shmid_ds.h +++ b/sysdeps/unix/sysv/linux/mips/bits/types/struct_shmid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm shm_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/mremap-failure.h b/sysdeps/unix/sysv/linux/mremap-failure.h new file mode 100644 index 0000000000..c99ab30ca9 --- /dev/null +++ b/sysdeps/unix/sysv/linux/mremap-failure.h @@ -0,0 +1,30 @@ +/* mremap failure handling. Linux version. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include + +/* Return exit value on mremap failure with errno ERR. */ + +static int +mremap_failure_exit (int err) +{ + if (err != EINVAL) + return EXIT_FAILURE; + + return EXIT_UNSUPPORTED; +} diff --git a/sysdeps/unix/sysv/linux/mremap.c b/sysdeps/unix/sysv/linux/mremap.c index 4f770799c4..1ada5c1f40 100644 --- a/sysdeps/unix/sysv/linux/mremap.c +++ b/sysdeps/unix/sysv/linux/mremap.c @@ -20,6 +20,12 @@ #include #include #include +#include + +#define MREMAP_KNOWN_BITS \ + (MREMAP_MAYMOVE \ + | MREMAP_FIXED \ + | MREMAP_DONTUNMAP) void * __mremap (void *addr, size_t old_len, size_t new_len, int flags, ...) @@ -27,7 +33,13 @@ __mremap (void *addr, size_t old_len, size_t new_len, int flags, ...) va_list va; void *new_addr = NULL; - if (flags & MREMAP_FIXED) + if (flags & ~(MREMAP_KNOWN_BITS)) + { + __set_errno (EINVAL); + return MAP_FAILED; + } + + if (flags & (MREMAP_FIXED | MREMAP_DONTUNMAP)) { va_start (va, flags); new_addr = va_arg (va, void *); diff --git a/sysdeps/unix/sysv/linux/net/if_ether.h b/sysdeps/unix/sysv/linux/net/if_ether.h new file mode 100644 index 0000000000..e0fe7b55f2 --- /dev/null +++ b/sysdeps/unix/sysv/linux/net/if_ether.h @@ -0,0 +1,7 @@ +#ifndef _NET_IF_ETHER_H +#define _NET_IF_ETHER_H 1 + +/* Get definitions from kernel header file. */ +#include + +#endif /* net/if_ether.h */ diff --git a/sysdeps/unix/sysv/linux/net/if_packet.h b/sysdeps/unix/sysv/linux/net/if_packet.h index 9ffb69b508..c17e1c23c5 100644 --- a/sysdeps/unix/sysv/linux/net/if_packet.h +++ b/sysdeps/unix/sysv/linux/net/if_packet.h @@ -26,7 +26,7 @@ From Linux 2.1 the AF_PACKET interface is preferred and you should consider using it in place of this one. */ -struct sockaddr_pkt +struct __attribute_struct_may_alias__ sockaddr_pkt { __SOCKADDR_COMMON (spkt_); unsigned char spkt_device[14]; diff --git a/sysdeps/unix/sysv/linux/netash/ash.h b/sysdeps/unix/sysv/linux/netash/ash.h index 7d885d17cc..7a6ff50b17 100644 --- a/sysdeps/unix/sysv/linux/netash/ash.h +++ b/sysdeps/unix/sysv/linux/netash/ash.h @@ -22,7 +22,7 @@ #include #include -struct sockaddr_ash +struct __attribute_struct_may_alias__ sockaddr_ash { __SOCKADDR_COMMON (sash_); /* Common data: address family etc. */ int sash_ifindex; /* Interface to use. */ diff --git a/sysdeps/unix/sysv/linux/neteconet/ec.h b/sysdeps/unix/sysv/linux/neteconet/ec.h index b07a107961..f3132f06ff 100644 --- a/sysdeps/unix/sysv/linux/neteconet/ec.h +++ b/sysdeps/unix/sysv/linux/neteconet/ec.h @@ -28,7 +28,7 @@ struct ec_addr unsigned char net; /* Network number. */ }; -struct sockaddr_ec +struct __attribute_struct_may_alias__ sockaddr_ec { __SOCKADDR_COMMON (sec_); unsigned char port; /* Port number. */ diff --git a/sysdeps/unix/sysv/linux/netiucv/iucv.h b/sysdeps/unix/sysv/linux/netiucv/iucv.h index f5fad81751..27151e8bbe 100644 --- a/sysdeps/unix/sysv/linux/netiucv/iucv.h +++ b/sysdeps/unix/sysv/linux/netiucv/iucv.h @@ -23,7 +23,7 @@ __BEGIN_DECLS -struct sockaddr_iucv +struct __attribute_struct_may_alias__ sockaddr_iucv { __SOCKADDR_COMMON (siucv_); unsigned short siucv_port; /* Reserved */ diff --git a/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h index 672c7c6bb8..dab466d881 100644 --- a/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/nios2/bits/struct_stat.h @@ -43,7 +43,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -88,7 +88,7 @@ struct stat #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/paths.h b/sysdeps/unix/sysv/linux/paths.h index 1342ab3a96..c764e208bc 100644 --- a/sysdeps/unix/sysv/linux/paths.h +++ b/sysdeps/unix/sysv/linux/paths.h @@ -68,7 +68,7 @@ /* Provide trailing slash, since mostly used for building pathnames. */ #define _PATH_DEV "/dev/" #define _PATH_TMP "/tmp/" -#define _PATH_VARDB "/var/db/" +#define _PATH_VARDB "/var/lib/misc/" #define _PATH_VARRUN "/var/run/" #define _PATH_VARTMP "/var/tmp/" diff --git a/sysdeps/unix/sysv/linux/pidfd_getpid.c b/sysdeps/unix/sysv/linux/pidfd_getpid.c index 8567b413dd..30025e5863 100644 --- a/sysdeps/unix/sysv/linux/pidfd_getpid.c +++ b/sysdeps/unix/sysv/linux/pidfd_getpid.c @@ -74,8 +74,10 @@ parse_fdinfo (const char *l, void *arg) /* Ignore invalid large values. */ if (INT_MULTIPLY_WRAPV (10, n, &n) - || INT_ADD_WRAPV (n, *l++ - '0', &n)) + || INT_ADD_WRAPV (n, *l - '0', &n)) return -1; + + l++; } /* -1 indicates that the process is terminated. */ diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/socket-constants.h b/sysdeps/unix/sysv/linux/powerpc/bits/socket-constants.h index 6be5055e65..0d3e095c5d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/socket-constants.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/socket-constants.h @@ -54,7 +54,7 @@ # define SO_TIMESTAMPNS_NEW 64 # define SO_TIMESTAMPING_NEW 65 -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # define SO_RCVTIMEO SO_RCVTIMEO_NEW # define SO_SNDTIMEO SO_SNDTIMEO_NEW # define SO_TIMESTAMP SO_TIMESTAMP_NEW diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h b/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h index f6328399cd..2cf331544a 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/struct_stat.h @@ -28,7 +28,7 @@ #if __WORDSIZE == 32 struct stat { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -79,13 +79,13 @@ struct stat # endif unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; # ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -122,7 +122,7 @@ struct stat64 # endif unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; # endif /* __USE_LARGEFILE64 */ diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_msqid_ds.h index 830629cd37..44ae08265d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_msqid_ds.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_msqid_ds.h @@ -26,7 +26,7 @@ The type `struct msg' is opaque. */ struct msqid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm msg_perm; /* structure describing operation permission */ diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h index 4370257557..ccee57c28b 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_semid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm sem_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_shmid_ds.h index da1b4b3c56..58145d0a5d 100644 --- a/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_shmid_ds.h +++ b/sysdeps/unix/sysv/linux/powerpc/bits/types/struct_shmid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm shm_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/powerpc/dl-auxv.h b/sysdeps/unix/sysv/linux/powerpc/dl-auxv.h index e47dac6af1..339b9f759c 100644 --- a/sysdeps/unix/sysv/linux/powerpc/dl-auxv.h +++ b/sysdeps/unix/sysv/linux/powerpc/dl-auxv.h @@ -16,5 +16,21 @@ License along with the GNU C Library; if not, see . */ +#ifndef __powerpc64__ +/* We have to detect 8xx processors, which have buggy dcbz implementations + * that cannot report page faults correctly. That requires reading SPR, + * which is a privileged operation. Fortunately 2.2.18 and later emulates + * PowerPC mfspr reads from the PVR register. */ +#define DL_PLATFORM_AUXV \ + { \ + unsigned pvr = 0; \ + asm ("mfspr %0, 287" : "=r" (pvr)); \ + if ((pvr & 0xffff0000) == 0x00500000) \ + GLRO(dl_cache_line_size) = 0; \ + else \ + GLRO(dl_cache_line_size) = auxv_values[AT_DCACHEBSIZE]; \ + } +#else #define DL_PLATFORM_AUXV \ GLRO(dl_cache_line_size) = auxv_values[AT_DCACHEBSIZE]; +#endif diff --git a/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed index 2927155f26..74bdbd9659 100644 --- a/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/powerpc/ldd-rewrite.sed @@ -8,5 +8,5 @@ # this works for /lib64/ld64.so.x and /lib/ld.so.x as input s_lib64_lib_ s_64\.so_\.so_ -s_^RTLDLIST=\(.*lib\)\(/[^/]*\)\(\.so\.[0-9.]*\)[[:blank:]]*$_RTLDLIST="\1\2\3 \1\264\3"_ +s_^RTLDLIST=\(.*lib\)\(/[^/]*\)\(\.so\.[0-9.]*\)[[:blank:]]*$_RTLDLIST="\1\2\3 \164\264\3"_ diff --git a/sysdeps/unix/sysv/linux/rseq-internal.h b/sysdeps/unix/sysv/linux/rseq-internal.h index 48eebc1e16..7ea935b4ad 100644 --- a/sysdeps/unix/sysv/linux/rseq-internal.h +++ b/sysdeps/unix/sysv/linux/rseq-internal.h @@ -25,15 +25,34 @@ #include #include +/* 32 is the initially required value for the area size. The + actually used rseq size may be less (20 bytes initially). */ +#define RSEQ_AREA_SIZE_INITIAL 32 +#define RSEQ_AREA_SIZE_INITIAL_USED 20 + +/* The variables are in .data.relro but are not yet write-protected. */ +extern unsigned int _rseq_size attribute_hidden; +extern ptrdiff_t _rseq_offset attribute_hidden; + #ifdef RSEQ_SIG static inline bool rseq_register_current_thread (struct pthread *self, bool do_rseq) { if (do_rseq) { + unsigned int size; +#if IS_IN (rtld) + /* Use the hidden symbol in ld.so. */ + size = _rseq_size; +#else + size = __rseq_size; +#endif + if (size < RSEQ_AREA_SIZE_INITIAL) + /* The initial implementation used only 20 bytes out of 32, + but still expected size 32. */ + size = RSEQ_AREA_SIZE_INITIAL; int ret = INTERNAL_SYSCALL_CALL (rseq, &self->rseq_area, - sizeof (self->rseq_area), - 0, RSEQ_SIG); + size, 0, RSEQ_SIG); if (!INTERNAL_SYSCALL_ERROR_P (ret)) return true; } diff --git a/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h b/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h index 9911c47bb2..e5c9024fb2 100644 --- a/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/s390/bits/struct_stat.h @@ -65,7 +65,7 @@ struct stat #else struct stat { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -166,7 +166,7 @@ struct stat64 # else struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ diff --git a/sysdeps/unix/sysv/linux/setrlimit.c b/sysdeps/unix/sysv/linux/setrlimit.c index 5dc7ba90ea..3be6f96f04 100644 --- a/sysdeps/unix/sysv/linux/setrlimit.c +++ b/sysdeps/unix/sysv/linux/setrlimit.c @@ -33,7 +33,6 @@ int __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlim) { -# ifdef __NR_prlimit64 struct rlimit64 rlim64; if (rlim->rlim_cur == RLIM_INFINITY) @@ -45,11 +44,7 @@ __setrlimit (enum __rlimit_resource resource, const struct rlimit *rlim) else rlim64.rlim_max = rlim->rlim_max; - int res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL); - if (res == 0 || errno != ENOSYS) - return res; -# endif - return INLINE_SYSCALL_CALL (setrlimit, resource, rlim); + return INLINE_SYSCALL_CALL (prlimit64, 0, resource, &rlim64, NULL); } libc_hidden_def (__setrlimit) diff --git a/sysdeps/unix/sysv/linux/setrlimit64.c b/sysdeps/unix/sysv/linux/setrlimit64.c index 9a0b9f262d..084700c335 100644 --- a/sysdeps/unix/sysv/linux/setrlimit64.c +++ b/sysdeps/unix/sysv/linux/setrlimit64.c @@ -37,36 +37,7 @@ int __setrlimit64 (enum __rlimit_resource resource, const struct rlimit64 *rlimits) { - int res; - -#ifdef __NR_prlimit64 - res = INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL); - if (res == 0 || errno != ENOSYS) - return res; -#endif - -/* The fallback code only makes sense if the platform supports - __NR_setrlimit. */ -#ifdef __NR_setrlimit -# if !__RLIM_T_MATCHES_RLIM64_T - struct rlimit rlimits32; - - if (rlimits->rlim_cur >= RLIM_INFINITY) - rlimits32.rlim_cur = RLIM_INFINITY; - else - rlimits32.rlim_cur = rlimits->rlim_cur; - if (rlimits->rlim_max >= RLIM_INFINITY) - rlimits32.rlim_max = RLIM_INFINITY; - else - rlimits32.rlim_max = rlimits->rlim_max; -# else -# define rlimits32 (*rlimits) -# endif - - res = INLINE_SYSCALL_CALL (setrlimit, resource, &rlimits32); -#endif - - return res; + return INLINE_SYSCALL_CALL (prlimit64, 0, resource, rlimits, NULL); } /* Alpha defines a versioned setrlimit{64}. */ #ifndef USE_VERSIONED_RLIMIT diff --git a/sysdeps/unix/sysv/linux/sh/Versions b/sysdeps/unix/sysv/linux/sh/Versions index 3ad702e165..931985b5d6 100644 --- a/sysdeps/unix/sysv/linux/sh/Versions +++ b/sysdeps/unix/sysv/linux/sh/Versions @@ -3,6 +3,7 @@ libc { GLIBC_2.2 { # functions used in other libraries __xstat64; __fxstat64; __lxstat64; + __fpscr_values; # a* alphasort64; diff --git a/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h index cbd4bc0f31..d47cd7be1e 100644 --- a/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/sh/bits/struct_stat.h @@ -28,7 +28,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -83,13 +83,13 @@ struct stat # else __ino64_t st_ino; /* File serial number. */ # endif -#endif /* __USE_TIME_BITS64 */ +#endif /* __USE_TIME64_REDIRECTS */ }; #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -125,7 +125,7 @@ struct stat64 unsigned long int st_ctimensec; /* Nsecs of last status change. */ # endif __ino64_t st_ino; /* File serial number. */ -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/sh/le/libc.abilist b/sysdeps/unix/sysv/linux/sh/le/libc.abilist index 449d92bbc5..d73efbafea 100644 --- a/sysdeps/unix/sysv/linux/sh/le/libc.abilist +++ b/sysdeps/unix/sysv/linux/sh/le/libc.abilist @@ -307,6 +307,7 @@ GLIBC_2.2 __finitel F GLIBC_2.2 __flbf F GLIBC_2.2 __fork F GLIBC_2.2 __fpending F +GLIBC_2.2 __fpscr_values D 0x8 GLIBC_2.2 __fpu_control D 0x4 GLIBC_2.2 __fpurge F GLIBC_2.2 __freadable F diff --git a/sysdeps/unix/sysv/linux/sh/sysdep.S b/sysdeps/unix/sysv/linux/sh/sysdep.S index d5d8c5e033..f356d02077 100644 --- a/sysdeps/unix/sysv/linux/sh/sysdep.S +++ b/sysdeps/unix/sysv/linux/sh/sysdep.S @@ -30,3 +30,14 @@ ENTRY (__syscall_error) #define __syscall_error __syscall_error_1 #include + + .data + .align 3 + .globl ___fpscr_values + .type ___fpscr_values, @object + .size ___fpscr_values, 8 +___fpscr_values: + .long 0 + .long 0x80000 +weak_alias (___fpscr_values, __fpscr_values) + diff --git a/sysdeps/unix/sysv/linux/sparc/bits/socket-constants.h b/sysdeps/unix/sysv/linux/sparc/bits/socket-constants.h index 59958611c4..e7a6b684cc 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/socket-constants.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/socket-constants.h @@ -54,7 +54,7 @@ # define SO_TIMESTAMPNS_NEW 0x0042 # define SO_TIMESTAMPING_NEW 0x0043 -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # define SO_RCVTIMEO SO_RCVTIMEO_NEW # define SO_SNDTIMEO SO_SNDTIMEO_NEW # define SO_TIMESTAMP SO_TIMESTAMP_NEW diff --git a/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h b/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h index 4e48634edc..fcab5f4804 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/struct_stat.h @@ -28,7 +28,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -79,13 +79,13 @@ struct stat # endif unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -#endif /* __USE_TIME_BITS64 */ +#endif /* __USE_TIME64_REDIRECTS */ }; #ifdef __USE_LARGEFILE64 struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -126,7 +126,7 @@ struct stat64 # endif unsigned long int __glibc_reserved4; unsigned long int __glibc_reserved5; -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_msqid_ds.h b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_msqid_ds.h index db783c28d4..ed8d47c9b6 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_msqid_ds.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_msqid_ds.h @@ -26,7 +26,7 @@ The type `struct msg' is opaque. */ struct msqid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm msg_perm; /* structure describing operation permission */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h index 1c8a3693db..b9e729b8b4 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_semid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm sem_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_shmid_ds.h b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_shmid_ds.h index 35a0cc36ab..7885d2ab25 100644 --- a/sysdeps/unix/sysv/linux/sparc/bits/types/struct_shmid_ds.h +++ b/sysdeps/unix/sysv/linux/sparc/bits/types/struct_shmid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a shared memory segment. */ struct shmid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm shm_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S index 748d25fcfe..c9cf9bb055 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc32/clone.S @@ -28,6 +28,9 @@ .text ENTRY (__clone) save %sp,-96,%sp + save %sp,-96,%sp + flushw + restore cfi_def_cfa_register(%fp) cfi_window_save cfi_register(%o7, %i7) diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S index e5ff2cf1a0..370d51fda2 100644 --- a/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S +++ b/sysdeps/unix/sysv/linux/sparc/sparc64/clone.S @@ -32,6 +32,9 @@ ENTRY (__clone) save %sp, -192, %sp + save %sp, -192, %sp + flushw + restore cfi_def_cfa_register(%fp) cfi_window_save cfi_register(%o7, %i7) diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c index e8ed2babb9..f57e92815e 100644 --- a/sysdeps/unix/sysv/linux/spawni.c +++ b/sysdeps/unix/sysv/linux/spawni.c @@ -449,13 +449,22 @@ __spawnix (int *pid, const char *file, caller to actually collect it. */ ec = args.err; if (ec > 0) - /* There still an unlikely case where the child is cancelled after - setting args.err, due to a positive error value. Also there is - possible pid reuse race (where the kernel allocated the same pid - to an unrelated process). Unfortunately due synchronization - issues where the kernel might not have the process collected - the waitpid below can not use WNOHANG. */ - __waitpid (new_pid, NULL, 0); + { + /* There still an unlikely case where the child is cancelled after + setting args.err, due to a positive error value. Also there is + possible pid reuse race (where the kernel allocated the same pid + to an unrelated process). Unfortunately due synchronization + issues where the kernel might not have the process collected + the waitpid below can not use WNOHANG. */ + __waitid (use_pidfd ? P_PIDFD : P_PID, + use_pidfd ? args.pidfd : new_pid, + NULL, + WEXITED); + /* For pidfd we need to also close the file descriptor for the case + where execve fails. */ + if (use_pidfd) + __close_nocancel_nostatus (args.pidfd); + } } else ec = errno; diff --git a/sysdeps/unix/sysv/linux/sys/epoll.h b/sysdeps/unix/sysv/linux/sys/epoll.h index 9b51e3bd14..fc8dce45c8 100644 --- a/sysdeps/unix/sysv/linux/sys/epoll.h +++ b/sysdeps/unix/sysv/linux/sys/epoll.h @@ -140,7 +140,7 @@ extern int epoll_pwait (int __epfd, struct epoll_event *__events, This function is a cancellation point and therefore not marked with __THROW. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int epoll_pwait2 (int __epfd, struct epoll_event *__events, int __maxevents, const struct timespec *__timeout, const __sigset_t *__ss) diff --git a/sysdeps/unix/sysv/linux/sys/prctl.h b/sysdeps/unix/sysv/linux/sys/prctl.h index b13b846261..79a9b31273 100644 --- a/sysdeps/unix/sysv/linux/sys/prctl.h +++ b/sysdeps/unix/sysv/linux/sys/prctl.h @@ -38,7 +38,7 @@ __BEGIN_DECLS /* Control process execution. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int prctl (int __option, ...) __THROW; #else # ifdef __REDIRECT diff --git a/sysdeps/unix/sysv/linux/sys/timerfd.h b/sysdeps/unix/sysv/linux/sys/timerfd.h index 19d0cbfae0..f66ece306a 100644 --- a/sysdeps/unix/sysv/linux/sys/timerfd.h +++ b/sysdeps/unix/sysv/linux/sys/timerfd.h @@ -47,7 +47,7 @@ extern int timerfd_settime (int __ufd, int __flags, const struct itimerspec *__utmr, struct itimerspec *__otmr) __THROW; -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # if defined(__REDIRECT_NTH) extern int __REDIRECT_NTH (timerfd_settime, (int __ufd, int __flags, @@ -62,7 +62,7 @@ extern int __REDIRECT_NTH (timerfd_settime, /* Return the next expiration time of UFD. */ extern int timerfd_gettime (int __ufd, struct itimerspec *__otmr) __THROW; -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # if defined(__REDIRECT_NTH) extern int __REDIRECT_NTH (timerfd_gettime, (int __ufd, struct itimerspec *__otmr), diff --git a/sysdeps/unix/sysv/linux/sys/timex.h b/sysdeps/unix/sysv/linux/sys/timex.h index 28ce022253..568748d767 100644 --- a/sysdeps/unix/sysv/linux/sys/timex.h +++ b/sysdeps/unix/sysv/linux/sys/timex.h @@ -54,7 +54,7 @@ struct ntptimeval __BEGIN_DECLS -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int adjtimex (struct timex *__ntx) __THROW __nonnull ((1)); extern int ntp_gettimex (struct ntptimeval *__ntv) __THROW __nonnull ((1)); diff --git a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c index aea74d3e04..62d654fbe3 100644 --- a/sysdeps/unix/sysv/linux/tcsetattr.c +++ b/sysdeps/unix/sysv/linux/tcsetattr.c @@ -44,7 +44,12 @@ int __tcsetattr (int fd, int optional_actions, const struct termios *termios_p) { struct __kernel_termios k_termios; + struct __kernel_termios k_termios_old; unsigned long int cmd; + int retval, old_retval; + + /* Preserve the previous termios state if we can. */ + old_retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios_old); switch (optional_actions) { @@ -75,7 +80,55 @@ __tcsetattr (int fd, int optional_actions, const struct termios *termios_p) memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0], __KERNEL_NCCS * sizeof (cc_t)); - return INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios); + retval = INLINE_SYSCALL (ioctl, 3, fd, cmd, &k_termios); + + /* The Linux kernel silently ignores the invalid c_cflag on pty. + We have to check it here, and return an error. But if some other + setting was successfully changed, POSIX requires us to report + success. */ + if ((retval == 0) && (old_retval == 0)) + { + int save = errno; + retval = INLINE_SYSCALL (ioctl, 3, fd, TCGETS, &k_termios); + if (retval) + { + /* We cannot verify if the setting is ok. We don't return + an error (?). */ + __set_errno (save); + retval = 0; + } + else if ((k_termios_old.c_oflag != k_termios.c_oflag) || + (k_termios_old.c_lflag != k_termios.c_lflag) || + (k_termios_old.c_line != k_termios.c_line) || + ((k_termios_old.c_iflag | IBAUD0) != (k_termios.c_iflag | IBAUD0))) + { + /* Some other setting was successfully changed, which + means we should not return an error. */ + __set_errno (save); + retval = 0; + } + else if ((k_termios_old.c_cflag & ~(PARENB | CREAD | CSIZE)) != + (k_termios.c_cflag & ~(PARENB | CREAD | CSIZE))) + { + /* Some other c_cflag setting was successfully changed, which + means we should not return an error. */ + __set_errno (save); + retval = 0; + } + else if ((termios_p->c_cflag & (PARENB | CREAD)) + != (k_termios.c_cflag & (PARENB | CREAD)) + || ((termios_p->c_cflag & CSIZE) + && (termios_p->c_cflag & CSIZE) + != (k_termios.c_cflag & CSIZE))) + { + /* It looks like the Linux kernel silently changed the + PARENB/CREAD/CSIZE bits in c_cflag. Report it as an + error. */ + __set_errno (EINVAL); + retval = -1; + } + } + return retval; } weak_alias (__tcsetattr, tcsetattr) libc_hidden_def (tcsetattr) diff --git a/sysdeps/unix/sysv/linux/tst-epoll.c b/sysdeps/unix/sysv/linux/tst-epoll.c index 3b38beae6e..545f506faa 100644 --- a/sysdeps/unix/sysv/linux/tst-epoll.c +++ b/sysdeps/unix/sysv/linux/tst-epoll.c @@ -22,7 +22,7 @@ #include #include #include -#include +#include #include #include @@ -97,8 +97,8 @@ test_epoll_basic (epoll_wait_check_t epoll_wait_check) xclose (fds[0][0]); xclose (fds[1][1]); - /* Wait some time so child is blocked on the syscall. */ - nanosleep (&(struct timespec) {0, 10000000}, NULL); + /* Wait until child is blocked on epoll_wait. */ + support_process_state_wait (p, support_process_state_sleeping); TEST_COMPARE (kill (p, SIGUSR1), 0); int e = epoll_wait_check (efd, &event, 1, 500000000, &ss); diff --git a/sysdeps/unix/sysv/linux/tst-linux-mremap1.c b/sysdeps/unix/sysv/linux/tst-linux-mremap1.c new file mode 100644 index 0000000000..408e8af2ab --- /dev/null +++ b/sysdeps/unix/sysv/linux/tst-linux-mremap1.c @@ -0,0 +1,63 @@ +/* Test mremap with MREMAP_DONTUNMAP. + Copyright (C) 2024 Free Software Foundation, Inc. + This file is part of the GNU C Library. + + The GNU C Library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 2.1 of the License, or (at your option) any later version. + + The GNU C Library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with the GNU C Library; if not, see + . */ + +#include +#include +#include +#include +#include +#include +#include + +static int +do_test (void) +{ + size_t old_size = getpagesize (); + size_t new_size = old_size; + char *old_addr = xmmap (NULL, old_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1); + old_addr[0] = 1; + old_addr[old_size - 1] = 2; + + /* Create an available 64-page mmap region. */ + size_t fixed_size = old_size * 64; + char *fixed_addr = xmmap (NULL, fixed_size, PROT_READ | PROT_WRITE, + MAP_PRIVATE | MAP_ANONYMOUS, -1); + xmunmap (fixed_addr, fixed_size); + + /* Add 3 * pagesize. */ + fixed_size += 3 * old_size; + + /* Test MREMAP_DONTUNMAP. It should return FIXED_ADDR created above. */ + char *new_addr = mremap (old_addr, old_size, new_size, + MREMAP_DONTUNMAP | MREMAP_MAYMOVE, + fixed_addr); + if (new_addr == MAP_FAILED) + return mremap_failure_exit (errno); + TEST_VERIFY_EXIT (fixed_addr == new_addr); + old_addr[0] = 3; + old_addr[old_size - 1] = 4; + new_addr[0] = 1; + new_addr[new_size - 1] = 2; + xmunmap (new_addr, new_size); + xmunmap (old_addr, old_size); + + return 0; +} + +#include diff --git a/sysdeps/unix/sysv/linux/tst-rseq.c b/sysdeps/unix/sysv/linux/tst-rseq.c index 2c90409ba0..08a9533130 100644 --- a/sysdeps/unix/sysv/linux/tst-rseq.c +++ b/sysdeps/unix/sysv/linux/tst-rseq.c @@ -29,6 +29,7 @@ # include # include # include +# include # include # include # include "tst-rseq.h" @@ -42,7 +43,8 @@ do_rseq_main_test (void) TEST_COMPARE (__rseq_flags, 0); TEST_VERIFY ((char *) __thread_pointer () + __rseq_offset == (char *) &pd->rseq_area); - TEST_COMPARE (__rseq_size, sizeof (pd->rseq_area)); + /* The current implementation only supports the initial size. */ + TEST_COMPARE (__rseq_size, 20); } static void @@ -52,6 +54,12 @@ do_rseq_test (void) { FAIL_UNSUPPORTED ("kernel does not support rseq, skipping test"); } + printf ("info: __rseq_size: %u\n", __rseq_size); + printf ("info: __rseq_offset: %td\n", __rseq_offset); + printf ("info: __rseq_flags: %u\n", __rseq_flags); + printf ("info: getauxval (AT_RSEQ_FEATURE_SIZE): %ld\n", + getauxval (AT_RSEQ_FEATURE_SIZE)); + printf ("info: getauxval (AT_RSEQ_ALIGN): %ld\n", getauxval (AT_RSEQ_ALIGN)); do_rseq_main_test (); } #else /* RSEQ_SIG */ diff --git a/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h b/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h index 21aa315d8d..810d6566f0 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h +++ b/sysdeps/unix/sysv/linux/x86/bits/struct_stat.h @@ -25,7 +25,7 @@ struct stat { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else __dev_t st_dev; /* Device. */ @@ -95,14 +95,14 @@ struct stat __ino64_t st_ino; /* File serial number. */ # endif # endif -#endif /* __USE_TIME_BITS64 */ +#endif /* __USE_TIME64_REDIRECTS */ }; #ifdef __USE_LARGEFILE64 /* Note stat64 has the same shape as stat for x86-64. */ struct stat64 { -# ifdef __USE_TIME_BITS64 +# ifdef __USE_TIME64_REDIRECTS # include # else __dev_t st_dev; /* Device. */ @@ -152,7 +152,7 @@ struct stat64 # else __ino64_t st_ino; /* File serial number. */ # endif -# endif /* __USE_TIME_BITS64 */ +# endif /* __USE_TIME64_REDIRECTS */ }; #endif diff --git a/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h b/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h index 9f3d170b65..81867c0316 100644 --- a/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h +++ b/sysdeps/unix/sysv/linux/x86/bits/types/struct_semid_ds.h @@ -23,7 +23,7 @@ /* Data structure describing a set of semaphores. */ struct semid_ds { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS # include #else struct ipc_perm sem_perm; /* operation permission struct */ diff --git a/sysdeps/unix/sysv/linux/x86_64/dl-cet.h b/sysdeps/unix/sysv/linux/x86_64/dl-cet.h index 1fe3133406..b4f7e6c9cd 100644 --- a/sysdeps/unix/sysv/linux/x86_64/dl-cet.h +++ b/sysdeps/unix/sysv/linux/x86_64/dl-cet.h @@ -92,9 +92,9 @@ dl_cet_ibt_enabled (void) # Pass GL(dl_x86_feature_1) to _dl_cet_setup_features.\n\ movl %edx, %edi\n\ # Align stack for the _dl_cet_setup_features call.\n\ - andq $-16, %rsp\n\ + and $-16, %" RSP_LP "\n\ call _dl_cet_setup_features\n\ # Restore %rax and %rsp from %r12 and %r13.\n\ - movq %r12, %rax\n\ - movq %r13, %rsp\n\ + mov %" R12_LP ", %" RAX_LP "\n\ + mov %" R13_LP ", %" RSP_LP "\n\ " diff --git a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed index ba1caf679b..49c0c7a3a8 100644 --- a/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed +++ b/sysdeps/unix/sysv/linux/x86_64/ldd-rewrite.sed @@ -1 +1 @@ -s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \2\4-x86-64\6 \2x32\4-x32\6"_ +s_^\(RTLDLIST=\)\(.*lib\)\(\|64\|x32\)\(/[^/]*\)\(-x86-64\|-x32\)\(\.so\.[0-9.]*\)[ ]*$_\1"\2\4\6 \264\4-x86-64\6 \2x32\4-x32\6"_ diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h index b9db8bc5be..645e85802f 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h +++ b/sysdeps/unix/sysv/linux/x86_64/x32/arch-syscall.h @@ -151,6 +151,7 @@ #define __NR_lsetxattr 1073742013 #define __NR_lstat 1073741830 #define __NR_madvise 1073741852 +#define __NR_map_shadow_stack 1073742277 #define __NR_mbind 1073742061 #define __NR_membarrier 1073742148 #define __NR_memfd_create 1073742143 diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/fixup-asm-unistd.h b/sysdeps/unix/sysv/linux/x86_64/x32/fixup-asm-unistd.h index 98124169e6..47fa8af4ce 100644 --- a/sysdeps/unix/sysv/linux/x86_64/x32/fixup-asm-unistd.h +++ b/sysdeps/unix/sysv/linux/x86_64/x32/fixup-asm-unistd.h @@ -15,6 +15,10 @@ License along with the GNU C Library; if not, see . */ +#ifndef __NR_map_shadow_stack +# define __NR_map_shadow_stack 1073742277 +#endif + /* X32 uses the same 64-bit syscall interface for set_thread_area. */ #ifndef __NR_set_thread_area # define __NR_set_thread_area 1073742029 diff --git a/sysdeps/x86/atomic-machine.h b/sysdeps/x86/atomic-machine.h index cfd395087b..807390b660 100644 --- a/sysdeps/x86/atomic-machine.h +++ b/sysdeps/x86/atomic-machine.h @@ -54,35 +54,26 @@ #define __arch_c_compare_and_exchange_val_8_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%" SEG_REG ":%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgb %b2, %1" \ + __asm __volatile ("lock\n" \ + "\tcmpxchgb %b2, %1" \ : "=a" (ret), "=m" (*mem) \ - : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_c_compare_and_exchange_val_16_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%" SEG_REG ":%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgw %w2, %1" \ + __asm __volatile ("lock\n" \ + "\tcmpxchgw %w2, %1" \ : "=a" (ret), "=m" (*mem) \ - : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval)); \ ret; }) #define __arch_c_compare_and_exchange_val_32_acq(mem, newval, oldval) \ ({ __typeof (*mem) ret; \ - __asm __volatile ("cmpl $0, %%" SEG_REG ":%P5\n\t" \ - "je 0f\n\t" \ - "lock\n" \ - "0:\tcmpxchgl %2, %1" \ + __asm __volatile ("lock\n" \ + "\tcmpxchgl %2, %1" \ : "=a" (ret), "=m" (*mem) \ - : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : BR_CONSTRAINT (newval), "m" (*mem), "0" (oldval)); \ ret; }) #ifdef __x86_64__ @@ -181,24 +172,20 @@ if (sizeof (*mem) == 1) \ __asm __volatile (lock "xaddb %b0, %1" \ : "=q" (__result), "=m" (*mem) \ - : "0" (__addval), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (__addval), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (lock "xaddw %w0, %1" \ : "=r" (__result), "=m" (*mem) \ - : "0" (__addval), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (__addval), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (lock "xaddl %0, %1" \ : "=r" (__result), "=m" (*mem) \ - : "0" (__addval), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "0" (__addval), "m" (*mem)); \ else if (__HAVE_64B_ATOMICS) \ __asm __volatile (lock "xaddq %q0, %1" \ : "=r" (__result), "=m" (*mem) \ : "0" ((int64_t) cast_to_integer (__addval)), \ - "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + "m" (*mem)); \ else \ __result = do_exchange_and_add_val_64_acq (pfx, (mem), __addval); \ __result; }) @@ -207,7 +194,7 @@ __sync_fetch_and_add (mem, value) #define __arch_exchange_and_add_cprefix \ - "cmpl $0, %%" SEG_REG ":%P4\n\tje 0f\n\tlock\n0:\t" + "lock\n\t" #define catomic_exchange_and_add(mem, value) \ __arch_exchange_and_add_body (__arch_exchange_and_add_cprefix, __arch_c, \ @@ -223,24 +210,20 @@ else if (sizeof (*mem) == 1) \ __asm __volatile (lock "addb %b1, %0" \ : "=m" (*mem) \ - : IBR_CONSTRAINT (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : IBR_CONSTRAINT (value), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (lock "addw %w1, %0" \ : "=m" (*mem) \ - : "ir" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "ir" (value), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (lock "addl %1, %0" \ : "=m" (*mem) \ - : "ir" (value), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "ir" (value), "m" (*mem)); \ else if (__HAVE_64B_ATOMICS) \ __asm __volatile (lock "addq %q1, %0" \ : "=m" (*mem) \ : "ir" ((int64_t) cast_to_integer (value)), \ - "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + "m" (*mem)); \ else \ do_add_val_64_acq (apfx, (mem), (value)); \ } while (0) @@ -249,7 +232,7 @@ __arch_add_body (LOCK_PREFIX, atomic, __arch, mem, value) #define __arch_add_cprefix \ - "cmpl $0, %%" SEG_REG ":%P3\n\tje 0f\n\tlock\n0:\t" + "lock\n\t" #define catomic_add(mem, value) \ __arch_add_body (__arch_add_cprefix, atomic, __arch_c, mem, value) @@ -308,23 +291,19 @@ if (sizeof (*mem) == 1) \ __asm __volatile (lock "incb %b0" \ : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (lock "incw %w0" \ : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (lock "incl %0" \ : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "m" (*mem)); \ else if (__HAVE_64B_ATOMICS) \ __asm __volatile (lock "incq %q0" \ : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "m" (*mem)); \ else \ do_add_val_64_acq (pfx, mem, 1); \ } while (0) @@ -332,7 +311,7 @@ #define atomic_increment(mem) __arch_increment_body (LOCK_PREFIX, __arch, mem) #define __arch_increment_cprefix \ - "cmpl $0, %%" SEG_REG ":%P2\n\tje 0f\n\tlock\n0:\t" + "lock\n\t" #define catomic_increment(mem) \ __arch_increment_body (__arch_increment_cprefix, __arch_c, mem) @@ -366,23 +345,19 @@ if (sizeof (*mem) == 1) \ __asm __volatile (lock "decb %b0" \ : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (lock "decw %w0" \ : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (lock "decl %0" \ : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "m" (*mem)); \ else if (__HAVE_64B_ATOMICS) \ __asm __volatile (lock "decq %q0" \ : "=m" (*mem) \ - : "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "m" (*mem)); \ else \ do_add_val_64_acq (pfx, mem, -1); \ } while (0) @@ -390,7 +365,7 @@ #define atomic_decrement(mem) __arch_decrement_body (LOCK_PREFIX, __arch, mem) #define __arch_decrement_cprefix \ - "cmpl $0, %%" SEG_REG ":%P2\n\tje 0f\n\tlock\n0:\t" + "lock\n\t" #define catomic_decrement(mem) \ __arch_decrement_body (__arch_decrement_cprefix, __arch_c, mem) @@ -472,29 +447,25 @@ if (sizeof (*mem) == 1) \ __asm __volatile (lock "andb %b1, %0" \ : "=m" (*mem) \ - : IBR_CONSTRAINT (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : IBR_CONSTRAINT (mask), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (lock "andw %w1, %0" \ : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "ir" (mask), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (lock "andl %1, %0" \ : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "ir" (mask), "m" (*mem)); \ else if (__HAVE_64B_ATOMICS) \ __asm __volatile (lock "andq %q1, %0" \ : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "ir" (mask), "m" (*mem)); \ else \ __atomic_link_error (); \ } while (0) #define __arch_cprefix \ - "cmpl $0, %%" SEG_REG ":%P3\n\tje 0f\n\tlock\n0:\t" + "lock\n\t" #define atomic_and(mem, mask) __arch_and_body (LOCK_PREFIX, mem, mask) @@ -506,23 +477,19 @@ if (sizeof (*mem) == 1) \ __asm __volatile (lock "orb %b1, %0" \ : "=m" (*mem) \ - : IBR_CONSTRAINT (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : IBR_CONSTRAINT (mask), "m" (*mem)); \ else if (sizeof (*mem) == 2) \ __asm __volatile (lock "orw %w1, %0" \ : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "ir" (mask), "m" (*mem)); \ else if (sizeof (*mem) == 4) \ __asm __volatile (lock "orl %1, %0" \ : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "ir" (mask), "m" (*mem)); \ else if (__HAVE_64B_ATOMICS) \ __asm __volatile (lock "orq %q1, %0" \ : "=m" (*mem) \ - : "ir" (mask), "m" (*mem), \ - "i" (offsetof (tcbhead_t, multiple_threads))); \ + : "ir" (mask), "m" (*mem)); \ else \ __atomic_link_error (); \ } while (0) diff --git a/sysdeps/x86/bits/floatn.h b/sysdeps/x86/bits/floatn.h index e661abaea4..b526fa4f37 100644 --- a/sysdeps/x86/bits/floatn.h +++ b/sysdeps/x86/bits/floatn.h @@ -28,7 +28,8 @@ support, for x86_64 and x86. */ #if (defined __x86_64__ \ ? __GNUC_PREREQ (4, 3) \ - : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) + : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))) \ + && !defined(__CUDACC__) && !defined(__ICC) # define __HAVE_FLOAT128 1 #else # define __HAVE_FLOAT128 0 diff --git a/sysdeps/x86/configure b/sysdeps/x86/configure index d28d9bcb29..04c6ba3e6c 100644 --- a/sysdeps/x86/configure +++ b/sysdeps/x86/configure @@ -139,8 +139,12 @@ libc_cv_have_x86_isa_level=4 libc_cv_have_x86_isa_level=3 #elif MINIMUM_X86_ISA_LEVEL == 2 libc_cv_have_x86_isa_level=2 -#else +#elif defined __x86_64__ libc_cv_have_x86_isa_level=baseline +#elif MINIMUM_X86_ISA_LEVEL == 1 +libc_cv_have_x86_isa_level=1 +#else +libc_cv_have_x86_isa_level=0 #endif EOF eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level` @@ -148,8 +152,10 @@ EOF fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: $libc_cv_have_x86_isa_level" >&5 printf "%s\n" "$libc_cv_have_x86_isa_level" >&6; } -else +elif test $base_machine = x86_64; then libc_cv_have_x86_isa_level=baseline +else + libc_cv_have_x86_isa_level=0 fi if test $libc_cv_have_x86_isa_level = baseline; then printf "%s\n" "#define MINIMUM_X86_ISA_LEVEL 1" >>confdefs.h diff --git a/sysdeps/x86/configure.ac b/sysdeps/x86/configure.ac index 5b0acd03d2..8a259d3971 100644 --- a/sysdeps/x86/configure.ac +++ b/sysdeps/x86/configure.ac @@ -96,14 +96,20 @@ libc_cv_have_x86_isa_level=4 libc_cv_have_x86_isa_level=3 #elif MINIMUM_X86_ISA_LEVEL == 2 libc_cv_have_x86_isa_level=2 -#else +#elif defined __x86_64__ libc_cv_have_x86_isa_level=baseline +#elif MINIMUM_X86_ISA_LEVEL == 1 +libc_cv_have_x86_isa_level=1 +#else +libc_cv_have_x86_isa_level=0 #endif EOF eval `${CC-cc} $CFLAGS $CPPFLAGS $ISAFLAG -I$srcdir -E conftest.c | grep libc_cv_have_x86_isa_level` rm -rf conftest*]) -else +elif test $base_machine = x86_64; then libc_cv_have_x86_isa_level=baseline +else + libc_cv_have_x86_isa_level=0 fi if test $libc_cv_have_x86_isa_level = baseline; then AC_DEFINE_UNQUOTED(MINIMUM_X86_ISA_LEVEL, 1) diff --git a/sysdeps/x86/isa-level.h b/sysdeps/x86/isa-level.h index 2c7f74212b..03c1fe2bf5 100644 --- a/sysdeps/x86/isa-level.h +++ b/sysdeps/x86/isa-level.h @@ -35,7 +35,17 @@ # define __X86_ISA_V1 0 #endif -#if __X86_ISA_V1 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 \ +#ifdef __x86_64__ +# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_16 +# define __GCC_HAVE_SYNC_COMPARE_AND_SWAP +# endif +#else +# ifdef __GCC_HAVE_SYNC_COMPARE_AND_SWAP_8 +# define __GCC_HAVE_SYNC_COMPARE_AND_SWAP +# endif +#endif + +#if __X86_ISA_V1 && defined __GCC_HAVE_SYNC_COMPARE_AND_SWAP \ && defined HAVE_X86_LAHF_SAHF && defined __POPCNT__ && defined __SSE3__ \ && defined __SSSE3__ && defined __SSE4_1__ && defined __SSE4_2__ /* NB: ISAs in x86-64 ISA level v2 are used. */ diff --git a/sysdeps/x86/readelflib.c b/sysdeps/x86/readelflib.c index 8ce65cdb65..fd633c097e 100644 --- a/sysdeps/x86/readelflib.c +++ b/sysdeps/x86/readelflib.c @@ -46,8 +46,11 @@ process_elf_file (const char *file_name, const char *lib, int *flag, break; /* Fall through. */ default: - error (0, 0, _("%s is for unknown machine %d.\n"), - file_name, elf_header->e_machine); + if (opt_verbose) + { + error (0, 0, _("%s is for unknown machine %d.\n"), + file_name, elf_header->e_machine); + } return 1; } diff --git a/sysdeps/x86/tst-cpu-features-supports.c b/sysdeps/x86/tst-cpu-features-supports.c index 93008dac70..0f43ef2b2d 100644 --- a/sysdeps/x86/tst-cpu-features-supports.c +++ b/sysdeps/x86/tst-cpu-features-supports.c @@ -65,7 +65,7 @@ do_test (int argc, char **argv) #endif fails += CHECK_FEATURE_ACTIVE (avx, AVX); fails += CHECK_FEATURE_ACTIVE (avx2, AVX2); -#if __GNUC_PREREQ (7, 0) +#if __GNUC_PREREQ (7, 0) && !__GNUC_PREREQ (15, 0) fails += CHECK_FEATURE_ACTIVE (avx5124fmaps, AVX512_4FMAPS); fails += CHECK_FEATURE_ACTIVE (avx5124vnniw, AVX512_4VNNIW); #endif @@ -92,14 +92,18 @@ do_test (int argc, char **argv) #if __GNUC_PREREQ (6, 0) fails += CHECK_FEATURE_ACTIVE (avx512bw, AVX512BW); fails += CHECK_FEATURE_ACTIVE (avx512cd, AVX512CD); +# if !__GNUC_PREREQ (15, 0) fails += CHECK_FEATURE_ACTIVE (avx512er, AVX512ER); +# endif fails += CHECK_FEATURE_ACTIVE (avx512dq, AVX512DQ); #endif #if __GNUC_PREREQ (5, 0) fails += CHECK_FEATURE_ACTIVE (avx512f, AVX512F); #endif #if __GNUC_PREREQ (6, 0) +# if !__GNUC_PREREQ (15, 0) fails += CHECK_FEATURE_ACTIVE (avx512pf, AVX512PF); +# endif fails += CHECK_FEATURE_ACTIVE (avx512vl, AVX512VL); #endif #if __GNUC_PREREQ (5, 0) @@ -148,7 +152,9 @@ do_test (int argc, char **argv) #endif fails += CHECK_FEATURE_ACTIVE (popcnt, POPCNT); #if __GNUC_PREREQ (11, 0) +# if !__GNUC_PREREQ (15, 0) fails += CHECK_FEATURE_ACTIVE (prefetchwt1, PREFETCHWT1); +# endif fails += CHECK_FEATURE_ACTIVE (ptwrite, PTWRITE); fails += CHECK_FEATURE_ACTIVE (rdpid, RDPID); fails += CHECK_FEATURE_ACTIVE (rdrnd, RDRAND); diff --git a/sysdeps/x86_64/dl-machine.h b/sysdeps/x86_64/dl-machine.h index ff5d45f7cb..899f56576f 100644 --- a/sysdeps/x86_64/dl-machine.h +++ b/sysdeps/x86_64/dl-machine.h @@ -139,37 +139,37 @@ elf_machine_runtime_setup (struct link_map *l, struct r_scope_elem *scope[], .globl _start\n\ .globl _dl_start_user\n\ _start:\n\ - movq %rsp, %rdi\n\ + mov %" RSP_LP ", %" RDI_LP "\n\ call _dl_start\n\ _dl_start_user:\n\ # Save the user entry point address in %r12.\n\ - movq %rax, %r12\n\ + mov %" RAX_LP ", %" R12_LP "\n\ # Save %rsp value in %r13.\n\ - movq %rsp, %r13\n\ + mov %" RSP_LP ", % " R13_LP "\n\ "\ RTLD_START_ENABLE_X86_FEATURES \ "\ # Read the original argument count.\n\ - movq (%rsp), %rdx\n\ + mov (%rsp), %" RDX_LP "\n\ # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\ # argc -> rsi\n\ - movq %rdx, %rsi\n\ + mov %" RDX_LP ", %" RSI_LP "\n\ # And align stack for the _dl_init call. \n\ - andq $-16, %rsp\n\ + and $-16, %" RSP_LP "\n\ # _dl_loaded -> rdi\n\ - movq _rtld_local(%rip), %rdi\n\ + mov _rtld_local(%rip), %" RDI_LP "\n\ # env -> rcx\n\ - leaq 16(%r13,%rdx,8), %rcx\n\ + lea 2*" LP_SIZE "(%r13,%rdx," LP_SIZE "), %" RCX_LP "\n\ # argv -> rdx\n\ - leaq 8(%r13), %rdx\n\ + lea " LP_SIZE "(%r13), %" RDX_LP "\n\ # Clear %rbp to mark outermost frame obviously even for constructors.\n\ xorl %ebp, %ebp\n\ # Call the function to run the initializers.\n\ call _dl_init\n\ # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\ - leaq _dl_fini(%rip), %rdx\n\ + lea _dl_fini(%rip), %" RDX_LP "\n\ # And make sure %rsp points to argc stored on the stack.\n\ - movq %r13, %rsp\n\ + mov %" R13_LP ", %" RSP_LP "\n\ # Jump to the user's entry point.\n\ jmp *%r12\n\ .previous\n\ @@ -234,8 +234,13 @@ elf_machine_plt_value (struct link_map *map, const ElfW(Rela) *reloc, /* Names of the architecture-specific auditing callback functions. */ +#ifdef __LP64__ #define ARCH_LA_PLTENTER x86_64_gnu_pltenter #define ARCH_LA_PLTEXIT x86_64_gnu_pltexit +#else +#define ARCH_LA_PLTENTER x32_gnu_pltenter +#define ARCH_LA_PLTEXIT x32_gnu_pltexit +#endif #endif /* !dl_machine_h */ diff --git a/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh b/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh index 46f1233757..0a9a164a3e 100755 --- a/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh +++ b/sysdeps/x86_64/tst-shstk-legacy-1e-static.sh @@ -26,7 +26,7 @@ ${common_objpfx}elf/tst-shstk-legacy-1e-static status=$? if test $status -eq 77; then exit 77 -elif test $status == 139; then +elif test $status -eq 139; then exit 0 else exit 1 diff --git a/sysdeps/x86_64/tst-shstk-legacy-1e.sh b/sysdeps/x86_64/tst-shstk-legacy-1e.sh index 31212453d9..3dec5623e4 100755 --- a/sysdeps/x86_64/tst-shstk-legacy-1e.sh +++ b/sysdeps/x86_64/tst-shstk-legacy-1e.sh @@ -28,7 +28,7 @@ ${test_program_prefix} \ status=$? if test $status -eq 77; then exit 77 -elif test $status == 139; then +elif test $status -eq 139; then exit 0 else exit 1 diff --git a/sysdeps/x86_64/tst-shstk-legacy-1g.sh b/sysdeps/x86_64/tst-shstk-legacy-1g.sh index e84087068e..249831e816 100755 --- a/sysdeps/x86_64/tst-shstk-legacy-1g.sh +++ b/sysdeps/x86_64/tst-shstk-legacy-1g.sh @@ -28,7 +28,7 @@ ${test_program_prefix} \ status=$? if test $status -eq 77; then exit 77 -elif test $status == 139; then +elif test $status -eq 139; then exit 0 else exit 1 diff --git a/sysdeps/x86_64/x32/dl-machine.h b/sysdeps/x86_64/x32/dl-machine.h deleted file mode 100644 index c35cee9261..0000000000 --- a/sysdeps/x86_64/x32/dl-machine.h +++ /dev/null @@ -1,76 +0,0 @@ -/* Machine-dependent ELF dynamic relocation inline functions. x32 version. - Copyright (C) 2012-2024 Free Software Foundation, Inc. - This file is part of the GNU C Library. - - The GNU C Library is free software; you can redistribute it and/or - modify it under the terms of the GNU Lesser General Public - License as published by the Free Software Foundation; either - version 2.1 of the License, or (at your option) any later version. - - The GNU C Library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Lesser General Public License for more details. - - You should have received a copy of the GNU Lesser General Public - License along with the GNU C Library; if not, see - . */ - -/* Must allow to be included more than once. - See #ifdef RESOLVE_MAP in sysdeps/x86_64/dl-machine.h. */ -#include - -#ifndef _X32_DL_MACHINE_H -#define _X32_DL_MACHINE_H - -#undef ARCH_LA_PLTENTER -#undef ARCH_LA_PLTEXIT -#undef RTLD_START - -/* Names of the architecture-specific auditing callback functions. */ -#define ARCH_LA_PLTENTER x32_gnu_pltenter -#define ARCH_LA_PLTEXIT x32_gnu_pltexit - -/* Initial entry point code for the dynamic linker. - The C function `_dl_start' is the real entry point; - its return value is the user program's entry point. */ -#define RTLD_START asm ("\n\ -.text\n\ - .p2align 4\n\ -.globl _start\n\ -.globl _dl_start_user\n\ -_start:\n\ - movl %esp, %edi\n\ - call _dl_start\n\ -_dl_start_user:\n\ - # Save the user entry point address in %r12.\n\ - movl %eax, %r12d\n\ - # Read the original argument count.\n\ - movl (%rsp), %edx\n\ - # Call _dl_init (struct link_map *main_map, int argc, char **argv, char **env)\n\ - # argc -> rsi\n\ - movl %edx, %esi\n\ - # Save %rsp value in %r13.\n\ - movl %esp, %r13d\n\ - # And align stack for the _dl_init call.\n\ - and $-16, %esp\n\ - # _dl_loaded -> rdi\n\ - movl _rtld_local(%rip), %edi\n\ - # env -> rcx\n\ - lea 8(%r13,%rdx,4), %ecx\n\ - # argv -> rdx\n\ - lea 4(%r13), %edx\n\ - # Clear %rbp to mark outermost frame obviously even for constructors.\n\ - xorl %ebp, %ebp\n\ - # Call the function to run the initializers.\n\ - call _dl_init\n\ - # Pass our finalizer function to the user in %rdx, as per ELF ABI.\n\ - lea _dl_fini(%rip), %edx\n\ - # And make sure %rsp points to argc stored on the stack.\n\ - movl %r13d, %esp\n\ - # Jump to the user's entry point.\n\ - jmp *%r12\n\ -.previous\n\ -"); - -#endif /* !_X32_DL_MACHINE_H */ diff --git a/sysvipc/sys/msg.h b/sysvipc/sys/msg.h index d0388b0522..4178ad9955 100644 --- a/sysvipc/sys/msg.h +++ b/sysvipc/sys/msg.h @@ -58,7 +58,7 @@ struct msgbuf __BEGIN_DECLS /* Message queue control operation. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int msgctl (int __msqid, int __cmd, struct msqid_ds *__buf) __THROW; #else # ifdef __REDIRECT_NTH diff --git a/sysvipc/sys/sem.h b/sysvipc/sys/sem.h index 5d9ec39296..812f1303b3 100644 --- a/sysvipc/sys/sem.h +++ b/sysvipc/sys/sem.h @@ -48,7 +48,7 @@ struct sembuf __BEGIN_DECLS /* Semaphore control operation. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int semctl (int __semid, int __semnum, int __cmd, ...) __THROW; #else # ifdef __REDIRECT_NTH @@ -68,7 +68,7 @@ extern int semop (int __semid, struct sembuf *__sops, size_t __nsops) __THROW; #ifdef __USE_GNU /* Operate on semaphore with timeout. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int semtimedop (int __semid, struct sembuf *__sops, size_t __nsops, const struct timespec *__timeout) __THROW; # else diff --git a/sysvipc/sys/shm.h b/sysvipc/sys/shm.h index 04191656d5..496e57ef45 100644 --- a/sysvipc/sys/shm.h +++ b/sysvipc/sys/shm.h @@ -46,7 +46,7 @@ __BEGIN_DECLS facility. The definition is found in XPG4.2. */ /* Shared memory control operation. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int shmctl (int __shmid, int __cmd, struct shmid_ds *__buf) __THROW; #else # ifdef __REDIRECT_NTH diff --git a/time/bits/types/struct_timespec.h b/time/bits/types/struct_timespec.h index 489e81136d..1141015f27 100644 --- a/time/bits/types/struct_timespec.h +++ b/time/bits/types/struct_timespec.h @@ -10,14 +10,14 @@ has nanoseconds instead of microseconds. */ struct timespec { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS __time64_t tv_sec; /* Seconds. */ #else __time_t tv_sec; /* Seconds. */ #endif #if __WORDSIZE == 64 \ || (defined __SYSCALL_WORDSIZE && __SYSCALL_WORDSIZE == 64) \ - || (__TIMESIZE == 32 && !defined __USE_TIME_BITS64) + || (__TIMESIZE == 32 && !defined __USE_TIME64_REDIRECTS) __syscall_slong_t tv_nsec; /* Nanoseconds. */ #else # if __BYTE_ORDER == __BIG_ENDIAN diff --git a/time/bits/types/struct_timeval.h b/time/bits/types/struct_timeval.h index 3466137c35..0c8e88c82c 100644 --- a/time/bits/types/struct_timeval.h +++ b/time/bits/types/struct_timeval.h @@ -7,7 +7,7 @@ microsecond but also has a range of years. */ struct timeval { -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS __time64_t tv_sec; /* Seconds. */ __suseconds64_t tv_usec; /* Microseconds. */ #else diff --git a/time/bits/types/time_t.h b/time/bits/types/time_t.h index 84d67f6ac3..00cde92c62 100644 --- a/time/bits/types/time_t.h +++ b/time/bits/types/time_t.h @@ -4,7 +4,7 @@ #include /* Returned by `time'. */ -#ifdef __USE_TIME_BITS64 +#ifdef __USE_TIME64_REDIRECTS typedef __time64_t time_t; #else typedef __time_t time_t; diff --git a/time/sys/time.h b/time/sys/time.h index c8708198a5..8c3d0c3022 100644 --- a/time/sys/time.h +++ b/time/sys/time.h @@ -63,7 +63,7 @@ struct timezone use localtime etc. instead. This function itself is semi-obsolete; most callers should use time or clock_gettime instead. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern int gettimeofday (struct timeval *__restrict __tv, void *__restrict __tz) __THROW __nonnull ((1)); #else @@ -77,7 +77,7 @@ extern int __REDIRECT_NTH (gettimeofday, (struct timeval *__restrict __tv, #endif #ifdef __USE_MISC -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Set the current time of day and timezone information. This call is restricted to the super-user. Setting the timezone in this way is obsolete, but we don't yet @@ -143,7 +143,7 @@ typedef enum __itimer_which __itimer_which_t; typedef int __itimer_which_t; #endif -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS /* Set *VALUE to the current setting of timer WHICH. Return 0 on success, -1 on errors. */ extern int getitimer (__itimer_which_t __which, @@ -184,7 +184,7 @@ extern int __REDIRECT_NTH (utimes, (const char *__file, #endif #ifdef __USE_MISC -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Same as `utimes', but does not follow symbolic links. */ extern int lutimes (const char *__file, const struct timeval __tvp[2]) __THROW __nonnull ((1)); @@ -207,7 +207,7 @@ extern int __REDIRECT_NTH (futimes, (int __fd, const struct timeval __tvp[2]), #endif #ifdef __USE_GNU -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Change the access time of FILE relative to FD to TVP[0] and the modification time of FILE to TVP[1]. If TVP is a null pointer, use the current time instead. Returns 0 on success, -1 on errors. */ diff --git a/time/time.h b/time/time.h index 1609aaeffa..3785dc608f 100644 --- a/time/time.h +++ b/time/time.h @@ -71,7 +71,7 @@ __BEGIN_DECLS The result / CLOCKS_PER_SEC is program time in seconds. */ extern clock_t clock (void) __THROW; -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS /* Return the current time and put it in *TIMER if TIMER is not NULL. */ extern time_t time (time_t *__timer) __THROW; @@ -127,7 +127,7 @@ extern char *strptime_l (const char *__restrict __s, #endif -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS /* Return the `struct tm' representation of *TIMER in Universal Coordinated Time (aka Greenwich Mean Time). */ extern struct tm *gmtime (const time_t *__timer) __THROW; @@ -149,7 +149,7 @@ extern struct tm *__REDIRECT_NTH (localtime, (const time_t *__timer), #if defined __USE_POSIX || __GLIBC_USE (ISOC2X) -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Return the `struct tm' representation of *TIMER in UTC, using *TP to store the result. */ extern struct tm *gmtime_r (const time_t *__restrict __timer, @@ -180,7 +180,7 @@ extern struct tm*__REDIRECT_NTH (localtime_r, (const time_t *__restrict __t, extern char *asctime (const struct tm *__tp) __THROW; /* Equivalent to `asctime (localtime (timer))'. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern char *ctime (const time_t *__timer) __THROW; #else # ifdef __REDIRECT_NTH @@ -199,7 +199,7 @@ extern char *asctime_r (const struct tm *__restrict __tp, char *__restrict __buf) __THROW; /* Equivalent to `asctime_r (localtime_r (timer, *TMP*), buf)'. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS extern char *ctime_r (const time_t *__restrict __timer, char *__restrict __buf) __THROW; #else @@ -242,7 +242,7 @@ extern long int timezone; #if defined __USE_MISC || __GLIBC_USE (ISOC2X) -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Like `mktime', but for TP represents Universal Time, not local time. */ extern time_t timegm (struct tm *__tp) __THROW; # else @@ -259,7 +259,7 @@ extern time_t __REDIRECT_NTH (timegm, (struct tm *__tp), __timegm64); /* Miscellaneous functions many Unices inherited from the public domain localtime package. These are included only for compatibility. */ -#ifndef __USE_TIME_BITS64 +#ifndef __USE_TIME64_REDIRECTS /* Another name for `mktime'. */ extern time_t timelocal (struct tm *__tp) __THROW; #else @@ -274,7 +274,7 @@ extern int dysize (int __year) __THROW __attribute__ ((__const__)); #ifdef __USE_POSIX199309 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Pause execution for a number of nanoseconds. This function is a cancellation point and therefore not marked with @@ -320,7 +320,7 @@ extern int __REDIRECT_NTH (clock_settime, (clockid_t __clock_id, const struct This function is a cancellation point and therefore not marked with __THROW. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int clock_nanosleep (clockid_t __clock_id, int __flags, const struct timespec *__req, struct timespec *__rem); @@ -349,7 +349,7 @@ extern int timer_create (clockid_t __clock_id, extern int timer_delete (timer_t __timerid) __THROW; /* Set timer TIMERID to VALUE, returning old value in OVALUE. */ -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS extern int timer_settime (timer_t __timerid, int __flags, const struct itimerspec *__restrict __value, struct itimerspec *__restrict __ovalue) __THROW; @@ -379,7 +379,7 @@ extern int timer_getoverrun (timer_t __timerid) __THROW; #ifdef __USE_ISOC11 -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Set TS to calendar time based in time base BASE. */ extern int timespec_get (struct timespec *__ts, int __base) __THROW __nonnull ((1)); @@ -395,7 +395,7 @@ extern int __REDIRECT_NTH (timespec_get, (struct timespec *__ts, int __base), #if __GLIBC_USE (ISOC2X) -# ifndef __USE_TIME_BITS64 +# ifndef __USE_TIME64_REDIRECTS /* Set TS to resolution of time base BASE. */ extern int timespec_getres (struct timespec *__ts, int __base) __THROW; diff --git a/wcsmbs/Makefile b/wcsmbs/Makefile index 65173e28aa..6eb38c2dcd 100644 --- a/wcsmbs/Makefile +++ b/wcsmbs/Makefile @@ -160,6 +160,7 @@ tests := \ test-wcsncmp \ test-wcsncpy \ test-wcsnlen \ + test-wcsnlen-nonarray \ test-wcspbrk \ test-wcsrchr \ test-wcsspn \ @@ -204,6 +205,10 @@ tests := \ wcsmbs-tst1 \ # tests +# This test runs for a long time. +xtests += test-wcsncmp-nonarray + + include ../Rules ifeq ($(run-built-tests),yes) diff --git a/wcsmbs/bits/wchar2.h b/wcsmbs/bits/wchar2.h index 49f19bca19..c863b60ec2 100644 --- a/wcsmbs/bits/wchar2.h +++ b/wcsmbs/bits/wchar2.h @@ -59,18 +59,18 @@ __NTH (wmemset (wchar_t *__s, wchar_t __c, size_t __n)) __fortify_function wchar_t * __NTH (wcscpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { - size_t sz = __glibc_objsize (__dest); - if (sz != (size_t) -1) - return __wcscpy_chk (__dest, __src, sz / sizeof (wchar_t)); + size_t __sz = __glibc_objsize (__dest); + if (__sz != (size_t) -1) + return __wcscpy_chk (__dest, __src, __sz / sizeof (wchar_t)); return __wcscpy_alias (__dest, __src); } __fortify_function wchar_t * __NTH (wcpcpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { - size_t sz = __glibc_objsize (__dest); - if (sz != (size_t) -1) - return __wcpcpy_chk (__dest, __src, sz / sizeof (wchar_t)); + size_t __sz = __glibc_objsize (__dest); + if (__sz != (size_t) -1) + return __wcpcpy_chk (__dest, __src, __sz / sizeof (wchar_t)); return __wcpcpy_alias (__dest, __src); } @@ -95,9 +95,9 @@ __NTH (wcpncpy (wchar_t *__restrict __dest, const wchar_t *__restrict __src, __fortify_function wchar_t * __NTH (wcscat (wchar_t *__restrict __dest, const wchar_t *__restrict __src)) { - size_t sz = __glibc_objsize (__dest); - if (sz != (size_t) -1) - return __wcscat_chk (__dest, __src, sz / sizeof (wchar_t)); + size_t __sz = __glibc_objsize (__dest); + if (__sz != (size_t) -1) + return __wcscat_chk (__dest, __src, __sz / sizeof (wchar_t)); return __wcscat_alias (__dest, __src); } @@ -105,9 +105,9 @@ __fortify_function wchar_t * __NTH (wcsncat (wchar_t *__restrict __dest, const wchar_t *__restrict __src, size_t __n)) { - size_t sz = __glibc_objsize (__dest); - if (sz != (size_t) -1) - return __wcsncat_chk (__dest, __src, __n, sz / sizeof (wchar_t)); + size_t __sz = __glibc_objsize (__dest); + if (__sz != (size_t) -1) + return __wcsncat_chk (__dest, __src, __n, __sz / sizeof (wchar_t)); return __wcsncat_alias (__dest, __src, __n); } @@ -144,10 +144,10 @@ __fortify_function int __NTH (swprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, ...)) { - size_t sz = __glibc_objsize (__s); - if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) + size_t __sz = __glibc_objsize (__s); + if (__sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __swprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - sz / sizeof (wchar_t), __fmt, __va_arg_pack ()); + __sz / sizeof (wchar_t), __fmt, __va_arg_pack ()); return __swprintf_alias (__s, __n, __fmt, __va_arg_pack ()); } #elif !defined __cplusplus @@ -163,10 +163,10 @@ __fortify_function int __NTH (vswprintf (wchar_t *__restrict __s, size_t __n, const wchar_t *__restrict __fmt, __gnuc_va_list __ap)) { - size_t sz = __glibc_objsize (__s); - if (sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) + size_t __sz = __glibc_objsize (__s); + if (__sz != (size_t) -1 || __USE_FORTIFY_LEVEL > 1) return __vswprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1, - sz / sizeof (wchar_t), __fmt, __ap); + __sz / sizeof (wchar_t), __fmt, __ap); return __vswprintf_alias (__s, __n, __fmt, __ap); } @@ -210,25 +210,25 @@ vfwprintf (__FILE *__restrict __stream, __fortify_function __wur wchar_t * fgetws (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { - size_t sz = __glibc_objsize (__s); - if (__glibc_safe_or_unknown_len (__n, sizeof (wchar_t), sz)) + size_t __sz = __glibc_objsize (__s); + if (__glibc_safe_or_unknown_len (__n, sizeof (wchar_t), __sz)) return __fgetws_alias (__s, __n, __stream); - if (__glibc_unsafe_len (__n, sizeof (wchar_t), sz)) - return __fgetws_chk_warn (__s, sz / sizeof (wchar_t), __n, __stream); - return __fgetws_chk (__s, sz / sizeof (wchar_t), __n, __stream); + if (__glibc_unsafe_len (__n, sizeof (wchar_t), __sz)) + return __fgetws_chk_warn (__s, __sz / sizeof (wchar_t), __n, __stream); + return __fgetws_chk (__s, __sz / sizeof (wchar_t), __n, __stream); } #ifdef __USE_GNU __fortify_function __wur wchar_t * fgetws_unlocked (wchar_t *__restrict __s, int __n, __FILE *__restrict __stream) { - size_t sz = __glibc_objsize (__s); - if (__glibc_safe_or_unknown_len (__n, sizeof (wchar_t), sz)) + size_t __sz = __glibc_objsize (__s); + if (__glibc_safe_or_unknown_len (__n, sizeof (wchar_t), __sz)) return __fgetws_unlocked_alias (__s, __n, __stream); - if (__glibc_unsafe_len (__n, sizeof (wchar_t), sz)) - return __fgetws_unlocked_chk_warn (__s, sz / sizeof (wchar_t), __n, + if (__glibc_unsafe_len (__n, sizeof (wchar_t), __sz)) + return __fgetws_unlocked_chk_warn (__s, __sz / sizeof (wchar_t), __n, __stream); - return __fgetws_unlocked_chk (__s, sz / sizeof (wchar_t), __n, __stream); + return __fgetws_unlocked_chk (__s, __sz / sizeof (wchar_t), __n, __stream); } #endif diff --git a/wcsmbs/test-wcsncmp-nonarray.c b/wcsmbs/test-wcsncmp-nonarray.c new file mode 100644 index 0000000000..1ad9ebd8fd --- /dev/null +++ b/wcsmbs/test-wcsncmp-nonarray.c @@ -0,0 +1,5 @@ +#include +#define TEST_IDENTIFIER wcsncmp +#define TEST_NAME "wcsncmp" +typedef wchar_t CHAR; +#include "../string/test-Xncmp-nonarray.c" diff --git a/wcsmbs/test-wcsnlen-nonarray.c b/wcsmbs/test-wcsnlen-nonarray.c new file mode 100644 index 0000000000..a4b21fecd3 --- /dev/null +++ b/wcsmbs/test-wcsnlen-nonarray.c @@ -0,0 +1,5 @@ +#include +#define TEST_IDENTIFIER wcsnlen +#define TEST_NAME "wcsnlen" +typedef wchar_t CHAR; +#include "../string/test-Xnlen-nonarray.c"