Accepting request 249235 from home:Andreas_Schwab:glibc

- Update to glibc 2.20 release.
  * Reverted change of ABI data structures for s390 and s390x
  * Support for file description locks is added to systems running the
    Linux kernel
  * Optimized strchr implementation for AArch64
  * The minimum Linux kernel version that this version of the GNU C Library
    can be used with is 2.6.32
  * Running the testsuite no longer terminates as soon as a test fails
  * The am33 port, which had not worked for several years, has been removed
    from ports.
  * The _BSD_SOURCE and _SVID_SOURCE feature test macros are no longer
    supported; they now act the same as _DEFAULT_SOURCE (but generate a
    warning)
  * Optimized strcmp implementation for ARMv7
  * Added support for TX lock elision of pthread mutexes on s390 and s390x
  * All supported architectures now use the main glibc sysdeps directory
    instead of some being in a separate "ports" directory
  * The NPTL implementation of POSIX pthreads is no longer an "add-on"
  * Locale names, including those obtained from environment variables (LANG
    and the LC_* variables), are more tightly checked for proper syntax
  * On x86-64, the dynamic linker's lazy-binding support is now compatible
    with application code using Intel MPX instructions
- Patches from upstream removed
  * nss-dns-memleak.patch
  * sin-sign.patch
  * pldd-wait-ptrace-stop.patch
  * nscd-track-startup-failures.patch
  * powerpc-opt-power8.patch
  * check-pf-alloca.patch
  * getaddrinfo-uninit-result.patch

OBS-URL: https://build.opensuse.org/request/show/249235
OBS-URL: https://build.opensuse.org/package/show/Base:System/glibc?expand=0&rev=387
This commit is contained in:
Andreas Schwab 2014-09-15 10:37:45 +00:00 committed by Git OBS Bridge
parent 29d670314e
commit d2f37bcdab
39 changed files with 489 additions and 9135 deletions

View File

@ -1,225 +0,0 @@
From 4dc40de1ed58a1de5d960e59f20a04191f6820c9 Mon Sep 17 00:00:00 2001
From: Will Newton <will.newton@linaro.org>
Date: Wed, 12 Mar 2014 16:14:51 +0000
Subject: [PATCH 1/3] aarch64: Re-implement setcontext without rt_sigreturn
syscall
The current implementation of setcontext uses rt_sigreturn to restore
the contents of registers. This contrasts with the way most other
architectures implement setcontext:
powerpc64, mips, tile:
Call rt_sigreturn if context was created by a call to a signal handler,
otherwise restore in user code.
powerpc32:
Call swapcontext system call and don't call sigreturn or rt_sigreturn.
x86_64, sparc, hppa, sh, ia64, m68k, s390, arm:
Only support restoring "synchronous" contexts, that is contexts
created by getcontext, and restoring in user code and don't call
sigreturn or rt_sigreturn.
alpha:
Call sigreturn (but not rt_sigreturn) in all cases to do the restore.
The text of the setcontext manpage suggests that the requirement to be
able to restore a signal handler created context has been dropped from
SUSv2:
If the context was obtained by a call to a signal handler, then old
standard text says that "program execution continues with the program
instruction following the instruction interrupted by the signal".
However, this sentence was removed in SUSv2, and the present verdict
is "the result is unspecified".
Implementing setcontext by calling rt_sigreturn unconditionally causes
problems when used with sigaltstack as in BZ #16629. On this basis it
seems that aarch64 is broken and that new ports should only support
restoring contexts created with getcontext and do not need to call
rt_sigreturn at all.
This patch re-implements the aarch64 setcontext function to restore
the context in user code in a similar manner to x86_64 and other ports.
ChangeLog:
2014-03-13 Will Newton <will.newton@linaro.org>
[BZ #16629]
* sysdeps/unix/sysv/linux/aarch64/setcontext.S (__setcontext):
Re-implement to restore registers in user code and avoid
rt_sigreturn system call.
---
sysdeps/unix/sysv/linux/aarch64/setcontext.S | 147 +++++++++++++++++----------
1 file changed, 92 insertions(+), 55 deletions(-)
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/aarch64/setcontext.S
===================================================================
--- glibc-2.19.orig/ports/sysdeps/unix/sysv/linux/aarch64/setcontext.S
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/aarch64/setcontext.S
@@ -22,68 +22,105 @@
#include "ucontext_i.h"
#include "ucontext-internal.h"
-/* int setcontext (const ucontext_t *ucp) */
+/* int __setcontext (const ucontext_t *ucp)
- .text
-
-ENTRY(__setcontext)
+ Restores the machine context in UCP and thereby resumes execution
+ in that context.
- /* Create a signal frame on the stack:
+ This implementation is intended to be used for *synchronous* context
+ switches only. Therefore, it does not have to restore anything
+ other than the PRESERVED state. */
- fp
- lr
- ...
- sp-> rt_sigframe
- */
-
- stp x29, x30, [sp, -16]!
- cfi_adjust_cfa_offset (16)
- cfi_rel_offset (x29, 0)
- cfi_rel_offset (x30, 8)
-
- mov x29, sp
- cfi_def_cfa_register (x29)
-
- /* Allocate space for the sigcontext. */
- mov w3, #((RT_SIGFRAME_SIZE + SP_ALIGN_SIZE) & SP_ALIGN_MASK)
- sub sp, sp, x3
-
- /* Compute the base address of the ucontext structure. */
- add x1, sp, #RT_SIGFRAME_UCONTEXT
-
- /* Only ucontext is required in the frame, *copy* it in. */
-
-#if UCONTEXT_SIZE % 16
-#error The implementation of setcontext.S assumes sizeof(ucontext_t) % 16 == 0
-#endif
-
- mov x2, #UCONTEXT_SIZE / 16
-0:
- ldp x3, x4, [x0], #16
- stp x3, x4, [x1], #16
- sub x2, x2, 1
- cbnz x2, 0b
+ .text
- /* rt_sigreturn () -- no arguments, sp points to struct rt_sigframe. */
- mov x8, SYS_ify (rt_sigreturn)
+ENTRY (__setcontext)
+ /* Save a copy of UCP. */
+ mov x9, x0
+
+ /* Set the signal mask with
+ rt_sigprocmask (SIG_SETMASK, mask, NULL, _NSIG/8). */
+ mov x0, #SIG_SETMASK
+ add x1, x9, #UCONTEXT_SIGMASK
+ mov x2, #0
+ mov x3, #_NSIG8
+ mov x8, SYS_ify (rt_sigprocmask)
svc 0
-
- /* Ooops we failed. Recover the stack */
-
- mov sp, x29
- cfi_def_cfa_register (sp)
-
- ldp x29, x30, [sp], 16
- cfi_adjust_cfa_offset (16)
- cfi_restore (x29)
- cfi_restore (x30)
- b C_SYMBOL_NAME(__syscall_error)
-
+ cbz x0, 1f
+ b C_SYMBOL_NAME (__syscall_error)
+1:
+ /* Restore the general purpose registers. */
+ mov x0, x9
+ cfi_def_cfa (x0, 0)
+ cfi_offset (x18, oX0 + 18 * SZREG)
+ cfi_offset (x19, oX0 + 19 * SZREG)
+ cfi_offset (x20, oX0 + 20 * SZREG)
+ cfi_offset (x21, oX0 + 21 * SZREG)
+ cfi_offset (x22, oX0 + 22 * SZREG)
+ cfi_offset (x23, oX0 + 23 * SZREG)
+ cfi_offset (x24, oX0 + 24 * SZREG)
+ cfi_offset (x25, oX0 + 25 * SZREG)
+ cfi_offset (x26, oX0 + 26 * SZREG)
+ cfi_offset (x27, oX0 + 27 * SZREG)
+ cfi_offset (x28, oX0 + 28 * SZREG)
+ cfi_offset (x29, oX0 + 29 * SZREG)
+ cfi_offset (x30, oX0 + 30 * SZREG)
+
+ cfi_offset ( d8, oV0 + 8 * SZVREG)
+ cfi_offset ( d9, oV0 + 9 * SZVREG)
+ cfi_offset (d10, oV0 + 10 * SZVREG)
+ cfi_offset (d11, oV0 + 11 * SZVREG)
+ cfi_offset (d12, oV0 + 12 * SZVREG)
+ cfi_offset (d13, oV0 + 13 * SZVREG)
+ cfi_offset (d14, oV0 + 14 * SZVREG)
+ cfi_offset (d15, oV0 + 15 * SZVREG)
+ ldp x18, x19, [x0, oX0 + 18 * SZREG]
+ ldp x20, x21, [x0, oX0 + 20 * SZREG]
+ ldp x22, x23, [x0, oX0 + 22 * SZREG]
+ ldp x24, x25, [x0, oX0 + 24 * SZREG]
+ ldp x26, x27, [x0, oX0 + 26 * SZREG]
+ ldp x28, x29, [x0, oX0 + 28 * SZREG]
+ ldr x30, [x0, oX0 + 30 * SZREG]
+ ldr x2, [x0, oSP]
+ mov sp, x2
+
+ /* Check for FP SIMD context. */
+ add x2, x0, #oEXTENSION
+
+ mov w3, #(FPSIMD_MAGIC & 0xffff)
+ movk w3, #(FPSIMD_MAGIC >> 16), lsl #16
+ ldr w1, [x2, #oHEAD + oMAGIC]
+ cmp w1, w3
+ b.ne 2f
+
+ /* Restore the FP SIMD context. */
+ add x3, x2, #oV0 + 8 * SZVREG
+ ldp d8, d9, [x3], #2 * SZVREG
+ ldp d10, d11, [x3], #2 * SZVREG
+ ldp d12, d13, [x3], #2 * SZVREG
+ ldp d14, d15, [x3], #2 * SZVREG
+
+ add x3, x2, oFPSR
+
+ ldr w4, [x3]
+ msr fpsr, x4
+
+ ldr w4, [x3, oFPCR - oFPSR]
+ msr fpcr, x4
+
+2:
+ ldr x16, [x0, oPC]
+ /* Restore arg registers. */
+ ldp x2, x3, [x0, oX0 + 2 * SZREG]
+ ldp x4, x5, [x0, oX0 + 4 * SZREG]
+ ldp x6, x7, [x0, oX0 + 6 * SZREG]
+ ldp x0, x1, [x0, oX0 + 0 * SZREG]
+ /* Jump to the new pc value. */
+ br x16
PSEUDO_END (__setcontext)
weak_alias (__setcontext, setcontext)
-ENTRY(__startcontext)
+ENTRY (__startcontext)
mov x0, x19
cbnz x0, __setcontext
-1: b HIDDEN_JUMPTARGET(_exit)
-END(__startcontext)
+1: b HIDDEN_JUMPTARGET (_exit)
+END (__startcontext)

View File

@ -1,163 +0,0 @@
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Add out_fail2
label to be used after in6ailist is initialized.
[BZ #16002]
* sysdeps/unix/sysv/linux/check_pf.c (make_request): Use
alloca_account and account alloca use for struct in6ailist.
Index: glibc-2.19/sysdeps/unix/sysv/linux/check_pf.c
===================================================================
--- glibc-2.19.orig/sysdeps/unix/sysv/linux/check_pf.c
+++ glibc-2.19/sysdeps/unix/sysv/linux/check_pf.c
@@ -106,6 +106,11 @@ cache_valid_p (void)
static struct cached_data *
make_request (int fd, pid_t pid)
{
+ struct cached_data *result = NULL;
+
+ size_t result_len = 0;
+ size_t result_cap = 32;
+
struct req
{
struct nlmsghdr nlh;
@@ -137,19 +142,9 @@ make_request (int fd, pid_t pid)
#else
const size_t buf_size = __getpagesize ();
#endif
- bool use_malloc = false;
char *buf;
- if (__libc_use_alloca (buf_size))
- buf = alloca (buf_size);
- else
- {
- buf = malloc (buf_size);
- if (buf != NULL)
- use_malloc = true;
- else
- goto out_fail;
- }
+ buf = alloca (buf_size);
struct iovec iov = { buf, buf_size };
@@ -159,12 +154,7 @@ make_request (int fd, pid_t pid)
goto out_fail;
bool done = false;
- struct in6ailist
- {
- struct in6addrinfo info;
- struct in6ailist *next;
- } *in6ailist = NULL;
- size_t in6ailistlen = 0;
+
bool seen_ipv4 = false;
bool seen_ipv6 = false;
@@ -239,28 +229,36 @@ make_request (int fd, pid_t pid)
}
}
- struct in6ailist *newp = alloca (sizeof (*newp));
- newp->info.flags = (((ifam->ifa_flags
- & (IFA_F_DEPRECATED
- | IFA_F_OPTIMISTIC))
- ? in6ai_deprecated : 0)
- | ((ifam->ifa_flags
- & IFA_F_HOMEADDRESS)
- ? in6ai_homeaddress : 0));
- newp->info.prefixlen = ifam->ifa_prefixlen;
- newp->info.index = ifam->ifa_index;
+ if (result_len == 0 || result_len == result_cap)
+ {
+ result_cap = 2 * result_cap;
+ result = realloc (result, sizeof (*result)
+ + result_cap * sizeof (struct in6addrinfo));
+ }
+
+ if (!result)
+ goto out_fail;
+
+ struct in6addrinfo *info = &result->in6ai[result_len++];
+
+ info->flags = (((ifam->ifa_flags
+ & (IFA_F_DEPRECATED
+ | IFA_F_OPTIMISTIC))
+ ? in6ai_deprecated : 0)
+ | ((ifam->ifa_flags
+ & IFA_F_HOMEADDRESS)
+ ? in6ai_homeaddress : 0));
+ info->prefixlen = ifam->ifa_prefixlen;
+ info->index = ifam->ifa_index;
if (ifam->ifa_family == AF_INET)
{
- newp->info.addr[0] = 0;
- newp->info.addr[1] = 0;
- newp->info.addr[2] = htonl (0xffff);
- newp->info.addr[3] = *(const in_addr_t *) address;
+ info->addr[0] = 0;
+ info->addr[1] = 0;
+ info->addr[2] = htonl (0xffff);
+ info->addr[3] = *(const in_addr_t *) address;
}
else
- memcpy (newp->info.addr, address, sizeof (newp->info.addr));
- newp->next = in6ailist;
- in6ailist = newp;
- ++in6ailistlen;
+ memcpy (info->addr, address, sizeof (info->addr));
}
else if (nlmh->nlmsg_type == NLMSG_DONE)
/* We found the end, leave the loop. */
@@ -269,42 +267,29 @@ make_request (int fd, pid_t pid)
}
while (! done);
- struct cached_data *result;
- if (seen_ipv6 && in6ailist != NULL)
+ if (seen_ipv6 && result != NULL)
{
- result = malloc (sizeof (*result)
- + in6ailistlen * sizeof (struct in6addrinfo));
- if (result == NULL)
- goto out_fail;
-
result->timestamp = get_nl_timestamp ();
result->usecnt = 2;
result->seen_ipv4 = seen_ipv4;
result->seen_ipv6 = true;
- result->in6ailen = in6ailistlen;
-
- do
- {
- result->in6ai[--in6ailistlen] = in6ailist->info;
- in6ailist = in6ailist->next;
- }
- while (in6ailist != NULL);
+ result->in6ailen = result_len;
}
else
{
+ free (result);
+
atomic_add (&noai6ai_cached.usecnt, 2);
noai6ai_cached.seen_ipv4 = seen_ipv4;
noai6ai_cached.seen_ipv6 = seen_ipv6;
result = &noai6ai_cached;
}
- if (use_malloc)
- free (buf);
return result;
-out_fail:
- if (use_malloc)
- free (buf);
+ out_fail:
+
+ free (result);
return NULL;
}

View File

@ -51,7 +51,15 @@ Index: crypt_blowfish-1.2/crypt_gensalt.c
===================================================================
--- crypt_blowfish-1.2.orig/crypt_gensalt.c
+++ crypt_blowfish-1.2/crypt_gensalt.c
@@ -180,3 +180,69 @@ error:
@@ -20,6 +20,7 @@
#include <string.h>
#include <stdio.h>
+#include <sys/param.h>
#include <errno.h>
#ifndef __set_errno
@@ -180,3 +181,69 @@ error:
errno = ENOMEM;
return NULL;
}

View File

