mirror of
https://sourceware.org/git/glibc.git
synced 2025-01-03 08:11:08 +00:00
Fix strftime wcschr namespace (bug 17634).
Use of strftime, a C90 function, ends up bringing in wcschr, which is not a C90 function. Although not a conformance bug (C90 reserves wcs*), this is still contrary to glibc practice of avoiding relying on those reservations; this patch arranges for the internal uses to use __wcschr instead, with wcschr being a weak alias. This is more complicated than some such patches because of the various IFUNC definitions of wcschr (which include code redefining libc_hidden_def in a way that involves creating __GI_wcschr manually and so also needs to create __GI___wcschr after the change of internal uses to use __wcschr). Tested for x86_64 and 32-bit x86 (testsuite, and that disassembly of installed shared libraries is unchanged by the patch). 2014-12-10 Joseph Myers <joseph@codesourcery.com> Adhemerval Zanella <azanella@linux.vnet.ibm.com> [BZ #17634] * wcsmbs/wcschr.c [!WCSCHR] (wcschr): Define as __wcschr. Undefine after defining function. Define as weak alias of __wcschr. Use libc_hidden_weak. * include/wchar.h (__wcschr): Declare. Use libc_hidden_proto. * sysdeps/i386/i686/multiarch/wcschr-c.c [IS_IN (libc) && SHARED] (libc_hidden_def): Also define __GI___wcschr alias. * sysdeps/i386/i686/multiarch/wcschr.S (wcschr): Rename to __wcschr and define as weak alias of __wcschr. * sysdeps/powerpc/power6/wcschr.c [!WCSCHR] (WCSCHR): Define as __wcschr. [!WCSCHR] (DEFAULT_WCSCHR): Define. [DEFAULT_WCSCHR] (__wcschr): Use libc_hidden_def. [DEFAULT_WCSCHR] (wcschr): Define as weak alias of __wcschr. Use libc_hidden_weak. Do not use libc_hidden_def. * sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c [IS_IN (libc) && SHARED] (libc_hidden_def): Also define __GI___wcschr alias. * sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c [IS_IN (libc)] (wcschr): Define as macro expanding to __redirect_wcschr. [IS_IN (libc)] (__wcschr_ppc): Use __redirect_wcschr in typeof. [IS_IN (libc)] (__wcschr_power6): Likewise. [IS_IN (libc)] (__wcschr_power7): Likewise. [IS_IN (libc)] (__libc_wcschr): New. Define with libc_ifunc instead of wcschr. [IS_IN (libc)] (wcschr): Undefine and define as weak alias of __libc_wcschr. [!IS_IN (libc)] (libc_hidden_def): Do not undefine and redefine. * sysdeps/powerpc/powerpc64/multiarch/wcschr.c (wcschr): Rename to __wcschr and define as weak alias of __wcschr. Use libc_hidden_builtin_def. * sysdeps/x86_64/wcschr.S (wcschr): Rename to __wcschr and define as weak alias of __wcschr. Use libc_hidden_weak. * time/alt_digit.c (_nl_get_walt_digit): Use __wcschr instead of wcschr. * time/era.c (_nl_init_era_entries): Likewise. * conform/Makefile (test-xfail-ISO/time.h/linknamespace): Remove variable. (test-xfail-XPG3/time.h/linknamespace): Likewise. (test-xfail-XPG4/time.h/linknamespace): Likewise.
This commit is contained in:
parent
1b8bf35181
commit
2cfbdb9a27
45
ChangeLog
45
ChangeLog
@ -1,3 +1,48 @@
|
|||||||
|
2014-12-10 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
Adhemerval Zanella <azanella@linux.vnet.ibm.com>
|
||||||
|
|
||||||
|
[BZ #17634]
|
||||||
|
* wcsmbs/wcschr.c [!WCSCHR] (wcschr): Define as __wcschr.
|
||||||
|
Undefine after defining function. Define as weak alias of
|
||||||
|
__wcschr. Use libc_hidden_weak.
|
||||||
|
* include/wchar.h (__wcschr): Declare. Use libc_hidden_proto.
|
||||||
|
* sysdeps/i386/i686/multiarch/wcschr-c.c [IS_IN (libc) && SHARED]
|
||||||
|
(libc_hidden_def): Also define __GI___wcschr alias.
|
||||||
|
* sysdeps/i386/i686/multiarch/wcschr.S (wcschr): Rename to
|
||||||
|
__wcschr and define as weak alias of __wcschr.
|
||||||
|
* sysdeps/powerpc/power6/wcschr.c [!WCSCHR] (WCSCHR): Define as
|
||||||
|
__wcschr.
|
||||||
|
[!WCSCHR] (DEFAULT_WCSCHR): Define.
|
||||||
|
[DEFAULT_WCSCHR] (__wcschr): Use libc_hidden_def.
|
||||||
|
[DEFAULT_WCSCHR] (wcschr): Define as weak alias of __wcschr. Use
|
||||||
|
libc_hidden_weak. Do not use libc_hidden_def.
|
||||||
|
* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr-ppc32.c
|
||||||
|
[IS_IN (libc) && SHARED] (libc_hidden_def): Also define
|
||||||
|
__GI___wcschr alias.
|
||||||
|
* sysdeps/powerpc/powerpc32/power4/multiarch/wcschr.c
|
||||||
|
[IS_IN (libc)] (wcschr): Define as macro expanding to
|
||||||
|
__redirect_wcschr.
|
||||||
|
[IS_IN (libc)] (__wcschr_ppc): Use __redirect_wcschr in typeof.
|
||||||
|
[IS_IN (libc)] (__wcschr_power6): Likewise.
|
||||||
|
[IS_IN (libc)] (__wcschr_power7): Likewise.
|
||||||
|
[IS_IN (libc)] (__libc_wcschr): New. Define with libc_ifunc
|
||||||
|
instead of wcschr.
|
||||||
|
[IS_IN (libc)] (wcschr): Undefine and define as weak alias of
|
||||||
|
__libc_wcschr.
|
||||||
|
[!IS_IN (libc)] (libc_hidden_def): Do not undefine and redefine.
|
||||||
|
* sysdeps/powerpc/powerpc64/multiarch/wcschr.c (wcschr): Rename to
|
||||||
|
__wcschr and define as weak alias of __wcschr. Use
|
||||||
|
libc_hidden_builtin_def.
|
||||||
|
* sysdeps/x86_64/wcschr.S (wcschr): Rename to __wcschr and define
|
||||||
|
as weak alias of __wcschr. Use libc_hidden_weak.
|
||||||
|
* time/alt_digit.c (_nl_get_walt_digit): Use __wcschr instead of
|
||||||
|
wcschr.
|
||||||
|
* time/era.c (_nl_init_era_entries): Likewise.
|
||||||
|
* conform/Makefile (test-xfail-ISO/time.h/linknamespace): Remove
|
||||||
|
variable.
|
||||||
|
(test-xfail-XPG3/time.h/linknamespace): Likewise.
|
||||||
|
(test-xfail-XPG4/time.h/linknamespace): Likewise.
|
||||||
|
|
||||||
2014-12-10 Joseph Myers <joseph@codesourcery.com>
|
2014-12-10 Joseph Myers <joseph@codesourcery.com>
|
||||||
|
|
||||||
* libio/tst-ftell-active-handler.c (do_ftruncate_test): Use %ld
|
* libio/tst-ftell-active-handler.c (do_ftruncate_test): Use %ld
|
||||||
|
4
NEWS
4
NEWS
@ -13,8 +13,8 @@ Version 2.21
|
|||||||
15884, 16469, 16619, 16740, 16857, 17192, 17266, 17344, 17363, 17370,
|
15884, 16469, 16619, 16740, 16857, 17192, 17266, 17344, 17363, 17370,
|
||||||
17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522, 17555,
|
17371, 17411, 17460, 17475, 17485, 17501, 17506, 17508, 17522, 17555,
|
||||||
17570, 17571, 17572, 17573, 17574, 17581, 17582, 17583, 17584, 17585,
|
17570, 17571, 17572, 17573, 17574, 17581, 17582, 17583, 17584, 17585,
|
||||||
17589, 17594, 17601, 17608, 17616, 17625, 17633, 17647, 17653, 17664,
|
17589, 17594, 17601, 17608, 17616, 17625, 17633, 17634, 17647, 17653,
|
||||||
17665, 17668, 17682.
|
17664, 17665, 17668, 17682.
|
||||||
|
|
||||||
* CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
|
* CVE-2104-7817 The wordexp function could ignore the WRDE_NOCMD flag
|
||||||
under certain input conditions resulting in the execution of a shell for
|
under certain input conditions resulting in the execution of a shell for
|
||||||
|
@ -345,7 +345,6 @@ test-xfail-XOPEN2K/ndbm.h/linknamespace = yes
|
|||||||
test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes
|
test-xfail-XOPEN2K8/ndbm.h/linknamespace = yes
|
||||||
|
|
||||||
# Unsorted expected failures.
|
# Unsorted expected failures.
|
||||||
test-xfail-ISO/time.h/linknamespace = yes
|
|
||||||
test-xfail-ISO99/ctype.h/linknamespace = yes
|
test-xfail-ISO99/ctype.h/linknamespace = yes
|
||||||
test-xfail-ISO11/ctype.h/linknamespace = yes
|
test-xfail-ISO11/ctype.h/linknamespace = yes
|
||||||
test-xfail-XPG3/ctype.h/linknamespace = yes
|
test-xfail-XPG3/ctype.h/linknamespace = yes
|
||||||
@ -354,7 +353,6 @@ test-xfail-XPG3/glob.h/linknamespace = yes
|
|||||||
test-xfail-XPG3/regex.h/linknamespace = yes
|
test-xfail-XPG3/regex.h/linknamespace = yes
|
||||||
test-xfail-XPG3/search.h/linknamespace = yes
|
test-xfail-XPG3/search.h/linknamespace = yes
|
||||||
test-xfail-XPG3/stdio.h/linknamespace = yes
|
test-xfail-XPG3/stdio.h/linknamespace = yes
|
||||||
test-xfail-XPG3/time.h/linknamespace = yes
|
|
||||||
test-xfail-XPG3/unistd.h/linknamespace = yes
|
test-xfail-XPG3/unistd.h/linknamespace = yes
|
||||||
test-xfail-XPG3/wordexp.h/linknamespace = yes
|
test-xfail-XPG3/wordexp.h/linknamespace = yes
|
||||||
test-xfail-XPG4/ctype.h/linknamespace = yes
|
test-xfail-XPG4/ctype.h/linknamespace = yes
|
||||||
@ -370,7 +368,6 @@ test-xfail-XPG4/search.h/linknamespace = yes
|
|||||||
test-xfail-XPG4/stdio.h/linknamespace = yes
|
test-xfail-XPG4/stdio.h/linknamespace = yes
|
||||||
test-xfail-XPG4/stdlib.h/linknamespace = yes
|
test-xfail-XPG4/stdlib.h/linknamespace = yes
|
||||||
test-xfail-XPG4/syslog.h/linknamespace = yes
|
test-xfail-XPG4/syslog.h/linknamespace = yes
|
||||||
test-xfail-XPG4/time.h/linknamespace = yes
|
|
||||||
test-xfail-XPG4/unistd.h/linknamespace = yes
|
test-xfail-XPG4/unistd.h/linknamespace = yes
|
||||||
test-xfail-XPG4/wordexp.h/linknamespace = yes
|
test-xfail-XPG4/wordexp.h/linknamespace = yes
|
||||||
test-xfail-POSIX/aio.h/linknamespace = yes
|
test-xfail-POSIX/aio.h/linknamespace = yes
|
||||||
|
@ -85,6 +85,12 @@ libc_hidden_proto (wcscmp)
|
|||||||
libc_hidden_proto (wcsftime)
|
libc_hidden_proto (wcsftime)
|
||||||
libc_hidden_proto (wcsspn)
|
libc_hidden_proto (wcsspn)
|
||||||
libc_hidden_proto (wcschr)
|
libc_hidden_proto (wcschr)
|
||||||
|
/* The C++ overloading of wcschr means we have to repeat the type to
|
||||||
|
declare __wcschr instead of using typeof, to avoid errors in C++
|
||||||
|
tests. */
|
||||||
|
extern wchar_t *__wcschr (const wchar_t *__wcs, wchar_t __wc)
|
||||||
|
__THROW __attribute_pure__;
|
||||||
|
libc_hidden_proto (__wcschr)
|
||||||
libc_hidden_proto (wcscoll)
|
libc_hidden_proto (wcscoll)
|
||||||
libc_hidden_proto (wcspbrk)
|
libc_hidden_proto (wcspbrk)
|
||||||
|
|
||||||
|
@ -4,7 +4,9 @@
|
|||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
# undef libc_hidden_def
|
# undef libc_hidden_def
|
||||||
# define libc_hidden_def(name) \
|
# define libc_hidden_def(name) \
|
||||||
__hidden_ver1 (__wcschr_ia32, __GI_wcschr, __wcschr_ia32);
|
__hidden_ver1 (__wcschr_ia32, __GI_wcschr, __wcschr_ia32); \
|
||||||
|
strong_alias (__wcschr_ia32, __wcschr_ia32_1); \
|
||||||
|
__hidden_ver1 (__wcschr_ia32_1, __GI___wcschr, __wcschr_ia32_1);
|
||||||
# endif
|
# endif
|
||||||
# define WCSCHR __wcschr_ia32
|
# define WCSCHR __wcschr_ia32
|
||||||
#endif
|
#endif
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#if IS_IN (libc)
|
#if IS_IN (libc)
|
||||||
.text
|
.text
|
||||||
ENTRY(wcschr)
|
ENTRY(__wcschr)
|
||||||
.type wcschr, @gnu_indirect_function
|
.type wcschr, @gnu_indirect_function
|
||||||
pushl %ebx
|
pushl %ebx
|
||||||
cfi_adjust_cfa_offset (4)
|
cfi_adjust_cfa_offset (4)
|
||||||
@ -40,5 +40,6 @@ ENTRY(wcschr)
|
|||||||
cfi_adjust_cfa_offset (-4);
|
cfi_adjust_cfa_offset (-4);
|
||||||
cfi_restore (ebx)
|
cfi_restore (ebx)
|
||||||
ret
|
ret
|
||||||
END(wcschr)
|
END(__wcschr)
|
||||||
|
weak_alias (__wcschr, wcschr)
|
||||||
#endif
|
#endif
|
||||||
|
@ -19,7 +19,8 @@
|
|||||||
#include <wchar.h>
|
#include <wchar.h>
|
||||||
|
|
||||||
#ifndef WCSCHR
|
#ifndef WCSCHR
|
||||||
# define WCSCHR wcschr
|
# define WCSCHR __wcschr
|
||||||
|
# define DEFAULT_WCSCHR
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Find the first occurrence of WC in WCS. */
|
/* Find the first occurrence of WC in WCS. */
|
||||||
@ -86,4 +87,10 @@ WCSCHR (const wchar_t *wcs, const wchar_t wc)
|
|||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
#ifdef DEFAULT_WCSCHR
|
||||||
|
libc_hidden_def (__wcschr)
|
||||||
|
weak_alias (__wcschr, wcschr)
|
||||||
|
libc_hidden_weak (wcschr)
|
||||||
|
#else
|
||||||
libc_hidden_def (wcschr)
|
libc_hidden_def (wcschr)
|
||||||
|
#endif
|
||||||
|
@ -21,7 +21,9 @@
|
|||||||
# ifdef SHARED
|
# ifdef SHARED
|
||||||
# undef libc_hidden_def
|
# undef libc_hidden_def
|
||||||
# define libc_hidden_def(name) \
|
# define libc_hidden_def(name) \
|
||||||
__hidden_ver1 (__wcschr_ppc, __GI_wcschr, __wcschr_ppc);
|
__hidden_ver1 (__wcschr_ppc, __GI_wcschr, __wcschr_ppc); \
|
||||||
|
strong_alias (__wcschr_ppc, __wcschr_ppc_1); \
|
||||||
|
__hidden_ver1 (__wcschr_ppc_1, __GI___wcschr, __wcschr_ppc_1);
|
||||||
# endif
|
# endif
|
||||||
# define WCSCHR __wcschr_ppc
|
# define WCSCHR __wcschr_ppc
|
||||||
#endif
|
#endif
|
||||||
|
@ -17,22 +17,25 @@
|
|||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#if IS_IN (libc)
|
#if IS_IN (libc)
|
||||||
|
# define wcschr __redirect_wcschr
|
||||||
# include <wchar.h>
|
# include <wchar.h>
|
||||||
# include <shlib-compat.h>
|
# include <shlib-compat.h>
|
||||||
# include "init-arch.h"
|
# include "init-arch.h"
|
||||||
|
|
||||||
extern __typeof (wcschr) __wcschr_ppc attribute_hidden;
|
extern __typeof (__redirect_wcschr) __wcschr_ppc attribute_hidden;
|
||||||
extern __typeof (wcschr) __wcschr_power6 attribute_hidden;
|
extern __typeof (__redirect_wcschr) __wcschr_power6 attribute_hidden;
|
||||||
extern __typeof (wcschr) __wcschr_power7 attribute_hidden;
|
extern __typeof (__redirect_wcschr) __wcschr_power7 attribute_hidden;
|
||||||
|
|
||||||
libc_ifunc (wcschr,
|
extern __typeof (__redirect_wcschr) __libc_wcschr;
|
||||||
|
|
||||||
|
libc_ifunc (__libc_wcschr,
|
||||||
(hwcap & PPC_FEATURE_HAS_VSX)
|
(hwcap & PPC_FEATURE_HAS_VSX)
|
||||||
? __wcschr_power7 :
|
? __wcschr_power7 :
|
||||||
(hwcap & PPC_FEATURE_ARCH_2_05)
|
(hwcap & PPC_FEATURE_ARCH_2_05)
|
||||||
? __wcschr_power6
|
? __wcschr_power6
|
||||||
: __wcschr_ppc);
|
: __wcschr_ppc);
|
||||||
|
#undef wcschr
|
||||||
|
weak_alias (__libc_wcschr, wcschr)
|
||||||
#else
|
#else
|
||||||
#undef libc_hidden_def
|
|
||||||
#define libc_hidden_def(a)
|
|
||||||
#include <wcsmbs/wcschr.c>
|
#include <wcsmbs/wcschr.c>
|
||||||
#endif
|
#endif
|
||||||
|
@ -25,12 +25,14 @@ extern __typeof (wcschr) __wcschr_ppc attribute_hidden;
|
|||||||
extern __typeof (wcschr) __wcschr_power6 attribute_hidden;
|
extern __typeof (wcschr) __wcschr_power6 attribute_hidden;
|
||||||
extern __typeof (wcschr) __wcschr_power7 attribute_hidden;
|
extern __typeof (wcschr) __wcschr_power7 attribute_hidden;
|
||||||
|
|
||||||
libc_ifunc (wcschr,
|
libc_ifunc (__wcschr,
|
||||||
(hwcap & PPC_FEATURE_HAS_VSX)
|
(hwcap & PPC_FEATURE_HAS_VSX)
|
||||||
? __wcschr_power7 :
|
? __wcschr_power7 :
|
||||||
(hwcap & PPC_FEATURE_ARCH_2_05)
|
(hwcap & PPC_FEATURE_ARCH_2_05)
|
||||||
? __wcschr_power6
|
? __wcschr_power6
|
||||||
: __wcschr_ppc);
|
: __wcschr_ppc);
|
||||||
|
weak_alias (__wcschr, wcschr)
|
||||||
|
libc_hidden_builtin_def (wcschr)
|
||||||
#else
|
#else
|
||||||
#undef libc_hidden_def
|
#undef libc_hidden_def
|
||||||
#define libc_hidden_def(a)
|
#define libc_hidden_def(a)
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
ENTRY (wcschr)
|
ENTRY (__wcschr)
|
||||||
|
|
||||||
movd %rsi, %xmm1
|
movd %rsi, %xmm1
|
||||||
pxor %xmm2, %xmm2
|
pxor %xmm2, %xmm2
|
||||||
@ -149,6 +149,8 @@ L(return_null):
|
|||||||
xor %rax, %rax
|
xor %rax, %rax
|
||||||
ret
|
ret
|
||||||
|
|
||||||
END (wcschr)
|
END (__wcschr)
|
||||||
|
|
||||||
libc_hidden_def(wcschr)
|
libc_hidden_def(__wcschr)
|
||||||
|
weak_alias (__wcschr, wcschr)
|
||||||
|
libc_hidden_weak (wcschr)
|
||||||
|
@ -132,7 +132,7 @@ _nl_get_walt_digit (unsigned int number, struct __locale_data *current)
|
|||||||
data->walt_digits[cnt] = ptr;
|
data->walt_digits[cnt] = ptr;
|
||||||
|
|
||||||
/* Skip digit format. */
|
/* Skip digit format. */
|
||||||
ptr = wcschr (ptr, L'\0') + 1;
|
ptr = __wcschr (ptr, L'\0') + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -122,11 +122,11 @@ _nl_init_era_entries (struct __locale_data *current)
|
|||||||
|
|
||||||
/* Set and skip wide era name. */
|
/* Set and skip wide era name. */
|
||||||
new_eras[cnt].era_wname = (wchar_t *) ptr;
|
new_eras[cnt].era_wname = (wchar_t *) ptr;
|
||||||
ptr = (char *) (wcschr ((wchar_t *) ptr, L'\0') + 1);
|
ptr = (char *) (__wcschr ((wchar_t *) ptr, L'\0') + 1);
|
||||||
|
|
||||||
/* Set and skip wide era format. */
|
/* Set and skip wide era format. */
|
||||||
new_eras[cnt].era_wformat = (wchar_t *) ptr;
|
new_eras[cnt].era_wformat = (wchar_t *) ptr;
|
||||||
ptr = (char *) (wcschr ((wchar_t *) ptr, L'\0') + 1);
|
ptr = (char *) (__wcschr ((wchar_t *) ptr, L'\0') + 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@
|
|||||||
/* Find the first occurrence of WC in WCS. */
|
/* Find the first occurrence of WC in WCS. */
|
||||||
#ifdef WCSCHR
|
#ifdef WCSCHR
|
||||||
# define wcschr WCSCHR
|
# define wcschr WCSCHR
|
||||||
|
#else
|
||||||
|
# define wcschr __wcschr
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
wchar_t *
|
wchar_t *
|
||||||
@ -35,3 +37,8 @@ wcschr (wcs, wc)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
libc_hidden_def (wcschr)
|
libc_hidden_def (wcschr)
|
||||||
|
#ifndef WCSCHR
|
||||||
|
# undef wcschr
|
||||||
|
weak_alias (__wcschr, wcschr)
|
||||||
|
libc_hidden_weak (wcschr)
|
||||||
|
#endif
|
||||||
|
Loading…
Reference in New Issue
Block a user