diff options
Diffstat (limited to 'libc/sysdeps/unix/sysv/linux')
15 files changed, 115 insertions, 195 deletions
diff --git a/libc/sysdeps/unix/sysv/linux/i386/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/i386/nptl/libm.abilist index 401a2c6dd..c185f0b20 100644 --- a/libc/sysdeps/unix/sysv/linux/i386/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/i386/nptl/libm.abilist @@ -396,6 +396,11 @@ GLIBC_2.15 __yn_finite F __ynf_finite F __ynl_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F GLIBC_2.2 GLIBC_2.2 A __expl F diff --git a/libc/sysdeps/unix/sysv/linux/kernel-features.h b/libc/sysdeps/unix/sysv/linux/kernel-features.h index 8fdff7e38..ccd4c5918 100644 --- a/libc/sysdeps/unix/sysv/linux/kernel-features.h +++ b/libc/sysdeps/unix/sysv/linux/kernel-features.h @@ -221,3 +221,9 @@ #if defined __x86_64__ && __LINUX_KERNEL_VERSION >= 0x030100 # define __ASSUME_GETCPU_SYSCALL 1 #endif + +/* 2.6.29 removed the XFS restricted_chown sysctl, so it is pointless looking + for it in newer kernels. */ +#if __LINUX_KERNEL_VERSION >= 0x02061d +# define __ASSUME_XFS_RESTRICTED_CHOWN 1 +#endif diff --git a/libc/sysdeps/unix/sysv/linux/libc_fatal.c b/libc/sysdeps/unix/sysv/linux/libc_fatal.c index d4f646643..9b69562bc 100644 --- a/libc/sysdeps/unix/sysv/linux/libc_fatal.c +++ b/libc/sysdeps/unix/sysv/linux/libc_fatal.c @@ -1,4 +1,5 @@ -/* Copyright (C) 1993-2013 Free Software Foundation, Inc. +/* Catastrophic failure reports. Linux version. + Copyright (C) 1993-2013 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 @@ -15,198 +16,55 @@ License along with the GNU C Library; if not, see <http://www.gnu.org/licenses/>. */ -#include <atomic.h> #include <errno.h> +#include <execinfo.h> #include <fcntl.h> -#include <ldsodefs.h> -#include <paths.h> -#include <stdarg.h> -#include <stdbool.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sysdep.h> -#include <unistd.h> +#include <not-cancel.h> #include <sys/mman.h> -#include <sys/syslog.h> -#include <execinfo.h> +#include <sys/uio.h> #include <gnu/option-groups.h> -/* Abort with an error message. */ -#include <not-cancel.h> - -#ifdef FATAL_PREPARE_INCLUDE -#include FATAL_PREPARE_INCLUDE -#endif - -struct str_list +static bool +writev_for_fatal (int fd, const struct iovec *iov, size_t niov, size_t total) { - const char *str; - size_t len; - struct str_list *next; -}; - + INTERNAL_SYSCALL_DECL (err); + ssize_t cnt; + do + cnt = INTERNAL_SYSCALL (writev, err, 3, fd, iov, niov); + while (INTERNAL_SYSCALL_ERROR_P (cnt, err) + && INTERNAL_SYSCALL_ERRNO (cnt, err) == EINTR); + return cnt == total; +} +#define WRITEV_FOR_FATAL writev_for_fatal -/* Abort with an error message. */ -void -__libc_message (int do_abort, const char *fmt, ...) +static void +backtrace_and_maps (int do_abort, bool written, int fd) { - va_list ap; - va_list ap_copy; - int fd = -1; - - va_start (ap, fmt); - va_copy (ap_copy, ap); - -#ifdef FATAL_PREPARE - FATAL_PREPARE; -#endif - - /* Open a descriptor for /dev/tty unless the user explicitly - requests errors on standard error. */ - const char *on_2 = __libc_secure_getenv ("LIBC_FATAL_STDERR_"); - if (on_2 == NULL || *on_2 == '\0') - fd = open_not_cancel_2 (_PATH_TTY, O_RDWR | O_NOCTTY | O_NDELAY); - - if (fd == -1) - fd = STDERR_FILENO; - - struct str_list *list = NULL; - int nlist = 0; - - const char *cp = fmt; - while (*cp != '\0') - { - /* Find the next "%s" or the end of the string. */ - const char *next = cp; - while (next[0] != '%' || next[1] != 's') - { - next = __strchrnul (next + 1, '%'); - - if (next[0] == '\0') - break; - } - - /* Determine what to print. */ - const char *str; - size_t len; - if (cp[0] == '%' && cp[1] == 's') - { - str = va_arg (ap, const char *); - len = strlen (str); - cp += 2; - } - else - { - str = cp; - len = next - cp; - cp = next; - } - - struct str_list *newp = alloca (sizeof (struct str_list)); - newp->str = str; - newp->len = len; - newp->next = list; - list = newp; - ++nlist; - } - - bool written = false; - if (nlist > 0) - { - struct iovec *iov = alloca (nlist * sizeof (struct iovec)); - ssize_t total = 0; - - for (int cnt = nlist - 1; cnt >= 0; --cnt) - { - iov[cnt].iov_base = (void *) list->str; - iov[cnt].iov_len = list->len; - total += list->len; - list = list->next; - } - - INTERNAL_SYSCALL_DECL (err); - ssize_t cnt; - do - cnt = INTERNAL_SYSCALL (writev, err, 3, fd, iov, nlist); - while (INTERNAL_SYSCALL_ERROR_P (cnt, err) - && INTERNAL_SYSCALL_ERRNO (cnt, err) == EINTR); - - if (cnt == total) - written = true; - - if (do_abort) - { - total = ((total + 1 + GLRO(dl_pagesize) - 1) - & ~(GLRO(dl_pagesize) - 1)); - struct abort_msg_s *buf = __mmap (NULL, total, - PROT_READ | PROT_WRITE, - MAP_ANON | MAP_PRIVATE, -1, 0); - if (__builtin_expect (buf != MAP_FAILED, 1)) - { - buf->size = total; - char *wp = buf->msg; - for (int cnt = 0; cnt < nlist; ++cnt) - wp = mempcpy (wp, iov[cnt].iov_base, iov[cnt].iov_len); - *wp = '\0'; - - /* We have to free the old buffer since the application might - catch the SIGABRT signal. */ - struct abort_msg_s *old = atomic_exchange_acq (&__abort_msg, - buf); - if (old != NULL) - __munmap (old, old->size); - } - } - } - - va_end (ap); - - /* If we had no success writing the message, use syslog. */ - if (! written) - vsyslog (LOG_ERR, fmt, ap_copy); - - va_end (ap_copy); - - if (do_abort) - { #if __OPTION_EGLIBC_BACKTRACE - if (do_abort > 1 && written) - { - void *addrs[64]; + if (do_abort > 1 && written) + { + void *addrs[64]; #define naddrs (sizeof (addrs) / sizeof (addrs[0])) - int n = __backtrace (addrs, naddrs); - if (n > 2) - { + int n = __backtrace (addrs, naddrs); + if (n > 2) + { #define strnsize(str) str, strlen (str) #define writestr(str) write_not_cancel (fd, str) - writestr (strnsize ("======= Backtrace: =========\n")); - __backtrace_symbols_fd (addrs + 1, n - 1, fd); - - writestr (strnsize ("======= Memory map: ========\n")); - int fd2 = open_not_cancel_2 ("/proc/self/maps", O_RDONLY); - char buf[1024]; - ssize_t n2; - while ((n2 = read_not_cancel (fd2, buf, sizeof (buf))) > 0) - if (write_not_cancel (fd, buf, n2) != n2) - break; - close_not_cancel_no_status (fd2); - } - } -#endif /* __OPTION_EGLIBC_BACKTRACE */ - - /* Terminate the process. */ - abort (); + writestr (strnsize ("======= Backtrace: =========\n")); + __backtrace_symbols_fd (addrs + 1, n - 1, fd); + + writestr (strnsize ("======= Memory map: ========\n")); + int fd2 = open_not_cancel_2 ("/proc/self/maps", O_RDONLY); + char buf[1024]; + ssize_t n2; + while ((n2 = read_not_cancel (fd2, buf, sizeof (buf))) > 0) + if (write_not_cancel (fd, buf, n2) != n2) + break; + close_not_cancel_no_status (fd2); + } } +#endif /* __OPTION_EGLIBC_BACKTRACE */ } +#define BEFORE_ABORT backtrace_and_maps - -void -__libc_fatal (message) - const char *message; -{ - /* The loop is added only to keep gcc happy. */ - while (1) - __libc_message (1, "%s", message); -} -libc_hidden_def (__libc_fatal) +#include <sysdeps/posix/libc_fatal.c> diff --git a/libc/sysdeps/unix/sysv/linux/pathconf.c b/libc/sysdeps/unix/sysv/linux/pathconf.c index de91a4541..723d23453 100644 --- a/libc/sysdeps/unix/sysv/linux/pathconf.c +++ b/libc/sysdeps/unix/sysv/linux/pathconf.c @@ -289,11 +289,16 @@ __statfs_chown_restricted (int result, const struct statfs *fsbuf) return -1; } +#if __ASSUME_XFS_RESTRICTED_CHOWN + return 1; +#else int fd; + int save_errno; long int retval = 1; switch (fsbuf->f_type) { case XFS_SUPER_MAGIC: + save_errno = errno; /* Read the value from /proc/sys/fs/xfs/restrict_chown. If we cannot read it default to assume the restriction is in place. */ fd = open_not_cancel_2 ("/proc/sys/fs/xfs/restrict_chown", O_RDONLY); @@ -306,6 +311,7 @@ __statfs_chown_restricted (int result, const struct statfs *fsbuf) close_not_cancel_no_status (fd); } + __set_errno (save_errno); break; default: @@ -313,4 +319,5 @@ __statfs_chown_restricted (int result, const struct statfs *fsbuf) } return retval; +#endif } diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libm.abilist index 620aff9e9..76a4ba31d 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libm.abilist @@ -397,6 +397,11 @@ GLIBC_2.15 __yn_finite F __ynf_finite F __ynl_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F GLIBC_2.2 GLIBC_2.2 A feclearexcept F diff --git a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libm.abilist index 89422ab9f..d309a6fa1 100644 --- a/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libm.abilist @@ -81,6 +81,11 @@ GLIBC_2.15 __yn_finite F __ynf_finite F __ynl_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F GLIBC_2.3 GLIBC_2.3 A _LIB_VERSION D 0x4 diff --git a/libc/sysdeps/unix/sysv/linux/s390/bits/statfs.h b/libc/sysdeps/unix/sysv/linux/s390/bits/statfs.h index ff54607fa..91dde1533 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/bits/statfs.h +++ b/libc/sysdeps/unix/sysv/linux/s390/bits/statfs.h @@ -23,8 +23,8 @@ struct statfs { - int f_type; - int f_bsize; + unsigned int f_type; + unsigned int f_bsize; #ifndef __USE_FILE_OFFSET64 __fsblkcnt_t f_blocks; __fsblkcnt_t f_bfree; @@ -39,27 +39,27 @@ struct statfs __fsfilcnt64_t f_ffree; #endif __fsid_t f_fsid; - int f_namelen; - int f_frsize; - int f_flags; - int f_spare[4]; + unsigned int f_namelen; + unsigned int f_frsize; + unsigned int f_flags; + unsigned int f_spare[4]; }; #ifdef __USE_LARGEFILE64 struct statfs64 { - int f_type; - int f_bsize; + unsigned int f_type; + unsigned int f_bsize; __fsblkcnt64_t f_blocks; __fsblkcnt64_t f_bfree; __fsblkcnt64_t f_bavail; __fsfilcnt64_t f_files; __fsfilcnt64_t f_ffree; __fsid_t f_fsid; - int f_namelen; - int f_frsize; - int f_flags; - int f_spare[4]; + unsigned int f_namelen; + unsigned int f_frsize; + unsigned int f_flags; + unsigned int f_spare[4]; }; #endif diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libm.abilist index ae8af50eb..f836c90d9 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libm.abilist @@ -393,6 +393,11 @@ GLIBC_2.15 __yn_finite F __ynf_finite F __ynl_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F GLIBC_2.2 GLIBC_2.2 A fedisableexcept F diff --git a/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libm.abilist index acf4d6851..a0891ad25 100644 --- a/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libm.abilist @@ -81,6 +81,11 @@ GLIBC_2.15 __yn_finite F __ynf_finite F __ynl_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F GLIBC_2.2 GLIBC_2.2 A _LIB_VERSION D 0x4 diff --git a/libc/sysdeps/unix/sysv/linux/sh/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/sh/nptl/libm.abilist index d85192910..92821fdbb 100644 --- a/libc/sysdeps/unix/sysv/linux/sh/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/sh/nptl/libm.abilist @@ -54,6 +54,10 @@ GLIBC_2.15 __y1f_finite F __yn_finite F __ynf_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F GLIBC_2.2 GLIBC_2.2 A _LIB_VERSION D 0x4 diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libm.abilist index 4c6ec6b71..9a1fcb1b4 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libm.abilist @@ -388,6 +388,11 @@ GLIBC_2.15 __yn_finite F __ynf_finite F __ynl_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F GLIBC_2.2 GLIBC_2.2 A feclearexcept F diff --git a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libm.abilist index 22fb92aec..2b41d3422 100644 --- a/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libm.abilist @@ -81,6 +81,11 @@ GLIBC_2.15 __yn_finite F __ynf_finite F __ynl_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F GLIBC_2.2 GLIBC_2.2 A _LIB_VERSION D 0x4 diff --git a/libc/sysdeps/unix/sysv/linux/sys/fsuid.h b/libc/sysdeps/unix/sysv/linux/sys/fsuid.h index f844a5ff0..7590313b1 100644 --- a/libc/sysdeps/unix/sysv/linux/sys/fsuid.h +++ b/libc/sysdeps/unix/sysv/linux/sys/fsuid.h @@ -25,10 +25,10 @@ __BEGIN_DECLS /* Change uid used for file access control to UID, without affecting other privileges (such as who can send signals at the process). */ -extern int setfsuid (__uid_t __uid) __THROW __wur; +extern int setfsuid (__uid_t __uid) __THROW; /* Ditto for group id. */ -extern int setfsgid (__gid_t __gid) __THROW __wur; +extern int setfsgid (__gid_t __gid) __THROW; __END_DECLS diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libm.abilist index 7bf568c51..239093467 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/x86_64/64/nptl/libm.abilist @@ -81,6 +81,11 @@ GLIBC_2.15 __yn_finite F __ynf_finite F __ynl_finite F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F GLIBC_2.2.5 GLIBC_2.2.5 A _LIB_VERSION D 0x4 diff --git a/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libm.abilist b/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libm.abilist index 0f3ea4ba4..1825adb1b 100644 --- a/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libm.abilist +++ b/libc/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libm.abilist @@ -395,3 +395,8 @@ GLIBC_2.16 yn F ynf F ynl F +GLIBC_2.18 + GLIBC_2.18 A + __issignaling F + __issignalingf F + __issignalingl F |