@ -1,196 +0,0 @@
2014-08-21 Florian Weimer <fweimer@redhat.com>
[BZ #17187]
* iconv/gconv_trans.c (struct known_trans, search_tree, lock,
trans_compare, open_translit, __gconv_translit_find):
Remove module loading code.
Index: glibc-2.19/iconv/gconv_trans.c
===================================================================
--- glibc-2.19.orig/iconv/gconv_trans.c
+++ glibc-2.19/iconv/gconv_trans.c
@@ -238,181 +238,11 @@ __gconv_transliterate (struct __gconv_st
return __GCONV_ILLEGAL_INPUT;
}
-
-/* Structure to represent results of found (or not) transliteration
- modules. */
-struct known_trans
-{
- /* This structure must remain the first member. */
- struct trans_struct info;
-
- char *fname;
- void *handle;
- int open_count;
-};
-
-
-/* Tree with results of previous calls to __gconv_translit_find. */
-static void *search_tree;
-
-/* We modify global data. */
-__libc_lock_define_initialized (static, lock);
-
-
-/* Compare two transliteration entries. */
-static int
-trans_compare (const void *p1, const void *p2)
-{
- const struct known_trans *s1 = (const struct known_trans *) p1;
- const struct known_trans *s2 = (const struct known_trans *) p2;
-
- return strcmp (s1->info.name, s2->info.name);
-}
-
-
-/* Open (maybe reopen) the module named in the struct. Get the function
- and data structure pointers we need. */
-static int
-open_translit (struct known_trans *trans)
-{
- __gconv_trans_query_fct queryfct;
-
- trans->handle = __libc_dlopen (trans->fname);
- if (trans->handle == NULL)
- /* Not available. */
- return 1;
-
- /* Find the required symbol. */
- queryfct = __libc_dlsym (trans->handle, "gconv_trans_context");
- if (queryfct == NULL)
- {
- /* We cannot live with that. */
- close_and_out:
- __libc_dlclose (trans->handle);
- trans->handle = NULL;
- return 1;
- }
-
- /* Get the context. */
- if (queryfct (trans->info.name, &trans->info.csnames, &trans->info.ncsnames)
- != 0)
- goto close_and_out;
-
- /* Of course we also have to have the actual function. */
- trans->info.trans_fct = __libc_dlsym (trans->handle, "gconv_trans");
- if (trans->info.trans_fct == NULL)
- goto close_and_out;
-
- /* Now the optional functions. */
- trans->info.trans_init_fct =
- __libc_dlsym (trans->handle, "gconv_trans_init");
- trans->info.trans_context_fct =
- __libc_dlsym (trans->handle, "gconv_trans_context");
- trans->info.trans_end_fct =
- __libc_dlsym (trans->handle, "gconv_trans_end");
-
- trans->open_count = 1;
-
- return 0;
-}
-
-
int
internal_function
__gconv_translit_find (struct trans_struct *trans)
{
- struct known_trans **found;
- const struct path_elem *runp;
- int res = 1;
-
- /* We have to have a name. */
- assert (trans->name != NULL);
-
- /* Acquire the lock. */
- __libc_lock_lock (lock);
-
- /* See whether we know this module already. */
- found = __tfind (trans, &search_tree, trans_compare);
- if (found != NULL)
- {
- /* Is this module available? */
- if ((*found)->handle != NULL)
- {
- /* Maybe we have to reopen the file. */
- if ((*found)->handle != (void *) -1)
- /* The object is not unloaded. */
- res = 0;
- else if (open_translit (*found) == 0)
- {
- /* Copy the data. */
- *trans = (*found)->info;
- (*found)->open_count++;
- res = 0;
- }
- }
- }
- else
- {
- size_t name_len = strlen (trans->name) + 1;
- int need_so = 0;
- struct known_trans *newp;
-
- /* We have to continue looking for the module. */
- if (__gconv_path_elem == NULL)
- __gconv_get_path ();
-
- /* See whether we have to append .so. */
- if (name_len <= 4 || memcmp (&trans->name[name_len - 4], ".so", 3) != 0)
- need_so = 1;
-
- /* Create a new entry. */
- newp = (struct known_trans *) malloc (sizeof (struct known_trans)
- + (__gconv_max_path_elem_len
- + name_len + 3)
- + name_len);
- if (newp != NULL)
- {
- char *cp;
-
- /* Clear the struct. */
- memset (newp, '\0', sizeof (struct known_trans));
-
- /* Store a copy of the module name. */
- newp->info.name = cp = (char *) (newp + 1);
- cp = __mempcpy (cp, trans->name, name_len);
-
- newp->fname = cp;
-
- /* Search in all the directories. */
- for (runp = __gconv_path_elem; runp->name != NULL; ++runp)
- {
- cp = __mempcpy (__stpcpy ((char *) newp->fname, runp->name),
- trans->name, name_len);
- if (need_so)
- memcpy (cp, ".so", sizeof (".so"));
-
- if (open_translit (newp) == 0)
- {
- /* We found a module. */
- res = 0;
- break;
- }
- }
-
- if (res)
- newp->fname = NULL;
-
- /* In any case we'll add the entry to our search tree. */
- if (__tsearch (newp, &search_tree, trans_compare) == NULL)
- {
- /* Yickes, this should not happen. Unload the object. */
- res = 1;
- /* XXX unload here. */
- }
- }
- }
-
- __libc_lock_unlock (lock);
-
- return res;
+ /* This function always fails. Transliteration module loading is
+ not implemented. */
+ return 1;
}

View File

@ -1,19 +0,0 @@
2014-07-14 Alan Modra <amodra@gmail.com>
[BZ #17153]
* elf/elf.h (DT_PPC64_NUM): Correct value.
* NEWS: Add to fixed bug list.
Index: glibc-2.19/elf/elf.h
===================================================================
--- glibc-2.19.orig/elf/elf.h
+++ glibc-2.19/elf/elf.h
@@ -2283,7 +2283,7 @@ typedef Elf32_Addr Elf32_Conflict;
#define DT_PPC64_OPD (DT_LOPROC + 1)
#define DT_PPC64_OPDSZ (DT_LOPROC + 2)
#define DT_PPC64_OPT (DT_LOPROC + 3)
-#define DT_PPC64_NUM 3
+#define DT_PPC64_NUM 4
/* PowerPC64 specific values for the DT_PPC64_OPT Dyn entry. */
#define PPC64_OPT_TLS 1

View File

@ -1,26 +0,0 @@
* sysdeps/posix/getaddrinfo.c (gaih_inet): Properly skip over
non-matching result from nscd.
Index: glibc-2.19/sysdeps/posix/getaddrinfo.c
===================================================================
--- glibc-2.19.orig/sysdeps/posix/getaddrinfo.c
+++ glibc-2.19/sysdeps/posix/getaddrinfo.c
@@ -712,6 +712,18 @@ gaih_inet (const char *name, const struc
{
socklen_t size = (air->family[i] == AF_INET
? INADDRSZ : IN6ADDRSZ);
+
+ if (!((air->family[i] == AF_INET
+ && req->ai_family == AF_INET6
+ && (req->ai_flags & AI_V4MAPPED) != 0)
+ || req->ai_family == AF_UNSPEC
+ || air->family[i] == req->ai_family))
+ {
+ /* Skip over non-matching result. */
+ addrs += size;
+ continue;
+ }
+
if (*pat == NULL)
{
*pat = addrfree++;

View File

@ -1,23 +1,9 @@
Index: glibc-2.19/Versions.def
Index: glibc-2.19.90/crypt/Makefile
===================================================================
--- glibc-2.19.orig/Versions.def
+++ glibc-2.19/Versions.def
@@ -45,6 +45,9 @@ libc {
libcrypt {
GLIBC_2.0
}
+libowcrypt {
+ OW_CRYPT_1.0
+}
libdl {
GLIBC_2.0
GLIBC_2.1
Index: glibc-2.19/crypt/Makefile
===================================================================
--- glibc-2.19.orig/crypt/Makefile
+++ glibc-2.19/crypt/Makefile
@@ -21,14 +21,18 @@
subdir := crypt
--- glibc-2.19.90.orig/crypt/Makefile
+++ glibc-2.19.90/crypt/Makefile
@@ -23,14 +23,18 @@ subdir := crypt
include ../Makeconfig
headers := crypt.h
+headers += gnu-crypt.h ow-crypt.h
@ -35,12 +21,12 @@ Index: glibc-2.19/crypt/Makefile
+
+tests := cert md5c-test sha256c-test sha512c-test
include ../Makeconfig
Index: glibc-2.19/crypt/Versions
ifeq ($(crypt-in-libc),yes)
routines += $(libcrypt-routines)
Index: glibc-2.19.90/crypt/Versions
===================================================================
--- glibc-2.19.orig/crypt/Versions
+++ glibc-2.19/crypt/Versions
--- glibc-2.19.90.orig/crypt/Versions
+++ glibc-2.19.90/crypt/Versions
@@ -3,3 +3,8 @@ libcrypt {
crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
}
@ -50,10 +36,10 @@ Index: glibc-2.19/crypt/Versions
+ crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra;
+ }
+}
Index: glibc-2.19/crypt/crypt-entry.c
Index: glibc-2.19.90/crypt/crypt-entry.c
===================================================================
--- glibc-2.19.orig/crypt/crypt-entry.c
+++ glibc-2.19/crypt/crypt-entry.c
--- glibc-2.19.90.orig/crypt/crypt-entry.c
+++ glibc-2.19.90/crypt/crypt-entry.c
@@ -81,7 +81,7 @@ extern struct crypt_data _ufc_foobar;
*/
@ -76,130 +62,10 @@ Index: glibc-2.19/crypt/crypt-entry.c
}
#endif
+#endif
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libowcrypt.abilist
Index: glibc-2.19.90/shlib-versions
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/aarch64/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/alpha/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/alpha/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/arm/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/arm/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/ia64/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/ia64/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/m68k/coldfire/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/m68k/m680x0/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/mips/mips32/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/mips/mips64/n32/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/mips/mips64/n64/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/ports/sysdeps/unix/sysv/linux/tile/tilepro/nptl/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/shlib-versions
===================================================================
--- glibc-2.19.orig/shlib-versions
+++ glibc-2.19/shlib-versions
--- glibc-2.19.90.orig/shlib-versions
+++ glibc-2.19.90/shlib-versions
@@ -93,6 +93,7 @@ sh.*-.*-linux.* ld=ld-linux.so.2 GLIBC_
# This defines the shared library version numbers we will install.
@ -208,120 +74,270 @@ Index: glibc-2.19/shlib-versions
# The gross patch for programs assuming broken locale implementations.
sh.*-.*-.* libBrokenLocale=1 GLIBC_2.2
Index: glibc-2.19/sysdeps/unix/sysv/linux/i386/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/aarch64/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/i386/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/aarch64/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/alpha/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/alpha/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/arm/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/arm/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libowcrypt-le.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/hppa/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libowcrypt-le.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/hppa/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/i386/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/powerpc/powerpc64/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/i386/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/ia64/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/s390/s390-32/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/ia64/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/m68k/coldfire/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/s390/s390-64/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/m68k/coldfire/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/sh/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/m68k/m680x0/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/sh/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/m68k/m680x0/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/microblaze/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/sparc/sparc32/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/microblaze/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/mips/mips32/fpu/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/sparc/sparc64/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/mips/mips32/fpu/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/x86_64/64/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/x86_64/64/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/mips/mips32/nofpu/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libowcrypt.abilist
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/mips/mips64/n32/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/unix/sysv/linux/x86_64/x32/nptl/libowcrypt.abilist
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/mips/mips64/n32/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/mips/mips64/n64/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/mips/mips64/n64/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/powerpc/powerpc64/libowcrypt-le.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/powerpc/powerpc64/libowcrypt-le.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/powerpc/powerpc64/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/powerpc/powerpc64/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/s390/s390-32/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/s390/s390-32/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/s390/s390-64/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/s390/s390-64/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/sh/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/sh/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/sparc/sparc32/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/sparc/sparc32/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/sparc/sparc64/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/sparc/sparc64/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/tile/tilepro/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/tile/tilepro/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/x86_64/64/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/x86_64/64/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A
+ crypt_gensalt F
+ crypt_gensalt_ra F
+ crypt_gensalt_rn F
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/x86_64/x32/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/x86_64/x32/libowcrypt.abilist
@@ -0,0 +1,5 @@
+OW_CRYPT_1.0
+ OW_CRYPT_1.0 A

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d3997f588401ea095a0b27227b1d50cdfdd416236f6567b564549d3b46ea2a2
size 12083312

3
glibc-2.20.tar.xz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f84b6d42aecc288d593c397b0a3d02260a33ee686bce0c634eb9b32798f36ba5
size 12283992

View File

@ -7,7 +7,7 @@ Index: glibc-2.17.90/intl/loadmsgcat.c
goto out;
- /* Try to open the addressed file. */
- fd = open (domain_file->filename, O_RDONLY);
- fd = open (domain_file->filename, O_RDONLY | O_BINARY);
+ /* Replace /locale/ with /usr/share/locale-langpack/ */
+ const char *langpackdir = "/usr/share/locale-langpack/";
+ char *filename_langpack = malloc (strlen (domain_file->filename) +
@ -20,18 +20,18 @@ Index: glibc-2.17.90/intl/loadmsgcat.c
+ strcpy (filename_langpack, langpackdir);
+ strcpy (&filename_langpack[strlen (langpackdir)],
+ (p+8));
+ if ((fd = open (filename_langpack, O_RDONLY)) == -1)
+ fd = open (domain_file->filename, O_RDONLY);
+ if ((fd = open (filename_langpack, O_RDONLY | O_BINARY)) == -1)
+ fd = open (domain_file->filename, O_RDONLY | O_BINARY);
+ }
+ else
+ /* Try to open the addressed file. */
+ fd = open (domain_file->filename, O_RDONLY);
+ fd = open (domain_file->filename, O_RDONLY | O_BINARY);
+
+ free (filename_langpack);
+ }
+ else
+ /* Try to open the addressed file. */
+ fd = open (domain_file->filename, O_RDONLY);
+ fd = open (domain_file->filename, O_RDONLY | O_BINARY);
+
+ if (fd == -1)
+ {
@ -47,7 +47,7 @@ Index: glibc-2.17.90/intl/loadmsgcat.c
+ strcpy (filename_bundle, bundle_dir);
+ strcpy (&filename_bundle[strlen (bundle_dir)],
+ (p+8));
+ fd = open (filename_bundle, O_RDONLY);
+ fd = open (filename_bundle, O_RDONLY | O_BINARY);
+ }
+
+ free (filename_bundle);

View File

@ -1,8 +1,8 @@
Index: glibc-2.17.90/elf/rtld.c
Index: glibc-2.19.90/elf/rtld.c
===================================================================
--- glibc-2.17.90.orig/elf/rtld.c
+++ glibc-2.17.90/elf/rtld.c
@@ -1717,6 +1717,53 @@ ERROR: ld.so: object '%s' cannot be load
--- glibc-2.19.90.orig/elf/rtld.c
+++ glibc-2.19.90/elf/rtld.c
@@ -1740,6 +1740,52 @@ ERROR: ld.so: object '%s' cannot be load
}
}
@ -18,32 +18,31 @@ Index: glibc-2.17.90/elf/rtld.c
+ */
+#define LIB_NOVERSION "/lib/obsolete/noversion/libNoVersion.so.1"
+
+ if (__builtin_expect (main_map->l_info[DT_NUM + DT_THISPROCNUM
+ if (__glibc_unlikely (main_map->l_info[DT_NUM + DT_THISPROCNUM
+ + DT_VERSIONTAGIDX (DT_VERNEED)]
+ == NULL, 0)
+ && (main_map->l_info[DT_DEBUG]
+ == NULL)
+ && (main_map->l_info[DT_DEBUG] != 0
+ || !(GLRO(dl_debug_mask) & DL_DEBUG_PRELINK)))
+ {
+ struct stat test_st;
+ int test_fd;
+ int can_load;
+ bool can_load;
+
+ HP_TIMING_NOW (start);
+
+ can_load = 1;
+ can_load = true;
+ test_fd = __open (LIB_NOVERSION, O_RDONLY);
+ if (test_fd < 0) {
+ can_load = 0;
+ } else {
+ if (__fxstat (_STAT_VER, test_fd, &test_st) < 0 || test_st.st_size == 0) {
+ can_load = 0;
+ if (test_fd < 0)
+ can_load = false;
+ else
+ {
+ if (__fxstat (_STAT_VER, test_fd, &test_st) < 0
+ || test_st.st_size == 0)
+ can_load = false;
+ __close(test_fd);
+ }
+ }
+
+ if (test_fd >= 0) /* open did no fail.. */
+ __close(test_fd); /* avoid fd leaks */
+
+ if (can_load != 0)
+ if (can_load)
+ npreloads += do_preload (LIB_NOVERSION, main_map,
+ "nonversioned binary");
+
@ -53,6 +52,6 @@ Index: glibc-2.17.90/elf/rtld.c
+ }
+#endif
+
if (__builtin_expect (*first_preload != NULL, 0))
if (__glibc_unlikely (*first_preload != NULL))
{
/* Set up PRELOADS with a vector of the preloaded libraries. */

View File

@ -1,18 +1,3 @@
Index: glibc-2.17.90/csu/Makefile
===================================================================
--- glibc-2.17.90.orig/csu/Makefile
+++ glibc-2.17.90/csu/Makefile
@@ -162,8 +162,8 @@ $(objpfx)version-info.h: $(common-objpfx
if [ -z "$$os" ]; then \
os=Linux; \
fi; \
- printf '"Compiled on a %s %s system on %s.\\n"\n' \
- "$$os" "$$version" "`date +%Y-%m-%d`";; \
+ printf '"Compiled on a %s %s system.\\n"\n' \
+ "$$os" "$$version";; \
*) ;; \
esac; \
files="$(all-Banner-files)"; \
Index: glibc-2.17.90/nscd/nscd_stat.c
===================================================================
--- glibc-2.17.90.orig/nscd/nscd_stat.c

View File

@ -1,3 +1,53 @@
-------------------------------------------------------------------
Mon Sep 8 09:48:26 UTC 2014 - schwab@suse.de
- Update to glibc 2.20 release.
* Reverted change of ABI data structures for s390 and s390x
* Support for file description locks is added to systems running the
Linux kernel
* Optimized strchr implementation for AArch64
* The minimum Linux kernel version that this version of the GNU C Library
can be used with is 2.6.32
* Running the testsuite no longer terminates as soon as a test fails
* The am33 port, which had not worked for several years, has been removed
from ports.
* The _BSD_SOURCE and _SVID_SOURCE feature test macros are no longer
supported; they now act the same as _DEFAULT_SOURCE (but generate a
warning)
* Optimized strcmp implementation for ARMv7
* Added support for TX lock elision of pthread mutexes on s390 and s390x
* All supported architectures now use the main glibc sysdeps directory
instead of some being in a separate "ports" directory
* The NPTL implementation of POSIX pthreads is no longer an "add-on"
* Locale names, including those obtained from environment variables (LANG
and the LC_* variables), are more tightly checked for proper syntax
* On x86-64, the dynamic linker's lazy-binding support is now compatible
with application code using Intel MPX instructions
- Patches from upstream removed
* nss-dns-memleak.patch
* sin-sign.patch
* pldd-wait-ptrace-stop.patch
* nscd-track-startup-failures.patch
* powerpc-opt-power8.patch
* check-pf-alloca.patch
* getaddrinfo-uninit-result.patch
* ppc64-copysign.patch
* nextafterl-ibm-ldouble.patch
* ibm-long-double-math.patch
* ibm-long-double-frexpl.patch
* aarch64-setcontext.patch
* nss-nis-stack-use.patch
* psfaa.patch
* nss-files-long-lines.patch
* setlocale-directory-traversal.patch
* dt-ppc64-num.patch
* ppc64le-profiling.patch
* s390-revert-abi-change.patch
* disable-gconv-translit-modules.patch
* resolv-dont-ignore-second-answer.patch
* iconv-ibm-sentinel-check.patch
- Remove sprof.1, and mtrace.1, now included in the man-pages package
-------------------------------------------------------------------
Tue Sep 2 07:52:36 UTC 2014 - schwab@suse.de

View File

@ -100,10 +100,10 @@ BuildRequires: gd-devel
# 3.1 is the openSUSE 12.1 kernel
%define enablekernel 3.0
Version: 2.19
Version: 2.20
Release: 0
%define glibc_major_version 2.19
%define git_id 9a869d822025
%define glibc_major_version 2.20
%define git_id b8079dd0d360
Url: http://www.gnu.org/software/libc/libc.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source: glibc-%{version}-%{git_id}.tar.xz
@ -232,54 +232,12 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM fix memory leak in nss_dns
Patch1000: nss-dns-memleak.patch
# PATCH-FIX-UPSTREAM Fix sign of input to bsloww1 (BZ #16623)
Patch1001: sin-sign.patch
# PATCH-FIX-UPSTREAM Fix pldd not to leave process stopped after detaching
Patch1002: pldd-wait-ptrace-stop.patch
# PATCH-FIX-UPSTREAM Improved support for tracking startup failure in nscd service (BZ #16639)
Patch1003: nscd-track-startup-failures.patch
# PATCH-FIX-UPSTREAM GLIBC Optimizations For POWER8 Hardware
Patch1004: powerpc-opt-power8.patch
# PATCH-FIX-UPSTREAM Account for alloca use when collecting interface addresses
Patch1005: check-pf-alloca.patch
# PATCH-FIX-UPSTREAM Fix use of half-initialized result in getaddrinfo when using nscd
Patch1006: getaddrinfo-uninit-result.patch
# PATCH-FIX-UPSTREAM Fix ppc64le copysign overwriting parent stack frame (BZ #16786)
Patch1007: ppc64-copysign.patch
# PATCH-FIX-UPSTREAM Correct IBM long double nextafterl (BZ #16739)
Patch1008: nextafterl-ibm-ldouble.patch
# PATCH-FIX-UPSTREAM Remove faulty assembler implementations for IBM long double (BZ #16701, BZ #16706, BZ #16707)
Patch1009: ibm-long-double-math.patch
# PATCH-FIX-UPSTREAM Correct IBM long double frexpl (BZ #16740, BZ #16619)
Patch1010: ibm-long-double-frexpl.patch
# PATCH-FIX-UPSTREAM Fix aarch64 setcontext clobbering alternate signal stack (BZ #16629)
Patch1011: aarch64-setcontext.patch
# PATCH-FIX-UPSTREAM Fix unbound stack use in NIS NSS module (BZ #16932)
Patch1012: nss-nis-stack-use.patch
# PATCH-FIX-UPSTREAM posix_spawn_file_actions_addopen needs to copy the path argument (BZ #17048)
Patch1013: psfaa.patch
# PATCH-FIX-UPSTREAM Don't ignore too long lines in nss_files (BZ #17079)
Patch1014: nss-files-long-lines.patch
# PATCH-FIX-UPSTREAM Directory traversal in locale environment handling (BZ #17137)
Patch1015: setlocale-directory-traversal.patch
# PATCH-FIX-UPSTREAM Correct DT_PPC64_NUM (BZ #17153)
Patch1016: dt-ppc64-num.patch
# PATCH-FIX-UPSTREAM PowerPC: Fix gprof entry point for LE (BZ #17213)
Patch1017: ppc64le-profiling.patch
# PATCH-FIX-UPSTREAM S/390 Reverting the jmp_buf/ucontext_t ABI change (bnc#887228)
Patch1018: s390-revert-abi-change.patch
# PATCH-FIX-UPSTREAM Disable gconv transliteration module loading (BZ #17187)
Patch1019: disable-gconv-translit-modules.patch
###
# Patches awaiting upstream approval
###
# PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142)
Patch2000: fix-locking-in-_IO_cleanup.patch
# PATCH-FIX-UPSTREAM Don't ignore second answer from nameserver if the first one was empty (BZ #13651)
Patch2001: resolv-dont-ignore-second-answer.patch
# PATCH-FIX-UPSTREAM Never try to execute the file in ldd (BZ #16750)
Patch2002: ldd-system-interp.patch
# PATCH-FIX-UPSTREAM Don't close or flush stdio streams on abort (BZ #15436)
@ -292,8 +250,6 @@ Patch2005: glibc-memset-nontemporal.diff
Patch2006: ibm93x-redundant-shift-si.patch
# PATCH-FIX-UPSTREAM Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in pthread_mutexattr_gettype (BZ #15790)
Patch2007: pthread-mutexattr-gettype-kind.patch
# PATCH-FIX-UPSTREAM Fix crashes on invalid input in IBM gconv modules (BZ #17325)
Patch2008: iconv-ibm-sentinel-check.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -494,36 +450,13 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch1013 -p1
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
%patch1018 -p1
%patch1019 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
%patch3000
@ -581,10 +514,10 @@ echo "#define GITID \"%{git_id}\"" >> version.h
# Default CFLAGS and Compiler
#
BuildFlags="%{optflags} -U_FORTIFY_SOURCE"
BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')"
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')
BuildCC="%__cc"
BuildCCplus="%__cxx"
add_ons=",libidn"
add_ons=libidn
#
#now overwrite for some architectures
#
@ -626,9 +559,6 @@ add_ons=",libidn"
%ifarch %ix86
add_ons=$add_ons,noversion
%endif
%ifarch %arm aarch64 mipsel ia64 m68k
add_ons=$add_ons,ports
%endif
%ifarch mipsel
# fails to build otherwise - need to recheck and fix
%define enable_stackguard_randomization 0
@ -637,7 +567,6 @@ add_ons=",libidn"
configure_and_build_glibc() {
local dirname="$1"; shift
local cflags="$1"; shift
local addons="$1"; shift
mkdir "cc-$dirname"
cd "cc-$dirname"
%ifarch %arm aarch64
@ -664,7 +593,7 @@ configure_and_build_glibc() {
CC="$BuildCC" CXX="$BuildCCplus" \
--prefix=%{_prefix} \
--libexecdir=%{_libexecdir} --infodir=%{_infodir} \
--enable-add-ons=nptl$addons \
--enable-add-ons=$add_ons \
$profile $elision \
"$@" \
%if %{enable_stackguard_randomization}
@ -694,7 +623,7 @@ configure_and_build_glibc() {
#
# Build base glibc
#
configure_and_build_glibc base "$BuildFlags" "$add_ons"
configure_and_build_glibc base "$BuildFlags"
%else
#
# Build POWER-optimized glibc
@ -705,10 +634,10 @@ configure_and_build_glibc() {
pBuildFlags+=" -mcpu=%{powerpc_optimize_base}"
%endif
%if "%{powerpc_optimize_base}" != ""
configure_and_build_glibc base "$pBuildFlags" "$add_ons" --with-cpu=%{powerpc_optimize_base}
configure_and_build_glibc base "$pBuildFlags" --with-cpu=%{powerpc_optimize_base}
%else
# Use no default CPU
configure_and_build_glibc base "$pBuildFlags" "$add_ons"
configure_and_build_glibc base "$pBuildFlags"
%endif
%if %{build_variants}
# Then other power variants:
@ -723,19 +652,19 @@ configure_and_build_glibc() {
power7 \
%endif
; do
configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" "$add_ons" \
configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" \
--with-cpu=$pcpu
done
# Eventually, special Cell variant:
%if %{powerpc_optimize_cpu_cell}
configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell" "$add_ons"
configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell"
%endif
%endif # %{build_variants}
%endif # optimize_power
%if %{build_variants}
%ifarch i686 x86_64
configure_and_build_glibc noelision "$BuildFlags" "$add_ons"
configure_and_build_glibc noelision "$BuildFlags"
%endif
%endif
@ -785,8 +714,25 @@ popd
export SUSE_ASNEEDED=0
# Increase timeout
export TIMEOUTFACTOR=16
make -C cc-base -k check ||
find cc-base -name "*.out" | tar -czf - -T - | base64
make -C cc-base -k check || {
cd cc-base
o=$-
set +x
for sum in */*.sum; do
while read s t; do
case $s in
XPASS:|PASS:)
echo ++++++ $s $t ++++++
;;
*) # X?FAIL:
echo ------ $s $t ------
test ! -f $t.out || cat $t.out
;;
esac
done < $sum
done
set -$o
}
%else
# This has to pass on all platforms!
# Exceptions:
@ -1016,7 +962,6 @@ rm -f %{buildroot}%{_bindir}/pcprofiledump
rm -f %{buildroot}%{_bindir}/sotruss
rm -f %{buildroot}%{_bindir}/xtrace
rm -f %{buildroot}%{_bindir}/pldd
rm -f %{buildroot}%{_mandir}/man1/mtrace.*
rm -rf %{buildroot}%{_libdir}/audit
%ifarch i686
@ -1041,8 +986,7 @@ rm -f %{buildroot}/%{_lib}/ld*.so* %{buildroot}/%{_lib}/lib[!mp]*
rm -f %{buildroot}/lib/ld*.so*
rm -f %{buildroot}%{_libdir}/lib*
rm -f %{buildroot}%{_bindir}/{catchsegv,ldd*,sprof}
rm -f %{buildroot}%{_mandir}/man1/[!m]*
rm -rf %{buildroot}%{_mandir}/man[!1]
rm -rf %{buildroot}%{_mandir}/man*
rm -rf %{buildroot}/sbin %{buildroot}%{_includedir}
%endif # %{utils_build}
@ -1266,7 +1210,6 @@ exit 0
%doc COPYING COPYING.LIB NEWS README BUGS CONFORMANCE
%doc %{_mandir}/man1/catchsegv.1.gz
%doc %{_mandir}/man1/rpcgen.1.gz
%doc %{_mandir}/man1/sprof.1.gz
%doc %{_mandir}/man3/*
%{_bindir}/catchsegv
%{_bindir}/rpcgen
@ -1377,7 +1320,6 @@ exit 0
%{_bindir}/sotruss
%{_bindir}/xtrace
%{_bindir}/pldd
%doc %{_mandir}/man1/mtrace.1.gz
%endif # %{utils_build}
%changelog

View File

@ -1,3 +1,53 @@
-------------------------------------------------------------------
Mon Sep 8 09:48:26 UTC 2014 - schwab@suse.de
- Update to glibc 2.20 release.
* Reverted change of ABI data structures for s390 and s390x
* Support for file description locks is added to systems running the
Linux kernel
* Optimized strchr implementation for AArch64
* The minimum Linux kernel version that this version of the GNU C Library
can be used with is 2.6.32
* Running the testsuite no longer terminates as soon as a test fails
* The am33 port, which had not worked for several years, has been removed
from ports.
* The _BSD_SOURCE and _SVID_SOURCE feature test macros are no longer
supported; they now act the same as _DEFAULT_SOURCE (but generate a
warning)
* Optimized strcmp implementation for ARMv7
* Added support for TX lock elision of pthread mutexes on s390 and s390x
* All supported architectures now use the main glibc sysdeps directory
instead of some being in a separate "ports" directory
* The NPTL implementation of POSIX pthreads is no longer an "add-on"
* Locale names, including those obtained from environment variables (LANG
and the LC_* variables), are more tightly checked for proper syntax
* On x86-64, the dynamic linker's lazy-binding support is now compatible
with application code using Intel MPX instructions
- Patches from upstream removed
* nss-dns-memleak.patch
* sin-sign.patch
* pldd-wait-ptrace-stop.patch
* nscd-track-startup-failures.patch
* powerpc-opt-power8.patch
* check-pf-alloca.patch
* getaddrinfo-uninit-result.patch
* ppc64-copysign.patch
* nextafterl-ibm-ldouble.patch
* ibm-long-double-math.patch
* ibm-long-double-frexpl.patch
* aarch64-setcontext.patch
* nss-nis-stack-use.patch
* psfaa.patch
* nss-files-long-lines.patch
* setlocale-directory-traversal.patch
* dt-ppc64-num.patch
* ppc64le-profiling.patch
* s390-revert-abi-change.patch
* disable-gconv-translit-modules.patch
* resolv-dont-ignore-second-answer.patch
* iconv-ibm-sentinel-check.patch
- Remove sprof.1, and mtrace.1, now included in the man-pages package
-------------------------------------------------------------------
Tue Sep 2 07:52:36 UTC 2014 - schwab@suse.de

View File

@ -99,10 +99,10 @@ BuildRequires: gd-devel
# 3.1 is the openSUSE 12.1 kernel
%define enablekernel 3.0
Version: 2.19
Version: 2.20
Release: 0
%define glibc_major_version 2.19
%define git_id 9a869d822025
%define glibc_major_version 2.20
%define git_id b8079dd0d360
Url: http://www.gnu.org/software/libc/libc.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source: glibc-%{version}-%{git_id}.tar.xz
@ -231,54 +231,12 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM fix memory leak in nss_dns
Patch1000: nss-dns-memleak.patch
# PATCH-FIX-UPSTREAM Fix sign of input to bsloww1 (BZ #16623)
Patch1001: sin-sign.patch
# PATCH-FIX-UPSTREAM Fix pldd not to leave process stopped after detaching
Patch1002: pldd-wait-ptrace-stop.patch
# PATCH-FIX-UPSTREAM Improved support for tracking startup failure in nscd service (BZ #16639)
Patch1003: nscd-track-startup-failures.patch
# PATCH-FIX-UPSTREAM GLIBC Optimizations For POWER8 Hardware
Patch1004: powerpc-opt-power8.patch
# PATCH-FIX-UPSTREAM Account for alloca use when collecting interface addresses
Patch1005: check-pf-alloca.patch
# PATCH-FIX-UPSTREAM Fix use of half-initialized result in getaddrinfo when using nscd
Patch1006: getaddrinfo-uninit-result.patch
# PATCH-FIX-UPSTREAM Fix ppc64le copysign overwriting parent stack frame (BZ #16786)
Patch1007: ppc64-copysign.patch
# PATCH-FIX-UPSTREAM Correct IBM long double nextafterl (BZ #16739)
Patch1008: nextafterl-ibm-ldouble.patch
# PATCH-FIX-UPSTREAM Remove faulty assembler implementations for IBM long double (BZ #16701, BZ #16706, BZ #16707)
Patch1009: ibm-long-double-math.patch
# PATCH-FIX-UPSTREAM Correct IBM long double frexpl (BZ #16740, BZ #16619)
Patch1010: ibm-long-double-frexpl.patch
# PATCH-FIX-UPSTREAM Fix aarch64 setcontext clobbering alternate signal stack (BZ #16629)
Patch1011: aarch64-setcontext.patch
# PATCH-FIX-UPSTREAM Fix unbound stack use in NIS NSS module (BZ #16932)
Patch1012: nss-nis-stack-use.patch
# PATCH-FIX-UPSTREAM posix_spawn_file_actions_addopen needs to copy the path argument (BZ #17048)
Patch1013: psfaa.patch
# PATCH-FIX-UPSTREAM Don't ignore too long lines in nss_files (BZ #17079)
Patch1014: nss-files-long-lines.patch
# PATCH-FIX-UPSTREAM Directory traversal in locale environment handling (BZ #17137)
Patch1015: setlocale-directory-traversal.patch
# PATCH-FIX-UPSTREAM Correct DT_PPC64_NUM (BZ #17153)
Patch1016: dt-ppc64-num.patch
# PATCH-FIX-UPSTREAM PowerPC: Fix gprof entry point for LE (BZ #17213)
Patch1017: ppc64le-profiling.patch
# PATCH-FIX-UPSTREAM S/390 Reverting the jmp_buf/ucontext_t ABI change (bnc#887228)
Patch1018: s390-revert-abi-change.patch
# PATCH-FIX-UPSTREAM Disable gconv transliteration module loading (BZ #17187)
Patch1019: disable-gconv-translit-modules.patch
###
# Patches awaiting upstream approval
###
# PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142)
Patch2000: fix-locking-in-_IO_cleanup.patch
# PATCH-FIX-UPSTREAM Don't ignore second answer from nameserver if the first one was empty (BZ #13651)
Patch2001: resolv-dont-ignore-second-answer.patch
# PATCH-FIX-UPSTREAM Never try to execute the file in ldd (BZ #16750)
Patch2002: ldd-system-interp.patch
# PATCH-FIX-UPSTREAM Don't close or flush stdio streams on abort (BZ #15436)
@ -291,8 +249,6 @@ Patch2005: glibc-memset-nontemporal.diff
Patch2006: ibm93x-redundant-shift-si.patch
# PATCH-FIX-UPSTREAM Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in pthread_mutexattr_gettype (BZ #15790)
Patch2007: pthread-mutexattr-gettype-kind.patch
# PATCH-FIX-UPSTREAM Fix crashes on invalid input in IBM gconv modules (BZ #17325)
Patch2008: iconv-ibm-sentinel-check.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -494,36 +450,13 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch1013 -p1
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
%patch1018 -p1
%patch1019 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
%patch3000
@ -581,10 +514,10 @@ echo "#define GITID \"%{git_id}\"" >> version.h
# Default CFLAGS and Compiler
#
BuildFlags="%{optflags} -U_FORTIFY_SOURCE"
BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')"
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')
BuildCC="%__cc"
BuildCCplus="%__cxx"
add_ons=",libidn"
add_ons=libidn
#
#now overwrite for some architectures
#
@ -626,9 +559,6 @@ add_ons=",libidn"
%ifarch %ix86
add_ons=$add_ons,noversion
%endif
%ifarch %arm aarch64 mipsel ia64 m68k
add_ons=$add_ons,ports
%endif
%ifarch mipsel
# fails to build otherwise - need to recheck and fix
%define enable_stackguard_randomization 0
@ -637,7 +567,6 @@ add_ons=",libidn"
configure_and_build_glibc() {
local dirname="$1"; shift
local cflags="$1"; shift
local addons="$1"; shift
mkdir "cc-$dirname"
cd "cc-$dirname"
%ifarch %arm aarch64
@ -664,7 +593,7 @@ configure_and_build_glibc() {
CC="$BuildCC" CXX="$BuildCCplus" \
--prefix=%{_prefix} \
--libexecdir=%{_libexecdir} --infodir=%{_infodir} \
--enable-add-ons=nptl$addons \
--enable-add-ons=$add_ons \
$profile $elision \
"$@" \
%if %{enable_stackguard_randomization}
@ -694,7 +623,7 @@ configure_and_build_glibc() {
#
# Build base glibc
#
configure_and_build_glibc base "$BuildFlags" "$add_ons"
configure_and_build_glibc base "$BuildFlags"
%else
#
# Build POWER-optimized glibc
@ -705,10 +634,10 @@ configure_and_build_glibc() {
pBuildFlags+=" -mcpu=%{powerpc_optimize_base}"
%endif
%if "%{powerpc_optimize_base}" != ""
configure_and_build_glibc base "$pBuildFlags" "$add_ons" --with-cpu=%{powerpc_optimize_base}
configure_and_build_glibc base "$pBuildFlags" --with-cpu=%{powerpc_optimize_base}
%else
# Use no default CPU
configure_and_build_glibc base "$pBuildFlags" "$add_ons"
configure_and_build_glibc base "$pBuildFlags"
%endif
%if %{build_variants}
# Then other power variants:
@ -723,19 +652,19 @@ configure_and_build_glibc() {
power7 \
%endif
; do
configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" "$add_ons" \
configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" \
--with-cpu=$pcpu
done
# Eventually, special Cell variant:
%if %{powerpc_optimize_cpu_cell}
configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell" "$add_ons"
configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell"
%endif
%endif # %{build_variants}
%endif # optimize_power
%if %{build_variants}
%ifarch i686 x86_64
configure_and_build_glibc noelision "$BuildFlags" "$add_ons"
configure_and_build_glibc noelision "$BuildFlags"
%endif
%endif
@ -785,8 +714,25 @@ popd
export SUSE_ASNEEDED=0
# Increase timeout
export TIMEOUTFACTOR=16
make -C cc-base -k check ||
find cc-base -name "*.out" | tar -czf - -T - | base64
make -C cc-base -k check || {
cd cc-base
o=$-
set +x
for sum in */*.sum; do
while read s t; do
case $s in
XPASS:|PASS:)
echo ++++++ $s $t ++++++
;;
*) # X?FAIL:
echo ------ $s $t ------
test ! -f $t.out || cat $t.out
;;
esac
done < $sum
done
set -$o
}
%else
# This has to pass on all platforms!
# Exceptions:
@ -1016,7 +962,6 @@ rm -f %{buildroot}%{_bindir}/pcprofiledump
rm -f %{buildroot}%{_bindir}/sotruss
rm -f %{buildroot}%{_bindir}/xtrace
rm -f %{buildroot}%{_bindir}/pldd
rm -f %{buildroot}%{_mandir}/man1/mtrace.*
rm -rf %{buildroot}%{_libdir}/audit
%ifarch i686
@ -1041,8 +986,7 @@ rm -f %{buildroot}/%{_lib}/ld*.so* %{buildroot}/%{_lib}/lib[!mp]*
rm -f %{buildroot}/lib/ld*.so*
rm -f %{buildroot}%{_libdir}/lib*
rm -f %{buildroot}%{_bindir}/{catchsegv,ldd*,sprof}
rm -f %{buildroot}%{_mandir}/man1/[!m]*
rm -rf %{buildroot}%{_mandir}/man[!1]
rm -rf %{buildroot}%{_mandir}/man*
rm -rf %{buildroot}/sbin %{buildroot}%{_includedir}
%endif # %{utils_build}
@ -1266,7 +1210,6 @@ exit 0
%doc COPYING COPYING.LIB NEWS README BUGS CONFORMANCE
%doc %{_mandir}/man1/catchsegv.1.gz
%doc %{_mandir}/man1/rpcgen.1.gz
%doc %{_mandir}/man1/sprof.1.gz
%doc %{_mandir}/man3/*
%{_bindir}/catchsegv
%{_bindir}/rpcgen
@ -1377,7 +1320,6 @@ exit 0
%{_bindir}/sotruss
%{_bindir}/xtrace
%{_bindir}/pldd
%doc %{_mandir}/man1/mtrace.1.gz
%endif # %{utils_build}
%changelog

View File

@ -1,3 +1,53 @@
-------------------------------------------------------------------
Mon Sep 8 09:48:26 UTC 2014 - schwab@suse.de
- Update to glibc 2.20 release.
* Reverted change of ABI data structures for s390 and s390x
* Support for file description locks is added to systems running the
Linux kernel
* Optimized strchr implementation for AArch64
* The minimum Linux kernel version that this version of the GNU C Library
can be used with is 2.6.32
* Running the testsuite no longer terminates as soon as a test fails
* The am33 port, which had not worked for several years, has been removed
from ports.
* The _BSD_SOURCE and _SVID_SOURCE feature test macros are no longer
supported; they now act the same as _DEFAULT_SOURCE (but generate a
warning)
* Optimized strcmp implementation for ARMv7
* Added support for TX lock elision of pthread mutexes on s390 and s390x
* All supported architectures now use the main glibc sysdeps directory
instead of some being in a separate "ports" directory
* The NPTL implementation of POSIX pthreads is no longer an "add-on"
* Locale names, including those obtained from environment variables (LANG
and the LC_* variables), are more tightly checked for proper syntax
* On x86-64, the dynamic linker's lazy-binding support is now compatible
with application code using Intel MPX instructions
- Patches from upstream removed
* nss-dns-memleak.patch
* sin-sign.patch
* pldd-wait-ptrace-stop.patch
* nscd-track-startup-failures.patch
* powerpc-opt-power8.patch
* check-pf-alloca.patch
* getaddrinfo-uninit-result.patch
* ppc64-copysign.patch
* nextafterl-ibm-ldouble.patch
* ibm-long-double-math.patch
* ibm-long-double-frexpl.patch
* aarch64-setcontext.patch
* nss-nis-stack-use.patch
* psfaa.patch
* nss-files-long-lines.patch
* setlocale-directory-traversal.patch
* dt-ppc64-num.patch
* ppc64le-profiling.patch
* s390-revert-abi-change.patch
* disable-gconv-translit-modules.patch
* resolv-dont-ignore-second-answer.patch
* iconv-ibm-sentinel-check.patch
- Remove sprof.1, and mtrace.1, now included in the man-pages package
-------------------------------------------------------------------
Tue Sep 2 07:52:36 UTC 2014 - schwab@suse.de

View File

@ -100,10 +100,10 @@ BuildRequires: gd-devel
# 3.1 is the openSUSE 12.1 kernel
%define enablekernel 3.0
Version: 2.19
Version: 2.20
Release: 0
%define glibc_major_version 2.19
%define git_id 9a869d822025
%define glibc_major_version 2.20
%define git_id b8079dd0d360
Url: http://www.gnu.org/software/libc/libc.html
BuildRoot: %{_tmppath}/%{name}-%{version}-build
#Source: glibc-%{version}-%{git_id}.tar.xz
@ -232,54 +232,12 @@ Patch306: glibc-fix-double-loopback.diff
###
# Patches from upstream
###
# PATCH-FIX-UPSTREAM fix memory leak in nss_dns
Patch1000: nss-dns-memleak.patch
# PATCH-FIX-UPSTREAM Fix sign of input to bsloww1 (BZ #16623)
Patch1001: sin-sign.patch
# PATCH-FIX-UPSTREAM Fix pldd not to leave process stopped after detaching
Patch1002: pldd-wait-ptrace-stop.patch
# PATCH-FIX-UPSTREAM Improved support for tracking startup failure in nscd service (BZ #16639)
Patch1003: nscd-track-startup-failures.patch
# PATCH-FIX-UPSTREAM GLIBC Optimizations For POWER8 Hardware
Patch1004: powerpc-opt-power8.patch
# PATCH-FIX-UPSTREAM Account for alloca use when collecting interface addresses
Patch1005: check-pf-alloca.patch
# PATCH-FIX-UPSTREAM Fix use of half-initialized result in getaddrinfo when using nscd
Patch1006: getaddrinfo-uninit-result.patch
# PATCH-FIX-UPSTREAM Fix ppc64le copysign overwriting parent stack frame (BZ #16786)
Patch1007: ppc64-copysign.patch
# PATCH-FIX-UPSTREAM Correct IBM long double nextafterl (BZ #16739)
Patch1008: nextafterl-ibm-ldouble.patch
# PATCH-FIX-UPSTREAM Remove faulty assembler implementations for IBM long double (BZ #16701, BZ #16706, BZ #16707)
Patch1009: ibm-long-double-math.patch
# PATCH-FIX-UPSTREAM Correct IBM long double frexpl (BZ #16740, BZ #16619)
Patch1010: ibm-long-double-frexpl.patch
# PATCH-FIX-UPSTREAM Fix aarch64 setcontext clobbering alternate signal stack (BZ #16629)
Patch1011: aarch64-setcontext.patch
# PATCH-FIX-UPSTREAM Fix unbound stack use in NIS NSS module (BZ #16932)
Patch1012: nss-nis-stack-use.patch
# PATCH-FIX-UPSTREAM posix_spawn_file_actions_addopen needs to copy the path argument (BZ #17048)
Patch1013: psfaa.patch
# PATCH-FIX-UPSTREAM Don't ignore too long lines in nss_files (BZ #17079)
Patch1014: nss-files-long-lines.patch
# PATCH-FIX-UPSTREAM Directory traversal in locale environment handling (BZ #17137)
Patch1015: setlocale-directory-traversal.patch
# PATCH-FIX-UPSTREAM Correct DT_PPC64_NUM (BZ #17153)
Patch1016: dt-ppc64-num.patch
# PATCH-FIX-UPSTREAM PowerPC: Fix gprof entry point for LE (BZ #17213)
Patch1017: ppc64le-profiling.patch
# PATCH-FIX-UPSTREAM S/390 Reverting the jmp_buf/ucontext_t ABI change (bnc#887228)
Patch1018: s390-revert-abi-change.patch
# PATCH-FIX-UPSTREAM Disable gconv transliteration module loading (BZ #17187)
Patch1019: disable-gconv-translit-modules.patch
###
# Patches awaiting upstream approval
###
# PATCH-FIX-UPSTREAM Always to locking when accessing streams (BZ #15142)
Patch2000: fix-locking-in-_IO_cleanup.patch
# PATCH-FIX-UPSTREAM Don't ignore second answer from nameserver if the first one was empty (BZ #13651)
Patch2001: resolv-dont-ignore-second-answer.patch
# PATCH-FIX-UPSTREAM Never try to execute the file in ldd (BZ #16750)
Patch2002: ldd-system-interp.patch
# PATCH-FIX-UPSTREAM Don't close or flush stdio streams on abort (BZ #15436)
@ -292,8 +250,6 @@ Patch2005: glibc-memset-nontemporal.diff
Patch2006: ibm93x-redundant-shift-si.patch
# PATCH-FIX-UPSTREAM Filter out PTHREAD_MUTEX_NO_ELISION_NP bit in pthread_mutexattr_gettype (BZ #15790)
Patch2007: pthread-mutexattr-gettype-kind.patch
# PATCH-FIX-UPSTREAM Fix crashes on invalid input in IBM gconv modules (BZ #17325)
Patch2008: iconv-ibm-sentinel-check.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -494,36 +450,13 @@ rm nscd/s-stamp
%patch304 -p1
%patch306 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1008 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch1013 -p1
%patch1014 -p1
%patch1015 -p1
%patch1016 -p1
%patch1017 -p1
%patch1018 -p1
%patch1019 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch2004 -p1
%patch2005 -p1
%patch2006 -p1
%patch2007 -p1
%patch2008 -p1
%patch3000
@ -581,10 +514,10 @@ echo "#define GITID \"%{git_id}\"" >> version.h
# Default CFLAGS and Compiler
#
BuildFlags="%{optflags} -U_FORTIFY_SOURCE"
BuildFlags="$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')"
BuildFlags=$(echo $BuildFlags | sed -e 's#-fstack-protector##' -e 's#-ffortify=[0-9]*##')
BuildCC="%__cc"
BuildCCplus="%__cxx"
add_ons=",libidn"
add_ons=libidn
#
#now overwrite for some architectures
#
@ -626,9 +559,6 @@ add_ons=",libidn"
%ifarch %ix86
add_ons=$add_ons,noversion
%endif
%ifarch %arm aarch64 mipsel ia64 m68k
add_ons=$add_ons,ports
%endif
%ifarch mipsel
# fails to build otherwise - need to recheck and fix
%define enable_stackguard_randomization 0
@ -637,7 +567,6 @@ add_ons=",libidn"
configure_and_build_glibc() {
local dirname="$1"; shift
local cflags="$1"; shift
local addons="$1"; shift
mkdir "cc-$dirname"
cd "cc-$dirname"
%ifarch %arm aarch64
@ -664,7 +593,7 @@ configure_and_build_glibc() {
CC="$BuildCC" CXX="$BuildCCplus" \
--prefix=%{_prefix} \
--libexecdir=%{_libexecdir} --infodir=%{_infodir} \
--enable-add-ons=nptl$addons \
--enable-add-ons=$add_ons \
$profile $elision \
"$@" \
%if %{enable_stackguard_randomization}
@ -694,7 +623,7 @@ configure_and_build_glibc() {
#
# Build base glibc
#
configure_and_build_glibc base "$BuildFlags" "$add_ons"
configure_and_build_glibc base "$BuildFlags"
%else
#
# Build POWER-optimized glibc
@ -705,10 +634,10 @@ configure_and_build_glibc() {
pBuildFlags+=" -mcpu=%{powerpc_optimize_base}"
%endif
%if "%{powerpc_optimize_base}" != ""
configure_and_build_glibc base "$pBuildFlags" "$add_ons" --with-cpu=%{powerpc_optimize_base}
configure_and_build_glibc base "$pBuildFlags" --with-cpu=%{powerpc_optimize_base}
%else
# Use no default CPU
configure_and_build_glibc base "$pBuildFlags" "$add_ons"
configure_and_build_glibc base "$pBuildFlags"
%endif
%if %{build_variants}
# Then other power variants:
@ -723,19 +652,19 @@ configure_and_build_glibc() {
power7 \
%endif
; do
configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" "$add_ons" \
configure_and_build_glibc $pcpu "$BuildFlags -mcpu=$pcpu" \
--with-cpu=$pcpu
done
# Eventually, special Cell variant:
%if %{powerpc_optimize_cpu_cell}
configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell" "$add_ons"
configure_and_build_glibc ppc-cell-be "$BuildFlags -mcpu=cell"
%endif
%endif # %{build_variants}
%endif # optimize_power
%if %{build_variants}
%ifarch i686 x86_64
configure_and_build_glibc noelision "$BuildFlags" "$add_ons"
configure_and_build_glibc noelision "$BuildFlags"
%endif
%endif
@ -785,8 +714,25 @@ popd
export SUSE_ASNEEDED=0
# Increase timeout
export TIMEOUTFACTOR=16
make -C cc-base -k check ||
find cc-base -name "*.out" | tar -czf - -T - | base64
make -C cc-base -k check || {
cd cc-base
o=$-
set +x
for sum in */*.sum; do
while read s t; do
case $s in
XPASS:|PASS:)
echo ++++++ $s $t ++++++
;;
*) # X?FAIL:
echo ------ $s $t ------
test ! -f $t.out || cat $t.out
;;
esac
done < $sum
done
set -$o
}
%else
# This has to pass on all platforms!
# Exceptions:
@ -1016,7 +962,6 @@ rm -f %{buildroot}%{_bindir}/pcprofiledump
rm -f %{buildroot}%{_bindir}/sotruss
rm -f %{buildroot}%{_bindir}/xtrace
rm -f %{buildroot}%{_bindir}/pldd
rm -f %{buildroot}%{_mandir}/man1/mtrace.*
rm -rf %{buildroot}%{_libdir}/audit
%ifarch i686
@ -1041,8 +986,7 @@ rm -f %{buildroot}/%{_lib}/ld*.so* %{buildroot}/%{_lib}/lib[!mp]*
rm -f %{buildroot}/lib/ld*.so*
rm -f %{buildroot}%{_libdir}/lib*
rm -f %{buildroot}%{_bindir}/{catchsegv,ldd*,sprof}
rm -f %{buildroot}%{_mandir}/man1/[!m]*
rm -rf %{buildroot}%{_mandir}/man[!1]
rm -rf %{buildroot}%{_mandir}/man*
rm -rf %{buildroot}/sbin %{buildroot}%{_includedir}
%endif # %{utils_build}
@ -1266,7 +1210,6 @@ exit 0
%doc COPYING COPYING.LIB NEWS README BUGS CONFORMANCE
%doc %{_mandir}/man1/catchsegv.1.gz
%doc %{_mandir}/man1/rpcgen.1.gz
%doc %{_mandir}/man1/sprof.1.gz
%doc %{_mandir}/man3/*
%{_bindir}/catchsegv
%{_bindir}/rpcgen
@ -1377,7 +1320,6 @@ exit 0
%{_bindir}/sotruss
%{_bindir}/xtrace
%{_bindir}/pldd
%doc %{_mandir}/man1/mtrace.1.gz
%endif # %{utils_build}
%changelog

View File

@ -1,194 +0,0 @@
2014-04-16 Alan Modra <amodra@gmail.com>
[BZ #16740]
[BZ #16619]
* sysdeps/ieee754/ldbl-128ibm/s_frexpl.c (__frexpl): Rewrite.
* math/libm-test.inc (frexp_test_data): Add tests.
Index: glibc-2.19/math/libm-test.inc
===================================================================
--- glibc-2.19.orig/math/libm-test.inc
+++ glibc-2.19/math/libm-test.inc
@@ -8723,6 +8723,15 @@ static const struct test_f_f1_data frexp
TEST_fI_f1 (frexp, 12.8L, 0.8L, 4, NO_INEXACT_EXCEPTION),
TEST_fI_f1 (frexp, -27.34L, -0.854375L, 5, NO_INEXACT_EXCEPTION),
+
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG >= 106
+ TEST_fI_f1 (frexp, 1.0L-0x1p-106L, 1.0L-0x1p-106L, 0, NO_INEXACT_EXCEPTION),
+ TEST_fI_f1 (frexp, 1.0L, 0.5L, 1, NO_INEXACT_EXCEPTION),
+ TEST_fI_f1 (frexp, 1.0L+0x1p-105L, 0.5L+0x1p-106L, 1, NO_INEXACT_EXCEPTION),
+ TEST_fI_f1 (frexp, -1.0L+0x1p-106L, -1.0L+0x1p-106L, 0, NO_INEXACT_EXCEPTION),
+ TEST_fI_f1 (frexp, -1.0L, -0.5L, 1, NO_INEXACT_EXCEPTION),
+ TEST_fI_f1 (frexp, -1.0L-0x1p-105L, -0.5L-0x1p-106L, 1, NO_INEXACT_EXCEPTION),
+#endif
};
static void
Index: glibc-2.19/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
===================================================================
--- glibc-2.19.orig/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
+++ glibc-2.19/sysdeps/ieee754/ldbl-128ibm/s_frexpl.c
@@ -31,57 +31,115 @@ static char rcsid[] = "$NetBSD: $";
#include <math_private.h>
#include <math_ldbl_opt.h>
-static const long double
-two107 = 162259276829213363391578010288128.0; /* 0x4670000000000000, 0 */
-
long double __frexpl(long double x, int *eptr)
{
- uint64_t hx, lx, ix, ixl;
- int64_t explo;
- double xhi, xlo;
-
- ldbl_unpack (x, &xhi, &xlo);
- EXTRACT_WORDS64 (hx, xhi);
- EXTRACT_WORDS64 (lx, xlo);
- ixl = 0x7fffffffffffffffULL&lx;
- ix = 0x7fffffffffffffffULL&hx;
- *eptr = 0;
- if(ix>=0x7ff0000000000000ULL||ix==0) return x; /* 0,inf,nan */
- if (ix<0x0010000000000000ULL) { /* subnormal */
- x *= two107;
- xhi = ldbl_high (x);
- EXTRACT_WORDS64 (hx, xhi);
- ix = hx&0x7fffffffffffffffULL;
- *eptr = -107;
+ uint64_t hx, lx, ix, ixl;
+ int64_t explo, expon;
+ double xhi, xlo;
+
+ ldbl_unpack (x, &xhi, &xlo);
+ EXTRACT_WORDS64 (hx, xhi);
+ EXTRACT_WORDS64 (lx, xlo);
+ ixl = 0x7fffffffffffffffULL & lx;
+ ix = 0x7fffffffffffffffULL & hx;
+ expon = 0;
+ if (ix >= 0x7ff0000000000000ULL || ix == 0)
+ {
+ /* 0,inf,nan. */
+ *eptr = expon;
+ return x;
+ }
+ expon = ix >> 52;
+ if (expon == 0)
+ {
+ /* Denormal high double, the low double must be 0.0. */
+ int cnt;
+
+ /* Normalize. */
+ if (sizeof (ix) == sizeof (long))
+ cnt = __builtin_clzl (ix);
+ else if ((ix >> 32) != 0)
+ cnt = __builtin_clzl ((long) (ix >> 32));
+ else
+ cnt = __builtin_clzl ((long) ix) + 32;
+ cnt = cnt - 12;
+ expon -= cnt;
+ ix <<= cnt + 1;
+ }
+ expon -= 1022;
+ ix &= 0x000fffffffffffffULL;
+ hx &= 0x8000000000000000ULL;
+ hx |= (1022LL << 52) | ix;
+
+ if (ixl != 0)
+ {
+ /* If the high double is an exact power of two and the low
+ double has the opposite sign, then the exponent calculated
+ from the high double is one too big. */
+ if (ix == 0
+ && (int64_t) (hx ^ lx) < 0)
+ {
+ hx += 1L << 52;
+ expon -= 1;
+ }
+
+ explo = ixl >> 52;
+ if (explo == 0)
+ {
+ /* The low double started out as a denormal. Normalize its
+ mantissa and adjust the exponent. */
+ int cnt;
+
+ if (sizeof (ixl) == sizeof (long))
+ cnt = __builtin_clzl (ixl);
+ else if ((ixl >> 32) != 0)
+ cnt = __builtin_clzl ((long) (ixl >> 32));
+ else
+ cnt = __builtin_clzl ((long) ixl) + 32;
+ cnt = cnt - 12;
+ explo -= cnt;
+ ixl <<= cnt + 1;
+ }
+
+ /* With variable precision we can't assume much about the
+ magnitude of the returned low double. It may even be a
+ denormal. */
+ explo -= expon;
+ ixl &= 0x000fffffffffffffULL;
+ lx &= 0x8000000000000000ULL;
+ if (explo <= 0)
+ {
+ /* Handle denormal low double. */
+ if (explo > -52)
+ {
+ ixl |= 1LL << 52;
+ ixl >>= 1 - explo;
+ }
+ else
+ {
+ ixl = 0;
+ lx = 0;
+ if ((hx & 0x7ff0000000000000ULL) == (1023LL << 52))
+ {
+ /* Oops, the adjustment we made above for values a
+ little smaller than powers of two turned out to
+ be wrong since the returned low double will be
+ zero. This can happen if the input was
+ something weird like 0x1p1000 - 0x1p-1000. */
+ hx -= 1L << 52;
+ expon += 1;
+ }
+ }
+ explo = 0;
}
- *eptr += (ix>>52)-1022;
+ lx |= (explo << 52) | ixl;
+ }
- if (ixl != 0ULL) {
- explo = (ixl>>52) - (ix>>52) + 0x3fe;
- if ((ixl&0x7ff0000000000000ULL) == 0LL) {
- /* the lower double is a denormal so we need to correct its
- mantissa and perhaps its exponent. */
- int cnt;
-
- if (sizeof (ixl) == sizeof (long))
- cnt = __builtin_clzl (ixl);
- else if ((ixl >> 32) != 0)
- cnt = __builtin_clzl ((long) (ixl >> 32));
- else
- cnt = __builtin_clzl ((long) ixl) + 32;
- cnt = cnt - 12;
- lx = (lx&0x8000000000000000ULL) | ((explo-cnt)<<52)
- | ((ixl<<(cnt+1))&0x000fffffffffffffULL);
- } else
- lx = (lx&0x800fffffffffffffULL) | (explo<<52);
- } else
- lx = 0ULL;
-
- hx = (hx&0x800fffffffffffffULL) | 0x3fe0000000000000ULL;
- INSERT_WORDS64 (xhi, hx);
- INSERT_WORDS64 (xlo, lx);
- x = ldbl_pack (xhi, xlo);
- return x;
+ INSERT_WORDS64 (xhi, hx);
+ INSERT_WORDS64 (xlo, lx);
+ x = ldbl_pack (xhi, xlo);
+ *eptr = expon;
+ return x;
}
#ifdef IS_IN_libm
long_double_symbol (libm, __frexpl, frexpl);

View File

@ -1,462 +0,0 @@
2014-03-14 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
[BZ #16707]
* sysdeps/powerpc/powerpc64/fpu/s_roundl.S: Remove wrong
implementation.
* math/libm-test.inc (round_test_data): Add more tests.
[BZ #16706]
* sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S: Remove wrong
implementation.
* math/libm-test.inc (nearbyint_test_data): Add more tests.
[BZ #16701]
* sysdeps/powerpc/powerpc64/fpu/s_ceill.S: Remove wrong
implementation.
* math/libm-test.inc (ceil_test_data): Add more tests.
Index: glibc-2.19/math/libm-test.inc
===================================================================
--- glibc-2.19.orig/math/libm-test.inc
+++ glibc-2.19/math/libm-test.inc
@@ -6000,6 +6000,15 @@ static const struct test_f_f_data ceil_t
TEST_f_f (ceil, -72057594037927936.75L, -72057594037927936.0L),
TEST_f_f (ceil, -72057594037927937.5L, -72057594037927937.0L),
+ /* Check cases where first double is a exact integer higher than 2^52 and
+ the precision is determined by second long double for IBM long double. */
+ TEST_f_f (ceil, 34503599627370498.515625L, 34503599627370499.0L),
+ TEST_f_f (ceil, -34503599627370498.515625L, -34503599627370498.0L),
+# if LDBL_MANT_DIG >= 106
+ TEST_f_f (ceil, 1192568192774434123539907640624.484375L, 1192568192774434123539907640625.0L),
+ TEST_f_f (ceil, -1192568192774434123539907640624.484375L, -1192568192774434123539907640624.0L),
+# endif
+
TEST_f_f (ceil, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L),
TEST_f_f (ceil, 10141204801825835211973625643008.25L, 10141204801825835211973625643009.0L),
TEST_f_f (ceil, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L),
@@ -10495,6 +10504,16 @@ static const struct test_f_f_data nearby
TEST_f_f (nearbyint, -562949953421312.75, -562949953421313.0, NO_INEXACT_EXCEPTION),
TEST_f_f (nearbyint, -1125899906842624.75, -1125899906842625.0, NO_INEXACT_EXCEPTION),
#endif
+#ifdef TEST_LDOUBLE
+ /* Check cases where first double is a exact integer higher than 2^52 and
+ the precision is determined by second long double for IBM long double. */
+ TEST_f_f (nearbyint, 34503599627370498.515625L, 34503599627370499.0L),
+ TEST_f_f (nearbyint, -34503599627370498.515625L, -34503599627370499.0L),
+# if LDBL_MANT_DIG >= 106
+ TEST_f_f (nearbyint, 1192568192774434123539907640624.484375L, 1192568192774434123539907640624.0L),
+ TEST_f_f (nearbyint, -1192568192774434123539907640624.484375L, -1192568192774434123539907640624.0L),
+# endif
+#endif
};
static void
@@ -11792,6 +11811,15 @@ static const struct test_f_f_data round_
TEST_f_f (round, -72057594037927936.75L, -72057594037927937.0L),
TEST_f_f (round, -72057594037927937.5L, -72057594037927938.0L),
+ /* Check cases where first double is a exact integer higher than 2^52 and
+ the precision is determined by second long double for IBM long double. */
+ TEST_f_f (round, 34503599627370498.515625L, 34503599627370499.0L),
+ TEST_f_f (round, -34503599627370498.515625L, -34503599627370499.0L),
+# if LDBL_MANT_DIG >= 106
+ TEST_f_f (round, 1192568192774434123539907640624.484375L, 1192568192774434123539907640624.0L),
+ TEST_f_f (round, -1192568192774434123539907640624.484375L, -1192568192774434123539907640624.0L),
+# endif
+
TEST_f_f (round, 10141204801825835211973625643007.5L, 10141204801825835211973625643008.0L),
TEST_f_f (round, 10141204801825835211973625643008.25L, 10141204801825835211973625643008.0L),
TEST_f_f (round, 10141204801825835211973625643008.5L, 10141204801825835211973625643009.0L),
Index: glibc-2.19/sysdeps/powerpc/powerpc64/fpu/s_ceill.S
===================================================================
--- glibc-2.19.orig/sysdeps/powerpc/powerpc64/fpu/s_ceill.S
+++ /dev/null
@@ -1,132 +0,0 @@
-/* s_ceill.S IBM extended format long double version.
- Copyright (C) 2004-2014 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
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
-
- .section ".text"
-
-/* long double [fp1,fp2] ceill (long double x [fp1,fp2])
- IEEE 1003.1 ceil function.
-
- PowerPC64 long double uses the IBM extended format which is
- represented two 64-floating point double values. The values are
- non-overlapping giving an effective precision of 106 bits. The first
- double contains the high order bits of mantissa and is always ceiled
- to represent a normal ceiling of long double to double. Since the
- long double value is sum of the high and low values, the low double
- normally has the opposite sign to compensate for the this ceiling.
-
- For long double there are two cases:
- 1) |x| < 2**52, all the integer bits are in the high double.
- ceil the high double and set the low double to -0.0.
- 2) |x| >= 2**52, ceiling involves both doubles.
- See the comment before label .L2 for details.
- */
-
-ENTRY (__ceill)
- mffs fp11 /* Save current FPU rounding mode. */
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fabs fp9,fp2
- fsub fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L2
- mtfsfi 7,2 /* Set rounding mode toward +inf. */
- fneg fp2,fp12
- ble- cr6,.L1
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fabs fp1,fp1 /* if (x == 0.0) */
-.L0:
- mtfsf 0x01,fp11 /* restore previous rounding mode. */
- blr /* x = 0.0; */
-.L1:
- bge- cr6,.L0 /* if (x < 0.0) */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fcmpu cr5,fp1,fp12 /* if (x > 0.0) */
- mtfsf 0x01,fp11 /* restore previous rounding mode. */
- fnabs fp1,fp1 /* if (x == 0.0) */
- blr /* x = -0.0; */
-
-/* The high double is > TWO52 so we need to round the low double and
- perhaps the high double. In this case we have to round the low
- double and handle any adjustment to the high double that may be
- caused by rounding (up). This is complicated by the fact that the
- high double may already be rounded and the low double may have the
- opposite sign to compensate.This gets a bit tricky so we use the
- following algorithm:
-
- tau = floor(x_high/TWO52);
- x0 = x_high - tau;
- x1 = x_low + tau;
- r1 = rint(x1);
- y_high = x0 + r1;
- y_low = x0 - y_high + r1;
- return y; */
-.L2:
- fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
- fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
- fcmpu cr5,fp2,fp12 /* if (x_low > 0.0) */
- bgelr- cr7 /* return x; */
- beqlr- cr0
- mtfsfi 7,2 /* Set rounding mode toward +inf. */
- fdiv fp8,fp1,fp13 /* x_high/TWO52 */
-
- bng- cr6,.L6 /* if (x > 0.0) */
- fctidz fp0,fp8
- fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
- bng cr5,.L4 /* if (x_low > 0.0) */
- fmr fp3,fp1
- fmr fp4,fp2
- b .L5
-.L4: /* if (x_low < 0.0) */
- fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
- fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
-.L5:
- fadd fp5,fp4,fp13 /* r1 = r1 + TWO52; */
- fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
- b .L9
-.L6: /* if (x < 0.0) */
- fctidz fp0,fp8
- fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
- bnl cr5,.L7 /* if (x_low < 0.0) */
- fmr fp3,fp1
- fmr fp4,fp2
- b .L8
-.L7: /* if (x_low > 0.0) */
- fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
- fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
-.L8:
- fsub fp5,fp4,fp13 /* r1-= TWO52; */
- fadd fp5,fp5,fp13 /* r1+= TWO52; */
-.L9:
- mtfsf 0x01,fp11 /* restore previous rounding mode. */
- fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
- fsub fp2,fp3,fp1 /* y_low = x0 - y_high + r1; */
- fadd fp2,fp2,fp5
- blr
-END (__ceill)
-
-long_double_symbol (libm, __ceill, ceill)
Index: glibc-2.19/sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S
===================================================================
--- glibc-2.19.orig/sysdeps/powerpc/powerpc64/fpu/s_nearbyintl.S
+++ /dev/null
@@ -1,113 +0,0 @@
-/* nearbyint long double.
- IBM extended format long double version.
- Copyright (C) 2004-2014 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
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
- .section ".text"
-
-/* long double [fp1,fp2] nearbyintl (long double x [fp1,fp2])
- IEEE 1003.1 nearbyintl function. nearbyintl is similar to the rintl
- but does raise the "inexact" exception. This implementation is
- based on rintl but explicitly masks the inexact exception on entry
- and clears any pending inexact before restoring the exception mask
- on exit.
-
- PowerPC64 long double uses the IBM extended format which is
- represented two 64-floating point double values. The values are
- non-overlapping giving an effective precision of 106 bits. The first
- double contains the high order bits of mantissa and is always rounded
- to represent a normal rounding of long double to double. Since the
- long double value is sum of the high and low values, the low double
- normally has the opposite sign to compensate for the this rounding.
-
- For long double there are two cases:
- 1) |x| < 2**52, all the integer bits are in the high double.
- floor the high double and set the low double to -0.0.
- 2) |x| >= 2**52, Rounding involves both doubles.
- See the comment before label .L2 for details.
- */
-ENTRY (__nearbyintl)
- mffs fp11 /* Save current FPSCR. */
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- mtfsb0 28 /* Disable "inexact" exceptions. */
- fsub fp12,fp13,fp13 /* generate 0.0 */
- fabs fp9,fp2
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L2
- fmr fp2,fp12
- bng- cr6,.L4
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- b .L9
-.L4:
- bnl- cr6,.L9 /* if (x < 0.0) */
- fsub fp1,fp13,fp1 /* x = TWO52 - x; */
- fsub fp0,fp1,fp13 /* x = - (x - TWO52); */
- fneg fp1,fp0
-.L9:
- mtfsb0 6 /* Clear any pending "inexact" exceptions. */
- mtfsf 0x01,fp11 /* restore exception mask. */
- blr
-
-/* The high double is > TWO52 so we need to round the low double and
- perhaps the high double. This gets a bit tricky so we use the
- following algorithm:
-
- tau = floor(x_high/TWO52);
- x0 = x_high - tau;
- x1 = x_low + tau;
- r1 = nearbyint(x1);
- y_high = x0 + r1;
- y_low = r1 - tau;
- return y; */
-.L2:
- fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
- fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
- bge- cr7,.L9 /* return x; */
- beq- cr0,.L9
- fdiv fp8,fp1,fp13 /* x_high/TWO52 */
- fctidz fp0,fp8
- fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
- fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
- fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
-
- fcmpu cr6,fp4,fp12 /* if (x1 > 0.0) */
- bng- cr6,.L8
- fadd fp5,fp4,fp13 /* r1 = x1 + TWO52; */
- fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
- b .L6
-.L8:
- fmr fp5,fp4
- bge- cr6,.L6 /* if (x1 < 0.0) */
- fsub fp5,fp13,fp4 /* r1 = TWO52 - x1; */
- fsub fp0,fp5,fp13 /* r1 = - (r1 - TWO52); */
- fneg fp5,fp0
-.L6:
- fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
- fsub fp2,fp5,fp8 /* y_low = r1 - tau; */
- b .L9
-END (__nearbyintl)
-
-long_double_symbol (libm, __nearbyintl, nearbyintl)
Index: glibc-2.19/sysdeps/powerpc/powerpc64/fpu/s_roundl.S
===================================================================
--- glibc-2.19.orig/sysdeps/powerpc/powerpc64/fpu/s_roundl.S
+++ /dev/null
@@ -1,132 +0,0 @@
-/* long double round function.
- IBM extended format long double version.
- Copyright (C) 2004-2014 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
- <http://www.gnu.org/licenses/>. */
-
-#include <sysdep.h>
-#include <math_ldbl_opt.h>
-
- .section ".toc","aw"
-.LC0: /* 2**52 */
- .tc FD_43300000_0[TC],0x4330000000000000
-.LC1: /* 0.5 */
- .tc FD_3fe00000_0[TC],0x3fe0000000000000
- .section ".text"
-
-/* long double [fp1,fp2] roundl (long double x [fp1,fp2])
- IEEE 1003.1 round function. IEEE specifies "round to the nearest
- integer value, rounding halfway cases away from zero, regardless of
- the current rounding mode." However PowerPC Architecture defines
- "Round to Nearest" as "Choose the best approximation. In case of a
- tie, choose the one that is even (least significant bit o).".
- So we can't use the PowerPC "Round to Nearest" mode. Instead we set
- "Round toward Zero" mode and round by adding +-0.5 before rounding
- to the integer value. */
-
-ENTRY (__roundl)
- mffs fp11 /* Save current FPU rounding mode. */
- lfd fp13,.LC0@toc(2)
- fabs fp0,fp1
- fabs fp9,fp2
- fsub fp12,fp13,fp13 /* generate 0.0 */
- fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
- fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
- bnl- cr7,.L2
- mtfsfi 7,1 /* Set rounding mode toward 0. */
- lfd fp10,.LC1@toc(2)
- ble- cr6,.L1
- fneg fp2,fp12
- fadd fp1,fp1,fp10 /* x+= 0.5; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fsub fp1,fp1,fp13 /* x-= TWO52; */
- fabs fp1,fp1 /* if (x == 0.0) x = 0.0; */
-.L0:
- mtfsf 0x01,fp11 /* restore previous rounding mode. */
- blr
-.L1:
- fsub fp9,fp1,fp10 /* x-= 0.5; */
- fneg fp2,fp12
- bge- cr6,.L0 /* if (x < 0.0) */
- fsub fp1,fp9,fp13 /* x-= TWO52; */
- fadd fp1,fp1,fp13 /* x+= TWO52; */
- fnabs fp1,fp1 /* if (x == 0.0) x = -0.0; */
- mtfsf 0x01,fp11 /* restore previous rounding mode. */
- blr
-
-/* The high double is > TWO52 so we need to round the low double and
- perhaps the high double. In this case we have to round the low
- double and handle any adjustment to the high double that may be
- caused by rounding (up). This is complicated by the fact that the
- high double may already be rounded and the low double may have the
- opposite sign to compensate.This gets a bit tricky so we use the
- following algorithm:
-
- tau = floor(x_high/TWO52);
- x0 = x_high - tau;
- x1 = x_low + tau;
- r1 = rint(x1);
- y_high = x0 + r1;
- y_low = x0 - y_high + r1;
- return y; */
-.L2:
- fcmpu cr7,fp9,fp13 /* if (|x_low| > TWO52) */
- fcmpu cr0,fp9,fp12 /* || (|x_low| == 0.0) */
- fcmpu cr5,fp2,fp12 /* if (x_low > 0.0) */
- lfd fp10,.LC1@toc(2)
- bgelr- cr7 /* return x; */
- beqlr- cr0
- mtfsfi 7,1 /* Set rounding mode toward 0. */
- fdiv fp8,fp1,fp13 /* x_high/TWO52 */
-
- bng- cr6,.L6 /* if (x > 0.0) */
- fctidz fp0,fp8
- fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
- bng cr5,.L4 /* if (x_low > 0.0) */
- fmr fp3,fp1
- fmr fp4,fp2
- b .L5
-.L4: /* if (x_low < 0.0) */
- fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
- fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
-.L5:
- fadd fp5,fp4,fp10 /* r1 = x1 + 0.5; */
- fadd fp5,fp5,fp13 /* r1 = r1 + TWO52; */
- fsub fp5,fp5,fp13 /* r1 = r1 - TWO52; */
- b .L9
-.L6: /* if (x < 0.0) */
- fctidz fp0,fp8
- fcfid fp8,fp0 /* tau = floor(x_high/TWO52); */
- bnl cr5,.L7 /* if (x_low < 0.0) */
- fmr fp3,fp1
- fmr fp4,fp2
- b .L8
-.L7: /* if (x_low > 0.0) */
- fsub fp3,fp1,fp8 /* x0 = x_high - tau; */
- fadd fp4,fp2,fp8 /* x1 = x_low + tau; */
-.L8:
- fsub fp5,fp4,fp10 /* r1 = x1 - 0.5; */
- fsub fp5,fp5,fp13 /* r1-= TWO52; */
- fadd fp5,fp5,fp13 /* r1+= TWO52; */
-.L9:
- mtfsf 0x01,fp11 /* restore previous rounding mode. */
- fadd fp1,fp3,fp5 /* y_high = x0 + r1; */
- fsub fp2,fp3,fp1 /* y_low = x0 - y_high + r1; */
- fadd fp2,fp2,fp5
- blr
-END (__roundl)
-
-long_double_symbol (libm, __roundl, roundl)

View File

@ -110,7 +110,7 @@ Index: glibc-2.19/iconvdata/ibm930.c
+ curcs = sb; \
} \
\
if (__builtin_expect (outptr + 1 > outend, 0)) \
if (__glibc_unlikely (outptr + 1 > outend)) \
@@ -268,7 +269,6 @@ enum
*outptr++ = 0x5b; \
else \
@ -130,7 +130,7 @@ Index: glibc-2.19/iconvdata/ibm933.c
+ curcs = sb; \
} \
\
if (__builtin_expect (outptr + 1 > outend, 0)) \
if (__glibc_unlikely (outptr + 1 > outend)) \
@@ -262,7 +263,6 @@ enum
break; \
} \
@ -150,7 +150,7 @@ Index: glibc-2.19/iconvdata/ibm935.c
+ curcs = sb; \
} \
\
if (__builtin_expect (outptr + 1 > outend, 0)) \
if (__glibc_unlikely (outptr + 1 > outend)) \
@@ -262,7 +263,6 @@ enum
break; \
} \
@ -170,7 +170,7 @@ Index: glibc-2.19/iconvdata/ibm937.c
+ curcs = sb; \
} \
\
if (__builtin_expect (outptr + 1 > outend, 0)) \
if (__glibc_unlikely (outptr + 1 > outend)) \
@@ -262,7 +263,6 @@ enum
break; \
} \
@ -190,7 +190,7 @@ Index: glibc-2.19/iconvdata/ibm939.c
+ curcs = sb; \
} \
\
if (__builtin_expect (outptr + 1 > outend, 0)) \
if (__glibc_unlikely (outptr + 1 > outend)) \
@@ -267,7 +268,6 @@ enum
*outptr++ = 0xb2; \
else \

View File

@ -1,162 +0,0 @@
2014-08-29 Florian Weimer <fweimer@redhat.com>
[BZ #17325]
* iconvdata/ibm1364.c (BODY): Fix check for sentinel.
* iconvdata/ibm932.c (BODY): Replace invalid sentinel check with
assert.
* iconvdata/ibm933.c (BODY): Fix check for sentinel.
* iconvdata/ibm935.c (BODY): Likewise.
* iconvdata/ibm937.c (BODY): Likewise.
* iconvdata/ibm939.c (BODY): Likewise.
* iconvdata/ibm943.c (BODY): Replace invalid sentinel check with
assert.
* iconvdata/Makefile (iconv-test.out): Pass module list to test
script.
* iconvdata/run-iconv-test.sh: New test loop for checking for
decoder crashers.
Index: glibc-2.19/iconvdata/Makefile
===================================================================
--- glibc-2.19.orig/iconvdata/Makefile
+++ glibc-2.19/iconvdata/Makefile
@@ -302,6 +302,7 @@ $(objpfx)bug-iconv10.out: $(objpfx)gconv
$(objpfx)iconv-test.out: run-iconv-test.sh $(objpfx)gconv-modules \
$(addprefix $(objpfx),$(modules.so)) \
$(common-objdir)/iconv/iconv_prog TESTS
+ iconv_modules="$(modules)" \
$(SHELL) $< $(common-objdir) '$(test-wrapper)' > $@
$(objpfx)tst-tables.out: tst-tables.sh $(objpfx)gconv-modules \
Index: glibc-2.19/iconvdata/ibm1364.c
===================================================================
--- glibc-2.19.orig/iconvdata/ibm1364.c
+++ glibc-2.19/iconvdata/ibm1364.c
@@ -220,7 +220,8 @@ enum
++rp2; \
\
uint32_t res; \
- if (__builtin_expect (ch < rp2->start, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
+ || __builtin_expect (ch < rp2->start, 0) \
|| (res = DB_TO_UCS4[ch + rp2->idx], \
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
{ \
Index: glibc-2.19/iconvdata/ibm932.c
===================================================================
--- glibc-2.19.orig/iconvdata/ibm932.c
+++ glibc-2.19/iconvdata/ibm932.c
@@ -73,11 +73,12 @@
} \
\
ch = (ch * 0x100) + inptr[1]; \
+ /* ch was less than 0xfd. */ \
+ assert (ch < 0xfd00); \
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (rp2 == NULL, 0) \
- || __builtin_expect (ch < rp2->start, 0) \
+ if (__builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm932db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, '\1') == 0 && ch !=0)) \
{ \
Index: glibc-2.19/iconvdata/ibm933.c
===================================================================
--- glibc-2.19.orig/iconvdata/ibm933.c
+++ glibc-2.19/iconvdata/ibm933.c
@@ -161,7 +161,7 @@ enum
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (rp2 == NULL, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
|| __builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm933db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
Index: glibc-2.19/iconvdata/ibm935.c
===================================================================
--- glibc-2.19.orig/iconvdata/ibm935.c
+++ glibc-2.19/iconvdata/ibm935.c
@@ -161,7 +161,7 @@ enum
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (rp2 == NULL, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
|| __builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm935db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
Index: glibc-2.19/iconvdata/ibm937.c
===================================================================
--- glibc-2.19.orig/iconvdata/ibm937.c
+++ glibc-2.19/iconvdata/ibm937.c
@@ -161,7 +161,7 @@ enum
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (rp2 == NULL, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
|| __builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm937db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
Index: glibc-2.19/iconvdata/ibm939.c
===================================================================
--- glibc-2.19.orig/iconvdata/ibm939.c
+++ glibc-2.19/iconvdata/ibm939.c
@@ -161,7 +161,7 @@ enum
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (rp2 == NULL, 0) \
+ if (__builtin_expect (rp2->start == 0xffff, 0) \
|| __builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm939db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, L'\1') == L'\0' && ch != '\0')) \
Index: glibc-2.19/iconvdata/ibm943.c
===================================================================
--- glibc-2.19.orig/iconvdata/ibm943.c
+++ glibc-2.19/iconvdata/ibm943.c
@@ -74,11 +74,12 @@
} \
\
ch = (ch * 0x100) + inptr[1]; \
+ /* ch was less than 0xfd. */ \
+ assert (ch < 0xfd00); \
while (ch > rp2->end) \
++rp2; \
\
- if (__builtin_expect (rp2 == NULL, 0) \
- || __builtin_expect (ch < rp2->start, 0) \
+ if (__builtin_expect (ch < rp2->start, 0) \
|| (res = __ibm943db_to_ucs4[ch + rp2->idx], \
__builtin_expect (res, '\1') == 0 && ch !=0)) \
{ \
Index: glibc-2.19/iconvdata/run-iconv-test.sh
===================================================================
--- glibc-2.19.orig/iconvdata/run-iconv-test.sh
+++ glibc-2.19/iconvdata/run-iconv-test.sh
@@ -188,6 +188,24 @@ while read utf8 from filename; do
done < TESTS2
+# Check for crashes in decoders.
+printf '\016\377\377\377\377\377\377\377' > $temp1
+for from in $iconv_modules ; do
+ echo $ac_n "test decoder $from $ac_c"
+ PROG=`eval echo $ICONV`
+ if $PROG < $temp1 >/dev/null 2>&1 ; then
+ : # fall through
+ else
+ status=$?
+ if test $status -gt 1 ; then
+ echo "/FAILED"
+ failed=1
+ continue
+ fi
+ fi
+ echo "OK"
+done
+
exit $failed
# Local Variables:
# mode:shell-script

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f05635b9beaec8379f31f0f0bc4ce2382b4ba734e97319ae37077e1eaa97f826
size 11861
oid sha256:e8715a207e621f2dea9f4d766d55514b9ac4dc91ea9652e7768cea0f950cc88b
size 10824

View File

@ -1,116 +0,0 @@
2014-04-02 Alan Modra <amodra@gmail.com>
[BZ #16739]
* sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c (__nextafterl): Correct
output when value is near a power of two. Use int64_t for lx and
remove casts. Use decimal rather than hex exponent constants.
Don't use long double multiplication when double will suffice.
* math/libm-test.inc (nextafter_test_data): Add tests.
Index: glibc-2.19/math/libm-test.inc
===================================================================
--- glibc-2.19.orig/math/libm-test.inc
+++ glibc-2.19/math/libm-test.inc
@@ -10528,6 +10528,14 @@ static const struct test_ff_f_data nexta
// XXX Enable once gcc is fixed.
//TEST_ff_f (nextafter, 0x0.00000040000000000000p-16385L, -0.1L, 0x0.0000003ffffffff00000p-16385L),
#endif
+#if defined TEST_LDOUBLE && LDBL_MANT_DIG == 106
+ TEST_ff_f (nextafter, 1.0L, -10.0L, 1.0L-0x1p-106L, NO_EXCEPTION),
+ TEST_ff_f (nextafter, 1.0L, 10.0L, 1.0L+0x1p-105L, NO_EXCEPTION),
+ TEST_ff_f (nextafter, 1.0L-0x1p-106L, 10.0L, 1.0L, NO_EXCEPTION),
+ TEST_ff_f (nextafter, -1.0L, -10.0L, -1.0L-0x1p-105L, NO_EXCEPTION),
+ TEST_ff_f (nextafter, -1.0L, 10.0L, -1.0L+0x1p-106L, NO_EXCEPTION),
+ TEST_ff_f (nextafter, -1.0L+0x1p-106L, -10.0L, -1.0L, NO_EXCEPTION),
+#endif
/* XXX We need the hexadecimal FP number representation here for further
tests. */
Index: glibc-2.19/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
===================================================================
--- glibc-2.19.orig/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
+++ glibc-2.19/sysdeps/ieee754/ldbl-128ibm/s_nextafterl.c
@@ -30,8 +30,7 @@ static char rcsid[] = "$NetBSD: $";
long double __nextafterl(long double x, long double y)
{
- int64_t hx,hy,ihx,ihy;
- uint64_t lx;
+ int64_t hx, hy, ihx, ihy, lx;
double xhi, xlo, yhi;
ldbl_unpack (x, &xhi, &xlo);
@@ -76,19 +75,28 @@ long double __nextafterl(long double x,
u = math_opt_barrier (x);
x -= __LDBL_DENORM_MIN__;
if (ihx < 0x0360000000000000LL
- || (hx > 0 && (int64_t) lx <= 0)
- || (hx < 0 && (int64_t) lx > 1)) {
+ || (hx > 0 && lx <= 0)
+ || (hx < 0 && lx > 1)) {
u = u * u;
math_force_eval (u); /* raise underflow flag */
}
return x;
}
- if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
- INSERT_WORDS64 (yhi, hx & (0x7ffLL<<52));
- u = yhi;
- u *= 0x1.0000000000000p-105L;
+ /* If the high double is an exact power of two and the low
+ double is the opposite sign, then 1ulp is one less than
+ what we might determine from the high double. Similarly
+ if X is an exact power of two, and positive, because
+ making it a little smaller will result in the exponent
+ decreasing by one and normalisation of the mantissa. */
+ if ((hx & 0x000fffffffffffffLL) == 0
+ && ((lx != 0 && (hx ^ lx) < 0)
+ || (lx == 0 && hx >= 0)))
+ ihx -= 1LL << 52;
+ if (ihx < (106LL << 52)) { /* ulp will denormal */
+ INSERT_WORDS64 (yhi, ihx & (0x7ffLL<<52));
+ u = yhi * 0x1p-105;
} else {
- INSERT_WORDS64 (yhi, (hx & (0x7ffLL<<52))-(0x069LL<<52));
+ INSERT_WORDS64 (yhi, (ihx & (0x7ffLL<<52))-(105LL<<52));
u = yhi;
}
return x - u;
@@ -103,8 +111,8 @@ long double __nextafterl(long double x,
u = math_opt_barrier (x);
x += __LDBL_DENORM_MIN__;
if (ihx < 0x0360000000000000LL
- || (hx > 0 && (int64_t) lx < 0 && lx != 0x8000000000000001LL)
- || (hx < 0 && (int64_t) lx >= 0)) {
+ || (hx > 0 && lx < 0 && lx != 0x8000000000000001LL)
+ || (hx < 0 && lx >= 0)) {
u = u * u;
math_force_eval (u); /* raise underflow flag */
}
@@ -112,12 +120,21 @@ long double __nextafterl(long double x,
x = -0.0L;
return x;
}
- if (ihx < 0x06a0000000000000LL) { /* ulp will denormal */
- INSERT_WORDS64 (yhi, hx & (0x7ffLL<<52));
- u = yhi;
- u *= 0x1.0000000000000p-105L;
+ /* If the high double is an exact power of two and the low
+ double is the opposite sign, then 1ulp is one less than
+ what we might determine from the high double. Similarly
+ if X is an exact power of two, and negative, because
+ making it a little larger will result in the exponent
+ decreasing by one and normalisation of the mantissa. */
+ if ((hx & 0x000fffffffffffffLL) == 0
+ && ((lx != 0 && (hx ^ lx) < 0)
+ || (lx == 0 && hx < 0)))
+ ihx -= 1LL << 52;
+ if (ihx < (106LL << 52)) { /* ulp will denormal */
+ INSERT_WORDS64 (yhi, ihx & (0x7ffLL<<52));
+ u = yhi * 0x1p-105;
} else {
- INSERT_WORDS64 (yhi, (hx & (0x7ffLL<<52))-(0x069LL<<52));
+ INSERT_WORDS64 (yhi, (ihx & (0x7ffLL<<52))-(105LL<<52));
u = yhi;
}
return x + u;

View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:469186780a61f0e0839e3938a674ebe7a46d649dd4de8ba52f1bc821aca42455
size 1520
oid sha256:3970c86754545a65f32f6595c3b638b9966e901827f2bc01db552b9cf9cf5bfc
size 1818

View File

@ -1,496 +0,0 @@
From 532a60357ef4c5852cc1bf836cfd9d6f093ef204 Mon Sep 17 00:00:00 2001
From: Siddhesh Poyarekar <siddhesh@redhat.com>
Date: Mon, 3 Mar 2014 22:51:39 +0530
Subject: [PATCH] nscd: Improved support for tracking startup failure in nscd
service (BZ #16639)
Currently, the nscd parent process parses commandline options and
configuration, forks on startup and immediately exits with a success.
If the child process encounters some error after this, it goes
undetected and any services started up after it may have to repeatedly
check to make sure that the nscd service did actually start up and is
serving requests.
To make this process more reliable, I have added a pipe between the
parent and child process, through which the child process sends a
notification to the parent informing it of its status. The parent
waits for this status and once it receives it, exits with the
corresponding exit code. So if the child service sends a success
status (0), the parent exits with a success status. Similarly for
error conditions, the child sends the non-zero status code, which the
parent passes on as the exit code.
This, along with setting the nscd service type to forking in its
systemd configuration file, allows systemd to be certain that the nscd
service is ready and is accepting connections.
2014-03-03 Siddhesh Poyarekar <siddhesh@redhat.com>
[BZ #16639]
* nscd/connections.c (nscd_init): Call do_exit.
(start_threads): Call do_exit and notify_parent.
(begin_drop_privileges): Call do_exit.
(finish_drop_privileges): Likewise.
* nscd/selinux.c (preserve_capabilities): Likewise.
(install_real_capabilities): Likewise.
(nscd_selinux_enabled): Likewise.
(avc_create_thread): Likewise.
(avc_alloc_lock): Likewise.
(nscd_avc_init): Likewise.
* nscd/nscd.c (parent_fd): New static variable.
(main): Create a pipe between parent and child processes.
Skip closing parent_fd.
(monitor_child): New function.
(do_exit): Likewise.
(notify_parent): Likewise.
* nscd/nscd.h (notify_parent): Likewise.
(do_exit): Likewise.
Index: glibc-2.19/nscd/connections.c
===================================================================
--- glibc-2.19.orig/nscd/connections.c
+++ glibc-2.19/nscd/connections.c
@@ -649,8 +649,8 @@ cannot create read-only descriptor for \
close (fd);
}
else if (errno == EACCES)
- error (EXIT_FAILURE, 0, _("cannot access '%s'"),
- dbs[cnt].db_filename);
+ do_exit (EXIT_FAILURE, 0, _("cannot access '%s'"),
+ dbs[cnt].db_filename);
}
if (dbs[cnt].head == NULL)
@@ -699,8 +699,7 @@ cannot create read-only descriptor for \
{
dbg_log (_("database for %s corrupted or simultaneously used; remove %s manually if necessary and restart"),
dbnames[cnt], dbs[cnt].db_filename);
- // XXX Correct way to terminate?
- exit (1);
+ do_exit (1, 0, NULL);
}
if (dbs[cnt].persistent)
@@ -867,7 +866,7 @@ cannot set socket to close on exec: %s;
if (sock < 0)
{
dbg_log (_("cannot open socket: %s"), strerror (errno));
- exit (errno == EACCES ? 4 : 1);
+ do_exit (errno == EACCES ? 4 : 1, 0, NULL);
}
/* Bind a name to the socket. */
struct sockaddr_un sock_addr;
@@ -876,7 +875,7 @@ cannot set socket to close on exec: %s;
if (bind (sock, (struct sockaddr *) &sock_addr, sizeof (sock_addr)) < 0)
{
dbg_log ("%s: %s", _PATH_NSCDSOCKET, strerror (errno));
- exit (errno == EACCES ? 4 : 1);
+ do_exit (errno == EACCES ? 4 : 1, 0, NULL);
}
#ifndef __ASSUME_SOCK_CLOEXEC
@@ -888,7 +887,7 @@ cannot set socket to close on exec: %s;
{
dbg_log (_("cannot change socket to nonblocking mode: %s"),
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}
/* The descriptor needs to be closed on exec. */
@@ -896,7 +895,7 @@ cannot set socket to close on exec: %s;
{
dbg_log (_("cannot set socket to close on exec: %s"),
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}
}
#endif
@@ -909,7 +908,7 @@ cannot set socket to close on exec: %s;
{
dbg_log (_("cannot enable socket to accept connections: %s"),
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}
#ifdef HAVE_NETLINK
@@ -953,7 +952,7 @@ cannot set socket to close on exec: %s;
dbg_log (_("\
cannot change socket to nonblocking mode: %s"),
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}
/* The descriptor needs to be closed on exec. */
@@ -962,7 +961,7 @@ cannot change socket to nonblocking mode
{
dbg_log (_("cannot set socket to close on exec: %s"),
strerror (errno));
- exit (1);
+ do_exit (1, 0, NULL);
}
}
# endif
@@ -2392,7 +2391,7 @@ start_threads (void)
if (pthread_cond_init (&dbs[i].prune_cond, &condattr) != 0)
{
dbg_log (_("could not initialize conditional variable"));
- exit (1);
+ do_exit (1, 0, NULL);
}
pthread_t th;
@@ -2400,7 +2399,7 @@ start_threads (void)
&& pthread_create (&th, &attr, nscd_run_prune, (void *) i) != 0)
{
dbg_log (_("could not start clean-up thread; terminating"));
- exit (1);
+ do_exit (1, 0, NULL);
}
}
@@ -2414,13 +2413,17 @@ start_threads (void)
if (i == 0)
{
dbg_log (_("could not start any worker thread; terminating"));
- exit (1);
+ do_exit (1, 0, NULL);
}
break;
}
}
+ /* Now it is safe to let the parent know that we're doing fine and it can
+ exit. */
+ notify_parent (0);
+
/* Determine how much room for descriptors we should initially
allocate. This might need to change later if we cap the number
with MAXCONN. */
@@ -2465,8 +2468,8 @@ begin_drop_privileges (void)
if (pwd == NULL)
{
dbg_log (_("Failed to run nscd as user '%s'"), server_user);
- error (EXIT_FAILURE, 0, _("Failed to run nscd as user '%s'"),
- server_user);
+ do_exit (EXIT_FAILURE, 0,
+ _("Failed to run nscd as user '%s'"), server_user);
}
server_uid = pwd->pw_uid;
@@ -2483,7 +2486,8 @@ begin_drop_privileges (void)
{
/* This really must never happen. */
dbg_log (_("Failed to run nscd as user '%s'"), server_user);
- error (EXIT_FAILURE, errno, _("initial getgrouplist failed"));
+ do_exit (EXIT_FAILURE, errno,
+ _("initial getgrouplist failed"));
}
server_groups = (gid_t *) xmalloc (server_ngroups * sizeof (gid_t));
@@ -2492,7 +2496,7 @@ begin_drop_privileges (void)
== -1)
{
dbg_log (_("Failed to run nscd as user '%s'"), server_user);
- error (EXIT_FAILURE, errno, _("getgrouplist failed"));
+ do_exit (EXIT_FAILURE, errno, _("getgrouplist failed"));
}
}
@@ -2510,7 +2514,7 @@ finish_drop_privileges (void)
if (setgroups (server_ngroups, server_groups) == -1)
{
dbg_log (_("Failed to run nscd as user '%s'"), server_user);
- error (EXIT_FAILURE, errno, _("setgroups failed"));
+ do_exit (EXIT_FAILURE, errno, _("setgroups failed"));
}
int res;
@@ -2521,8 +2525,7 @@ finish_drop_privileges (void)
if (res == -1)
{
dbg_log (_("Failed to run nscd as user '%s'"), server_user);
- perror ("setgid");
- exit (4);
+ do_exit (4, errno, "setgid");
}
if (paranoia)
@@ -2532,8 +2535,7 @@ finish_drop_privileges (void)
if (res == -1)
{
dbg_log (_("Failed to run nscd as user '%s'"), server_user);
- perror ("setuid");
- exit (4);
+ do_exit (4, errno, "setuid");
}
#if defined HAVE_LIBAUDIT && defined HAVE_LIBCAP
Index: glibc-2.19/nscd/nscd.c
===================================================================
--- glibc-2.19.orig/nscd/nscd.c
+++ glibc-2.19/nscd/nscd.c
@@ -39,6 +39,8 @@
#include <sys/stat.h>
#include <sys/uio.h>
#include <sys/un.h>
+#include <sys/wait.h>
+#include <stdarg.h>
#include "dbg_log.h"
#include "nscd.h"
@@ -101,6 +103,7 @@ gid_t old_gid;
static int check_pid (const char *file);
static int write_pid (const char *file);
+static int monitor_child (int fd);
/* Name and version of program. */
static void print_version (FILE *stream, struct argp_state *state);
@@ -142,6 +145,7 @@ static struct argp argp =
/* True if only statistics are requested. */
static bool get_stats;
+static int parent_fd = -1;
int
main (int argc, char **argv)
@@ -196,11 +200,27 @@ main (int argc, char **argv)
/* Behave like a daemon. */
if (run_mode == RUN_DAEMONIZE)
{
+ int fd[2];
+
+ if (pipe (fd) != 0)
+ error (EXIT_FAILURE, errno,
+ _("cannot create a pipe to talk to the child"));
+
pid = fork ();
if (pid == -1)
error (EXIT_FAILURE, errno, _("cannot fork"));
if (pid != 0)
- exit (0);
+ {
+ /* The parent only reads from the child. */
+ close (fd[1]);
+ exit (monitor_child (fd[0]));
+ }
+ else
+ {
+ /* The child only writes to the parent. */
+ close (fd[0]);
+ parent_fd = fd[1];
+ }
}
int nullfd = open (_PATH_DEVNULL, O_RDWR);
@@ -242,7 +262,8 @@ main (int argc, char **argv)
char *endp;
long int fdn = strtol (dirent->d_name, &endp, 10);
- if (*endp == '\0' && fdn != dfdn && fdn >= min_close_fd)
+ if (*endp == '\0' && fdn != dfdn && fdn >= min_close_fd
+ && fdn != parent_fd)
close ((int) fdn);
}
@@ -250,13 +271,14 @@ main (int argc, char **argv)
}
else
for (i = min_close_fd; i < getdtablesize (); i++)
- close (i);
+ if (i != parent_fd)
+ close (i);
setsid ();
if (chdir ("/") != 0)
- error (EXIT_FAILURE, errno,
- _("cannot change current working directory to \"/\""));
+ do_exit (EXIT_FAILURE, errno,
+ _("cannot change current working directory to \"/\""));
openlog ("nscd", LOG_CONS | LOG_ODELAY, LOG_DAEMON);
@@ -592,3 +614,79 @@ write_pid (const char *file)
return result;
}
+
+static int
+monitor_child (int fd)
+{
+ int child_ret = 0;
+ int ret = read (fd, &child_ret, sizeof (child_ret));
+
+ /* The child terminated with an error, either via exit or some other abnormal
+ method, like a segfault. */
+ if (ret <= 0 || child_ret != 0)
+ {
+ int err = wait (&child_ret);
+
+ if (err < 0)
+ {
+ fprintf (stderr, _("wait failed"));
+ return 1;
+ }
+
+ fprintf (stderr, _("child exited with status %d"),
+ WEXITSTATUS (child_ret));
+ if (WIFSIGNALED (child_ret))
+ fprintf (stderr, _(", terminated by signal %d.\n"),
+ WTERMSIG (child_ret));
+ else
+ fprintf (stderr, ".\n");
+ }
+
+ /* We have the child status, so exit with that code. */
+ close (fd);
+
+ return child_ret;
+}
+
+void
+do_exit (int child_ret, int errnum, const char *format, ...)
+{
+ if (parent_fd != -1)
+ {
+ int ret = write (parent_fd, &child_ret, sizeof (child_ret));
+ assert (ret == sizeof (child_ret));
+ close (parent_fd);
+ }
+
+ if (format != NULL)
+ {
+ /* Emulate error() since we don't have a va_list variant for it. */
+ va_list argp;
+
+ fflush (stdout);
+
+ fprintf (stderr, "%s: ", program_invocation_name);
+
+ va_start (argp, format);
+ vfprintf (stderr, format, argp);
+ va_end (argp);
+
+ fprintf (stderr, ": %s\n", strerror (errnum));
+ fflush (stderr);
+ }
+
+ /* Finally, exit. */
+ exit (child_ret);
+}
+
+void
+notify_parent (int child_ret)
+{
+ if (parent_fd == -1)
+ return;
+
+ int ret = write (parent_fd, &child_ret, sizeof (child_ret));
+ assert (ret == sizeof (child_ret));
+ close (parent_fd);
+ parent_fd = -1;
+}
Index: glibc-2.19/nscd/nscd.h
===================================================================
--- glibc-2.19.orig/nscd/nscd.h
+++ glibc-2.19/nscd/nscd.h
@@ -205,6 +205,8 @@ extern gid_t old_gid;
/* nscd.c */
extern void termination_handler (int signum) __attribute__ ((__noreturn__));
extern int nscd_open_socket (void);
+void notify_parent (int child_ret);
+void do_exit (int child_ret, int errnum, const char *format, ...);
/* connections.c */
extern void nscd_init (void);
Index: glibc-2.19/nscd/selinux.c
===================================================================
--- glibc-2.19.orig/nscd/selinux.c
+++ glibc-2.19/nscd/selinux.c
@@ -179,7 +179,7 @@ preserve_capabilities (void)
if (prctl (PR_SET_KEEPCAPS, 1) == -1)
{
dbg_log (_("Failed to set keep-capabilities"));
- error (EXIT_FAILURE, errno, _("prctl(KEEPCAPS) failed"));
+ do_exit (EXIT_FAILURE, errno, _("prctl(KEEPCAPS) failed"));
/* NOTREACHED */
}
@@ -194,7 +194,7 @@ preserve_capabilities (void)
cap_free (tmp_caps);
dbg_log (_("Failed to initialize drop of capabilities"));
- error (EXIT_FAILURE, 0, _("cap_init failed"));
+ do_exit (EXIT_FAILURE, 0, _("cap_init failed"));
}
/* There is no reason why these should not work. */
@@ -216,7 +216,7 @@ preserve_capabilities (void)
{
cap_free (new_caps);
dbg_log (_("Failed to drop capabilities"));
- error (EXIT_FAILURE, 0, _("cap_set_proc failed"));
+ do_exit (EXIT_FAILURE, 0, _("cap_set_proc failed"));
}
return new_caps;
@@ -233,7 +233,7 @@ install_real_capabilities (cap_t new_cap
{
cap_free (new_caps);
dbg_log (_("Failed to drop capabilities"));
- error (EXIT_FAILURE, 0, _("cap_set_proc failed"));
+ do_exit (EXIT_FAILURE, 0, _("cap_set_proc failed"));
/* NOTREACHED */
}
@@ -242,7 +242,7 @@ install_real_capabilities (cap_t new_cap
if (prctl (PR_SET_KEEPCAPS, 0) == -1)
{
dbg_log (_("Failed to unset keep-capabilities"));
- error (EXIT_FAILURE, errno, _("prctl(KEEPCAPS) failed"));
+ do_exit (EXIT_FAILURE, errno, _("prctl(KEEPCAPS) failed"));
/* NOTREACHED */
}
}
@@ -258,7 +258,7 @@ nscd_selinux_enabled (int *selinux_enabl
if (*selinux_enabled < 0)
{
dbg_log (_("Failed to determine if kernel supports SELinux"));
- exit (EXIT_FAILURE);
+ do_exit (EXIT_FAILURE, 0, NULL);
}
}
@@ -272,7 +272,7 @@ avc_create_thread (void (*run) (void))
rc =
pthread_create (&avc_notify_thread, NULL, (void *(*) (void *)) run, NULL);
if (rc != 0)
- error (EXIT_FAILURE, rc, _("Failed to start AVC thread"));
+ do_exit (EXIT_FAILURE, rc, _("Failed to start AVC thread"));
return &avc_notify_thread;
}
@@ -294,7 +294,7 @@ avc_alloc_lock (void)
avc_mutex = malloc (sizeof (pthread_mutex_t));
if (avc_mutex == NULL)
- error (EXIT_FAILURE, errno, _("Failed to create AVC lock"));
+ do_exit (EXIT_FAILURE, errno, _("Failed to create AVC lock"));
pthread_mutex_init (avc_mutex, NULL);
return avc_mutex;
@@ -334,7 +334,7 @@ nscd_avc_init (void)
avc_entry_ref_init (&aeref);
if (avc_init ("avc", NULL, &log_cb, &thread_cb, &lock_cb) < 0)
- error (EXIT_FAILURE, errno, _("Failed to start AVC"));
+ do_exit (EXIT_FAILURE, errno, _("Failed to start AVC"));
else
dbg_log (_("Access Vector Cache (AVC) started"));
#ifdef HAVE_LIBAUDIT

View File

@ -1,461 +0,0 @@
2014-02-18 Andreas Schwab <schwab@suse.de>
[BZ #16574]
* resolv/res_send.c (send_vc): Add parameter ansp2_malloced.
Store non-zero if the second buffer was newly allocated.
(send_dg): Likewise.
(__libc_res_nsend): Add parameter ansp2_malloced and pass it down
to send_vc and send_dg.
(res_nsend): Pass NULL for ansp2_malloced.
* resolv/res_query.c (__libc_res_nquery): Add parameter
answerp2_malloced and pass it down to __libc_res_nsend.
(res_nquery): Pass additional NULL to __libc_res_nquery.
(__libc_res_nsearch): Add parameter answerp2_malloced and pass it
down to __libc_res_nquery and __libc_res_nquerydomain. Deallocate
second answer buffer if answerp2_malloced was set.
(res_nsearch): Pass additional NULL to __libc_res_nsearch.
(__libc_res_nquerydomain): Add parameter
answerp2_malloced and pass it down to __libc_res_nquery.
(res_nquerydomain): Pass additional NULL to
__libc_res_nquerydomain.
* resolv/nss_dns/dns-network.c (_nss_dns_getnetbyname_r): Pass
additional NULL to __libc_res_nsend and __libc_res_nquery.
* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname3_r): Pass
additional NULL to __libc_res_nsearch.
(_nss_dns_gethostbyname4_r): Revert last change. Use new
parameter of __libc_res_nsearch to check for separately allocated
second buffer.
(_nss_dns_gethostbyaddr2_r): Pass additional NULL to
__libc_res_nquery.
* resolv/nss_dns/dns-canon.c (_nss_dns_getcanonname_r): Pass
additional NULL to __libc_res_nquery.
* resolv/gethnamaddr.c (gethostbyname2): Pass additional NULL to
__libc_res_nsearch.
(gethostbyaddr): Pass additional NULL to __libc_res_nquery.
* include/resolv.h: Update prototypes of __libc_res_nquery,
__libc_res_nsearch, __libc_res_nsend.
2014-02-13 Andreas Schwab <schwab@suse.de>
[BZ #16574]
* resolv/nss_dns/dns-host.c (_nss_dns_gethostbyname4_r): Free the
second answer buffer if it was separately allocated.
Index: glibc-2.19/include/resolv.h
===================================================================
--- glibc-2.19.orig/include/resolv.h
+++ glibc-2.19/include/resolv.h
@@ -48,11 +48,11 @@ libc_hidden_proto (__res_randomid)
libc_hidden_proto (__res_state)
int __libc_res_nquery (res_state, const char *, int, int, u_char *, int,
- u_char **, u_char **, int *, int *);
+ u_char **, u_char **, int *, int *, int *);
int __libc_res_nsearch (res_state, const char *, int, int, u_char *, int,
- u_char **, u_char **, int *, int *);
+ u_char **, u_char **, int *, int *, int *);
int __libc_res_nsend (res_state, const u_char *, int, const u_char *, int,
- u_char *, int, u_char **, u_char **, int *, int *)
+ u_char *, int, u_char **, u_char **, int *, int *, int *)
attribute_hidden;
libresolv_hidden_proto (_sethtent)
Index: glibc-2.19/resolv/gethnamaddr.c
===================================================================
--- glibc-2.19.orig/resolv/gethnamaddr.c
+++ glibc-2.19/resolv/gethnamaddr.c
@@ -621,7 +621,7 @@ gethostbyname2(name, af)
buf.buf = origbuf = (querybuf *) alloca (1024);
if ((n = __libc_res_nsearch(&_res, name, C_IN, type, buf.buf->buf, 1024,
- &buf.ptr, NULL, NULL, NULL)) < 0) {
+ &buf.ptr, NULL, NULL, NULL, NULL)) < 0) {
if (buf.buf != origbuf)
free (buf.buf);
Dprintf("res_nsearch failed (%d)\n", n);
@@ -716,12 +716,12 @@ gethostbyaddr(addr, len, af)
buf.buf = orig_buf = (querybuf *) alloca (1024);
n = __libc_res_nquery(&_res, qbuf, C_IN, T_PTR, buf.buf->buf, 1024,
- &buf.ptr, NULL, NULL, NULL);
+ &buf.ptr, NULL, NULL, NULL, NULL);
if (n < 0 && af == AF_INET6 && (_res.options & RES_NOIP6DOTINT) == 0) {
strcpy(qp, "ip6.int");
n = __libc_res_nquery(&_res, qbuf, C_IN, T_PTR, buf.buf->buf,
buf.buf != orig_buf ? MAXPACKET : 1024,
- &buf.ptr, NULL, NULL, NULL);
+ &buf.ptr, NULL, NULL, NULL, NULL);
}
if (n < 0) {
if (buf.buf != orig_buf)
Index: glibc-2.19/resolv/nss_dns/dns-canon.c
===================================================================
--- glibc-2.19.orig/resolv/nss_dns/dns-canon.c
+++ glibc-2.19/resolv/nss_dns/dns-canon.c
@@ -62,7 +62,7 @@ _nss_dns_getcanonname_r (const char *nam
{
int r = __libc_res_nquery (&_res, name, ns_c_in, qtypes[i],
buf, sizeof (buf), &ansp.ptr, NULL, NULL,
- NULL);
+ NULL, NULL);
if (r > 0)
{
/* We need to decode the response. Just one question record.
Index: glibc-2.19/resolv/nss_dns/dns-host.c
===================================================================
--- glibc-2.19.orig/resolv/nss_dns/dns-host.c
+++ glibc-2.19/resolv/nss_dns/dns-host.c
@@ -190,7 +190,7 @@ _nss_dns_gethostbyname3_r (const char *n
host_buffer.buf = orig_host_buffer = (querybuf *) alloca (1024);
n = __libc_res_nsearch (&_res, name, C_IN, type, host_buffer.buf->buf,
- 1024, &host_buffer.ptr, NULL, NULL, NULL);
+ 1024, &host_buffer.ptr, NULL, NULL, NULL, NULL);
if (n < 0)
{
switch (errno)
@@ -225,7 +225,7 @@ _nss_dns_gethostbyname3_r (const char *n
n = __libc_res_nsearch (&_res, name, C_IN, T_A, host_buffer.buf->buf,
host_buffer.buf != orig_host_buffer
? MAXPACKET : 1024, &host_buffer.ptr,
- NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
if (n < 0)
{
@@ -308,12 +308,13 @@ _nss_dns_gethostbyname4_r (const char *n
u_char *ans2p = NULL;
int nans2p = 0;
int resplen2 = 0;
+ int ans2p_malloced = 0;
int olderr = errno;
enum nss_status status;
int n = __libc_res_nsearch (&_res, name, C_IN, T_UNSPEC,
host_buffer.buf->buf, 2048, &host_buffer.ptr,
- &ans2p, &nans2p, &resplen2);
+ &ans2p, &nans2p, &resplen2, &ans2p_malloced);
if (n < 0)
{
switch (errno)
@@ -352,6 +353,10 @@ _nss_dns_gethostbyname4_r (const char *n
resplen2, name, pat, buffer, buflen,
errnop, herrnop, ttlp);
+ /* Check whether ans2p was separately allocated. */
+ if (ans2p_malloced)
+ free (ans2p);
+
if (host_buffer.buf != orig_host_buffer)
free (host_buffer.buf);
@@ -460,7 +465,7 @@ _nss_dns_gethostbyaddr2_r (const void *a
strcpy (qp, "].ip6.arpa");
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR,
host_buffer.buf->buf, 1024, &host_buffer.ptr,
- NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
if (n >= 0)
goto got_it_already;
}
@@ -481,14 +486,14 @@ _nss_dns_gethostbyaddr2_r (const void *a
}
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer.buf->buf,
- 1024, &host_buffer.ptr, NULL, NULL, NULL);
+ 1024, &host_buffer.ptr, NULL, NULL, NULL, NULL);
if (n < 0 && af == AF_INET6 && (_res.options & RES_NOIP6DOTINT) == 0)
{
strcpy (qp, "ip6.int");
n = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, host_buffer.buf->buf,
host_buffer.buf != orig_host_buffer
? MAXPACKET : 1024, &host_buffer.ptr,
- NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL);
}
if (n < 0)
{
Index: glibc-2.19/resolv/nss_dns/dns-network.c
===================================================================
--- glibc-2.19.orig/resolv/nss_dns/dns-network.c
+++ glibc-2.19/resolv/nss_dns/dns-network.c
@@ -129,7 +129,7 @@ _nss_dns_getnetbyname_r (const char *nam
net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
anslen = __libc_res_nsearch (&_res, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
- 1024, &net_buffer.ptr, NULL, NULL, NULL);
+ 1024, &net_buffer.ptr, NULL, NULL, NULL, NULL);
if (anslen < 0)
{
/* Nothing found. */
@@ -205,7 +205,7 @@ _nss_dns_getnetbyaddr_r (uint32_t net, i
net_buffer.buf = orig_net_buffer = (querybuf *) alloca (1024);
anslen = __libc_res_nquery (&_res, qbuf, C_IN, T_PTR, net_buffer.buf->buf,
- 1024, &net_buffer.ptr, NULL, NULL, NULL);
+ 1024, &net_buffer.ptr, NULL, NULL, NULL, NULL);
if (anslen < 0)
{
/* Nothing found. */
Index: glibc-2.19/resolv/res_query.c
===================================================================
--- glibc-2.19.orig/resolv/res_query.c
+++ glibc-2.19/resolv/res_query.c
@@ -98,7 +98,7 @@ static int
__libc_res_nquerydomain(res_state statp, const char *name, const char *domain,
int class, int type, u_char *answer, int anslen,
u_char **answerp, u_char **answerp2, int *nanswerp2,
- int *resplen2);
+ int *resplen2, int *answerp2_malloced);
/*
* Formulate a normal query, send, and await answer.
@@ -119,7 +119,8 @@ __libc_res_nquery(res_state statp,
u_char **answerp, /* if buffer needs to be enlarged */
u_char **answerp2,
int *nanswerp2,
- int *resplen2)
+ int *resplen2,
+ int *answerp2_malloced)
{
HEADER *hp = (HEADER *) answer;
HEADER *hp2;
@@ -224,7 +225,8 @@ __libc_res_nquery(res_state statp,
}
assert (answerp == NULL || (void *) *answerp == (void *) answer);
n = __libc_res_nsend(statp, query1, nquery1, query2, nquery2, answer,
- anslen, answerp, answerp2, nanswerp2, resplen2);
+ anslen, answerp, answerp2, nanswerp2, resplen2,
+ answerp2_malloced);
if (use_malloc)
free (buf);
if (n < 0) {
@@ -316,7 +318,7 @@ res_nquery(res_state statp,
int anslen) /* size of answer buffer */
{
return __libc_res_nquery(statp, name, class, type, answer, anslen,
- NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nquery)
@@ -335,7 +337,8 @@ __libc_res_nsearch(res_state statp,
u_char **answerp,
u_char **answerp2,
int *nanswerp2,
- int *resplen2)
+ int *resplen2,
+ int *answerp2_malloced)
{
const char *cp, * const *domain;
HEADER *hp = (HEADER *) answer;
@@ -360,7 +363,7 @@ __libc_res_nsearch(res_state statp,
if (!dots && (cp = res_hostalias(statp, name, tmp, sizeof tmp))!= NULL)
return (__libc_res_nquery(statp, cp, class, type, answer,
anslen, answerp, answerp2,
- nanswerp2, resplen2));
+ nanswerp2, resplen2, answerp2_malloced));
#ifdef DEBUG
if (statp->options & RES_DEBUG)
@@ -377,7 +380,8 @@ __libc_res_nsearch(res_state statp,
if (dots >= statp->ndots || trailing_dot) {
ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
answer, anslen, answerp,
- answerp2, nanswerp2, resplen2);
+ answerp2, nanswerp2, resplen2,
+ answerp2_malloced);
if (ret > 0 || trailing_dot)
return (ret);
saved_herrno = h_errno;
@@ -386,11 +390,11 @@ __libc_res_nsearch(res_state statp,
answer = *answerp;
anslen = MAXPACKET;
}
- if (answerp2
- && (*answerp2 < answer || *answerp2 >= answer + anslen))
+ if (answerp2 && *answerp2_malloced)
{
free (*answerp2);
*answerp2 = NULL;
+ *answerp2_malloced = 0;
}
}
@@ -417,7 +421,7 @@ __libc_res_nsearch(res_state statp,
class, type,
answer, anslen, answerp,
answerp2, nanswerp2,
- resplen2);
+ resplen2, answerp2_malloced);
if (ret > 0)
return (ret);
@@ -425,12 +429,11 @@ __libc_res_nsearch(res_state statp,
answer = *answerp;
anslen = MAXPACKET;
}
- if (answerp2
- && (*answerp2 < answer
- || *answerp2 >= answer + anslen))
+ if (answerp2 && *answerp2_malloced)
{
free (*answerp2);
*answerp2 = NULL;
+ *answerp2_malloced = 0;
}
/*
@@ -486,7 +489,8 @@ __libc_res_nsearch(res_state statp,
&& !(tried_as_is || root_on_list)) {
ret = __libc_res_nquerydomain(statp, name, NULL, class, type,
answer, anslen, answerp,
- answerp2, nanswerp2, resplen2);
+ answerp2, nanswerp2, resplen2,
+ answerp2_malloced);
if (ret > 0)
return (ret);
}
@@ -498,10 +502,11 @@ __libc_res_nsearch(res_state statp,
* else send back meaningless H_ERRNO, that being the one from
* the last DNSRCH we did.
*/
- if (answerp2 && (*answerp2 < answer || *answerp2 >= answer + anslen))
+ if (answerp2 && *answerp2_malloced)
{
free (*answerp2);
*answerp2 = NULL;
+ *answerp2_malloced = 0;
}
if (saved_herrno != -1)
RES_SET_H_ERRNO(statp, saved_herrno);
@@ -521,7 +526,7 @@ res_nsearch(res_state statp,
int anslen) /* size of answer */
{
return __libc_res_nsearch(statp, name, class, type, answer,
- anslen, NULL, NULL, NULL, NULL);
+ anslen, NULL, NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nsearch)
@@ -539,7 +544,8 @@ __libc_res_nquerydomain(res_state statp,
u_char **answerp,
u_char **answerp2,
int *nanswerp2,
- int *resplen2)
+ int *resplen2,
+ int *answerp2_malloced)
{
char nbuf[MAXDNAME];
const char *longname = nbuf;
@@ -581,7 +587,7 @@ __libc_res_nquerydomain(res_state statp,
}
return (__libc_res_nquery(statp, longname, class, type, answer,
anslen, answerp, answerp2, nanswerp2,
- resplen2));
+ resplen2, answerp2_malloced));
}
int
@@ -593,7 +599,8 @@ res_nquerydomain(res_state statp,
int anslen) /* size of answer */
{
return __libc_res_nquerydomain(statp, name, domain, class, type,
- answer, anslen, NULL, NULL, NULL, NULL);
+ answer, anslen, NULL, NULL, NULL, NULL,
+ NULL);
}
libresolv_hidden_def (res_nquerydomain)
Index: glibc-2.19/resolv/res_send.c
===================================================================
--- glibc-2.19.orig/resolv/res_send.c
+++ glibc-2.19/resolv/res_send.c
@@ -186,12 +186,12 @@ evNowTime(struct timespec *res) {
static int send_vc(res_state, const u_char *, int,
const u_char *, int,
u_char **, int *, int *, int, u_char **,
- u_char **, int *, int *);
+ u_char **, int *, int *, int *);
static int send_dg(res_state, const u_char *, int,
const u_char *, int,
u_char **, int *, int *, int,
int *, int *, u_char **,
- u_char **, int *, int *);
+ u_char **, int *, int *, int *);
#ifdef DEBUG
static void Aerror(const res_state, FILE *, const char *, int,
const struct sockaddr *);
@@ -343,7 +343,7 @@ int
__libc_res_nsend(res_state statp, const u_char *buf, int buflen,
const u_char *buf2, int buflen2,
u_char *ans, int anssiz, u_char **ansp, u_char **ansp2,
- int *nansp2, int *resplen2)
+ int *nansp2, int *resplen2, int *ansp2_malloced)
{
int gotsomewhere, terrno, try, v_circuit, resplen, ns, n;
@@ -546,7 +546,8 @@ __libc_res_nsend(res_state statp, const
try = statp->retry;
n = send_vc(statp, buf, buflen, buf2, buflen2,
&ans, &anssiz, &terrno,
- ns, ansp, ansp2, nansp2, resplen2);
+ ns, ansp, ansp2, nansp2, resplen2,
+ ansp2_malloced);
if (n < 0)
return (-1);
if (n == 0 && (buf2 == NULL || *resplen2 == 0))
@@ -556,7 +557,7 @@ __libc_res_nsend(res_state statp, const
n = send_dg(statp, buf, buflen, buf2, buflen2,
&ans, &anssiz, &terrno,
ns, &v_circuit, &gotsomewhere, ansp,
- ansp2, nansp2, resplen2);
+ ansp2, nansp2, resplen2, ansp2_malloced);
if (n < 0)
return (-1);
if (n == 0 && (buf2 == NULL || *resplen2 == 0))
@@ -646,7 +647,7 @@ res_nsend(res_state statp,
const u_char *buf, int buflen, u_char *ans, int anssiz)
{
return __libc_res_nsend(statp, buf, buflen, NULL, 0, ans, anssiz,
- NULL, NULL, NULL, NULL);
+ NULL, NULL, NULL, NULL, NULL);
}
libresolv_hidden_def (res_nsend)
@@ -657,7 +658,7 @@ send_vc(res_state statp,
const u_char *buf, int buflen, const u_char *buf2, int buflen2,
u_char **ansp, int *anssizp,
int *terrno, int ns, u_char **anscp, u_char **ansp2, int *anssizp2,
- int *resplen2)
+ int *resplen2, int *ansp2_malloced)
{
const HEADER *hp = (HEADER *) buf;
const HEADER *hp2 = (HEADER *) buf2;
@@ -823,6 +824,8 @@ send_vc(res_state statp,
}
*thisanssizp = MAXPACKET;
*thisansp = newp;
+ if (thisansp == ansp2)
+ *ansp2_malloced = 1;
anhp = (HEADER *) newp;
len = rlen;
} else {
@@ -992,7 +995,7 @@ send_dg(res_state statp,
const u_char *buf, int buflen, const u_char *buf2, int buflen2,
u_char **ansp, int *anssizp,
int *terrno, int ns, int *v_circuit, int *gotsomewhere, u_char **anscp,
- u_char **ansp2, int *anssizp2, int *resplen2)
+ u_char **ansp2, int *anssizp2, int *resplen2, int *ansp2_malloced)
{
const HEADER *hp = (HEADER *) buf;
const HEADER *hp2 = (HEADER *) buf2;
@@ -1238,6 +1241,8 @@ send_dg(res_state statp,
if (newp != NULL) {
*anssizp = MAXPACKET;
*thisansp = ans = newp;
+ if (thisansp == ansp2)
+ *ansp2_malloced = 1;
}
}
HEADER *anhp = (HEADER *) *thisansp;

View File

@ -1,24 +0,0 @@
2014-06-23 Andreas Schwab <schwab@suse.de>
[BZ #17079]
* nss/nss_files/files-XXX.c (get_contents): Store overflow marker
before reading the next line.
Index: glibc-2.19/nss/nss_files/files-XXX.c
===================================================================
--- glibc-2.19.orig/nss/nss_files/files-XXX.c
+++ glibc-2.19/nss/nss_files/files-XXX.c
@@ -198,10 +198,12 @@ get_contents (char *linebuf, size_t len,
{
int curlen = ((remaining_len > (size_t) INT_MAX) ? INT_MAX
: remaining_len);
- char *p = fgets_unlocked (curbuf, curlen, stream);
+ /* Terminate the line so that we can test for overflow. */
((unsigned char *) curbuf)[curlen - 1] = 0xff;
+ char *p = fgets_unlocked (curbuf, curlen, stream);
+
/* EOF or read error. */
if (p == NULL)
return gcr_error;

View File

@ -1,111 +0,0 @@
2014-05-12 Andreas Schwab <schwab@suse.de>
[BZ #16932]
* nis/nss_nis/nis-hosts.c (internal_gethostbyname2_r)
(_nss_nis_gethostbyname4_r): Return error if item length is larger
than maximum RPC packet size.
* nis/nss_nis/nis-initgroups.c (initgroups_netid): Likewise.
* nis/nss_nis/nis-network.c (_nss_nis_getnetbyname_r): Likewise.
* nis/nss_nis/nis-service.c (_nss_nis_getservbyname_r)
(_nss_nis_getservbyport_r): Likewise.
Index: glibc-2.19/nis/nss_nis/nis-hosts.c
===================================================================
--- glibc-2.19.orig/nis/nss_nis/nis-hosts.c
+++ glibc-2.19/nis/nss_nis/nis-hosts.c
@@ -270,6 +270,13 @@ internal_gethostbyname2_r (const char *n
/* Convert name to lowercase. */
size_t namlen = strlen (name);
+ /* Limit name length to the maximum size of an RPC packet. */
+ if (namlen > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
char name2[namlen + 1];
size_t i;
@@ -461,6 +468,13 @@ _nss_nis_gethostbyname4_r (const char *n
/* Convert name to lowercase. */
size_t namlen = strlen (name);
+ /* Limit name length to the maximum size of an RPC packet. */
+ if (namlen > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
char name2[namlen + 1];
size_t i;
Index: glibc-2.19/nis/nss_nis/nis-initgroups.c
===================================================================
--- glibc-2.19.orig/nis/nss_nis/nis-initgroups.c
+++ glibc-2.19/nis/nss_nis/nis-initgroups.c
@@ -150,6 +150,13 @@ initgroups_netid (uid_t uid, gid_t group
gid_t **groupsp, long int limit, int *errnop,
const char *domainname)
{
+ /* Limit domainname length to the maximum size of an RPC packet. */
+ if (strlen (domainname) > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
/* Prepare the key. The form is "unix.UID@DOMAIN" with the UID and
DOMAIN field filled in appropriately. */
char key[sizeof ("unix.@") + sizeof (uid_t) * 3 + strlen (domainname)];
Index: glibc-2.19/nis/nss_nis/nis-network.c
===================================================================
--- glibc-2.19.orig/nis/nss_nis/nis-network.c
+++ glibc-2.19/nis/nss_nis/nis-network.c
@@ -179,6 +179,13 @@ _nss_nis_getnetbyname_r (const char *nam
/* Convert name to lowercase. */
size_t namlen = strlen (name);
+ /* Limit name length to the maximum size of an RPC packet. */
+ if (namlen > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
char name2[namlen + 1];
size_t i;
Index: glibc-2.19/nis/nss_nis/nis-service.c
===================================================================
--- glibc-2.19.orig/nis/nss_nis/nis-service.c
+++ glibc-2.19/nis/nss_nis/nis-service.c
@@ -271,6 +271,13 @@ _nss_nis_getservbyname_r (const char *na
/* If the protocol is given, we could try if our NIS server knows
about services.byservicename map. If yes, we only need one query. */
size_t keylen = strlen (name) + (protocol ? 1 + strlen (protocol) : 0);
+ /* Limit key length to the maximum size of an RPC packet. */
+ if (keylen > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
char key[keylen + 1];
/* key is: "name/proto" */
@@ -355,6 +362,13 @@ _nss_nis_getservbyport_r (int port, cons
Otherwise try first port/tcp, then port/udp and then fallback
to sequential scanning of services.byname. */
const char *proto = protocol != NULL ? protocol : "tcp";
+ /* Limit protocol name length to the maximum size of an RPC packet. */
+ if (strlen (proto) > UDPMSGSIZE)
+ {
+ *errnop = ERANGE;
+ return NSS_STATUS_UNAVAIL;
+ }
+
do
{
/* key is: "port/proto" */

View File

@ -1,63 +0,0 @@
2014-02-24 Andreas Schwab <schwab@suse.de>
[BZ #15804]
* elf/pldd.c (wait_for_ptrace_stop): New function.
(main): Call it after attaching.
Index: glibc-2.19/elf/pldd.c
===================================================================
--- glibc-2.19.orig/elf/pldd.c
+++ glibc-2.19/elf/pldd.c
@@ -34,6 +34,7 @@
#include <unistd.h>
#include <sys/ptrace.h>
#include <sys/stat.h>
+#include <sys/wait.h>
#include <ldsodefs.h>
#include <version.h>
@@ -82,6 +83,7 @@ static char *exe;
/* Local functions. */
static int get_process_info (int dfd, long int pid);
+static void wait_for_ptrace_stop (long int pid);
int
@@ -170,6 +172,8 @@ main (int argc, char *argv[])
tid);
}
+ wait_for_ptrace_stop (tid);
+
struct thread_list *newp = alloca (sizeof (*newp));
newp->tid = tid;
newp->next = thread_list;
@@ -194,6 +198,27 @@ main (int argc, char *argv[])
}
+/* Wait for PID to enter ptrace-stop state after being attached. */
+static void
+wait_for_ptrace_stop (long int pid)
+{
+ int status;
+
+ /* While waiting for SIGSTOP being delivered to the tracee we have to
+ reinject any other pending signal. Ignore all other errors. */
+ while (waitpid (pid, &status, __WALL) == pid && WIFSTOPPED (status))
+ {
+ /* The STOP signal should not be delivered to the tracee. */
+ if (WSTOPSIG (status) == SIGSTOP)
+ return;
+ if (ptrace (PTRACE_CONT, pid, NULL,
+ (void *) (uintptr_t) WSTOPSIG (status)))
+ /* The only possible error is that the process died. */
+ return;
+ }
+}
+
+
/* Handle program arguments. */
static error_t
parse_opt (int key, char *arg, struct argp_state *state)

File diff suppressed because it is too large Load Diff

View File

@ -1,23 +0,0 @@
2014-04-01 Alan Modra <amodra@gmail.com>
[BZ #16786]
* sysdeps/powerpc/powerpc64/fpu/s_copysign.S: Don't trash stack.
Index: glibc-2.19/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
===================================================================
--- glibc-2.19.orig/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
+++ glibc-2.19/sysdeps/powerpc/powerpc64/fpu/s_copysign.S
@@ -27,11 +27,11 @@ ENTRY(__copysign)
/* double [f1] copysign (double [f1] x, double [f2] y);
copysign(x,y) returns a value with the magnitude of x and
with the sign bit of y. */
- stfd fp2,56(r1)
+ stfd fp2,-8(r1)
nop
nop
nop
- ld r3,56(r1)
+ ld r3,-8(r1)
cmpdi r3,0
blt L(0)
fabs fp1,fp1

View File

@ -1,23 +0,0 @@
2013-07-29 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
[BZ #17213]
* sysdeps/powerpc/powerpc64/entry.h: Fix TEXT_START definition for
powerpc64le.
Index: glibc-2.19/sysdeps/powerpc/powerpc64/entry.h
===================================================================
--- glibc-2.19.orig/sysdeps/powerpc/powerpc64/entry.h
+++ glibc-2.19/sysdeps/powerpc/powerpc64/entry.h
@@ -23,6 +23,7 @@ extern void _start (void);
#define ENTRY_POINT _start
+#if _CALL_ELF != 2
/* We have to provide a special declaration. */
#define ENTRY_POINT_DECL(class) class void _start (void);
@@ -33,3 +34,4 @@ extern void _start (void);
#define TEXT_START \
({ extern unsigned long int _start_as_data[] asm ("_start"); \
_start_as_data[0]; })
+#endif

View File

@ -1,139 +0,0 @@
2014-06-11 Florian Weimer <fweimer@redhat.com>
[BZ #17048]
* posix/spawn_int.h (struct __spawn_action): Make the path string
non-const to support deallocation.
* posix/spawn_faction_addopen.c
(posix_spawn_file_actions_addopen): Make a copy of the pathname.
* posix/spawn_faction_destroy.c
(posix_spawn_file_actions_destroy): Adjust comment. Deallocate
path in all spawn_do_open actions.
* posix/tst-spawn.c (do_test): Exercise the copy operation in
posix_spawn_file_actions_addopen.
Index: glibc-2.19/posix/spawn_faction_addopen.c
===================================================================
--- glibc-2.19.orig/posix/spawn_faction_addopen.c
+++ glibc-2.19/posix/spawn_faction_addopen.c
@@ -18,6 +18,7 @@
#include <errno.h>
#include <spawn.h>
#include <unistd.h>
+#include <string.h>
#include "spawn_int.h"
@@ -35,17 +36,24 @@ posix_spawn_file_actions_addopen (posix_
if (fd < 0 || fd >= maxfd)
return EBADF;
+ char *path_copy = strdup (path);
+ if (path_copy == NULL)
+ return ENOMEM;
+
/* Allocate more memory if needed. */
if (file_actions->__used == file_actions->__allocated
&& __posix_spawn_file_actions_realloc (file_actions) != 0)
- /* This can only mean we ran out of memory. */
- return ENOMEM;
+ {
+ /* This can only mean we ran out of memory. */
+ free (path_copy);
+ return ENOMEM;
+ }
/* Add the new value. */
rec = &file_actions->__actions[file_actions->__used];
rec->tag = spawn_do_open;
rec->action.open_action.fd = fd;
- rec->action.open_action.path = path;
+ rec->action.open_action.path = path_copy;
rec->action.open_action.oflag = oflag;
rec->action.open_action.mode = mode;
Index: glibc-2.19/posix/spawn_faction_destroy.c
===================================================================
--- glibc-2.19.orig/posix/spawn_faction_destroy.c
+++ glibc-2.19/posix/spawn_faction_destroy.c
@@ -18,11 +18,29 @@
#include <spawn.h>
#include <stdlib.h>
-/* Initialize data structure for file attribute for `spawn' call. */
+#include "spawn_int.h"
+
+/* Deallocate the file actions. */
int
posix_spawn_file_actions_destroy (posix_spawn_file_actions_t *file_actions)
{
- /* Free the memory allocated. */
+ /* Free the paths in the open actions. */
+ for (int i = 0; i < file_actions->__used; ++i)
+ {
+ struct __spawn_action *sa = &file_actions->__actions[i];
+ switch (sa->tag)
+ {
+ case spawn_do_open:
+ free (sa->action.open_action.path);
+ break;
+ case spawn_do_close:
+ case spawn_do_dup2:
+ /* No cleanup required. */
+ break;
+ }
+ }
+
+ /* Free the array of actions. */
free (file_actions->__actions);
return 0;
}
Index: glibc-2.19/posix/spawn_int.h
===================================================================
--- glibc-2.19.orig/posix/spawn_int.h
+++ glibc-2.19/posix/spawn_int.h
@@ -22,7 +22,7 @@ struct __spawn_action
struct
{
int fd;
- const char *path;
+ char *path;
int oflag;
mode_t mode;
} open_action;
Index: glibc-2.19/posix/tst-spawn.c
===================================================================
--- glibc-2.19.orig/posix/tst-spawn.c
+++ glibc-2.19/posix/tst-spawn.c
@@ -168,6 +168,7 @@ do_test (int argc, char *argv[])
char fd2name[18];
char fd3name[18];
char fd4name[18];
+ char *name3_copy;
char *spargv[12];
int i;
@@ -222,9 +223,15 @@ do_test (int argc, char *argv[])
if (posix_spawn_file_actions_addclose (&actions, fd1) != 0)
error (EXIT_FAILURE, errno, "posix_spawn_file_actions_addclose");
/* We want to open the third file. */
- if (posix_spawn_file_actions_addopen (&actions, fd3, name3,
+ name3_copy = strdup (name3);
+ if (name3_copy == NULL)
+ error (EXIT_FAILURE, errno, "strdup");
+ if (posix_spawn_file_actions_addopen (&actions, fd3, name3_copy,
O_RDONLY, 0666) != 0)
error (EXIT_FAILURE, errno, "posix_spawn_file_actions_addopen");
+ /* Overwrite the name to check that a copy has been made. */
+ memset (name3_copy, 'X', strlen (name3_copy));
+
/* We dup the second descriptor. */
fd4 = MAX (2, MAX (fd1, MAX (fd2, fd3))) + 1;
if (posix_spawn_file_actions_adddup2 (&actions, fd2, fd4) != 0)
@@ -253,6 +260,7 @@ do_test (int argc, char *argv[])
/* Cleanup. */
if (posix_spawn_file_actions_destroy (&actions) != 0)
error (EXIT_FAILURE, errno, "posix_spawn_file_actions_destroy");
+ free (name3_copy);
/* Wait for the child. */
if (waitpid (pid, &status, 0) != pid)

View File

@ -1,19 +1,15 @@
[PATCH] Properly handle forced elision in pthread_mutex_trylock
BZ #16657
* pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
* nptl/pthread_mutex_trylock.c (__pthread_mutex_trylock): Use
FORCE_ELISION instead of DO_ELISION.
* sysdeps/unix/sysv/linux/x86/force-elision.h (DO_ELISION):
Remove.
---
nptl/pthread_mutex_trylock.c | 7 +++----
nptl/sysdeps/unix/sysv/linux/x86/force-elision.h | 5 -----
2 files changed, 3 insertions(+), 9 deletions(-)
Index: glibc-2.19/nptl/pthread_mutex_trylock.c
Index: glibc-2.19.90/nptl/pthread_mutex_trylock.c
===================================================================
--- glibc-2.19.orig/nptl/pthread_mutex_trylock.c
+++ glibc-2.19/nptl/pthread_mutex_trylock.c
--- glibc-2.19.90.orig/nptl/pthread_mutex_trylock.c
+++ glibc-2.19.90/nptl/pthread_mutex_trylock.c
@@ -26,8 +26,8 @@
#define lll_trylock_elision(a,t) lll_trylock(a)
#endif
@ -35,10 +31,10 @@ Index: glibc-2.19/nptl/pthread_mutex_trylock.c
/*FALL THROUGH*/
case PTHREAD_MUTEX_ADAPTIVE_NP:
case PTHREAD_MUTEX_ERRORCHECK_NP:
Index: glibc-2.19/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
Index: glibc-2.19.90/sysdeps/unix/sysv/linux/x86/force-elision.h
===================================================================
--- glibc-2.19.orig/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
+++ glibc-2.19/nptl/sysdeps/unix/sysv/linux/x86/force-elision.h
--- glibc-2.19.90.orig/sysdeps/unix/sysv/linux/x86/force-elision.h
+++ glibc-2.19.90/sysdeps/unix/sysv/linux/x86/force-elision.h
@@ -16,11 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */

View File

@ -1,33 +0,0 @@
Don't ignore second answer from nameserver if the first one was empty (BZ #13651)
Index: glibc-2.19/resolv/res_query.c
===================================================================
--- glibc-2.19.orig/resolv/res_query.c
+++ glibc-2.19/resolv/res_query.c
@@ -382,7 +382,7 @@ __libc_res_nsearch(res_state statp,
answer, anslen, answerp,
answerp2, nanswerp2, resplen2,
answerp2_malloced);
- if (ret > 0 || trailing_dot)
+ if (ret > 0 || (ret == 0 && *resplen2 > 0) || trailing_dot)
return (ret);
saved_herrno = h_errno;
tried_as_is++;
@@ -422,7 +422,7 @@ __libc_res_nsearch(res_state statp,
answer, anslen, answerp,
answerp2, nanswerp2,
resplen2, answerp2_malloced);
- if (ret > 0)
+ if (ret > 0 || (ret == 0 && *resplen2 > 0))
return (ret);
if (answerp && *answerp != answer) {
@@ -491,7 +491,7 @@ __libc_res_nsearch(res_state statp,
answer, anslen, answerp,
answerp2, nanswerp2, resplen2,
answerp2_malloced);
- if (ret > 0)
+ if (ret > 0 || (ret == 0 && *resplen2 > 0))
return (ret);
}

File diff suppressed because it is too large Load Diff

View File

@ -1,648 +0,0 @@
2014-07-02 Florian Weimer <fweimer@redhat.com>
* manual/locale.texi (Locale Names): New section documenting
locale name syntax. Adjust menu and node chaining accordingly.
(Choosing Locale): Reference Locale Names, Locale Categories.
Mention setting LC_ALL=C. Reflect that name syntax is now
documented.
(Locale Categories): New section title. Reference Locale Names.
LC_ALL is an environment variable, but not a category.
(Setting the Locale): Remove "locale -a" invocation and LOCPATH
description, now in Locale Name. Reference that section. Locale
name syntax is now documented.
[BZ #17137]
* locale/findlocale.c (name_present, valid_locale_name): New
functions.
(_nl_find_locale): Use the loc_name variable to store name
candidates. Call name_present and valid_locale_name to check and
validate locale names. Return an error if the locale is invalid.
* localedata/tst-setlocale3.c: New file.
* localedata/Makefile (tests): Add tst-setlocale3.
(tst-setlocale3-ENV): New variable.
* locale/setlocale.c (setlocale): Use strdup for allocating
composite name copy.
Index: glibc-2.19/locale/findlocale.c
===================================================================
--- glibc-2.19.orig/locale/findlocale.c
+++ glibc-2.19/locale/findlocale.c
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <assert.h>
+#include <errno.h>
#include <locale.h>
#include <stdlib.h>
#include <string.h>
@@ -57,6 +58,45 @@ struct loaded_l10nfile *_nl_locale_file_
const char _nl_default_locale_path[] attribute_hidden = LOCALEDIR;
+/* Checks if the name is actually present, that is, not NULL and not
+ empty. */
+static inline int
+name_present (const char *name)
+{
+ return name != NULL && name[0] != '\0';
+}
+
+/* Checks that the locale name neither extremely long, nor contains a
+ ".." path component (to prevent directory traversal). */
+static inline int
+valid_locale_name (const char *name)
+{
+ /* Not set. */
+ size_t namelen = strlen (name);
+ /* Name too long. The limit is arbitrary and prevents stack overflow
+ issues later. */
+ if (__glibc_unlikely (namelen > 255))
+ return 0;
+ /* Directory traversal attempt. */
+ static const char slashdot[4] = {'/', '.', '.', '/'};
+ if (__glibc_unlikely (memmem (name, namelen,
+ slashdot, sizeof (slashdot)) != NULL))
+ return 0;
+ if (namelen == 2 && __glibc_unlikely (name[0] == '.' && name [1] == '.'))
+ return 0;
+ if (namelen >= 3
+ && __glibc_unlikely (((name[0] == '.'
+ && name[1] == '.'
+ && name[2] == '/')
+ || (name[namelen - 3] == '/'
+ && name[namelen - 2] == '.'
+ && name[namelen - 1] == '.'))))
+ return 0;
+ /* If there is a slash in the name, it must start with one. */
+ if (__glibc_unlikely (memchr (name, '/', namelen) != NULL) && name[0] != '/')
+ return 0;
+ return 1;
+}
struct __locale_data *
internal_function
@@ -65,7 +105,7 @@ _nl_find_locale (const char *locale_path
{
int mask;
/* Name of the locale for this category. */
- char *loc_name;
+ char *loc_name = (char *) *name;
const char *language;
const char *modifier;
const char *territory;
@@ -73,31 +113,39 @@ _nl_find_locale (const char *locale_path
const char *normalized_codeset;
struct loaded_l10nfile *locale_file;
- if ((*name)[0] == '\0')
+ if (loc_name[0] == '\0')
{
/* The user decides which locale to use by setting environment
variables. */
- *name = getenv ("LC_ALL");
- if (*name == NULL || (*name)[0] == '\0')
- *name = getenv (_nl_category_names.str
+ loc_name = getenv ("LC_ALL");
+ if (!name_present (loc_name))
+ loc_name = getenv (_nl_category_names.str
+ _nl_category_name_idxs[category]);
- if (*name == NULL || (*name)[0] == '\0')
- *name = getenv ("LANG");
+ if (!name_present (loc_name))
+ loc_name = getenv ("LANG");
+ if (!name_present (loc_name))
+ loc_name = (char *) _nl_C_name;
}
- if (*name == NULL || (*name)[0] == '\0'
- || (__builtin_expect (__libc_enable_secure, 0)
- && strchr (*name, '/') != NULL))
- *name = (char *) _nl_C_name;
+ /* We used to fall back to the C locale if the name contains a slash
+ character '/', but we now check for directory traversal in
+ valid_locale_name, so this is no longer necessary. */
- if (__builtin_expect (strcmp (*name, _nl_C_name), 1) == 0
- || __builtin_expect (strcmp (*name, _nl_POSIX_name), 1) == 0)
+ if (__builtin_expect (strcmp (loc_name, _nl_C_name), 1) == 0
+ || __builtin_expect (strcmp (loc_name, _nl_POSIX_name), 1) == 0)
{
/* We need not load anything. The needed data is contained in
the library itself. */
*name = (char *) _nl_C_name;
return _nl_C[category];
}
+ else if (!valid_locale_name (loc_name))
+ {
+ __set_errno (EINVAL);
+ return NULL;
+ }
+
+ *name = loc_name;
/* We really have to load some data. First we try the archive,
but only if there was no LOCPATH environment variable specified. */
Index: glibc-2.19/locale/setlocale.c
===================================================================
--- glibc-2.19.orig/locale/setlocale.c
+++ glibc-2.19/locale/setlocale.c
@@ -272,6 +272,8 @@ setlocale (int category, const char *loc
of entries of the form `CATEGORY=VALUE'. */
const char *newnames[__LC_LAST];
struct __locale_data *newdata[__LC_LAST];
+ /* Copy of the locale argument, for in-place splitting. */
+ char *locale_copy = NULL;
/* Set all name pointers to the argument name. */
for (category = 0; category < __LC_LAST; ++category)
@@ -281,7 +283,13 @@ setlocale (int category, const char *loc
if (__builtin_expect (strchr (locale, ';') != NULL, 0))
{
/* This is a composite name. Make a copy and split it up. */
- char *np = strdupa (locale);
+ locale_copy = strdup (locale);
+ if (__glibc_unlikely (locale_copy == NULL))
+ {
+ __libc_rwlock_unlock (__libc_setlocale_lock);
+ return NULL;
+ }
+ char *np = locale_copy;
char *cp;
int cnt;
@@ -299,6 +307,7 @@ setlocale (int category, const char *loc
{
error_return:
__libc_rwlock_unlock (__libc_setlocale_lock);
+ free (locale_copy);
/* Bogus category name. */
ERROR_RETURN;
@@ -391,8 +400,9 @@ setlocale (int category, const char *loc
/* Critical section left. */
__libc_rwlock_unlock (__libc_setlocale_lock);
- /* Free the resources (the locale path variable). */
+ /* Free the resources. */
free (locale_path);
+ free (locale_copy);
return composite;
}
Index: glibc-2.19/localedata/Makefile
===================================================================
--- glibc-2.19.orig/localedata/Makefile
+++ glibc-2.19/localedata/Makefile
@@ -77,7 +77,7 @@ locale_test_suite := tst_iswalnum tst_is
tests = $(locale_test_suite) tst-digits tst-setlocale bug-iconv-trans \
tst-leaks tst-mbswcs6 tst-xlocale1 tst-xlocale2 bug-usesetlocale \
- tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2
+ tst-strfmon1 tst-sscanf bug-setlocale1 tst-setlocale2 tst-setlocale3
tests-static = bug-setlocale1-static
tests += $(tests-static)
ifeq (yes,$(build-shared))
@@ -292,6 +292,7 @@ bug-setlocale1-ARGS = -- $(host-test-pro
bug-setlocale1-static-ENV = $(bug-setlocale1-ENV)
bug-setlocale1-static-ARGS = $(bug-setlocale1-ARGS)
tst-setlocale2-ENV = LOCPATH=$(common-objpfx)localedata
+tst-setlocale3-ENV = LOCPATH=$(common-objpfx)localedata
$(objdir)/iconvdata/gconv-modules:
$(MAKE) -C ../iconvdata subdir=iconvdata $@
Index: glibc-2.19/localedata/tst-setlocale3.c
===================================================================
--- /dev/null
+++ glibc-2.19/localedata/tst-setlocale3.c
@@ -0,0 +1,203 @@
+/* Regression test for setlocale invalid environment variable handling.
+ Copyright (C) 2014 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
+ <http://www.gnu.org/licenses/>. */
+
+#include <locale.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* The result of setlocale may be overwritten by subsequent calls, so
+ this wrapper makes a copy. */
+static char *
+setlocale_copy (int category, const char *locale)
+{
+ const char *result = setlocale (category, locale);
+ if (result == NULL)
+ return NULL;
+ return strdup (result);
+}
+
+static char *de_locale;
+
+static void
+setlocale_fail (const char *envstring)
+{
+ setenv ("LC_CTYPE", envstring, 1);
+ if (setlocale (LC_CTYPE, "") != NULL)
+ {
+ printf ("unexpected setlocale success for \"%s\" locale\n", envstring);
+ exit (1);
+ }
+ const char *newloc = setlocale (LC_CTYPE, NULL);
+ if (strcmp (newloc, de_locale) != 0)
+ {
+ printf ("failed setlocale call \"%s\" changed locale to \"%s\"\n",
+ envstring, newloc);
+ exit (1);
+ }
+}
+
+static void
+setlocale_success (const char *envstring)
+{
+ setenv ("LC_CTYPE", envstring, 1);
+ char *newloc = setlocale_copy (LC_CTYPE, "");
+ if (newloc == NULL)
+ {
+ printf ("setlocale for \"%s\": %m\n", envstring);
+ exit (1);
+ }
+ if (strcmp (newloc, de_locale) == 0)
+ {
+ printf ("setlocale with LC_CTYPE=\"%s\" left locale at \"%s\"\n",
+ envstring, de_locale);
+ exit (1);
+ }
+ if (setlocale (LC_CTYPE, de_locale) == NULL)
+ {
+ printf ("restoring locale \"%s\" with LC_CTYPE=\"%s\": %m\n",
+ de_locale, envstring);
+ exit (1);
+ }
+ char *newloc2 = setlocale_copy (LC_CTYPE, newloc);
+ if (newloc2 == NULL)
+ {
+ printf ("restoring locale \"%s\" following \"%s\": %m\n",
+ newloc, envstring);
+ exit (1);
+ }
+ if (strcmp (newloc, newloc2) != 0)
+ {
+ printf ("representation of locale \"%s\" changed from \"%s\" to \"%s\"",
+ envstring, newloc, newloc2);
+ exit (1);
+ }
+ free (newloc);
+ free (newloc2);
+
+ if (setlocale (LC_CTYPE, de_locale) == NULL)
+ {
+ printf ("restoring locale \"%s\" with LC_CTYPE=\"%s\": %m\n",
+ de_locale, envstring);
+ exit (1);
+ }
+}
+
+/* Checks that a known-good locale still works if LC_ALL contains a
+ value which should be ignored. */
+static void
+setlocale_ignore (const char *to_ignore)
+{
+ const char *fr_locale = "fr_FR.UTF-8";
+ setenv ("LC_CTYPE", fr_locale, 1);
+ char *expected_locale = setlocale_copy (LC_CTYPE, "");
+ if (expected_locale == NULL)
+ {
+ printf ("setlocale with LC_CTYPE=\"%s\" failed: %m\n", fr_locale);
+ exit (1);
+ }
+ if (setlocale (LC_CTYPE, de_locale) == NULL)
+ {
+ printf ("failed to restore locale: %m\n");
+ exit (1);
+ }
+ unsetenv ("LC_CTYPE");
+
+ setenv ("LC_ALL", to_ignore, 1);
+ setenv ("LC_CTYPE", fr_locale, 1);
+ const char *actual_locale = setlocale (LC_CTYPE, "");
+ if (actual_locale == NULL)
+ {
+ printf ("setlocale with LC_ALL, LC_CTYPE=\"%s\" failed: %m\n",
+ fr_locale);
+ exit (1);
+ }
+ if (strcmp (actual_locale, expected_locale) != 0)
+ {
+ printf ("setlocale under LC_ALL failed: got \"%s\", expected \"%s\"\n",
+ actual_locale, expected_locale);
+ exit (1);
+ }
+ unsetenv ("LC_CTYPE");
+ setlocale_success (fr_locale);
+ unsetenv ("LC_ALL");
+ free (expected_locale);
+}
+
+static int
+do_test (void)
+{
+ /* The glibc test harness sets this environment variable
+ uncondionally. */
+ unsetenv ("LC_ALL");
+
+ de_locale = setlocale_copy (LC_CTYPE, "de_DE.UTF-8");
+ if (de_locale == NULL)
+ {
+ printf ("setlocale (LC_CTYPE, \"de_DE.UTF-8\"): %m\n");
+ return 1;
+ }
+ setlocale_success ("C");
+ setlocale_success ("en_US.UTF-8");
+ setlocale_success ("/en_US.UTF-8");
+ setlocale_success ("//en_US.UTF-8");
+ setlocale_ignore ("");
+
+ setlocale_fail ("does-not-exist");
+ setlocale_fail ("/");
+ setlocale_fail ("/../localedata/en_US.UTF-8");
+ setlocale_fail ("en_US.UTF-8/");
+ setlocale_fail ("en_US.UTF-8/..");
+ setlocale_fail ("en_US.UTF-8/../en_US.UTF-8");
+ setlocale_fail ("../localedata/en_US.UTF-8");
+ {
+ size_t large_length = 1024;
+ char *large_name = malloc (large_length + 1);
+ if (large_name == NULL)
+ {
+ puts ("malloc failure");
+ return 1;
+ }
+ memset (large_name, '/', large_length);
+ const char *suffix = "en_US.UTF-8";
+ strcpy (large_name + large_length - strlen (suffix), suffix);
+ setlocale_fail (large_name);
+ free (large_name);
+ }
+ {
+ size_t huge_length = 64 * 1024 * 1024;
+ char *huge_name = malloc (huge_length + 1);
+ if (huge_name == NULL)
+ {
+ puts ("malloc failure");
+ return 1;
+ }
+ memset (huge_name, 'X', huge_length);
+ huge_name[huge_length] = '\0';
+ /* Construct a composite locale specification. */
+ const char *prefix = "LC_CTYPE=de_DE.UTF-8;LC_TIME=";
+ memcpy (huge_name, prefix, strlen (prefix));
+ setlocale_fail (huge_name);
+ free (huge_name);
+ }
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test ()
+#include "../test-skeleton.c"
Index: glibc-2.19/manual/locale.texi
===================================================================
--- glibc-2.19.orig/manual/locale.texi
+++ glibc-2.19/manual/locale.texi
@@ -29,6 +29,7 @@ will follow the conventions preferred by
* Setting the Locale:: How a program specifies the locale
with library functions.
* Standard Locales:: Locale names available on all systems.
+* Locale Names:: Format of system-specific locale names.
* Locale Information:: How to access the information for the locale.
* Formatting Numbers:: A dedicated function to format numbers.
* Yes-or-No Questions:: Check a Response against the locale.
@@ -99,14 +100,16 @@ locale named @samp{espana-castellano} to
most of Spain.
The set of locales supported depends on the operating system you are
-using, and so do their names. We can't make any promises about what
-locales will exist, except for one standard locale called @samp{C} or
-@samp{POSIX}. Later we will describe how to construct locales.
-@comment (@pxref{Building Locale Files}).
+using, and so do their names, except that the standard locale called
+@samp{C} or @samp{POSIX} always exist. @xref{Locale Names}.
+
+In order to force the system to always use the default locale, the
+user can set the @code{LC_ALL} environment variable to @samp{C}.
@cindex combining locales
-A user also has the option of specifying different locales for different
-purposes---in effect, choosing a mixture of multiple locales.
+A user also has the option of specifying different locales for
+different purposes---in effect, choosing a mixture of multiple
+locales. @xref{Locale Categories}.
For example, the user might specify the locale @samp{espana-castellano}
for most purposes, but specify the locale @samp{usa-english} for
@@ -120,7 +123,7 @@ which locales apply. However, the user
for a particular subset of those purposes.
@node Locale Categories, Setting the Locale, Choosing Locale, Locales
-@section Categories of Activities that Locales Affect
+@section Locale Categories
@cindex categories for locales
@cindex locale categories
@@ -128,7 +131,11 @@ The purposes that locales serve are grou
that a user or a program can choose the locale for each category
independently. Here is a table of categories; each name is both an
environment variable that a user can set, and a macro name that you can
-use as an argument to @code{setlocale}.
+use as the first argument to @code{setlocale}.
+
+The contents of the environment variable (or the string in the second
+argument to @code{setlocale}) has to be a valid locale name.
+@xref{Locale Names}.
@vtable @code
@comment locale.h
@@ -172,7 +179,7 @@ for affirmative and negative responses.
@comment locale.h
@comment ISO
@item LC_ALL
-This is not an environment variable; it is only a macro that you can use
+This is not a category; it is only a macro that you can use
with @code{setlocale} to set a single locale for all purposes. Setting
this environment variable overwrites all selections by the other
@code{LC_*} variables or @code{LANG}.
@@ -355,13 +362,7 @@ The symbols in this section are defined
@c strndup @ascuheap @acsmem
@c strcasecmp_l ok (C locale)
The function @code{setlocale} sets the current locale for category
-@var{category} to @var{locale}. A list of all the locales the system
-provides can be created by running
-
-@pindex locale
-@smallexample
- locale -a
-@end smallexample
+@var{category} to @var{locale}.
If @var{category} is @code{LC_ALL}, this specifies the locale for all
purposes. The other possible values of @var{category} specify an
@@ -386,10 +387,9 @@ is passed in as @var{locale} parameter.
When you read the current locale for category @code{LC_ALL}, the value
encodes the entire combination of selected locales for all categories.
-In this case, the value is not just a single locale name. In fact, we
-don't make any promises about what it looks like. But if you specify
-the same ``locale name'' with @code{LC_ALL} in a subsequent call to
-@code{setlocale}, it restores the same combination of locale selections.
+If you specify the same ``locale name'' with @code{LC_ALL} in a
+subsequent call to @code{setlocale}, it restores the same combination
+of locale selections.
To be sure you can use the returned string encoding the currently selected
locale at a later time, you must make a copy of the string. It is not
@@ -405,20 +405,15 @@ for @var{category}.
If a nonempty string is given for @var{locale}, then the locale of that
name is used if possible.
+The effective locale name (either the second argument to
+@code{setlocale}, or if the argument is an empty string, the name
+obtained from the process environment) must be valid locale name.
+@xref{Locale Names}.
+
If you specify an invalid locale name, @code{setlocale} returns a null
pointer and leaves the current locale unchanged.
@end deftypefun
-The path used for finding locale data can be set using the
-@code{LOCPATH} environment variable. The default path for finding
-locale data is system specific. It is computed from the value given
-as the prefix while configuring the C library. This value normally is
-@file{/usr} or @file{/}. For the former the complete path is:
-
-@smallexample
-/usr/lib/locale
-@end smallexample
-
Here is an example showing how you might use @code{setlocale} to
temporarily switch to a new locale.
@@ -458,7 +453,7 @@ locale categories, and future versions o
portability, assume that any symbol beginning with @samp{LC_} might be
defined in @file{locale.h}.
-@node Standard Locales, Locale Information, Setting the Locale, Locales
+@node Standard Locales, Locale Names, Setting the Locale, Locales
@section Standard Locales
The only locale names you can count on finding on all operating systems
@@ -492,7 +487,94 @@ with the environment, rather than trying
locale explicitly by name. Remember, different machines might have
different sets of locales installed.
-@node Locale Information, Formatting Numbers, Standard Locales, Locales
+@node Locale Names, Locale Information, Standard Locales, Locales
+@section Locale Names
+
+The following command prints a list of locales supported by the
+system:
+
+@pindex locale
+@smallexample
+ locale -a
+@end smallexample
+
+@strong{Portability Note:} With the notable exception of the standard
+locale names @samp{C} and @samp{POSIX}, locale names are
+system-specific.
+
+Most locale names follow XPG syntax and consist of up to four parts:
+
+@smallexample
+@var{language}[_@var{territory}[.@var{codeset}]][@@@var{modifier}]
+@end smallexample
+
+Beside the first part, all of them are allowed to be missing. If the
+full specified locale is not found, less specific ones are looked for.
+The various parts will be stripped off, in the following order:
+
+@enumerate
+@item
+codeset
+@item
+normalized codeset
+@item
+territory
+@item
+modifier
+@end enumerate
+
+For example, the locale name @samp{de_AT.iso885915@@euro} denotes a
+German-language locale for use in Austria, using the ISO-8859-15
+(Latin-9) character set, and with the Euro as the currency symbol.
+
+In addition to locale names which follow XPG syntax, systems may
+provide aliases such as @samp{german}. Both categories of names must
+not contain the slash character @samp{/}.
+
+If the locale name starts with a slash @samp{/}, it is treated as a
+path relative to the configured locale directories; see @code{LOCPATH}
+below. The specified path must not contain a component @samp{..}, or
+the name is invalid, and @code{setlocale} will fail.
+
+@strong{Portability Note:} POSIX suggests that if a locale name starts
+with a slash @samp{/}, it is resolved as an absolute path. However,
+@theglibc{} treats it as a relative path under the directories listed
+in @code{LOCPATH} (or the default locale directory if @code{LOCPATH}
+is unset).
+
+Locale names which are longer than an implementation-defined limit are
+invalid and cause @code{setlocale} to fail.
+
+As a special case, locale names used with @code{LC_ALL} can combine
+several locales, reflecting different locale settings for different
+categories. For example, you might want to use a U.S. locale with ISO
+A4 paper format, so you set @code{LANG} to @samp{en_US.UTF-8}, and
+@code{LC_PAPER} to @samp{de_DE.UTF-8}. In this case, the
+@code{LC_ALL}-style combined locale name is
+
+@smallexample
+LC_CTYPE=en_US.UTF-8;LC_TIME=en_US.UTF-8;LC_PAPER=de_DE.UTF-8;@dots{}
+@end smallexample
+
+followed by other category settings not shown here.
+
+@vindex LOCPATH
+The path used for finding locale data can be set using the
+@code{LOCPATH} environment variable. This variable lists the
+directories in which to search for locale definitions, separated by a
+colon @samp{:}.
+
+The default path for finding locale data is system specific. A typical
+value for the @code{LOCPATH} default is:
+
+@smallexample
+/usr/share/locale
+@end smallexample
+
+The value of @code{LOCPATH} is ignored by privileged programs for
+security reasons, and only the default directory is used.
+
+@node Locale Information, Formatting Numbers, Locale Names, Locales
@section Accessing Locale Information
There are several ways to access locale information. The simplest

View File

@ -1,54 +0,0 @@
Index: glibc-2.19/sysdeps/ieee754/dbl-64/s_sin.c
===================================================================
--- glibc-2.19.orig/sysdeps/ieee754/dbl-64/s_sin.c
+++ glibc-2.19/sysdeps/ieee754/dbl-64/s_sin.c
@@ -447,19 +447,21 @@ __sin (double x)
}
else
{
+ double t;
if (a > 0)
{
m = 1;
+ t = a;
db = da;
}
else
{
m = 0;
- a = -a;
+ t = -a;
db = -da;
}
- u.x = big + a;
- y = a - (u.x - big);
+ u.x = big + t;
+ y = t - (u.x - big);
res = do_sin (u, y, db, &cor);
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)
@@ -671,19 +673,21 @@ __cos (double x)
}
else
{
+ double t;
if (a > 0)
{
m = 1;
+ t = a;
db = da;
}
else
{
m = 0;
- a = -a;
+ t = -a;
db = -da;
}
- u.x = big + a;
- y = a - (u.x - big);
+ u.x = big + t;
+ y = t - (u.x - big);
res = do_sin (u, y, db, &cor);
cor = (cor > 0) ? 1.035 * cor + eps : 1.035 * cor - eps;
retval = ((res == res + cor) ? ((m) ? res : -res)