Accepting request 227477 from Base:System

- abort-no-flush.patch: Don't close or flush stdio streams on abort (BZ
  #15436)
- fix-locking-in-_IO_cleanup.patch: always do locking when accessing
  streams (bnc#796982, BZ #15142)
- resolv-dont-ignore-second-answer.patch: don't ignore second answer from
  nameserver if the first one was empty (bnc#767266, BZ #13651)
- ldd-system-interp.patch: Never try to execute the file in ldd
  (bnc#677787, BZ #16750)

- check-pf-alloca.patch: Account for alloca use when collecting interface
  addresses (bnc#785041, BZ #16002)

- powerpc-opt-power8.patch: two more POWER8 optimisations (bnc#866711,
  fate#315443)

- getaddrinfo-uninit-result.patch: Fix use of half-initialized result in
  getaddrinfo when using nscd (bnc#867636, BZ #16743) (forwarded request 227472 from Andreas_Schwab)

OBS-URL: https://build.opensuse.org/request/show/227477
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=170
This commit is contained in:
Stephan Kulow 2014-03-27 08:28:34 +00:00 committed by Git OBS Bridge
parent 8ff1d380f0
commit 128caffcb1
13 changed files with 1324 additions and 3 deletions

80
abort-no-flush.patch Normal file
View File

@ -0,0 +1,80 @@
Don't close or flush stdio streams on abort
[BZ #15436]
* stdlib/abort.c (abort): Don't call fflush and __fcloseall.
Index: glibc-2.19/stdlib/abort.c
===================================================================
--- glibc-2.19.orig/stdlib/abort.c
+++ glibc-2.19/stdlib/abort.c
@@ -30,9 +30,6 @@
# define ABORT_INSTRUCTION
#endif
-#include <libio/libioP.h>
-#define fflush(s) _IO_flush_all_lockp (0)
-
/* Exported variable to locate abort message in core files etc. */
struct abort_msg_s *__abort_msg __attribute__ ((nocommon));
libc_hidden_def (__abort_msg)
@@ -66,16 +63,8 @@ abort (void)
__sigprocmask (SIG_UNBLOCK, &sigs, (sigset_t *) NULL);
}
- /* Flush all streams. We cannot close them now because the user
- might have registered a handler for SIGABRT. */
- if (stage == 1)
- {
- ++stage;
- fflush (NULL);
- }
-
/* Send signal which possibly calls a user handler. */
- if (stage == 2)
+ if (stage == 1)
{
/* This stage is special: we must allow repeated calls of
`abort' when a user defined handler for SIGABRT is installed.
@@ -93,7 +82,7 @@ abort (void)
}
/* There was a handler installed. Now remove it. */
- if (stage == 3)
+ if (stage == 2)
{
++stage;
memset (&act, '\0', sizeof (struct sigaction));
@@ -103,30 +92,22 @@ abort (void)
__sigaction (SIGABRT, &act, NULL);
}
- /* Now close the streams which also flushes the output the user
- defined handler might has produced. */
- if (stage == 4)
- {
- ++stage;
- __fcloseall ();
- }
-
/* Try again. */
- if (stage == 5)
+ if (stage == 3)
{
++stage;
raise (SIGABRT);
}
/* Now try to abort using the system specific command. */
- if (stage == 6)
+ if (stage == 4)
{
++stage;
ABORT_INSTRUCTION;
}
/* If we can't signal ourselves and the abort instruction failed, exit. */
- if (stage == 7)
+ if (stage == 5)
{
++stage;
_exit (127);

103
check-pf-alloca.patch Normal file
View File

@ -0,0 +1,103 @@
* 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
@@ -139,9 +139,10 @@ make_request (int fd, pid_t pid)
#endif
bool use_malloc = false;
char *buf;
+ size_t alloca_used = 0;
if (__libc_use_alloca (buf_size))
- buf = alloca (buf_size);
+ buf = alloca_account (buf_size, alloca_used);
else
{
buf = malloc (buf_size);
@@ -163,6 +164,7 @@ make_request (int fd, pid_t pid)
{
struct in6addrinfo info;
struct in6ailist *next;
+ bool use_malloc;
} *in6ailist = NULL;
size_t in6ailistlen = 0;
bool seen_ipv4 = false;
@@ -180,10 +182,10 @@ make_request (int fd, pid_t pid)
ssize_t read_len = TEMP_FAILURE_RETRY (__recvmsg (fd, &msg, 0));
if (read_len < 0)
- goto out_fail;
+ goto out_fail2;
if (msg.msg_flags & MSG_TRUNC)
- goto out_fail;
+ goto out_fail2;
struct nlmsghdr *nlmh;
for (nlmh = (struct nlmsghdr *) buf;
@@ -239,7 +241,19 @@ make_request (int fd, pid_t pid)
}
}
- struct in6ailist *newp = alloca (sizeof (*newp));
+ struct in6ailist *newp;
+ if (__libc_use_alloca (alloca_used + sizeof (*newp)))
+ {
+ newp = alloca_account (sizeof (*newp), alloca_used);
+ newp->use_malloc = false;
+ }
+ else
+ {
+ newp = malloc (sizeof (*newp));
+ if (newp == NULL)
+ goto out_fail2;
+ newp->use_malloc = true;
+ }
newp->info.flags = (((ifam->ifa_flags
& (IFA_F_DEPRECATED
| IFA_F_OPTIMISTIC))
@@ -275,7 +289,7 @@ make_request (int fd, pid_t pid)
result = malloc (sizeof (*result)
+ in6ailistlen * sizeof (struct in6addrinfo));
if (result == NULL)
- goto out_fail;
+ goto out_fail2;
result->timestamp = get_nl_timestamp ();
result->usecnt = 2;
@@ -286,7 +300,10 @@ make_request (int fd, pid_t pid)
do
{
result->in6ai[--in6ailistlen] = in6ailist->info;
- in6ailist = in6ailist->next;
+ struct in6ailist *next = in6ailist->next;
+ if (in6ailist->use_malloc)
+ free (in6ailist);
+ in6ailist = next;
}
while (in6ailist != NULL);
}
@@ -302,7 +319,15 @@ make_request (int fd, pid_t pid)
free (buf);
return result;
-out_fail:
+ out_fail2:
+ while (in6ailist != NULL)
+ {
+ struct in6ailist *next = in6ailist->next;
+ if (in6ailist->use_malloc)
+ free (in6ailist);
+ in6ailist = next;
+ }
+ out_fail:
if (use_malloc)
free (buf);
return NULL;

View File

@ -0,0 +1,236 @@
Always do locking when accessing streams
[BZ #15142]
* libio/genops.c (_IO_list_all_stamp): Delete. All uses removed.
(_IO_flush_all_all_lockp): Delete.
(_IO_flush_all): Replace with body of _IO_flush_all_all_lockp.
Always do locking.
(_IO_unbuffer_write): Always do locking.
(_IO_cleanup): Call _IO_flush_all instead of _IO_flush_all_lockp.
* libio/libioP.h (_IO_flush_all_all_lockp): Remove declaration.
diff --git a/libio/genops.c b/libio/genops.c
index e0ce8cc..9def1d4 100644
--- a/libio/genops.c
+++ b/libio/genops.c
@@ -38,10 +38,6 @@
static _IO_lock_t list_all_lock = _IO_lock_initializer;
#endif
-/* Used to signal modifications to the list of FILE decriptors. */
-static int _IO_list_all_stamp;
-
-
static _IO_FILE *run_fp;
#ifdef _IO_MTSAFE_IO
@@ -70,16 +66,12 @@ _IO_un_link (fp)
if (_IO_list_all == NULL)
;
else if (fp == _IO_list_all)
- {
- _IO_list_all = (struct _IO_FILE_plus *) _IO_list_all->file._chain;
- ++_IO_list_all_stamp;
- }
+ _IO_list_all = (struct _IO_FILE_plus *) _IO_list_all->file._chain;
else
for (f = &_IO_list_all->file._chain; *f; f = &(*f)->_chain)
if (*f == (_IO_FILE *) fp)
{
*f = fp->file._chain;
- ++_IO_list_all_stamp;
break;
}
fp->file._flags &= ~_IO_LINKED;
@@ -108,7 +100,6 @@ _IO_link_in (fp)
#endif
fp->file._chain = (_IO_FILE *) _IO_list_all;
_IO_list_all = fp;
- ++_IO_list_all_stamp;
#ifdef _IO_MTSAFE_IO
_IO_funlockfile ((_IO_FILE *) fp);
run_fp = NULL;
@@ -818,25 +809,20 @@ _IO_get_column (fp)
int
-_IO_flush_all_lockp (int do_lock)
+_IO_flush_all (void)
{
int result = 0;
struct _IO_FILE *fp;
- int last_stamp;
#ifdef _IO_MTSAFE_IO
- __libc_cleanup_region_start (do_lock, flush_cleanup, NULL);
- if (do_lock)
- _IO_lock_lock (list_all_lock);
+ _IO_cleanup_region_start_noarg (flush_cleanup);
+ _IO_lock_lock (list_all_lock);
#endif
- last_stamp = _IO_list_all_stamp;
- fp = (_IO_FILE *) _IO_list_all;
- while (fp != NULL)
+ for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
{
run_fp = fp;
- if (do_lock)
- _IO_flockfile (fp);
+ _IO_flockfile (fp);
if (((fp->_mode <= 0 && fp->_IO_write_ptr > fp->_IO_write_base)
#if defined _LIBC || defined _GLIBCPP_USE_WCHAR_T
@@ -848,52 +834,30 @@ _IO_flush_all_lockp (int do_lock)
&& _IO_OVERFLOW (fp, EOF) == EOF)
result = EOF;
- if (do_lock)
- _IO_funlockfile (fp);
+ _IO_funlockfile (fp);
run_fp = NULL;
-
- if (last_stamp != _IO_list_all_stamp)
- {
- /* Something was added to the list. Start all over again. */
- fp = (_IO_FILE *) _IO_list_all;
- last_stamp = _IO_list_all_stamp;
- }
- else
- fp = fp->_chain;
}
#ifdef _IO_MTSAFE_IO
- if (do_lock)
- _IO_lock_unlock (list_all_lock);
- __libc_cleanup_region_end (0);
+ _IO_lock_unlock (list_all_lock);
+ _IO_cleanup_region_end (0);
#endif
return result;
}
-
-
-int
-_IO_flush_all (void)
-{
- /* We want locking. */
- return _IO_flush_all_lockp (1);
-}
libc_hidden_def (_IO_flush_all)
void
_IO_flush_all_linebuffered (void)
{
struct _IO_FILE *fp;
- int last_stamp;
#ifdef _IO_MTSAFE_IO
_IO_cleanup_region_start_noarg (flush_cleanup);
_IO_lock_lock (list_all_lock);
#endif
- last_stamp = _IO_list_all_stamp;
- fp = (_IO_FILE *) _IO_list_all;
- while (fp != NULL)
+ for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
{
run_fp = fp;
_IO_flockfile (fp);
@@ -903,15 +867,6 @@ _IO_flush_all_linebuffered (void)
_IO_funlockfile (fp);
run_fp = NULL;
-
- if (last_stamp != _IO_list_all_stamp)
- {
- /* Something was added to the list. Start all over again. */
- fp = (_IO_FILE *) _IO_list_all;
- last_stamp = _IO_list_all_stamp;
- }
- else
- fp = fp->_chain;
}
#ifdef _IO_MTSAFE_IO
@@ -947,6 +902,12 @@ static void
_IO_unbuffer_write (void)
{
struct _IO_FILE *fp;
+
+#ifdef _IO_MTSAFE_IO
+ _IO_cleanup_region_start_noarg (flush_cleanup);
+ _IO_lock_lock (list_all_lock);
+#endif
+
for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain)
{
if (! (fp->_flags & _IO_UNBUFFERED)
@@ -956,15 +917,8 @@ _IO_unbuffer_write (void)
&& fp->_mode != 0)
{
#ifdef _IO_MTSAFE_IO
- int cnt;
-#define MAXTRIES 2
- for (cnt = 0; cnt < MAXTRIES; ++cnt)
- if (fp->_lock == NULL || _IO_lock_trylock (*fp->_lock) == 0)
- break;
- else
- /* Give the other thread time to finish up its use of the
- stream. */
- __sched_yield ();
+ run_fp = fp;
+ _IO_flockfile (fp);
#endif
if (! dealloc_buffers && !(fp->_flags & _IO_USER_BUF))
@@ -980,8 +934,8 @@ _IO_unbuffer_write (void)
_IO_SETBUF (fp, NULL, 0);
#ifdef _IO_MTSAFE_IO
- if (cnt < MAXTRIES && fp->_lock != NULL)
- _IO_lock_unlock (*fp->_lock);
+ _IO_funlockfile (fp);
+ run_fp = NULL;
#endif
}
@@ -989,6 +943,11 @@ _IO_unbuffer_write (void)
used. */
fp->_mode = -1;
}
+
+#ifdef _IO_MTSAFE_IO
+ _IO_lock_unlock (list_all_lock);
+ _IO_cleanup_region_end (0);
+#endif
}
@@ -1008,9 +967,7 @@ libc_freeres_fn (buffer_free)
int
_IO_cleanup (void)
{
- /* We do *not* want locking. Some threads might use streams but
- that is their problem, we flush them underneath them. */
- int result = _IO_flush_all_lockp (0);
+ int result = _IO_flush_all ();
/* We currently don't have a reliable mechanism for making sure that
C++ static destructors are executed in the correct order.
diff --git a/libio/libioP.h b/libio/libioP.h
index 8a7b85b..3e3a724 100644
--- a/libio/libioP.h
+++ b/libio/libioP.h
@@ -488,7 +488,6 @@ extern int _IO_new_do_write (_IO_FILE *, const char *, _IO_size_t);
extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t);
extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t);
libc_hidden_proto (_IO_wdo_write)
-extern int _IO_flush_all_lockp (int);
extern int _IO_flush_all (void);
libc_hidden_proto (_IO_flush_all)
extern int _IO_cleanup (void);
--
1.9.1

View File

@ -0,0 +1,22 @@
* 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
@@ -710,6 +710,14 @@ gaih_inet (const char *name, const struc
struct gaih_addrtuple *addrfree = addrmem;
for (int i = 0; i < air->naddrs; ++i)
{
+ 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. */
+ continue;
+
socklen_t size = (air->family[i] == AF_INET
? INADDRSZ : IN6ADDRSZ);
if (*pat == NULL)

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Tue Mar 25 09:26:44 UTC 2014 - schwab@suse.de
- abort-no-flush.patch: Don't close or flush stdio streams on abort (BZ
#15436)
- fix-locking-in-_IO_cleanup.patch: always do locking when accessing
streams (bnc#796982, BZ #15142)
- resolv-dont-ignore-second-answer.patch: don't ignore second answer from
nameserver if the first one was empty (bnc#767266, BZ #13651)
- ldd-system-interp.patch: Never try to execute the file in ldd
(bnc#677787, BZ #16750)
-------------------------------------------------------------------
Mon Mar 24 12:26:50 UTC 2014 - schwab@suse.de
- check-pf-alloca.patch: Account for alloca use when collecting interface
addresses (bnc#785041, BZ #16002)
-------------------------------------------------------------------
Mon Mar 24 07:59:40 UTC 2014 - schwab@suse.de
- powerpc-opt-power8.patch: two more POWER8 optimisations (bnc#866711,
fate#315443)
-------------------------------------------------------------------
Thu Mar 20 14:52:47 UTC 2014 - schwab@suse.de
- getaddrinfo-uninit-result.patch: Fix use of half-initialized result in
getaddrinfo when using nscd (bnc#867636, BZ #16743)
-------------------------------------------------------------------
Thu Mar 20 07:42:50 UTC 2014 - schwab@suse.de

View File

@ -240,10 +240,22 @@ Patch1002: pldd-wait-ptrace-stop.patch
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
###
# 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)
Patch2003: abort-no-flush.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -449,6 +461,13 @@ rm nscd/s-stamp
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch3000

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Tue Mar 25 09:26:44 UTC 2014 - schwab@suse.de
- abort-no-flush.patch: Don't close or flush stdio streams on abort (BZ
#15436)
- fix-locking-in-_IO_cleanup.patch: always do locking when accessing
streams (bnc#796982, BZ #15142)
- resolv-dont-ignore-second-answer.patch: don't ignore second answer from
nameserver if the first one was empty (bnc#767266, BZ #13651)
- ldd-system-interp.patch: Never try to execute the file in ldd
(bnc#677787, BZ #16750)
-------------------------------------------------------------------
Mon Mar 24 12:26:50 UTC 2014 - schwab@suse.de
- check-pf-alloca.patch: Account for alloca use when collecting interface
addresses (bnc#785041, BZ #16002)
-------------------------------------------------------------------
Mon Mar 24 07:59:40 UTC 2014 - schwab@suse.de
- powerpc-opt-power8.patch: two more POWER8 optimisations (bnc#866711,
fate#315443)
-------------------------------------------------------------------
Thu Mar 20 14:52:47 UTC 2014 - schwab@suse.de
- getaddrinfo-uninit-result.patch: Fix use of half-initialized result in
getaddrinfo when using nscd (bnc#867636, BZ #16743)
-------------------------------------------------------------------
Thu Mar 20 07:42:50 UTC 2014 - schwab@suse.de

View File

@ -239,10 +239,22 @@ Patch1002: pldd-wait-ptrace-stop.patch
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
###
# 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)
Patch2003: abort-no-flush.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -449,6 +461,13 @@ rm nscd/s-stamp
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch3000

View File

@ -1,3 +1,33 @@
-------------------------------------------------------------------
Tue Mar 25 09:26:44 UTC 2014 - schwab@suse.de
- abort-no-flush.patch: Don't close or flush stdio streams on abort (BZ
#15436)
- fix-locking-in-_IO_cleanup.patch: always do locking when accessing
streams (bnc#796982, BZ #15142)
- resolv-dont-ignore-second-answer.patch: don't ignore second answer from
nameserver if the first one was empty (bnc#767266, BZ #13651)
- ldd-system-interp.patch: Never try to execute the file in ldd
(bnc#677787, BZ #16750)
-------------------------------------------------------------------
Mon Mar 24 12:26:50 UTC 2014 - schwab@suse.de
- check-pf-alloca.patch: Account for alloca use when collecting interface
addresses (bnc#785041, BZ #16002)
-------------------------------------------------------------------
Mon Mar 24 07:59:40 UTC 2014 - schwab@suse.de
- powerpc-opt-power8.patch: two more POWER8 optimisations (bnc#866711,
fate#315443)
-------------------------------------------------------------------
Thu Mar 20 14:52:47 UTC 2014 - schwab@suse.de
- getaddrinfo-uninit-result.patch: Fix use of half-initialized result in
getaddrinfo when using nscd (bnc#867636, BZ #16743)
-------------------------------------------------------------------
Thu Mar 20 07:42:50 UTC 2014 - schwab@suse.de

View File

@ -240,10 +240,22 @@ Patch1002: pldd-wait-ptrace-stop.patch
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
###
# 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)
Patch2003: abort-no-flush.patch
# Non-glibc patches
# PATCH-FIX-OPENSUSE Remove debianisms from manpages
@ -449,6 +461,13 @@ rm nscd/s-stamp
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch2000 -p1
%patch2001 -p1
%patch2002 -p1
%patch2003 -p1
%patch3000

51
ldd-system-interp.patch Normal file
View File

@ -0,0 +1,51 @@
Never try to execute the file in ldd
Executing a random file is never a good idea. Treat all arguments as if
they are invoked with __libc_enable_secure, and run them through the known
good dynamic linker.
* elf/ldd.bash.in: Always run through the dynamic linker, even if
the file has its own interpreter. Remove unneeded executable
check.
Index: glibc-2.19/elf/ldd.bash.in
===================================================================
--- glibc-2.19.orig/elf/ldd.bash.in
+++ glibc-2.19/elf/ldd.bash.in
@@ -150,8 +150,6 @@ for file do
echo "ldd: ${file}:" $"not regular file" >&2
result=1
elif test -r "$file"; then
- test -x "$file" || echo 'ldd:' $"\
-warning: you do not have execution permission for" "\`$file'" >&2
RTLD=
ret=1
for rtld in ${RTLDLIST}; do
@@ -164,18 +162,6 @@ warning: you do not have execution permi
fi
done
case $ret in
- 0)
- # If the program exits with exit code 5, it means the process has been
- # invoked with __libc_enable_secure. Fall back to running it through
- # the dynamic linker.
- try_trace "$file"
- rc=$?
- if [ $rc = 5 ]; then
- try_trace "$RTLD" "$file"
- rc=$?
- fi
- [ $rc = 0 ] || result=1
- ;;
1)
# This can be a non-ELF binary or no binary at all.
nonelf "$file" || {
@@ -183,7 +169,7 @@ warning: you do not have execution permi
result=1
}
;;
- 2)
+ [02])
try_trace "$RTLD" "$file" || result=1
;;
*)

View File

@ -1,3 +1,36 @@
2014-03-20 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
Vidya Ranganathan <vidya@linux.vnet.ibm.com>
* string/strpbrk.c (strpbrk): Using macro to redefine symbol name.
* sysdeps/powerpc/powerpc64/multiarch/Makefile: Add strpbrk-power7
and strpbrk-ppc64 objects.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add new strpbrk optimized symbols.
* sysdeps/powerpc/powerpc64/multiarch/strpbrk-power7.S: New file:
multiarch strpbrk for POWER7.
* sysdeps/powerpc/powerpc64/multiarch/strpbrk-ppc64.c: New file:
multiarch strpbrk for PPC64.
* sysdeps/powerpc/powerpc64/multiarch/strpbrk.c: New file: strpbrk
ifunc selector.
* sysdeps/powerpc/powerpc64/power7/strpbrk.S: New file: optimited
strpbrk for POWER7.
2014-03-20 Adhemerval Zanella <azanella@linux.vnet.ibm.com>
* string/strcspn.c (strcspn): Using macro to redefine symbol name.
* sysdeps/powerpc/powerpc64/multiarch/Makefile: Add strcspn-power7
and strcspn-ppc64 objects.
* sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
(__libc_ifunc_impl_list): Add new strcspn optimized symbols.
* sysdeps/powerpc/powerpc64/multiarch/strcspn-power7.S: New file:
multiarch strcspn for POWER7.
* sysdeps/powerpc/powerpc64/multiarch/strcspn-ppc64.c: New file:
multiarch strcspn for PPC64.
* sysdeps/powerpc/powerpc64/multiarch/strcspn.c: New file: strcspn
ifunc selector.
* sysdeps/powerpc/powerpc64/power7/strcspn.S: New file: optimited
strcspn for POWER7.
2014-03-11 Vidya Ranganathan <vidya@linux.vnet.ibm.com>
* sysdeps/powerpc/powerpc64/power7/strspn.S: New file: Optimization.
@ -94,6 +127,76 @@
POWER8 isnan implementation.
* sysdeps/powerpc/powerpc64/power8/fpu/s_isnanf.S: New file.
Index: glibc-2.19/string/strcspn.c
===================================================================
--- glibc-2.19.orig/string/strcspn.c
+++ glibc-2.19/string/strcspn.c
@@ -15,27 +15,18 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#if HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if defined _LIBC || HAVE_STRING_H
-# include <string.h>
-#else
-# include <strings.h>
-# ifndef strchr
-# define strchr index
-# endif
-#endif
+#include <string.h>
#undef strcspn
+#ifndef STRCSPN
+# define STRCSPN strcspn
+#endif
+
/* Return the length of the maximum initial segment of S
which contains no characters from REJECT. */
size_t
-strcspn (s, reject)
- const char *s;
- const char *reject;
+STRCSPN (const char *s, const char *reject)
{
size_t count = 0;
Index: glibc-2.19/string/strpbrk.c
===================================================================
--- glibc-2.19.orig/string/strpbrk.c
+++ glibc-2.19/string/strpbrk.c
@@ -15,21 +15,17 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-
-#if defined _LIBC || defined HAVE_CONFIG_H
-# include <string.h>
-#endif
+#include <string.h>
#undef strpbrk
+#ifndef STRPBRK
+#define STRPBRK strpbrk
+#endif
+
/* Find the first occurrence in S of any character in ACCEPT. */
char *
-strpbrk (s, accept)
- const char *s;
- const char *accept;
+STRPBRK (const char *s, const char *accept)
{
while (*s != '\0')
{
Index: glibc-2.19/string/strrchr.c
===================================================================
--- glibc-2.19.orig/string/strrchr.c
@ -549,14 +652,15 @@ Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/Makefile
===================================================================
--- glibc-2.19.orig/sysdeps/powerpc/powerpc64/multiarch/Makefile
+++ glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/Makefile
@@ -13,7 +13,9 @@ sysdep_routines += memcpy-power7 memcpy-
@@ -13,7 +13,10 @@ sysdep_routines += memcpy-power7 memcpy-
wcschr-power6 wcschr-ppc64 wcsrchr-power7 wcsrchr-power6 \
wcsrchr-ppc64 wcscpy-power7 wcscpy-power6 wcscpy-ppc64 \
wordcopy-power7 wordcopy-power6 wordcopy-ppc64 \
- strcpy-power7 strcpy-ppc64 stpcpy-power7 stpcpy-ppc64
+ strcpy-power7 strcpy-ppc64 stpcpy-power7 stpcpy-ppc64 \
+ strrchr-power7 strrchr-ppc64 strncat-power7 strncat-ppc64 \
+ strspn-power7 strspn-ppc64
+ strspn-power7 strspn-ppc64 strcspn-power7 strcspn-ppc64 \
+ strpbrk-power7 strpbrk-ppc64
CFLAGS-strncase-power7.c += -mcpu=power7 -funroll-loops
CFLAGS-strncase_l-power7.c += -mcpu=power7 -funroll-loops
@ -564,7 +668,7 @@ Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
===================================================================
--- glibc-2.19.orig/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+++ glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
@@ -238,5 +238,29 @@ __libc_ifunc_impl_list (const char *name
@@ -238,5 +238,45 @@ __libc_ifunc_impl_list (const char *name
IFUNC_IMPL_ADD (array, i, wcscpy, 1,
__wcscpy_ppc))
@ -591,9 +695,141 @@ Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/ifunc-impl-list.c
+ __strspn_power7)
+ IFUNC_IMPL_ADD (array, i, strspn, 1,
+ __strspn_ppc))
+
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strcspn.c. */
+ IFUNC_IMPL (i, name, strcspn,
+ IFUNC_IMPL_ADD (array, i, strcspn,
+ hwcap & PPC_FEATURE_HAS_VSX,
+ __strcspn_power7)
+ IFUNC_IMPL_ADD (array, i, strcspn, 1,
+ __strcspn_ppc))
+
+ /* Support sysdeps/powerpc/powerpc64/multiarch/strpbrk.c. */
+ IFUNC_IMPL (i, name, strpbrk,
+ IFUNC_IMPL_ADD (array, i, strpbrk,
+ hwcap & PPC_FEATURE_HAS_VSX,
+ __strpbrk_power7)
+ IFUNC_IMPL_ADD (array, i, strpbrk, 1,
+ __strpbrk_ppc))
+
return i;
}
Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strcspn-power7.S
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strcspn-power7.S
@@ -0,0 +1,40 @@
+/* Optimized strcspn implementation for POWER7.
+ 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 <sysdep.h>
+
+#undef EALIGN
+#define EALIGN(name, alignt, words) \
+ .section ".text"; \
+ ENTRY_2(__strcspn_power7) \
+ .align ALIGNARG(alignt); \
+ EALIGN_W_##words; \
+ BODY_LABEL(__strcspn_power7): \
+ cfi_startproc; \
+ LOCALENTRY(__strcspn_power7)
+
+#undef END
+#define END(name) \
+ cfi_endproc; \
+ TRACEBACK(__strcspn_power7) \
+ END_2(__strcspn_power7)
+
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(name)
+
+#include <sysdeps/powerpc/powerpc64/power7/strcspn.S>
Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strcspn-ppc64.c
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strcspn-ppc64.c
@@ -0,0 +1,30 @@
+/* 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 <string.h>
+
+#define STRCSPN __strcspn_ppc
+#ifdef SHARED
+
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name) \
+ __hidden_ver1 (__strcspn_ppc, __GI_strcspn, __strcspn_ppc);
+#endif
+
+extern __typeof (strcspn) __strcspn_ppc attribute_hidden;
+
+#include <string/strcspn.c>
Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strcspn.c
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strcspn.c
@@ -0,0 +1,31 @@
+/* Multiple versions of strcspn. PowerPC64 version.
+ 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/>. */
+
+#ifndef NOT_IN_libc
+# include <string.h>
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+extern __typeof (strcspn) __strcspn_ppc attribute_hidden;
+extern __typeof (strcspn) __strcspn_power7 attribute_hidden;
+
+libc_ifunc (strcspn,
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strcspn_power7
+ : __strcspn_ppc);
+#endif
Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strncat-power7.S
===================================================================
--- /dev/null
@ -711,6 +947,122 @@ Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strncat.c
+ ? __strncat_power7
+ : __strncat_ppc);
+#endif
Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strpbrk-power7.S
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strpbrk-power7.S
@@ -0,0 +1,40 @@
+/* Optimized strpbrk implementation for POWER7.
+ 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 <sysdep.h>
+
+#undef EALIGN
+#define EALIGN(name, alignt, words) \
+ .section ".text"; \
+ ENTRY_2(__strpbrk_power7) \
+ .align ALIGNARG(alignt); \
+ EALIGN_W_##words; \
+ BODY_LABEL(__strpbrk_power7): \
+ cfi_startproc; \
+ LOCALENTRY(__strpbrk_power7)
+
+#undef END
+#define END(name) \
+ cfi_endproc; \
+ TRACEBACK(__strpbrk_power7) \
+ END_2(__strpbrk_power7)
+
+#undef libc_hidden_builtin_def
+#define libc_hidden_builtin_def(name)
+
+#include <sysdeps/powerpc/powerpc64/power7/strpbrk.S>
Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strpbrk-ppc64.c
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strpbrk-ppc64.c
@@ -0,0 +1,30 @@
+/* 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 <string.h>
+
+#define STRPBRK __strpbrk_ppc
+#ifdef SHARED
+
+# undef libc_hidden_builtin_def
+# define libc_hidden_builtin_def(name) \
+ __hidden_ver1 (__strpbrk_ppc, __GI_strpbrk, __strpbrk_ppc);
+#endif
+
+extern __typeof (strpbrk) __strpbrk_ppc attribute_hidden;
+
+#include <string/strpbrk.c>
Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strpbrk.c
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strpbrk.c
@@ -0,0 +1,31 @@
+/* Multiple versions of strpbrk. PowerPC64 version.
+ 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/>. */
+
+#ifndef NOT_IN_libc
+# include <string.h>
+# include <shlib-compat.h>
+# include "init-arch.h"
+
+extern __typeof (strpbrk) __strpbrk_ppc attribute_hidden;
+extern __typeof (strpbrk) __strpbrk_power7 attribute_hidden;
+
+libc_ifunc (strpbrk,
+ (hwcap & PPC_FEATURE_HAS_VSX)
+ ? __strpbrk_power7
+ : __strpbrk_ppc);
+#endif
Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strrchr-power7.S
===================================================================
--- /dev/null
@ -952,6 +1304,150 @@ Index: glibc-2.19/sysdeps/powerpc/powerpc64/multiarch/strspn.c
+ ? __strspn_power7
+ : __strspn_ppc);
+#endif
Index: glibc-2.19/sysdeps/powerpc/powerpc64/power7/strcspn.S
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/powerpc/powerpc64/power7/strcspn.S
@@ -0,0 +1,139 @@
+/* Optimized strcspn implementation for PowerPC64.
+ 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 <sysdep.h>
+
+/* size_t [r3] strcspn (const char [r4] *s, const char [r5] *reject) */
+
+ .machine power7
+EALIGN (strcspn, 4, 0)
+ CALL_MCOUNT 3
+
+ /* The idea to speed up the algorithm is to create a lookup table
+ for fast check if input character should be considered. For ASCII
+ or ISO-8859-X character sets it has 256 positions. */
+ lbz r10,0(r4)
+
+ /* First the table should be cleared and to avoid unaligned accesses
+ when using the VSX stores the table address is aligned to 16
+ bytes. */
+ xxlxor v0,v0,v0
+
+ /* PPC64 ELF ABI stack is aligned to 16 bytes. */
+ addi r9,r1,-256
+
+ li r8,48
+ li r5,16
+ li r6,32
+ cmpdi cr7,r10,0 /* reject[0] == '\0' ? */
+ addi r12,r9,64
+ /* Clear the table with 0 values */
+ stxvw4x v0,r0,r9
+ addi r11,r9,128
+ addi r7,r9,192
+ stxvw4x v0,r9,r5
+ stxvw4x v0,r9,r6
+ stxvw4x v0,r9,r8
+ stxvw4x v0,r0,r12
+ stxvw4x v0,r12,r5
+ stxvw4x v0,r12,r6
+ stxvw4x v0,r12,r8
+ stxvw4x v0,r0,r11
+ stxvw4x v0,r11,r5
+ stxvw4x v0,r11,r6
+ stxvw4x v0,r11,r8
+ stxvw4x v0,r0,r7
+ stxvw4x v0,r7,r5
+ stxvw4x v0,r7,r6
+ stxvw4x v0,r7,r8
+ li r8,1
+ beq cr7,L(finish_table) /* If reject[0] == '\0' skip */
+
+ /* Initialize the table as:
+ for (i=0; reject[i]; i++
+ table[reject[i]]] = 1 */
+ .p2align 4,,15
+L(init_table):
+ stbx r8,r9,r10
+ lbzu r10,1(r4)
+ cmpdi cr7,r10,0 /* If reject[0] == '\0' finish */
+ bne cr7,L(init_table)
+L(finish_table):
+ /* set table[0] = 1 */
+ li r10,1
+ stb r10,0(r9)
+ li r10,0
+ b L(mainloop)
+
+ /* Unrool the loop 4 times and check using the table as:
+ i = 0;
+ while (1)
+ {
+ if (table[input[i++]] == 1)
+ return i - 1;
+ if (table[input[i++]] == 1)
+ return i - 1;
+ if (table[input[i++]] == 1)
+ return i - 1;
+ if (table[input[i++]] == 1)
+ return i - 1;
+ } */
+ .p2align 4,,15
+L(unroll):
+ lbz r8,1(r3)
+ addi r10,r10,4
+ lbzx r8,r9,r8
+ cmpwi r7,r8,1
+ beq cr7,L(end)
+ lbz r8,2(r3)
+ addi r3,r3,4
+ lbzx r8,r9,r8
+ cmpwi cr7,r8,1
+ beq cr7,L(end2)
+ lbz r8,3(r7)
+ lbzx r8,r9,r8
+ cmpwi cr7,r8,1
+ beq cr7,L(end3)
+L(mainloop):
+ lbz r8,0(r3)
+ mr r7,r3
+ addi r6,r10,1
+ addi r4,r10,2
+ addi r5,r10,3
+ lbzx r8,r9,8
+ cmpwi cr7,r8,1
+ bne cr7,L(unroll)
+ mr r3,r10
+ blr
+
+ .p2align 4,,15
+L(end):
+ mr r3,r6
+ blr
+
+ .p2align 4,,15
+L(end2):
+ mr r3,r4
+ blr
+
+ .p2align 4,,15
+L(end3):
+ mr r3,r5
+ blr
+END (strcspn)
+libc_hidden_builtin_def (strcspn)
Index: glibc-2.19/sysdeps/powerpc/powerpc64/power7/strncat.S
===================================================================
--- /dev/null
@ -1179,6 +1675,159 @@ Index: glibc-2.19/sysdeps/powerpc/powerpc64/power7/strncat.S
+ b L(nullTerminate) /* Now, finish catenation with
+ NULL termination. */
+END(STRNCAT)
Index: glibc-2.19/sysdeps/powerpc/powerpc64/power7/strpbrk.S
===================================================================
--- /dev/null
+++ glibc-2.19/sysdeps/powerpc/powerpc64/power7/strpbrk.S
@@ -0,0 +1,148 @@
+/* Optimized strpbrk implementation for PowerPC64/POWER7.
+ 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 <sysdep.h>
+
+/* char [r3] *strpbrk(const char [r4] *s, const char [r5] *accept) */
+
+ .machine power7
+EALIGN (strpbrk, 4, 0)
+ CALL_MCOUNT 3
+
+ lbz r10,0(r4)
+ cmpdi cr7,r10,0 /* accept[0] == '\0' ? */
+ beq cr7,L(nullfound)
+
+ /* The idea to speed up the algorithm is to create a lookup table
+ for fast check if input character should be considered. For ASCII
+ or ISO-8859-X character sets it has 256 positions. */
+
+ /* First the table should be cleared and to avoid unaligned accesses
+ when using the VSX stores the table address is aligned to 16
+ bytes. */
+ xxlxor v0,v0,v0
+
+ /* PPC64 ELF ABI stack is aligned to 16 bytes */
+ addi r9,r1,-256
+
+ li r5,16
+ li r6,32
+ li r8,48
+ addi r12,r9,64
+ /* Clear the table with 0 values */
+ stxvw4x v0,r0,r9
+ addi r11,r9,128
+ addi r7,r9,192
+ stxvw4x v0,r9,r5
+ li r0,1
+ stxvw4x v0,r9,r6
+ stxvw4x v0,r9,r8
+ stxvw4x v0,r0,r12
+ stxvw4x v0,r12,r5
+ stxvw4x v0,r12,r6
+ stxvw4x v0,r12,r8
+ stxvw4x v0,r0,r11
+ stxvw4x v0,r11,r5
+ stxvw4x v0,r11,r6
+ stxvw4x v0,r11,r8
+ stxvw4x v0,r0,r7
+ stxvw4x v0,r7,r5
+ stxvw4x v0,r7,r6
+ stxvw4x v0,r7,r8
+
+ /* Initialize the table as:
+ for (i=0; accept[i]; i++
+ table[accept[i]]] = 1 */
+ .p2align 4,,15
+L(init_table):
+ stbx r0,r9,r10
+ lbzu r10,1(r4)
+ cmpdi r0,r10,0
+ bne cr0,L(init_table)
+L(finish_table):
+ /* set table[0] = 1 */
+ li r4,1
+ stb r4,0(r9)
+ b L(mainloop)
+
+ /* Unrool the loop 4 times and check using the table as:
+ i = 0;
+ while (1)
+ {
+ if (table[input[i++]] == 1)
+ return (s[i -1] ? s + i - 1: NULL);
+ if (table[input[i++]] == 1)
+ return (s[i -1] ? s + i - 1: NULL);
+ if (table[input[i++]] == 1)
+ return (s[i -1] ? s + i - 1: NULL);
+ if (table[input[i++]] == 1)
+ return (s[i -1] ? s + i - 1: NULL);
+ } */
+ .p2align 4
+L(unroll):
+ lbz r0,1(r3)
+ lbzx r8,r9,r0
+ cmpwi cr6,r8,1
+ beq cr6,L(checkend2)
+ lbz r10,2(r3)
+ lbzx r4,r9,r10
+ cmpwi cr7,r4,1
+ beq cr7,L(checkend3)
+ lbz r12,3(r3)
+ addi r3,r3,4
+ lbzx r11,r9,r12
+ cmpwi cr0,r11,1
+ beq cr0,L(checkend)
+L(mainloop):
+ lbz r12,0(r3)
+ addi r11,r3,1
+ addi r5,r3,2
+ addi r7,r3,3
+ lbzx r6,r9,r12
+ cmpwi cr1,r6,1
+ bne cr1,L(unroll)
+ cmpdi cr0,r12,0
+ beq cr0,L(nullfound)
+L(end):
+ blr
+
+ .p2align 4
+L(checkend):
+ cmpdi cr1,r12,0
+ mr r3,r7
+ bne cr1,L(end)
+L(nullfound):
+ /* return NULL */
+ li 3,0
+ blr
+
+ .p2align 4
+L(checkend2):
+ cmpdi cr7,r0,0
+ mr r3,r11
+ beq cr7,L(nullfound)
+ blr
+
+ .p2align 4
+L(checkend3):
+ cmpdi cr6,r10,0
+ mr r3,r5
+ beq cr6,L(nullfound)
+ blr
+END (strpbrk)
+libc_hidden_builtin_def (strpbrk)
Index: glibc-2.19/sysdeps/powerpc/powerpc64/power7/strrchr.S
===================================================================
--- /dev/null

View File

@ -0,0 +1,33 @@
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);
}