Accepting request 670586 from Base:System

- Update to glibc 2.29
  * The getcpu wrapper function has been added, which returns the currently
    used CPU and NUMA node
  * Optimized generic exp, exp2, log, log2, pow, sinf, cosf, sincosf and tanf
  * The reallocarray function is now declared under _DEFAULT_SOURCE, not just
    for _GNU_SOURCE, to match BSD environments
  * For powercp64le ABI, Transactional Lock Elision is now enabled iff kernel
    indicates that it will abort the transaction prior to entering the kernel
    (PPC_FEATURE2_HTM_NOSC on hwcap2)
  * The functions posix_spawn_file_actions_addchdir_np and
    posix_spawn_file_actions_addfchdir_np have been added, enabling
    posix_spawn and posix_spawnp to run the new process in a different
    directory
  * The popen and system do not run atfork handlers anymore (BZ#17490)
  * strftime's default formatting of a locale's alternative year (%Ey)
    has been changed to zero-pad the year to a minimum of two digits,
    like "%y"
  * As a GNU extension, the '_' and '-' flags can now be applied to
    "%EY" to control how the year number is formatted
  * The glibc.tune tunable namespace has been renamed to glibc.cpu and the
    tunable glibc.tune.cpu has been renamed to glibc.cpu.name
  * The type of the pr_uid and pr_gid members of struct elf_prpsinfo, defined
    in <sys/procfs.h>, has been corrected to match the type actually used by
    the Linux kernel
  * An archaic GNU extension to scanf, under which '%as', '%aS', and '%a[...]'
    meant to scan a string and allocate space for it with malloc, is now
    restricted to programs compiled in C89 or C++98 mode with _GNU_SOURCE
    defined
- unwind-ctor.patch, old-getdents64.patch, nss-files-leak.patch,
  riscv-feholdexcept-setround.patch, (forwarded request 670585 from Andreas_Schwab)

OBS-URL: https://build.opensuse.org/request/show/670586
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/glibc?expand=0&rev=225
This commit is contained in:
Stephan Kulow 2019-02-08 11:03:36 +00:00 committed by Git OBS Bridge
commit f4f4f8e2df
33 changed files with 429 additions and 2207 deletions

View File

@ -1,30 +0,0 @@
2018-02-10 Dmitry V. Levin <ldv@altlinux.org>
[BZ #22433]
* sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h (__ptrace_request):
Remove arm-specific PTRACE_GET_THREAD_AREA, PTRACE_GETHBPREGS,
and PTRACE_SETHBPREGS.
Index: glibc-2.27/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
===================================================================
--- glibc-2.27.orig/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
+++ glibc-2.27/sysdeps/unix/sysv/linux/aarch64/sys/ptrace.h
@@ -78,18 +78,10 @@ enum __ptrace_request
PTRACE_DETACH = 17,
#define PT_DETACH PTRACE_DETACH
- PTRACE_GET_THREAD_AREA = 22,
-
/* Continue and stop at the next entry to or return from syscall. */
PTRACE_SYSCALL = 24,
#define PT_SYSCALL PTRACE_SYSCALL
- /* Get all hardware breakpoint registers. */
- PTRACE_GETHBPREGS = 29,
-
- /* Set all hardware breakpoint registers. */
- PTRACE_SETHBPREGS = 30,
-
/* Set ptrace filter options. */
PTRACE_SETOPTIONS = 0x4200,
#define PT_SETOPTIONS PTRACE_SETOPTIONS

View File

@ -8,10 +8,11 @@ glibc
prereq -glibc-x86 prereq -glibc-x86
+/usr/lib/getconf/[^g] +/usr/lib/getconf/[^g]
+/usr/sbin/iconvconfig -> /usr/sbin/iconvconfig-<extension> +/usr/sbin/iconvconfig -> /usr/sbin/iconvconfig-<extension>
glibc-locale glibc-locale-base
arch i586 block! arch i586 block!
+/usr/lib(64)?/gconv/gconv-modules +/usr/lib(64)?/gconv/gconv-modules
targettype x86 -/usr/lib(64)?/gconv/gconv-modules targettype x86 -/usr/lib(64)?/gconv/gconv-modules
obsoletes "glibc-locale-<targettype>"
glibc-devel glibc-devel
requires "glibc-<targettype> = %version" requires "glibc-<targettype> = %version"
arch i586 block! arch i586 block!

View File

@ -1,9 +0,0 @@
--- x86.S
+++ x86.S
@@ -199,5 +199,5 @@
#endif
#if defined(__ELF__) && defined(__linux__)
-.section .note.GNU-stack,"",@progbits
+.section .note.GNU-stack,"",%progbits
#endif

View File

@ -1,174 +0,0 @@
From 1c581a8364ab18a6938f3153d7bea793d06a4652 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Thu, 25 Aug 2011 14:00:38 +0200
Subject: [PATCH crypt_blowfish] support for sha256 and sha512
---
crypt.3 | 14 +++++++++++++
crypt_gensalt.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
wrapper.c | 23 +++++++++++++++++++++
3 files changed, 95 insertions(+), 0 deletions(-)
Index: crypt_blowfish-1.3/crypt.3
===================================================================
--- crypt_blowfish-1.3.orig/crypt.3
+++ crypt_blowfish-1.3/crypt.3
@@ -399,6 +399,20 @@ too low for the currently available hard
.hash "$1$" "\e$1\e$[^$]{1,8}\e$[./0-9A-Za-z]{22}" unlimited 8 "" 128 "6 to 48" 1000
.PP
.ti -2
+.B SHA256 based
+.br
+This is Ulrich Drepper's SHA256-based password hashing method originally
+developed for Linux.
+.hash "$5$" "\e$5\e$(rounds=[0-9]{1,9}\e$)?([./0-9A-Za-z]{1,16})?\e$[./0-9A-Za-z]{43}" unlimited 8 "" 256 "0 to 96" "1000 to 999999999 (default 5000)"
+.PP
+.ti -2
+.B SHA512 based
+.br
+This is Ulrich Drepper's SHA512-based password hashing method originally
+developed for Linux.
+.hash "$6$" "\e$6\e$(rounds=[0-9]{1,9}\e$)?([./0-9A-Za-z]{1,16})?\e$[./0-9A-Za-z]{86}" unlimited 8 "" 512 "0 to 96" "1000 to 999999999 (default 5000)"
+.PP
+.ti -2
.BR "OpenBSD-style Blowfish-based" " (" bcrypt )
.br
.B bcrypt
Index: crypt_blowfish-1.3/crypt_gensalt.c
===================================================================
--- crypt_blowfish-1.3.orig/crypt_gensalt.c
+++ crypt_blowfish-1.3/crypt_gensalt.c
@@ -19,6 +19,7 @@
*/
#include <string.h>
+#include <stdio.h>
#include <errno.h>
#ifndef __set_errno
@@ -122,3 +123,60 @@ char *_crypt_gensalt_md5_rn(const char *
return output;
}
+
+#define SHA2_SALT_LEN_MAX 16
+#define SHA2_ROUNDS_MIN 1000
+#define SHA2_ROUNDS_MAX 999999999
+char *_crypt_gensalt_sha2_rn (const char *prefix, unsigned long count,
+ const char *input, int size, char *output, int output_size)
+
+{
+ char *o = output;
+ const char *i = input;
+ unsigned needed = 3 + MIN(size/3*4, SHA2_SALT_LEN_MAX) + 1;
+
+ if (size < 3 || output_size < needed)
+ goto error;
+
+ size = MIN(size, SHA2_SALT_LEN_MAX/4*3);
+
+ o[0] = prefix[0];
+ o[1] = prefix[1];
+ o[2] = prefix[2];
+ o += 3;
+
+ if (count) {
+ count = MAX(SHA2_ROUNDS_MIN, MIN(count, SHA2_ROUNDS_MAX));
+ int n = snprintf (o, output_size-3, "rounds=%ld$", count);
+ if (n < 0 || n >= output_size-3)
+ goto error;
+ needed += n;
+ o += n;
+ }
+
+ if (output_size < needed)
+ goto error;
+
+ while (size >= 3) {
+ unsigned long value =
+ (unsigned long)(unsigned char)i[0] |
+ ((unsigned long)(unsigned char)i[1] << 8) |
+ ((unsigned long)(unsigned char)i[2] << 16);
+ o[0] = _crypt_itoa64[value & 0x3f];
+ o[1] = _crypt_itoa64[(value >> 6) & 0x3f];
+ o[2] = _crypt_itoa64[(value >> 12) & 0x3f];
+ o[3] = _crypt_itoa64[(value >> 18) & 0x3f];
+ size -= 3;
+ i += 3;
+ o += 3;
+ }
+ o[0] = '\0';
+
+ return output;
+
+error:
+ if (output_size > 0)
+ output[0] = '\0';
+ errno = ENOMEM;
+ return NULL;
+}
Index: crypt_blowfish-1.3/crypt_gensalt.h
===================================================================
--- crypt_blowfish-1.3.orig/crypt_gensalt.h
+++ crypt_blowfish-1.3/crypt_gensalt.h
@@ -26,5 +26,7 @@ extern char *_crypt_gensalt_extended_rn(
const char *input, int size, char *output, int output_size);
extern char *_crypt_gensalt_md5_rn(const char *prefix, unsigned long count,
const char *input, int size, char *output, int output_size);
+extern char *_crypt_gensalt_sha2_rn(const char *prefix, unsigned long count,
+ const char *input, int size, char *output, int output_size);
#endif
Index: crypt_blowfish-1.3/wrapper.c
===================================================================
--- crypt_blowfish-1.3.orig/wrapper.c
+++ crypt_blowfish-1.3/wrapper.c
@@ -50,6 +50,10 @@
#include "crypt.h"
extern char *__md5_crypt_r(const char *key, const char *salt,
char *buffer, int buflen);
+extern char *__sha256_crypt_r (const char *key, const char *salt,
+ char *buffer, int buflen);
+extern char *__sha512_crypt_r (const char *key, const char *salt,
+ char *buffer, int buflen);
/* crypt-entry.c needs to be patched to define __des_crypt_r rather than
* __crypt_r, and not define crypt_r and crypt at all */
extern char *__des_crypt_r(const char *key, const char *salt,
@@ -112,6 +116,10 @@ static char *_crypt_retval_magic(char *r
char *__crypt_rn(__const char *key, __const char *setting,
void *data, int size)
{
+ if (setting[0] == '$' && setting[1] == '6')
+ return __sha512_crypt_r(key, setting, (char *)data, size);
+ if (setting[0] == '$' && setting[1] == '5')
+ return __sha256_crypt_r(key, setting, (char *)data, size);
if (setting[0] == '$' && setting[1] == '2')
return _crypt_blowfish_rn(key, setting, (char *)data, size);
if (setting[0] == '$' && setting[1] == '1')
@@ -129,6 +137,16 @@ char *__crypt_rn(__const char *key, __co
char *__crypt_ra(__const char *key, __const char *setting,
void **data, int *size)
{
+ if (setting[0] == '$' && setting[1] == '6') {
+ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
+ return NULL;
+ return __sha512_crypt_r(key, setting, (char *)*data, *size);
+ }
+ if (setting[0] == '$' && setting[1] == '5') {
+ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
+ return NULL;
+ return __sha256_crypt_r(key, setting, (char *)*data, *size);
+ }
if (setting[0] == '$' && setting[1] == '2') {
if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
return NULL;
@@ -210,6 +228,9 @@ char *__crypt_gensalt_rn(const char *pre
return NULL;
}
+ if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3))
+ use = _crypt_gensalt_sha2_rn;
+ else
if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) ||
!strncmp(prefix, "$2y$", 4))
use = _crypt_gensalt_blowfish_rn;

View File

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

View File

@ -1,46 +0,0 @@
Index: crypt_blowfish-1.2/crypt_blowfish.c
===================================================================
--- crypt_blowfish-1.2.orig/crypt_blowfish.c
+++ crypt_blowfish-1.2/crypt_blowfish.c
@@ -81,7 +81,7 @@ typedef struct {
* Magic IV for 64 Blowfish encryptions that we do at the end.
* The string is "OrpheanBeholderScryDoubt" on big-endian.
*/
-static BF_word BF_magic_w[6] = {
+static const BF_word BF_magic_w[6] = {
0x4F727068, 0x65616E42, 0x65686F6C,
0x64657253, 0x63727944, 0x6F756274
};
@@ -89,7 +89,7 @@ static BF_word BF_magic_w[6] = {
/*
* P-box and S-box tables initialized with digits of Pi.
*/
-static BF_ctx BF_init_state = {
+static const BF_ctx BF_init_state = {
{
{
0xd1310ba6, 0x98dfb5ac, 0x2ffd72db, 0xd01adfb7,
@@ -361,10 +361,10 @@ static BF_ctx BF_init_state = {
}
};
-static unsigned char BF_itoa64[64 + 1] =
+static const unsigned char BF_itoa64[64 + 1] =
"./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
-static unsigned char BF_atoi64[0x60] = {
+static const unsigned char BF_atoi64[0x60] = {
64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 64, 0, 1,
54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 64, 64, 64, 64, 64,
64, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16,
@@ -440,8 +440,8 @@ static void BF_encode(char *dst, const B
static void BF_swap(BF_word *x, int count)
{
- static int endianness_check = 1;
- char *is_little_endian = (char *)&endianness_check;
+ static const int endianness_check = 1;
+ const char *is_little_endian = (const char *)&endianness_check;
BF_word tmp;
if (*is_little_endian)

View File

@ -1,373 +0,0 @@
Index: crypt_blowfish-1.3/crypt_blowfish.c
===================================================================
--- crypt_blowfish-1.3.orig/crypt_blowfish.c
+++ crypt_blowfish-1.3/crypt_blowfish.c
@@ -877,31 +877,3 @@ char *_crypt_blowfish_rn(const char *key
__set_errno(EINVAL); /* pretend we don't support this hash type */
return NULL;
}
-
-char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count,
- const char *input, int size, char *output, int output_size)
-{
- if (size < 16 || output_size < 7 + 22 + 1 ||
- (count && (count < 4 || count > 31)) ||
- prefix[0] != '$' || prefix[1] != '2' ||
- (prefix[2] != 'a' && prefix[2] != 'b' && prefix[2] != 'y')) {
- if (output_size > 0) output[0] = '\0';
- __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL);
- return NULL;
- }
-
- if (!count) count = 5;
-
- output[0] = '$';
- output[1] = '2';
- output[2] = prefix[2];
- output[3] = '$';
- output[4] = '0' + count / 10;
- output[5] = '0' + count % 10;
- output[6] = '$';
-
- BF_encode(&output[7], (const BF_word *)input, 16);
- output[7 + 22] = '\0';
-
- return output;
-}
Index: crypt_blowfish-1.3/crypt_blowfish.h
===================================================================
--- crypt_blowfish-1.3.orig/crypt_blowfish.h
+++ crypt_blowfish-1.3/crypt_blowfish.h
@@ -20,8 +20,5 @@
extern int _crypt_output_magic(const char *setting, char *output, int size);
extern char *_crypt_blowfish_rn(const char *key, const char *setting,
char *output, int size);
-extern char *_crypt_gensalt_blowfish_rn(const char *prefix,
- unsigned long count,
- const char *input, int size, char *output, int output_size);
#endif
Index: crypt_blowfish-1.3/crypt_gensalt.c
===================================================================
--- crypt_blowfish-1.3.orig/crypt_gensalt.c
+++ crypt_blowfish-1.3/crypt_gensalt.c
@@ -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;
}
+
+
+typedef unsigned int BF_word;
+
+static const unsigned char BF_itoa64[64 + 1] =
+ "./ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+static void BF_encode(char *dst, const BF_word *src, int size)
+{
+ const unsigned char *sptr = (const unsigned char *)src;
+ const unsigned char *end = sptr + size;
+ unsigned char *dptr = (unsigned char *)dst;
+ unsigned int c1, c2;
+
+ do {
+ c1 = *sptr++;
+ *dptr++ = BF_itoa64[c1 >> 2];
+ c1 = (c1 & 0x03) << 4;
+ if (sptr >= end) {
+ *dptr++ = BF_itoa64[c1];
+ break;
+ }
+
+ c2 = *sptr++;
+ c1 |= c2 >> 4;
+ *dptr++ = BF_itoa64[c1];
+ c1 = (c2 & 0x0f) << 2;
+ if (sptr >= end) {
+ *dptr++ = BF_itoa64[c1];
+ break;
+ }
+
+ c2 = *sptr++;
+ c1 |= c2 >> 6;
+ *dptr++ = BF_itoa64[c1];
+ *dptr++ = BF_itoa64[c2 & 0x3f];
+ } while (sptr < end);
+}
+
+char *_crypt_gensalt_blowfish_rn(const char *prefix, unsigned long count,
+ const char *input, int size, char *output, int output_size)
+{
+ if (size < 16 || output_size < 7 + 22 + 1 ||
+ (count && (count < 4 || count > 31)) ||
+ prefix[0] != '$' || prefix[1] != '2' ||
+ (prefix[2] != 'a' && prefix[2] != 'b' && prefix[2] != 'y')) {
+ if (output_size > 0) output[0] = '\0';
+ __set_errno((output_size < 7 + 22 + 1) ? ERANGE : EINVAL);
+ return NULL;
+ }
+
+ if (!count) count = 5;
+
+ output[0] = '$';
+ output[1] = '2';
+ output[2] = prefix[2];
+ output[3] = '$';
+ output[4] = '0' + count / 10;
+ output[5] = '0' + count % 10;
+ output[6] = '$';
+
+ BF_encode(&output[7], (const BF_word *)input, 16);
+ output[7 + 22] = '\0';
+
+ return output;
+}
Index: crypt_blowfish-1.3/crypt_gensalt.h
===================================================================
--- crypt_blowfish-1.3.orig/crypt_gensalt.h
+++ crypt_blowfish-1.3/crypt_gensalt.h
@@ -28,5 +28,8 @@ extern char *_crypt_gensalt_md5_rn(const
const char *input, int size, char *output, int output_size);
extern char *_crypt_gensalt_sha2_rn(const char *prefix, unsigned long count,
const char *input, int size, char *output, int output_size);
+extern char *_crypt_gensalt_blowfish_rn(const char *prefix,
+ unsigned long count,
+ const char *input, int size, char *output, int output_size);
#endif
Index: crypt_blowfish-1.3/wrapper-gensalt.c
===================================================================
--- /dev/null
+++ crypt_blowfish-1.3/wrapper-gensalt.c
@@ -0,0 +1,114 @@
+/*
+ * Written by Solar Designer <solar at openwall.com> in 2000-2011.
+ * No copyright is claimed, and the software is hereby placed in the public
+ * domain. In case this attempt to disclaim copyright and place the software
+ * in the public domain is deemed null and void, then the software is
+ * Copyright (c) 2000-2011 Solar Designer and it is hereby released to the
+ * general public under the following terms:
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted.
+ *
+ * There's ABSOLUTELY NO WARRANTY, express or implied.
+ *
+ * See crypt_blowfish.c for more information.
+ */
+
+#include <stdlib.h>
+#include <string.h>
+
+#include <errno.h>
+#ifndef __set_errno
+#define __set_errno(val) errno = (val)
+#endif
+
+#define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1)
+
+#if defined(__GLIBC__) && defined(_LIBC)
+#define __SKIP_GNU
+#endif
+#include "ow-crypt.h"
+
+#include "crypt_gensalt.h"
+
+#if !(defined(__GLIBC__) && defined(_LIBC))
+#define __crypt_gensalt_rn crypt_gensalt_rn
+#define __crypt_gensalt_ra crypt_gensalt_ra
+#define __crypt_gensalt crypt_gensalt
+#endif
+
+char *__crypt_gensalt_rn(const char *prefix, unsigned long count,
+ const char *input, int size, char *output, int output_size)
+{
+ char *(*use)(const char *_prefix, unsigned long _count,
+ const char *_input, int _size,
+ char *_output, int _output_size);
+
+ /* This may be supported on some platforms in the future */
+ if (!input) {
+ __set_errno(EINVAL);
+ return NULL;
+ }
+
+ if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3))
+ use = _crypt_gensalt_sha2_rn;
+ else
+ if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) ||
+ !strncmp(prefix, "$2y$", 4))
+ use = _crypt_gensalt_blowfish_rn;
+ else
+ if (!strncmp(prefix, "$1$", 3))
+ use = _crypt_gensalt_md5_rn;
+ else
+ if (prefix[0] == '_')
+ use = _crypt_gensalt_extended_rn;
+ else
+ if (!prefix[0] ||
+ (prefix[0] && prefix[1] &&
+ memchr(_crypt_itoa64, prefix[0], 64) &&
+ memchr(_crypt_itoa64, prefix[1], 64)))
+ use = _crypt_gensalt_traditional_rn;
+ else {
+ __set_errno(EINVAL);
+ return NULL;
+ }
+
+ return use(prefix, count, input, size, output, output_size);
+}
+
+char *__crypt_gensalt_ra(const char *prefix, unsigned long count,
+ const char *input, int size)
+{
+ char output[CRYPT_GENSALT_OUTPUT_SIZE];
+ char *retval;
+
+ retval = __crypt_gensalt_rn(prefix, count,
+ input, size, output, sizeof(output));
+
+ if (retval) {
+ retval = strdup(retval);
+#ifndef __GLIBC__
+ /* strdup(3) on glibc sets errno, so we don't need to bother */
+ if (!retval)
+ __set_errno(ENOMEM);
+#endif
+ }
+
+ return retval;
+}
+
+char *__crypt_gensalt(const char *prefix, unsigned long count,
+ const char *input, int size)
+{
+ static char output[CRYPT_GENSALT_OUTPUT_SIZE];
+
+ return __crypt_gensalt_rn(prefix, count,
+ input, size, output, sizeof(output));
+}
+
+#if defined(__GLIBC__) && defined(_LIBC)
+weak_alias(__crypt_gensalt_rn, crypt_gensalt_rn)
+weak_alias(__crypt_gensalt_ra, crypt_gensalt_ra)
+weak_alias(__crypt_gensalt, crypt_gensalt)
+#endif
+
Index: crypt_blowfish-1.3/wrapper.c
===================================================================
--- crypt_blowfish-1.3.orig/wrapper.c
+++ crypt_blowfish-1.3/wrapper.c
@@ -35,7 +35,6 @@
#endif
#define CRYPT_OUTPUT_SIZE (7 + 22 + 31 + 1)
-#define CRYPT_GENSALT_OUTPUT_SIZE (7 + 22 + 1)
#if defined(__GLIBC__) && defined(_LIBC)
#define __SKIP_GNU
@@ -43,7 +42,6 @@
#include "ow-crypt.h"
#include "crypt_blowfish.h"
-#include "crypt_gensalt.h"
#if defined(__GLIBC__) && defined(_LIBC)
/* crypt.h from glibc-crypt-2.1 will define struct crypt_data for us */
@@ -209,89 +207,11 @@ char *crypt(const char *key, const char
crypt_rn(key, setting, output, sizeof(output)),
setting, output, sizeof(output));
}
-
-#define __crypt_gensalt_rn crypt_gensalt_rn
-#define __crypt_gensalt_ra crypt_gensalt_ra
-#define __crypt_gensalt crypt_gensalt
-#endif
-
-char *__crypt_gensalt_rn(const char *prefix, unsigned long count,
- const char *input, int size, char *output, int output_size)
-{
- char *(*use)(const char *_prefix, unsigned long _count,
- const char *_input, int _size,
- char *_output, int _output_size);
-
- /* This may be supported on some platforms in the future */
- if (!input) {
- __set_errno(EINVAL);
- return NULL;
- }
-
- if (!strncmp(prefix, "$5$", 3) || !strncmp(prefix, "$6$", 3))
- use = _crypt_gensalt_sha2_rn;
- else
- if (!strncmp(prefix, "$2a$", 4) || !strncmp(prefix, "$2b$", 4) ||
- !strncmp(prefix, "$2y$", 4))
- use = _crypt_gensalt_blowfish_rn;
- else
- if (!strncmp(prefix, "$1$", 3))
- use = _crypt_gensalt_md5_rn;
- else
- if (prefix[0] == '_')
- use = _crypt_gensalt_extended_rn;
- else
- if (!prefix[0] ||
- (prefix[0] && prefix[1] &&
- memchr(_crypt_itoa64, prefix[0], 64) &&
- memchr(_crypt_itoa64, prefix[1], 64)))
- use = _crypt_gensalt_traditional_rn;
- else {
- __set_errno(EINVAL);
- return NULL;
- }
-
- return use(prefix, count, input, size, output, output_size);
-}
-
-char *__crypt_gensalt_ra(const char *prefix, unsigned long count,
- const char *input, int size)
-{
- char output[CRYPT_GENSALT_OUTPUT_SIZE];
- char *retval;
-
- retval = __crypt_gensalt_rn(prefix, count,
- input, size, output, sizeof(output));
-
- if (retval) {
- retval = strdup(retval);
-#ifndef __GLIBC__
- /* strdup(3) on glibc sets errno, so we don't need to bother */
- if (!retval)
- __set_errno(ENOMEM);
#endif
- }
-
- return retval;
-}
-
-char *__crypt_gensalt(const char *prefix, unsigned long count,
- const char *input, int size)
-{
- static char output[CRYPT_GENSALT_OUTPUT_SIZE];
-
- return __crypt_gensalt_rn(prefix, count,
- input, size, output, sizeof(output));
-}
#if defined(__GLIBC__) && defined(_LIBC)
-weak_alias(__crypt_rn, crypt_rn)
-weak_alias(__crypt_ra, crypt_ra)
weak_alias(__crypt_r, crypt_r)
weak_alias(__crypt, crypt)
-weak_alias(__crypt_gensalt_rn, crypt_gensalt_rn)
-weak_alias(__crypt_gensalt_ra, crypt_gensalt_ra)
-weak_alias(__crypt_gensalt, crypt_gensalt)
weak_alias(crypt, fcrypt)
#endif

View File

@ -3,7 +3,7 @@ Always do locking when accessing streams (bug 15142)
During exit, skip files that are currently locked to avoid deadlock. During exit, skip files that are currently locked to avoid deadlock.
[BZ #15142] [BZ #15142]
* include/bits/libio.h (_IO_ftrylockfile) [_IO_MTSAVE_IO]: Define. * libio/libio.h (_IO_ftrylockfile) [_IO_MTSAVE_IO]: Define.
* libio/genops.c (_IO_flush_all_lockp): Make static. Rename * libio/genops.c (_IO_flush_all_lockp): Make static. Rename
argument to skip_locked, callers changed. Skip files that are argument to skip_locked, callers changed. Skip files that are
locked if skip_locked. locked if skip_locked.
@ -11,10 +11,10 @@ During exit, skip files that are currently locked to avoid deadlock.
files. files.
* libio/libioP.h (_IO_flush_all_lockp): Don't declare. * libio/libioP.h (_IO_flush_all_lockp): Don't declare.
Index: glibc-2.27/include/bits/libio.h Index: glibc-2.27/libio/libio.h
=================================================================== ===================================================================
--- glibc-2.27.orig/include/bits/libio.h --- glibc-2.27.orig/libio/libio.h
+++ glibc-2.27/include/bits/libio.h +++ glibc-2.27/libio/libio.h
@@ -33,11 +33,15 @@ libc_hidden_proto (_IO_vfscanf) @@ -33,11 +33,15 @@ libc_hidden_proto (_IO_vfscanf)
if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_lock (*(_fp)->_lock) if (((_fp)->_flags & _IO_USER_LOCK) == 0) _IO_lock_lock (*(_fp)->_lock)
# define _IO_funlockfile(_fp) \ # define _IO_funlockfile(_fp) \
@ -35,9 +35,9 @@ Index: glibc-2.27/libio/genops.c
=================================================================== ===================================================================
--- glibc-2.27.orig/libio/genops.c --- glibc-2.27.orig/libio/genops.c
+++ glibc-2.27/libio/genops.c +++ glibc-2.27/libio/genops.c
@@ -744,8 +744,8 @@ _IO_get_column (_IO_FILE *fp) @@ -744,8 +744,8 @@ _IO_adjust_column (unsigned start, const
#endif }
libc_hidden_def (_IO_adjust_column)
-int -int
-_IO_flush_all_lockp (int do_lock) -_IO_flush_all_lockp (int do_lock)
@ -45,9 +45,9 @@ Index: glibc-2.27/libio/genops.c
+_IO_flush_all_lockp (bool skip_locked) +_IO_flush_all_lockp (bool skip_locked)
{ {
int result = 0; int result = 0;
struct _IO_FILE *fp; FILE *fp;
@@ -758,7 +758,16 @@ _IO_flush_all_lockp (int do_lock) @@ -758,7 +758,16 @@ _IO_flush_all_lockp (int do_lock)
for (fp = (_IO_FILE *) _IO_list_all; fp != NULL; fp = fp->_chain) for (fp = (FILE *) _IO_list_all; fp != NULL; fp = fp->_chain)
{ {
run_fp = fp; run_fp = fp;
- if (do_lock) - if (do_lock)
@ -85,7 +85,7 @@ Index: glibc-2.27/libio/genops.c
@@ -852,22 +860,18 @@ _IO_unbuffer_all (void) @@ -852,22 +860,18 @@ _IO_unbuffer_all (void)
for (fp = (_IO_FILE *) _IO_list_all; fp; fp = fp->_chain) for (fp = (FILE *) _IO_list_all; fp; fp = fp->_chain)
{ {
+ run_fp = fp; + run_fp = fp;
+ /* Skip files that are currently locked. */ + /* Skip files that are currently locked. */
@ -151,9 +151,9 @@ Index: glibc-2.27/libio/libioP.h
=================================================================== ===================================================================
--- glibc-2.27.orig/libio/libioP.h --- glibc-2.27.orig/libio/libioP.h
+++ glibc-2.27/libio/libioP.h +++ glibc-2.27/libio/libioP.h
@@ -486,7 +486,6 @@ extern int _IO_new_do_write (_IO_FILE *, @@ -486,7 +486,6 @@ extern int _IO_new_do_write (FILE *, con
extern int _IO_old_do_write (_IO_FILE *, const char *, _IO_size_t); extern int _IO_old_do_write (FILE *, const char *, size_t);
extern int _IO_wdo_write (_IO_FILE *, const wchar_t *, _IO_size_t); extern int _IO_wdo_write (FILE *, const wchar_t *, size_t);
libc_hidden_proto (_IO_wdo_write) libc_hidden_proto (_IO_wdo_write)
-extern int _IO_flush_all_lockp (int); -extern int _IO_flush_all_lockp (int);
extern int _IO_flush_all (void); extern int _IO_flush_all (void);

View File

@ -1,4 +1,8 @@
Fix fnmatch handling of collating elements (BZ #17396, BZ #16976) Fix handling of collating elements in fnmatch (bug 17396, bug 16976)
This fixes the same bug in fnmatch that was fixed by commit 7e2f0d2d77 for
regexp matching. As a side effect it also removes the use of an unbound
VLA.
[BZ #16976] [BZ #16976]
[BZ #17396] [BZ #17396]
@ -6,14 +10,34 @@ Fix fnmatch handling of collating elements (BZ #17396, BZ #16976)
looking up collating elements match against (wide) character looking up collating elements match against (wide) character
sequence instead of name. Correct alignment adjustment. sequence instead of name. Correct alignment adjustment.
* posix/fnmatch.c: Don't include "../locale/elem-hash.h". * posix/fnmatch.c: Don't include "../locale/elem-hash.h".
(WMEMCMP) [HANDLE_MULTIBYTE]: Define.
* posix/Makefile (tests): Add tst-fnmatch4 and tst-fnmatch5. * posix/Makefile (tests): Add tst-fnmatch4 and tst-fnmatch5.
(LOCALES): Add cs_CZ.ISO-8859-2.
* posix/tst-fnmatch4.c: New file. * posix/tst-fnmatch4.c: New file.
* posix/tst-fnmatch5.c: New file. * posix/tst-fnmatch5.c: New file.
* include/wchar.h (__wmemcmp): Declare.
* wcsmbs/wmemcmp.c: Define __wmemcmp and add wmemcmp as weak alias.
* sysdeps/i386/i686/multiarch/wmemcmp.c: Likewise.
* sysdeps/x86_64/multiarch/wmemcmp.c: Likewise.
* sysdeps/s390/wmemcmp.c: Likewise.
Index: glibc-2.27/posix/Makefile Index: glibc-2.28/include/wchar.h
=================================================================== ===================================================================
--- glibc-2.27.orig/posix/Makefile --- glibc-2.28.orig/include/wchar.h
+++ glibc-2.27/posix/Makefile +++ glibc-2.28/include/wchar.h
@@ -143,6 +143,8 @@ libc_hidden_proto (wmemchr)
libc_hidden_proto (__wmemchr)
libc_hidden_proto (wmemset)
libc_hidden_proto (__wmemset)
+extern int __wmemcmp (const wchar_t *__s1, const wchar_t *__s2, size_t __n)
+ __THROW __attribute_pure__;
/* Now define the internal interfaces. */
extern int __wcscasecmp (const wchar_t *__s1, const wchar_t *__s2)
Index: glibc-2.28/posix/Makefile
===================================================================
--- glibc-2.28.orig/posix/Makefile
+++ glibc-2.28/posix/Makefile
@@ -92,6 +92,7 @@ tests := test-errno tstgetopt testfnm r @@ -92,6 +92,7 @@ tests := test-errno tstgetopt testfnm r
bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \ bug-getopt5 tst-getopt_long1 bug-regex34 bug-regex35 \
tst-pathconf tst-rxspencer-no-utf8 \ tst-pathconf tst-rxspencer-no-utf8 \
@ -22,10 +46,20 @@ Index: glibc-2.27/posix/Makefile
tst-posix_spawn-fd tst-posix_spawn-setsid \ tst-posix_spawn-fd tst-posix_spawn-setsid \
tst-posix_fadvise tst-posix_fadvise64 \ tst-posix_fadvise tst-posix_fadvise64 \
tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \ tst-sysconf-empty-chroot tst-glob_symlinks tst-fexecve \
Index: glibc-2.27/posix/fnmatch.c @@ -166,7 +167,8 @@ $(objpfx)wordexp-tst.out: wordexp-tst.sh
endif
LOCALES := cs_CZ.UTF-8 da_DK.ISO-8859-1 de_DE.ISO-8859-1 de_DE.UTF-8 \
- en_US.UTF-8 es_US.ISO-8859-1 es_US.UTF-8 ja_JP.EUC-JP tr_TR.UTF-8
+ en_US.UTF-8 es_US.ISO-8859-1 es_US.UTF-8 ja_JP.EUC-JP tr_TR.UTF-8 \
+ cs_CZ.ISO-8859-2
include ../gen-locales.mk
$(objpfx)bug-regex1.out: $(gen-locales)
Index: glibc-2.28/posix/fnmatch.c
=================================================================== ===================================================================
--- glibc-2.27.orig/posix/fnmatch.c --- glibc-2.28.orig/posix/fnmatch.c
+++ glibc-2.27/posix/fnmatch.c +++ glibc-2.28/posix/fnmatch.c
@@ -53,7 +53,6 @@ @@ -53,7 +53,6 @@
we support a correct implementation only in glibc. */ we support a correct implementation only in glibc. */
#ifdef _LIBC #ifdef _LIBC
@ -34,10 +68,22 @@ Index: glibc-2.27/posix/fnmatch.c
# include "../locale/coll-lookup.h" # include "../locale/coll-lookup.h"
# include <shlib-compat.h> # include <shlib-compat.h>
Index: glibc-2.27/posix/fnmatch_loop.c @@ -237,6 +236,11 @@ __wcschrnul (const wchar_t *s, wint_t c)
# define MEMPCPY(D, S, N) __wmempcpy (D, S, N)
# define MEMCHR(S, C, N) __wmemchr (S, C, N)
# define STRCOLL(S1, S2) wcscoll (S1, S2)
+# ifdef _LIBC
+# define WMEMCMP(S1, S2, N) __wmemcmp (S1, S2, N)
+# else
+# define WMEMCMP(S1, S2, N) wmemcmp (S1, S2, N)
+# endif
# define WIDE_CHAR_VERSION 1
/* Change the name the header defines so it doesn't conflict with
the <locale/weight.h> version included above. */
Index: glibc-2.28/posix/fnmatch_loop.c
=================================================================== ===================================================================
--- glibc-2.27.orig/posix/fnmatch_loop.c --- glibc-2.28.orig/posix/fnmatch_loop.c
+++ glibc-2.27/posix/fnmatch_loop.c +++ glibc-2.28/posix/fnmatch_loop.c
@@ -494,26 +494,12 @@ FCT (const CHAR *pattern, const CHAR *st @@ -494,26 +494,12 @@ FCT (const CHAR *pattern, const CHAR *st
{ {
int32_t table_size; int32_t table_size;
@ -62,12 +108,12 @@ Index: glibc-2.27/posix/fnmatch_loop.c
- for (strcnt = 0; strcnt < c1; ++strcnt) - for (strcnt = 0; strcnt < c1; ++strcnt)
- str[strcnt] = startp[1 + strcnt]; - str[strcnt] = startp[1 + strcnt];
-#endif -#endif
+ int32_t *wextra; + CHAR *wextra;
+# endif +# endif
table_size = table_size =
_NL_CURRENT_WORD (LC_COLLATE, _NL_CURRENT_WORD (LC_COLLATE,
@@ -525,71 +511,55 @@ FCT (const CHAR *pattern, const CHAR *st @@ -525,71 +511,54 @@ FCT (const CHAR *pattern, const CHAR *st
_NL_CURRENT (LC_COLLATE, _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_SYMB_EXTRAMB); _NL_COLLATE_SYMB_EXTRAMB);
@ -115,13 +161,13 @@ Index: glibc-2.27/posix/fnmatch_loop.c
+ /* Adjust for the alignment. */ + /* Adjust for the alignment. */
+ idx = (idx + 3) & ~3; + idx = (idx + 3) & ~3;
+ +
+ wextra = (int32_t *) &extra[idx + 4]; + wextra = (CHAR *) &extra[idx + 4];
+ +
+ if (/* Compare the length of the sequence. */ + if (/* Compare the length of the sequence. */
+ c1 == wextra[0] + c1 == wextra[0]
+ /* Compare the wide char sequence. */ + /* Compare the wide char sequence. */
+ && memcmp (startp + 1, &wextra[1], + && WMEMCMP (startp + 1, &wextra[1],
+ c1 * sizeof (UCHAR)) == 0) + c1) == 0)
+ /* Yep, this is the entry. */ + /* Yep, this is the entry. */
+ break; + break;
+# else +# else
@ -142,12 +188,12 @@ Index: glibc-2.27/posix/fnmatch_loop.c
this is not part of a range. */ this is not part of a range. */
-# if WIDE_CHAR_VERSION -# if WIDE_CHAR_VERSION
- int32_t *wextra; - int32_t *wextra;
+ if (! is_range -
- idx += 1 + extra[idx]; - idx += 1 + extra[idx];
- /* Adjust for the alignment. */ - /* Adjust for the alignment. */
- idx = (idx + 3) & ~3; - idx = (idx + 3) & ~3;
- + if (! is_range
- wextra = (int32_t *) &extra[idx + 4]; - wextra = (int32_t *) &extra[idx + 4];
-# endif -# endif
- -
@ -162,8 +208,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c
- -
- if ((int32_t) c1 == wextra[idx]) - if ((int32_t) c1 == wextra[idx])
- goto matched; - goto matched;
+ && memcmp (n, &wextra[1], + && WMEMCMP (n, &wextra[1], c1) == 0
+ c1 * sizeof (UCHAR)) == 0
# else # else
- for (c1 = 0; c1 < extra[idx]; ++c1) - for (c1 = 0; c1 < extra[idx]; ++c1)
- if (n[c1] != extra[1 + c1]) - if (n[c1] != extra[1 + c1])
@ -180,7 +225,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c
} }
/* Get the collation sequence value. */ /* Get the collation sequence value. */
@@ -597,9 +567,9 @@ FCT (const CHAR *pattern, const CHAR *st @@ -597,9 +566,9 @@ FCT (const CHAR *pattern, const CHAR *st
# if WIDE_CHAR_VERSION # if WIDE_CHAR_VERSION
cold = wextra[1 + wextra[idx]]; cold = wextra[1 + wextra[idx]];
# else # else
@ -192,7 +237,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c
cold = *((int32_t *) &extra[idx]); cold = *((int32_t *) &extra[idx]);
# endif # endif
@@ -609,10 +579,10 @@ FCT (const CHAR *pattern, const CHAR *st @@ -609,10 +578,10 @@ FCT (const CHAR *pattern, const CHAR *st
{ {
/* No valid character. Match it as a /* No valid character. Match it as a
single byte. */ single byte. */
@ -205,7 +250,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c
c = *p++; c = *p++;
} }
else else
@@ -620,7 +590,6 @@ FCT (const CHAR *pattern, const CHAR *st @@ -620,7 +589,6 @@ FCT (const CHAR *pattern, const CHAR *st
} }
} }
else else
@ -213,7 +258,7 @@ Index: glibc-2.27/posix/fnmatch_loop.c
#endif #endif
{ {
c = FOLD (c); c = FOLD (c);
@@ -712,25 +681,11 @@ FCT (const CHAR *pattern, const CHAR *st @@ -712,25 +680,11 @@ FCT (const CHAR *pattern, const CHAR *st
{ {
int32_t table_size; int32_t table_size;
const int32_t *symb_table; const int32_t *symb_table;
@ -236,11 +281,11 @@ Index: glibc-2.27/posix/fnmatch_loop.c
- representation is UCS4. */ - representation is UCS4. */
- for (strcnt = 0; strcnt < c1; ++strcnt) - for (strcnt = 0; strcnt < c1; ++strcnt)
- str[strcnt] = startp[1 + strcnt]; - str[strcnt] = startp[1 + strcnt];
+ int32_t *wextra; + CHAR *wextra;
# endif # endif
table_size = table_size =
@@ -743,51 +698,44 @@ FCT (const CHAR *pattern, const CHAR *st @@ -743,71 +697,63 @@ FCT (const CHAR *pattern, const CHAR *st
_NL_CURRENT (LC_COLLATE, _NL_CURRENT (LC_COLLATE,
_NL_COLLATE_SYMB_EXTRAMB); _NL_COLLATE_SYMB_EXTRAMB);
@ -301,14 +346,14 @@ Index: glibc-2.27/posix/fnmatch_loop.c
+ /* Adjust for the alignment. */ + /* Adjust for the alignment. */
+ idx = (idx + 3) & ~3; + idx = (idx + 3) & ~3;
+ +
+ wextra = (int32_t *) &extra[idx + 4]; + wextra = (CHAR *) &extra[idx + 4];
+ +
+ if (/* Compare the length of the + if (/* Compare the length of the
+ sequence. */ + sequence. */
+ c1 == wextra[0] + c1 == wextra[0]
+ /* Compare the wide char sequence. */ + /* Compare the wide char sequence. */
+ && memcmp (startp + 1, &wextra[1], + && WMEMCMP (startp + 1, &wextra[1],
+ c1 * sizeof (int32_t)) == 0) + c1) == 0)
+ /* Yep, this is the entry. */ + /* Yep, this is the entry. */
+ break; + break;
+# else +# else
@ -328,11 +373,12 @@ Index: glibc-2.27/posix/fnmatch_loop.c
/* Get the collation sequence value. */ /* Get the collation sequence value. */
is_seqval = 1; is_seqval = 1;
# if WIDE_CHAR_VERSION # if WIDE_CHAR_VERSION
@@ -795,19 +743,18 @@ FCT (const CHAR *pattern, const CHAR *st cend = wextra[1 + wextra[idx]];
# else # else
/* Adjust for the alignment. */ - /* Adjust for the alignment. */
idx += 1 + extra[idx]; idx += 1 + extra[idx];
- idx = (idx + 3) & ~4; - idx = (idx + 3) & ~4;
+ /* Adjust for the alignment. */
+ idx = (idx + 3) & ~3; + idx = (idx + 3) & ~3;
cend = *((int32_t *) &extra[idx]); cend = *((int32_t *) &extra[idx]);
# endif # endif
@ -351,13 +397,13 @@ Index: glibc-2.27/posix/fnmatch_loop.c
} }
else else
{ {
Index: glibc-2.27/posix/tst-fnmatch4.c Index: glibc-2.28/posix/tst-fnmatch4.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ glibc-2.27/posix/tst-fnmatch4.c +++ glibc-2.28/posix/tst-fnmatch4.c
@@ -0,0 +1,51 @@ @@ -0,0 +1,41 @@
+/* Test for fnmatch handling of collating elements +/* Test for fnmatch handling of collating elements
+ Copyright (C) 2015 Free Software Foundation, Inc. + Copyright (C) 2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library. + This file is part of the GNU C Library.
+ +
+ The GNU C Library is free software; you can redistribute it and/or + The GNU C Library is free software; you can redistribute it and/or
@ -377,43 +423,33 @@ Index: glibc-2.27/posix/tst-fnmatch4.c
+#include <stdio.h> +#include <stdio.h>
+#include <locale.h> +#include <locale.h>
+#include <fnmatch.h> +#include <fnmatch.h>
+#include <support/check.h>
+ +
+static int +static void
+do_test_locale (const char *locale) +do_test_locale (const char *locale)
+{ +{
+ const char *pattern = "[[.ll.]]"; + TEST_VERIFY_EXIT (setlocale (LC_ALL, locale) != NULL);
+ +
+ if (setlocale (LC_ALL, locale) == NULL) + TEST_VERIFY (fnmatch ("[[.ch.]]", "ch", 0) == 0);
+ {
+ printf ("could not set locale %s\n", locale);
+ return 1;
+ }
+
+ if (fnmatch (pattern, "ll", 0) != 0)
+ {
+ printf ("%s didn't match in locale %s\n", pattern, locale);
+ return 1;
+ }
+
+ return 0;
+} +}
+ +
+static int +static int
+do_test (void) +do_test (void)
+{ +{
+ return (do_test_locale ("es_US.ISO-8859-1") + do_test_locale ("cs_CZ.ISO-8859-2");
+ || do_test_locale ("es_US.UTF-8")); + do_test_locale ("cs_CZ.UTF-8");
+
+ return 0;
+} +}
+ +
+#define TEST_FUNCTION do_test () +#include <support/test-driver.c>
+#include "../test-skeleton.c" Index: glibc-2.28/posix/tst-fnmatch5.c
Index: glibc-2.27/posix/tst-fnmatch5.c
=================================================================== ===================================================================
--- /dev/null --- /dev/null
+++ glibc-2.27/posix/tst-fnmatch5.c +++ glibc-2.28/posix/tst-fnmatch5.c
@@ -0,0 +1,53 @@ @@ -0,0 +1,46 @@
+/* Test for fnmatch handling of collating elements +/* Test for fnmatch handling of collating elements
+ Copyright (C) 2015 Free Software Foundation, Inc. + Copyright (C) 2019 Free Software Foundation, Inc.
+ This file is part of the GNU C Library. + This file is part of the GNU C Library.
+ +
+ The GNU C Library is free software; you can redistribute it and/or + The GNU C Library is free software; you can redistribute it and/or
@ -434,19 +470,17 @@ Index: glibc-2.27/posix/tst-fnmatch5.c
+#include <locale.h> +#include <locale.h>
+#include <stdio.h> +#include <stdio.h>
+#include <string.h> +#include <string.h>
+#include <support/check.h>
+ +
+#define LENGTH 20000000 +#define LENGTH 20000000
+ +
+char pattern[LENGTH + 7]; +static char pattern[LENGTH + 7];
+ +
+static int +static int
+do_test (void) +do_test (void)
+{ +{
+ if (setlocale (LC_ALL, "en_US.UTF-8") == NULL) + TEST_VERIFY_EXIT (setlocale (LC_ALL, "en_US.UTF-8") != NULL);
+ { +
+ puts ("could not set locale");
+ return 1;
+ }
+ pattern[0] = '['; + pattern[0] = '[';
+ pattern[1] = '['; + pattern[1] = '[';
+ pattern[2] = '.'; + pattern[2] = '.';
@ -454,14 +488,85 @@ Index: glibc-2.27/posix/tst-fnmatch5.c
+ pattern[LENGTH + 3] = '.'; + pattern[LENGTH + 3] = '.';
+ pattern[LENGTH + 4] = ']'; + pattern[LENGTH + 4] = ']';
+ pattern[LENGTH + 5] = ']'; + pattern[LENGTH + 5] = ']';
+ int ret = fnmatch (pattern, "a", 0); + TEST_VERIFY (fnmatch (pattern, "a", 0) != 0);
+ if (ret == 0) +
+ {
+ puts ("fnmatch returned 0 for invalid pattern");
+ return 1;
+ }
+ return 0; + return 0;
+} +}
+ +
+#define TEST_FUNCTION do_test () +#include <support/test-driver.c>
+#include "../test-skeleton.c" Index: glibc-2.28/sysdeps/i386/i686/multiarch/wmemcmp.c
===================================================================
--- glibc-2.28.orig/sysdeps/i386/i686/multiarch/wmemcmp.c
+++ glibc-2.28/sysdeps/i386/i686/multiarch/wmemcmp.c
@@ -26,5 +26,6 @@
# define SYMBOL_NAME wmemcmp
# include "ifunc-ssse3-sse4_2.h"
-libc_ifunc_redirected (__redirect_wmemcmp, wmemcmp, IFUNC_SELECTOR ());
+libc_ifunc_redirected (__redirect_wmemcmp, __wmemcmp, IFUNC_SELECTOR ());
+weak_alias (__wmemcmp, wmemcmp)
#endif
Index: glibc-2.28/sysdeps/s390/wmemcmp.c
===================================================================
--- glibc-2.28.orig/sysdeps/s390/wmemcmp.c
+++ glibc-2.28/sysdeps/s390/wmemcmp.c
@@ -23,16 +23,17 @@
# include <ifunc-resolve.h>
# if HAVE_WMEMCMP_C
-extern __typeof (wmemcmp) WMEMCMP_C attribute_hidden;
+extern __typeof (__wmemcmp) WMEMCMP_C attribute_hidden;
# endif
# if HAVE_WMEMCMP_Z13
-extern __typeof (wmemcmp) WMEMCMP_Z13 attribute_hidden;
+extern __typeof (__wmemcmp) WMEMCMP_Z13 attribute_hidden;
# endif
-s390_libc_ifunc_expr (wmemcmp, wmemcmp,
+s390_libc_ifunc_expr (__wmemcmp, __wmemcmp,
(HAVE_WMEMCMP_Z13 && (hwcap & HWCAP_S390_VX))
? WMEMCMP_Z13
: WMEMCMP_DEFAULT
)
+weak_alias (__wmemcmp, wmemcmp)
#endif
Index: glibc-2.28/sysdeps/x86_64/multiarch/wmemcmp.c
===================================================================
--- glibc-2.28.orig/sysdeps/x86_64/multiarch/wmemcmp.c
+++ glibc-2.28/sysdeps/x86_64/multiarch/wmemcmp.c
@@ -26,5 +26,6 @@
# define SYMBOL_NAME wmemcmp
# include "ifunc-memcmp.h"
-libc_ifunc_redirected (__redirect_wmemcmp, wmemcmp, IFUNC_SELECTOR ());
+libc_ifunc_redirected (__redirect_wmemcmp, __wmemcmp, IFUNC_SELECTOR ());
+weak_alias (__wmemcmp, wmemcmp)
#endif
Index: glibc-2.28/wcsmbs/wmemcmp.c
===================================================================
--- glibc-2.28.orig/wcsmbs/wmemcmp.c
+++ glibc-2.28/wcsmbs/wmemcmp.c
@@ -18,12 +18,12 @@
#include <wchar.h>
-#ifndef WMEMCMP
-# define WMEMCMP wmemcmp
+#ifdef WMEMCMP
+# define __wmemcmp WMEMCMP
#endif
int
-WMEMCMP (const wchar_t *s1, const wchar_t *s2, size_t n)
+__wmemcmp (const wchar_t *s1, const wchar_t *s2, size_t n)
{
wchar_t c1;
wchar_t c2;
@@ -81,3 +81,6 @@ WMEMCMP (const wchar_t *s1, const wchar_
return 0;
}
+#ifndef WMEMCMP
+weak_alias (__wmemcmp, wmemcmp)
+#endif

View File

@ -1,98 +0,0 @@
Index: glibc-2.27/crypt/Makefile
===================================================================
--- glibc-2.27.orig/crypt/Makefile
+++ glibc-2.27/crypt/Makefile
@@ -23,14 +23,18 @@ subdir := crypt
include ../Makeconfig
headers := crypt.h
+headers += gnu-crypt.h ow-crypt.h
-extra-libs := libcrypt
+extra-libs := libcrypt libowcrypt
extra-libs-others := $(extra-libs)
libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
crypt_util
-tests := cert md5c-test sha256c-test sha512c-test badsalttest
+libcrypt-routines += crypt_blowfish x86 wrapper
+libowcrypt-routines := crypt_gensalt wrapper-gensalt
+
+tests := cert md5c-test sha256c-test sha512c-test
ifeq ($(crypt-in-libc),yes)
routines += $(libcrypt-routines)
Index: glibc-2.27/crypt/Versions
===================================================================
--- glibc-2.27.orig/crypt/Versions
+++ glibc-2.27/crypt/Versions
@@ -3,3 +3,8 @@ libcrypt {
crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
}
}
+libowcrypt {
+ OW_CRYPT_1.0 {
+ crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra;
+ }
+}
Index: glibc-2.27/crypt/crypt-entry.c
===================================================================
--- glibc-2.27.orig/crypt/crypt-entry.c
+++ glibc-2.27/crypt/crypt-entry.c
@@ -71,7 +71,7 @@ extern struct crypt_data _ufc_foobar;
*/
char *
-__crypt_r (const char *key, const char *salt,
+__des_crypt_r (const char *key, const char *salt,
struct crypt_data * __restrict data)
{
ufc_long res[4];
@@ -152,6 +152,7 @@ __crypt_r (const char *key, const char *
return data->crypt_3_buf;
}
+#if 0
weak_alias (__crypt_r, crypt_r)
char *
@@ -190,3 +191,4 @@ __fcrypt (const char *key, const char *s
return crypt (key, salt);
}
#endif
+#endif
Index: glibc-2.27/crypt/crypt-private.h
===================================================================
--- glibc-2.27.orig/crypt/crypt-private.h
+++ glibc-2.27/crypt/crypt-private.h
@@ -65,7 +65,7 @@ extern void __encrypt_r (char * __restri
struct crypt_data * __restrict __data);
/* crypt-entry.c */
-extern char *__crypt_r (const char *__key, const char *__salt,
+extern char *__des_crypt_r (const char *__key, const char *__salt,
struct crypt_data * __restrict __data);
extern char *fcrypt (const char *key, const char *salt);
Index: glibc-2.27/shlib-versions
===================================================================
--- glibc-2.27.orig/shlib-versions
+++ glibc-2.27/shlib-versions
@@ -59,6 +59,7 @@ libnsl=1
# This defines the shared library version numbers we will install.
libcrypt=1
+libowcrypt=1
# The gross patch for programs assuming broken locale implementations.
libBrokenLocale=1
Index: glibc-2.27/sysdeps/unix/sysv/linux/libowcrypt.abilist
===================================================================
--- /dev/null
+++ glibc-2.27/sysdeps/unix/sysv/linux/libowcrypt.abilist
@@ -0,0 +1,4 @@
+OW_CRYPT_1.0 OW_CRYPT_1.0 A
+OW_CRYPT_1.0 crypt_gensalt F
+OW_CRYPT_1.0 crypt_gensalt_ra F
+OW_CRYPT_1.0 crypt_gensalt_rn F

View File

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

View File

@ -1,16 +0,0 @@
-----BEGIN PGP SIGNATURE-----
iQIcBAABAgAGBQJac3pRAAoJEBZ5K06iU0D42ScP/1a2BmqiRw3vt2vtjRpZAeE+
UcJ44FFbgRfybe2e0hSI9/Yl3aMRp3ntdUyrZrUKdDiiaBvWt6Ye7UWDHe0iraxM
1PvQsVu1HmfXGgsAyMlk9XtfqvDqBXcFWE99HbTbuybT+W+JXP+751ioN73MTgp5
ZECrYy3o5FUPHHb2MBA1zqY4sryWR+27vY+CP2BMSvLNIUpYKVe2xOMvayi2Asxr
rTB6dlpcxwZaoErkqeOl4vgNO744WFMRj0RaMVN6/HkGfvuf1gzqcLjlsJ5AFpA/
GliE9rJn7ogpV0cXgagcjt/+CuL/htvFOw9qTzkDrT41t0n3DBQ0HXwh60oCTN8I
3gbuudLN51+cDWk17TcNh6PDyuYFEiZbIAmU2aRha+lsGGnQaoI8fS/thHfzzGBd
P5jSvpHPfL3lp8PBwjgiuXElEi/hJlGYfjDfJZ5ta4p08362LcfHe1xNCSP49x5a
V/ZV+Ggpsf6MiRmwQBNykA55s3akYgIOtBwDs0polookDcKJ/BzczNnWYNqX0Szv
k4pvIEWsMLMsX9j3qnKbmmtlrcFTIwaQzQ75e3D1OFL3JCup7byoDf1icfRKWr8D
3Y0FWExqQ3NYpR7F7hPsbU55DGqpMlLnVMTZ0wlEn9s1TyO1vWiba1BuVMtCICDJ
fyTjM1MZXfBiFDcP1D4P
=SzqE
-----END PGP SIGNATURE-----

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

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

11
glibc-2.29.tar.xz.sig Normal file
View File

@ -0,0 +1,11 @@
-----BEGIN PGP SIGNATURE-----
iQEzBAABCAAdFiEEvHxzcmN+wQxX16plecQ9+/HPIYcFAlxTOTQACgkQecQ9+/HP
IYcW+Qf9EeusdF3KQfwpErbtSgoLwthbLWv93f9+r/XIa0oWvAeaU7DHeZf85px2
OLA0mG+p0D8JIBMXPX1oQUKLA+0mN7jdX9K29q2ibMYMDbHfTTfFhMdP3JDaixvx
XSAHOjvmLPteb1yix5hH0l7GhyWhV4n9GAMUdpOJ8Gbsof78i4eNdlLReQYqH/R7
frsmuFomNrpy+CMNGxEHpcTrUqkL7x78d/msgaQjDQi1eoqpTWmgzgCjvxv5HMPN
JKMwYTsgLk5cr51lHCDYbLE2ksn84yoMLJQz8dV7JH28EaBlgl1nss1aquX2zUGM
SDtYqhBBGB8d6ijv5x26NbyfFP6bvQ==
=Xdix
-----END PGP SIGNATURE-----

View File

@ -8,7 +8,7 @@ Index: glibc-2.27/csu/version.c
static const char banner[] = static const char banner[] =
-"GNU C Library "PKGVERSION RELEASE" release version "VERSION".\n\ -"GNU C Library "PKGVERSION RELEASE" release version "VERSION".\n\
+"GNU C Library "PKGVERSION RELEASE" release version "VERSION" (git "GITID").\n\ +"GNU C Library "PKGVERSION RELEASE" release version "VERSION" (git "GITID").\n\
Copyright (C) 2018 Free Software Foundation, Inc.\n\ Copyright (C) 2019 Free Software Foundation, Inc.\n\
This is free software; see the source for copying conditions.\n\ This is free software; see the source for copying conditions.\n\
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\ There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A\n\
PARTICULAR PURPOSE.\n\ PARTICULAR PURPOSE.\n\

View File

@ -1,3 +1,155 @@
-------------------------------------------------------------------
Fri Feb 1 10:34:39 UTC 2019 - schwab@suse.de
- Update to glibc 2.29
* The getcpu wrapper function has been added, which returns the currently
used CPU and NUMA node
* Optimized generic exp, exp2, log, log2, pow, sinf, cosf, sincosf and tanf
* The reallocarray function is now declared under _DEFAULT_SOURCE, not just
for _GNU_SOURCE, to match BSD environments
* For powercp64le ABI, Transactional Lock Elision is now enabled iff kernel
indicates that it will abort the transaction prior to entering the kernel
(PPC_FEATURE2_HTM_NOSC on hwcap2)
* The functions posix_spawn_file_actions_addchdir_np and
posix_spawn_file_actions_addfchdir_np have been added, enabling
posix_spawn and posix_spawnp to run the new process in a different
directory
* The popen and system do not run atfork handlers anymore (BZ#17490)
* strftime's default formatting of a locale's alternative year (%Ey)
has been changed to zero-pad the year to a minimum of two digits,
like "%y"
* As a GNU extension, the '_' and '-' flags can now be applied to
"%EY" to control how the year number is formatted
* The glibc.tune tunable namespace has been renamed to glibc.cpu and the
tunable glibc.tune.cpu has been renamed to glibc.cpu.name
* The type of the pr_uid and pr_gid members of struct elf_prpsinfo, defined
in <sys/procfs.h>, has been corrected to match the type actually used by
the Linux kernel
* An archaic GNU extension to scanf, under which '%as', '%aS', and '%a[...]'
meant to scan a string and allocate space for it with malloc, is now
restricted to programs compiled in C89 or C++98 mode with _GNU_SOURCE
defined
- unwind-ctor.patch, old-getdents64.patch, nss-files-leak.patch,
riscv-feholdexcept-setround.patch,
pthread-cond-broadcast-waiters-after-spinning.patch,
regex-uninit-memory-access.patch, spawni-maybe-script-execute.patch,
gethostid-gethostbyname-failure.patch, strstr-huge-needle.patch,
pthread-mutex-lock-elision-race.patch, x86-haswell-string-flags.patch,
if-nametoindex-descr-leak.patch, riscv-flush-icache.patch: Removed
-------------------------------------------------------------------
Wed Jan 9 14:21:04 UTC 2019 - schwab@suse.de
- fnmatch-collating-elements.patch: update
- riscv-flush-icache.patch: fix for compiling against 4.20 headers
-------------------------------------------------------------------
Wed Nov 28 09:52:49 UTC 2018 - schwab@suse.de
- if-nametoindex-descr-leak.patch: if_nametoindex: Fix descriptor leak for
overlong name (CVE-2018-19591, BZ #23927, bsc#1117603)
-------------------------------------------------------------------
Wed Nov 7 17:24:35 UTC 2018 - Jan Engelhardt <jengelh@inai.de>
- Fix typography for glibc-locale-base.
-------------------------------------------------------------------
Wed Nov 7 11:09:05 UTC 2018 - schwab@suse.de
- pthread-mutex-lock-elision-race.patch: Fix race in pthread_mutex_lock
while promoting to PTHREAD_MUTEX_ELISION_NP (BZ #23275)
- x86-haswell-string-flags.patch: x86: Fix Haswell CPU string flags (BZ
#23709)
-------------------------------------------------------------------
Wed Sep 26 09:41:59 UTC 2018 - schwab@suse.de
- unwind-ctor.patch: Add missing unwind information to ld.so on powerpc32
(BZ #23707)
- old-getdents64.patch: Rewrite __old_getdents64 (BZ #23497)
- nss-files-leak.patch: Fix file stream leak in aliases lookup (BZ #23521)
- riscv-feholdexcept-setround.patch: Fix rounding save/restore bug
- pthread-cond-broadcast-waiters-after-spinning.patch: Fix
waiters-after-spinning case (BZ #23538)
- regex-uninit-memory-access.patch: fix uninitialized memory access (BZ
#23578)
- spawni-maybe-script-execute.patch: Fix segfault in maybe_script_execute
- gethostid-gethostbyname-failure.patch: Check for NULL value from
gethostbyname_r (BZ #23679)
- strstr-huge-needle.patch: Fix strstr bug with huge needles (BZ #23637)
-------------------------------------------------------------------
Wed Sep 12 06:47:33 UTC 2018 - schwab@suse.de
- Add libpng-devel and zlib-devel for utils build
-------------------------------------------------------------------
Wed Aug 15 13:53:41 UTC 2018 - schwab@suse.de
- Add glibc-locale-base subpackage containing only C, C.UTF-8 and
en_US.UTF-8 locales (fate#326551)
-------------------------------------------------------------------
Thu Aug 2 07:48:07 UTC 2018 - schwab@suse.de
- Update to glibc 2.28
* The localization data for ISO 14651 is updated to match the 2016
Edition 4 release of the standard, this matches data provided by
Unicode 9.0.0
* Unicode 11.0.0 Support: Character encoding, character type info, and
transliteration tables are all updated to Unicode 11.0.0, using
generator scripts contributed by Mike FABIAN (Red Hat)
* <math.h> functions that round their results to a narrower type are added
from TS 18661-1:2014 and TS 18661-3:2015
* Two grammatical forms of month names are now supported
* The renameat2 function has been added, a variant of the renameat function
which has a flags argument
* The statx function has been added, a variant of the fstatat64
function with an additional flags argument
* IDN domain names in getaddrinfo and getnameinfo now use the system libidn2
library if installed
* Parsing of dynamic string tokens in DT_RPATH, DT_RUNPATH, DT_NEEDED,
DT_AUXILIARY, and DT_FILTER has been expanded to support the full
range of ELF gABI expressions including such constructs as
'$ORIGIN$ORIGIN' (if valid)
* Support for ISO C threads (ISO/IEC 9899:2011) has been added.
* The nonstandard header files <libio.h> and <_G_config.h> are no longer
installed
* The stdio functions 'getc' and 'putc' are no longer defined as macros
* All stdio functions now treat end-of-file as a sticky condition
* The macros 'major', 'minor', and 'makedev' are now only available from
the header <sys/sysmacros.h>
* The obsolete function ustat is no longer available to newly linked
binaries; the headers <ustat.h> and <sys/ustat.h> have been removed
* The obsolete function nfsservctl is no longer available to newly linked
binaries
* The obsolete function name llseek is no longer available to newly linked
binaries
* The AI_IDN_ALLOW_UNASSIGNED and NI_IDN_ALLOW_UNASSIGNED flags for the
getaddrinfo and getnameinfo functions have been deprecated
* The AI_IDN_USE_STD3_ASCII_RULES and NI_IDN_USE_STD3_ASCII_RULES flags for
the getaddrinfo and getnameinfo functions have been deprecated
* The fcntl function now have a Long File Support variant named fcntl64
* CVE-2016-6261, CVE-2016-6263, CVE-2017-14062: Various vulnerabilities have
been fixed by removing the glibc-internal IDNA implementation and using
the system-provided libidn2 library instead
- Split off all libcrypt related functions into package libxcrypt
- fix-locking-in-_IO_cleanup.patch, fnmatch-collating-elements.patch:
Rediff
- aarch64-sys-ptrace-update.patch,
crypt_blowfish-1.2-hack_around_arm.diff, crypt_blowfish-1.2-sha.diff,
crypt_blowfish-const.patch, crypt_blowfish-gensalt.patch,
glibc-2.14-crypt.diff, i386-memmove-sse2-unaligned.patch,
i386-sigaction-sa-restorer.patch, mempcpy-avx512.patch,
netgroup-cache-keys.patch, nss-database-multiple-dfn.patch,
pkey-get-reserved-name.patch, powerpc-sys-ptrace-undefine-macros.patch,
powerpc-sys-ptrace-update.patch, realpath-ssize-max-overflow.patch,
res-send-enomem.patch, riscv-fmax-fmin-nan.patch,
riscv-kernel-sigaction.patch, riscv-readelflib.patch,
riscv-tls-init.patch: Removed
- glibc_post_upgrade.c: Don't reload init (bsc#1103124)
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Jun 19 08:37:43 UTC 2018 - schwab@suse.de Tue Jun 19 08:37:43 UTC 2018 - schwab@suse.de

View File

@ -1,7 +1,7 @@
# #
# spec file for package glibc # spec file for package glibc
# #
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
# #
# All modifications and additions to the file contributed by third parties # All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed # remain the property of their copyright owners, unless otherwise agreed
@ -12,7 +12,7 @@
# license that conforms to the Open Source Definition (Version 1.9) # license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative. # published by the Open Source Initiative.
# Please submit bugfixes or comments via http://bugs.opensuse.org/ # Please submit bugfixes or comments via https://bugs.opensuse.org/
# #
@ -20,7 +20,6 @@
# It will avoid building some parts of glibc # It will avoid building some parts of glibc
%bcond_with fast_build %bcond_with fast_build
%define crypt_bf_version 1.3
%define build_snapshot 0 %define build_snapshot 0
%bcond_with ringdisabled %bcond_with ringdisabled
@ -64,6 +63,7 @@ BuildRequires: libcap-devel
BuildRequires: libselinux-devel BuildRequires: libselinux-devel
BuildRequires: makeinfo BuildRequires: makeinfo
BuildRequires: pwdutils BuildRequires: pwdutils
BuildRequires: python3-base
BuildRequires: systemd-rpm-macros BuildRequires: systemd-rpm-macros
BuildRequires: systemtap-headers BuildRequires: systemtap-headers
BuildRequires: xz BuildRequires: xz
@ -71,11 +71,15 @@ BuildRequires: xz
BuildRequires: gcc-c++ BuildRequires: gcc-c++
BuildRequires: gdb BuildRequires: gdb
BuildRequires: glibc-devel-static BuildRequires: glibc-devel-static
# BZ #24113
#BuildRequires: libidn2-0
BuildRequires: libstdc++-devel BuildRequires: libstdc++-devel
BuildRequires: python3-pexpect BuildRequires: python3-pexpect
%endif %endif
%if %{build_utils} %if %{build_utils}
BuildRequires: gd-devel BuildRequires: gd-devel
BuildRequires: libpng-devel
BuildRequires: zlib-devel
%endif %endif
%if "%flavor" == "i686" %if "%flavor" == "i686"
ExclusiveArch: i586 i686 ExclusiveArch: i586 i686
@ -146,10 +150,10 @@ BuildArch: i686
%define enablekernel 4.15 %define enablekernel 4.15
%endif %endif
Version: 2.27 Version: 2.29
Release: 0 Release: 0
%if !%{build_snapshot} %if !%{build_snapshot}
%define git_id 3260f6ce87b7 %define git_id 56c86f5dd516
%define libversion %version %define libversion %version
%else %else
%define git_id %(echo %version | sed 's/.*\.g//') %define git_id %(echo %version | sed 's/.*\.g//')
@ -173,10 +177,6 @@ Source10: baselibs.conf
# For systemd # For systemd
Source20: nscd.conf Source20: nscd.conf
Source21: nscd.service Source21: nscd.service
# crypt_blowfish
Source50: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz
# The sign key uses MD5 which is no longer accepted by gpg
#Source51: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_version}.tar.gz.sign
%if %{build_main} %if %{build_main}
# ngpt was used in 8.1 and SLES8 # ngpt was used in 8.1 and SLES8
@ -230,16 +230,6 @@ NoSource: 0
# openSUSE specific patches - won't go upstream # openSUSE specific patches - won't go upstream
### ###
### openSUSE extensions, configuration ### openSUSE extensions, configuration
# PATCH-FEATURE-OPENSUSE -- add crypt_blowfish support - bnc#700876
Patch1: glibc-2.14-crypt.diff
# PATCH-FEATURE-OPENSUSE constify crypt_blowfish
Patch2: crypt_blowfish-const.patch
# PATCH-FEATURE-OPENSUSE -- add sha support to crypt_blowfish lnussel@suse.de
Patch3: crypt_blowfish-1.2-sha.diff
# PATCH-FEATURE-OPENSUSE Move crypt_gensalt_rn to separate library
Patch4: crypt_blowfish-gensalt.patch
# PATCH-FEATURE-OPENSUSE Avoid build failure on noexecstack marker on ARM dmueller@suse.de
Patch5: crypt_blowfish-1.2-hack_around_arm.diff
# PATCH-FIX-OPENSUSE Fix path for nscd databases # PATCH-FIX-OPENSUSE Fix path for nscd databases
Patch6: glibc-2.3.3-nscd-db-path.diff Patch6: glibc-2.3.3-nscd-db-path.diff
# PATCH-FIX-OPENSUSE Fix path for nss_db (bnc#753657) - aj@suse.de # PATCH-FIX-OPENSUSE Fix path for nss_db (bnc#753657) - aj@suse.de
@ -280,36 +270,6 @@ Patch306: glibc-fix-double-loopback.diff
### ###
# Patches from upstream # Patches from upstream
### ###
# PATCH-FIX-UPSTREAM Fix parsing flags in ELF64 files (BZ #22827)
Patch1000: riscv-readelflib.patch
# PATCH-FIX-UPSTREAM Fix multiple definitions of __nss_*_database (BZ #22918)
Patch1001: nss-database-multiple-dfn.patch
# PATCH-FIX-UPSTREAM Linux: use reserved name __key in pkey_get (BZ #22797)
Patch1002: pkey-get-reserved-name.patch
# PATCH-FIX-UPSTREAM linux/aarch64: sync sys/ptrace.h with Linux 4.15 (BZ #22433)
Patch1003: aarch64-sys-ptrace-update.patch
# PATCH-FIX-UPSTREAM powerpc: Undefine Linux ptrace macros that conflict with __ptrace_request
Patch1004: powerpc-sys-ptrace-undefine-macros.patch
# PATCH-FIX-UPSTREAM linux/powerpc: sync sys/ptrace.h with Linux 4.15 (BZ #22433, BZ #22807)
Patch1005: powerpc-sys-ptrace-update.patch
# PATCH-FIX-UPSTREAM Fix netgroup cache keys (BZ #22342)
Patch1006: netgroup-cache-keys.patch
# PATCH-FIX-UPSTREAM i386: Fix i386 sigaction sa_restorer initialization (BZ #21269)
Patch1007: i386-sigaction-sa-restorer.patch
# PATCH-FIX-UPSTREAM RISC-V: Do not initialize $gp in TLS macros
Patch1008: riscv-tls-init.patch
# PATCH-FIX-UPSTREAM RISC-V: fmax/fmin: Handle signalling NaNs correctly (BZ #22884)
Patch1009: riscv-fmax-fmin-nan.patch
# PATCH-FIX-UPSTREAM Fix crash in resolver on memory allocation failure (BZ #23005)
Patch1010: res-send-enomem.patch
# PATCH-FIX-UPSTREAM memmove-sse2-unaligned on 32bit x86 produces garbage when crossing 2GB threshold (CVE-2017-18269, BZ #22644)
Patch1011: i386-memmove-sse2-unaligned.patch
# PATCH-FIX-UPSTREAM __mempcpy_avx512_no_vzeroupper mishandles large copies (CVE-2018-11237, BZ #23196)
Patch1012: mempcpy-avx512.patch
# PATCH-FIX-UPSTREAM realpath-ssize-max-overflow.patch: Fix overflow in path length computation (CVE-2018-11236, BZ #22786)
Patch1013: realpath-ssize-max-overflow.patch
# PATCH-FIX-UPSTREAM RISC-V: fix struct kernel_sigaction to match the kernel version (BZ #23069)
Patch1014: riscv-kernel-sigaction.patch
### ###
# Patches awaiting upstream approval # Patches awaiting upstream approval
@ -391,12 +351,22 @@ use the internationalization features of the GNU libc. It is normally
not necessary to install this packages, the data files are already not necessary to install this packages, the data files are already
created. created.
%package locale %package locale-base
Summary: Locale Data for Localized Programs Summary: en_US Locale Data for Localized Programs
License: GPL-2.0-or-later AND MIT AND LGPL-2.1-or-later License: GPL-2.0-or-later AND MIT AND LGPL-2.1-or-later
Group: System/Libraries Group: System/Libraries
Requires(post): /bin/cat Requires(post): /bin/cat
Requires: glibc = %{version} Requires: glibc = %{version}
%description locale-base
Locale data for the internationalisation features of the GNU C library.
This package contains only the U.S. English locale.
%package locale
Summary: Locale Data for Localized Programs
License: GPL-2.0-or-later AND MIT AND LGPL-2.1-or-later
Group: System/Libraries
Requires: glibc-locale-base = %{version}
# bug437293 # bug437293
%ifarch ppc64 %ifarch ppc64
Obsoletes: glibc-locale-64bit Obsoletes: glibc-locale-64bit
@ -453,6 +423,7 @@ Obsoletes: glibc-devel-64bit
Obsoletes: glibc-devel-32bit Obsoletes: glibc-devel-32bit
%endif %endif
Requires: glibc = %{version} Requires: glibc = %{version}
Requires: libxcrypt-devel
Requires: linux-kernel-headers Requires: linux-kernel-headers
%description devel %description devel
@ -464,6 +435,7 @@ Summary: C library static libraries for -static linking
License: BSD-3-Clause AND LGPL-2.1-or-later AND LGPL-2.1-or-later WITH GCC-exception-2.0 AND GPL-2.0-or-later License: BSD-3-Clause AND LGPL-2.1-or-later AND LGPL-2.1-or-later WITH GCC-exception-2.0 AND GPL-2.0-or-later
Group: Development/Libraries/C and C++ Group: Development/Libraries/C and C++
Requires: %{name}-devel = %{version} Requires: %{name}-devel = %{version}
Requires: libxcrypt-devel-static
# Provide Fedora name for package to make packaging easier # Provide Fedora name for package to make packaging easier
Provides: %{name}-static = %{version} Provides: %{name}-static = %{version}
@ -489,18 +461,6 @@ makedb: A program to create a database for nss
%prep %prep
%setup -n glibc-%{version} -q -a 4 %setup -n glibc-%{version} -q -a 4
# Owl crypt_blowfish
tar -xzf %SOURCE50
pushd crypt_blowfish-%{crypt_bf_version}
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5
popd
mv crypt/{crypt.h,gnu-crypt.h}
mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/
#
%patch1 -p1
%patch6 -p1 %patch6 -p1
%patch7 -p1 %patch7 -p1
%patch8 -p1 %patch8 -p1
@ -519,22 +479,6 @@ mv crypt_blowfish-%crypt_bf_version/*.[chS] crypt/
%patch304 -p1 %patch304 -p1
%patch306 -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
%patch2000 -p1 %patch2000 -p1
%patch2004 -p1 %patch2004 -p1
%patch2005 -p1 %patch2005 -p1
@ -601,7 +545,6 @@ done
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" BuildCC="%__cc"
BuildCCplus="%__cxx" BuildCCplus="%__cxx"
add_ons=libidn
# #
#now overwrite for some architectures #now overwrite for some architectures
# #
@ -670,7 +613,6 @@ configure_and_build_glibc() {
CC="$BuildCC" CXX="$BuildCCplus" \ CC="$BuildCC" CXX="$BuildCCplus" \
--prefix=%{_prefix} \ --prefix=%{_prefix} \
--libexecdir=%{_libexecdir} --infodir=%{_infodir} \ --libexecdir=%{_libexecdir} --infodir=%{_infodir} \
--enable-add-ons=$add_ons \
$profile \ $profile \
"$@" \ "$@" \
--build=%{target} --host=%{target} \ --build=%{target} --host=%{target} \
@ -692,8 +634,8 @@ configure_and_build_glibc() {
--with-bugurl=http://bugs.opensuse.org \ --with-bugurl=http://bugs.opensuse.org \
--enable-bind-now \ --enable-bind-now \
--enable-systemtap \ --enable-systemtap \
--disable-timezone-tools --disable-timezone-tools \
# Should we enable --enable-nss-crypt to build use freebl3 hash functions? --disable-crypt
# explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure) # explicitly set CFLAGS to use the full CFLAGS (not the reduced one for configure)
make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags" make %{?_smp_mflags} CFLAGS="$cflags" BUILD_CFLAGS="$cflags"
cd .. cd ..
@ -752,29 +694,35 @@ make -C cc-base html
# #
# Build glibc_post_upgrade binary # Build glibc_post_upgrade binary
# #
$BuildCC -static %{optflags} -Os $RPM_SOURCE_DIR/glibc_post_upgrade.c -o glibc_post_upgrade \ mkdir glibc-post-upgrade
-Lcc-base -Bcc-base/csu \ cat > glibc-post-upgrade/Makefile <<\EOF
'-DREMOVE_TLS_DIRS' '-DREMOVE_PPC_OPTIMIZE_POWER5' \ subdir := glibc-post-upgrade
include ../Makeconfig
vpath %.c $(dir %{SOURCE8})
others = glibc_post_upgrade
others-static = glibc_post_upgrade
libof-glibc_post_upgrade = glibc_post_upgrade
$(objpfx)glibc_post_upgrade: $(common-objpfx)elf/static-stubs.o
CFLAGS-glibc_post_upgrade.o = \
-Os -Wno-write-strings -DREMOVE_TLS_DIRS -DREMOVE_PPC_OPTIMIZE_POWER5 \
%ifarch ppc ppc64 %ifarch ppc ppc64
%if !%{powerpc_optimize_cpu_power4} %if !%{powerpc_optimize_cpu_power4}
'-DREMOVE_PPC_OPTIMIZE_POWER4' \ -DREMOVE_PPC_OPTIMIZE_POWER4 \
%endif %endif
%if !%{powerpc_optimize_cpu_power6} %if !%{powerpc_optimize_cpu_power6}
'-DREMOVE_PPC_OPTIMIZE_POWER6' \ -DREMOVE_PPC_OPTIMIZE_POWER6 \
%endif %endif
%if !%{powerpc_optimize_cpu_power7} %if !%{powerpc_optimize_cpu_power7}
'-DREMOVE_PPC_OPTIMIZE_POWER7' \ -DREMOVE_PPC_OPTIMIZE_POWER7 \
%endif %endif
%if !%{powerpc_optimize_cpu_cell} %if !%{powerpc_optimize_cpu_cell}
'-DREMOVE_PPC_OPTIMIZE_CELL' \ -DREMOVE_PPC_OPTIMIZE_CELL \
%endif %endif
%endif %endif
'-DLIBDIR="/%{_lib}"' '-DGCONV_MODULES_DIR="%{_libdir}/gconv"' -DLIBDIR='"/%{_lib}"' -DGCONV_MODULES_DIR='"%{_libdir}/gconv"'
include ../Rules
# crypt_blowfish man pages EOF
pushd crypt_blowfish-%{crypt_bf_version} make -C cc-base subdirs=glibc-post-upgrade glibc-post-upgrade/others
make man
popd
%check %check
%if %{build_testsuite} %if %{build_testsuite}
@ -902,10 +850,13 @@ cc-base/elf/ldconfig -vn $destdir
# this will not work if we generate them in parallel. # this will not work if we generate them in parallel.
# thus we need to run fdupes on /usr/lib/locale/ # thus we need to run fdupes on /usr/lib/locale/
# Still, on my system this is a speed advantage: # Still, on my system this is a speed advantage:
# non-parallel build for install-locales: 9:34mins # non-parallel build for install-locale-files: 9:34mins
# parallel build with fdupes: 7:08mins # parallel build with fdupes: 7:08mins
make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locales make %{?_smp_mflags} install_root=%{buildroot} localedata/install-locale-files
# Avoid hardlinks across subpackages
mv %{buildroot}/usr/lib/locale/{en_US,C}.utf8 .
%fdupes %{buildroot}/usr/lib/locale %fdupes %{buildroot}/usr/lib/locale
mv {en_US,C}.utf8 %{buildroot}/usr/lib/locale/
cd .. cd ..
%endif %endif
# Create file list for glibc-locale package # Create file list for glibc-locale package
@ -913,7 +864,7 @@ cc-base/elf/ldconfig -vn $destdir
# Miscelanna: # Miscelanna:
install -m 0700 glibc_post_upgrade %{buildroot}%{_sbindir} install -m 0700 cc-base/glibc-post-upgrade/glibc_post_upgrade %{buildroot}%{_sbindir}
install -m 644 %{SOURCE7} %{buildroot}/etc install -m 644 %{SOURCE7} %{buildroot}/etc
install -m 644 %{SOURCE5} %{buildroot}/etc install -m 644 %{SOURCE5} %{buildroot}/etc
@ -933,12 +884,6 @@ cp -p cc-base/manual/libc/*.html %{buildroot}%{_datadir}/doc/glibc
cd manpages; make install_root=%{buildroot} install; cd .. cd manpages; make install_root=%{buildroot} install; cd ..
# crypt_blowfish man pages
pushd crypt_blowfish-%{crypt_bf_version}
install -m755 -d %{buildroot}%{_mandir}/man3
install -m644 *.3 %{buildroot}%{_mandir}/man3
popd
# nscd tools: # nscd tools:
%ifnarch i686 %ifnarch i686
@ -1064,7 +1009,7 @@ rm %{buildroot}/%{_lib}/lp64d %{buildroot}%{_libdir}/lp64d
%post -p %{_sbindir}/glibc_post_upgrade %post -p %{_sbindir}/glibc_post_upgrade
%postun -p /sbin/ldconfig %postun -p /sbin/ldconfig
%post locale %post locale-base
for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do for l in /usr/share/locale/locale.alias %{_libdir}/gconv/gconv-modules; do
[ -d "$l.d" ] || continue [ -d "$l.d" ] || continue
echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l" echo "###X# The following is autogenerated from extra files in the .d directory:" >>"$l"
@ -1170,12 +1115,6 @@ exit 0
/%{_lib}/libanl.so.1 /%{_lib}/libanl.so.1
/%{_lib}/libc-%{libversion}.so /%{_lib}/libc-%{libversion}.so
/%{_lib}/libc.so.6* /%{_lib}/libc.so.6*
/%{_lib}/libcidn-%{libversion}.so
/%{_lib}/libcidn.so.1
/%{_lib}/libcrypt-%{libversion}.so
/%{_lib}/libcrypt.so.1
/%{_lib}/libowcrypt-%{libversion}.so
/%{_lib}/libowcrypt.so.1
/%{_lib}/libdl-%{libversion}.so /%{_lib}/libdl-%{libversion}.so
/%{_lib}/libdl.so.2* /%{_lib}/libdl.so.2*
/%{_lib}/libm-%{libversion}.so /%{_lib}/libm-%{libversion}.so
@ -1251,14 +1190,24 @@ exit 0
%{_sbindir}/glibc_post_upgrade %{_sbindir}/glibc_post_upgrade
%{_sbindir}/iconvconfig %{_sbindir}/iconvconfig
%files locale -f libc.lang %files locale-base -f libc.lang
%defattr(-,root,root) %defattr(-,root,root)
%{_datadir}/locale/locale.alias %{_datadir}/locale/locale.alias
%if %{build_locales} %if %{build_locales}
/usr/lib/locale %dir %{_prefix}/lib/locale
%{_prefix}/lib/locale/C.utf8
%{_prefix}/lib/locale/en_US.utf8
%endif %endif
%{_libdir}/gconv %{_libdir}/gconv
%files locale
%defattr(-,root,root)
%if %{build_locales}
%{_prefix}/lib/locale
%exclude %{_prefix}/lib/locale/C.utf8
%exclude %{_prefix}/lib/locale/en_US.utf8
%endif
%files devel %files devel
%defattr(-,root,root) %defattr(-,root,root)
%license COPYING COPYING.LIB %license COPYING COPYING.LIB
@ -1281,15 +1230,12 @@ exit 0
%ifarch x86_64 %ifarch x86_64
%{_libdir}/libmvec_nonshared.a %{_libdir}/libmvec_nonshared.a
%endif %endif
%{_libdir}/libpthread_nonshared.a
%files devel-static %files devel-static
%defattr(-,root,root) %defattr(-,root,root)
%{_libdir}/libBrokenLocale.a %{_libdir}/libBrokenLocale.a
%{_libdir}/libanl.a %{_libdir}/libanl.a
%{_libdir}/libc.a %{_libdir}/libc.a
%{_libdir}/libcrypt.a
%{_libdir}/libowcrypt.a
%{_libdir}/libdl.a %{_libdir}/libdl.a
%{_libdir}/libm.a %{_libdir}/libm.a
%ifarch x86_64 %ifarch x86_64
@ -1347,8 +1293,6 @@ exit 0
%ifarch x86_64 %ifarch x86_64
%{_libdir}/libmvec_p.a %{_libdir}/libmvec_p.a
%endif %endif
%{_libdir}/libcrypt_p.a
%{_libdir}/libowcrypt_p.a
%{_libdir}/libpthread_p.a %{_libdir}/libpthread_p.a
%{_libdir}/libresolv_p.a %{_libdir}/libresolv_p.a
%{_libdir}/librt_p.a %{_libdir}/librt_p.a

View File

@ -1,6 +1,8 @@
/* skeleton based on version from Fedora Core 3 */ /* skeleton based on version from Fedora Core 3 */
#define _GNU_SOURCE #ifndef _GNU_SOURCE
# define _GNU_SOURCE 1
#endif
#include <sys/types.h> #include <sys/types.h>
#include <sys/wait.h> #include <sys/wait.h>
@ -26,14 +28,10 @@ __attribute__((noinline)) void vexec (int failcode, char *const path[]);
__attribute__((noinline)) void says (const char *str); __attribute__((noinline)) void says (const char *str);
__attribute__((noinline)) void sayn (long num); __attribute__((noinline)) void sayn (long num);
__attribute__((noinline)) void message (char *const path[]); __attribute__((noinline)) void message (char *const path[]);
__attribute__((noinline)) int check_elf (const char *name);
int int
main (void) main (void)
{ {
char initpath[256];
struct stat root, init_root;
/* First, get rid of platform-optimized libraries. We remove any we have /* First, get rid of platform-optimized libraries. We remove any we have
ever built, since otherwise we might end up using some old leftover ever built, since otherwise we might end up using some old leftover
libraries when new ones aren't installed in their place anymore. */ libraries when new ones aren't installed in their place anymore. */
@ -128,33 +126,6 @@ main (void)
"--nostdlib", GCONV_MODULES_DIR); "--nostdlib", GCONV_MODULES_DIR);
} }
/* Check if telinit is available and the init fifo as well. */
if (access ("/sbin/telinit", X_OK) || access ("/dev/initctl", F_OK))
_exit (0);
/* Check if we are not inside of some chroot, because we'd just
timeout and leave /etc/initrunlvl. */
if (readlink ("/proc/1/exe", initpath, 256) <= 0 ||
readlink ("/proc/1/root", initpath, 256) <= 0 ||
access ("/.buildenv", F_OK) == 0 || /* XEN build */
stat ("/proc/1/root", &init_root) < 0 ||
stat ("/", &root) < 0 ||
init_root.st_dev != root.st_dev || init_root.st_ino != root.st_ino)
_exit (0);
if (check_elf ("/proc/1/exe"))
verbose_exec (116, "/sbin/telinit", "/sbin/telinit", "u");
#if 0
/* Check if we can safely condrestart sshd. */
if (access ("/sbin/service", X_OK) == 0
&& access ("/usr/sbin/sshd", X_OK) == 0
&& access ("/bin/bash", X_OK) == 0)
{
if (check_elf ("/usr/sbin/sshd"))
verbose_exec (121, "/sbin/service", "/sbin/service", "sshd", "condrestart");
}
#endif
_exit(0); _exit(0);
} }
@ -231,106 +202,3 @@ message (char *const path[])
says ("/usr/sbin/glibc_post_upgrade: While trying to execute "); says ("/usr/sbin/glibc_post_upgrade: While trying to execute ");
says (path[0]); says (path[0]);
} }
int
check_elf (const char *name)
{
/* Play safe, if we can't open or read, assume it might be
ELF for the current arch. */
int ret = 1;
int fd = open (name, O_RDONLY);
if (fd >= 0)
{
Elf32_Ehdr ehdr;
if (read (fd, &ehdr, offsetof (Elf32_Ehdr, e_version))
== offsetof (Elf32_Ehdr, e_version))
{
ret = 0;
if (ehdr.e_ident[EI_CLASS]
== (sizeof (long) == 8 ? ELFCLASS64 : ELFCLASS32))
{
#if defined __i386__
ret = ehdr.e_machine == EM_386;
#elif defined __x86_64__
ret = ehdr.e_machine == EM_X86_64;
#elif defined __ia64__
ret = ehdr.e_machine == EM_IA_64;
#elif defined __powerpc64__
ret = ehdr.e_machine == EM_PPC64;
#elif defined __powerpc__
ret = ehdr.e_machine == EM_PPC;
#elif defined __s390__ || defined __s390x__
ret = ehdr.e_machine == EM_S390;
#elif defined __x86_64__
ret = ehdr.e_machine == EM_X86_64;
#elif defined __sparc__
if (sizeof (long) == 8)
ret = ehdr.e_machine == EM_SPARCV9;
else
ret = (ehdr.e_machine == EM_SPARC
|| ehdr.e_machine == EM_SPARC32PLUS);
#else
ret = 1;
#endif
}
}
close (fd);
}
return ret;
}
#ifdef SMALL_BINARY
int __libc_multiple_threads __attribute__((nocommon));
int __libc_enable_asynccancel (void) { return 0; }
void __libc_disable_asynccancel (int x) { }
void __libc_csu_init (void) { }
void __libc_csu_fini (void) { }
pid_t __fork (void) { return -1; }
char thr_buf[65536];
#ifndef __powerpc__
int
__libc_start_main (int (*main) (void), int argc, char **argv,
void (*init) (void), void (*fini) (void),
void (*rtld_fini) (void), void * stack_end)
#else
struct startup_info
{
void *sda_base;
int (*main) (int, char **, char **, void *);
int (*init) (int, char **, char **, void *);
void (*fini) (void);
};
int
__libc_start_main (int argc, char **ubp_av, char **ubp_ev,
void *auxvec, void (*rtld_fini) (void),
struct startup_info *stinfo,
char **stack_on_entry)
#endif
{
#if defined __ia64__ || defined __powerpc64__
register void *r13 __asm ("r13") = thr_buf + 32768;
__asm ("" : : "r" (r13));
#elif defined __sparc__
register void *g6 __asm ("g6") = thr_buf + 32768;
# ifdef __arch64__
__thread_self = thr_buf + 32768;
# else
register void *__thread_self __asm ("g7") = thr_buf + 32768;
# endif
__asm ("" : : "r" (g6), "r" (__thread_self));
#elif defined __s390__ && !defined __s390x__
__asm ("sar %%a0,%0" : : "d" (thr_buf + 32768));
#elif defined __s390x__
__asm ("sar %%a1,%0; srlg 0,%0,32; sar %%a0,0" : : "d" (thr_buf + 32768) : "0");
#elif defined __powerpc__ && !defined __powerpc64__
register void *r2 __asm ("r2") = thr_buf + 32768;
__asm ("" : : "r" (r2));
#endif
main();
return 0;
}
#endif

View File

@ -1,149 +0,0 @@
2018-03-23 Andrew Senkevich <andrew.senkevich@intel.com>
Max Horn <max@quendi.de>
[BZ #22644]
* sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed
branch conditions.
* string/test-memmove.c (do_test2): New testcase.
Index: glibc-2.27/string/test-memmove.c
===================================================================
--- glibc-2.27.orig/string/test-memmove.c
+++ glibc-2.27/string/test-memmove.c
@@ -24,6 +24,7 @@
# define TEST_NAME "memmove"
#endif
#include "test-string.h"
+#include <support/test-driver.h>
char *simple_memmove (char *, const char *, size_t);
@@ -245,6 +246,60 @@ do_random_tests (void)
}
}
+static void
+do_test2 (void)
+{
+ size_t size = 0x20000000;
+ uint32_t * large_buf;
+
+ large_buf = mmap ((void*) 0x70000000, size, PROT_READ | PROT_WRITE,
+ MAP_PRIVATE | MAP_ANON, -1, 0);
+
+ if (large_buf == MAP_FAILED)
+ error (EXIT_UNSUPPORTED, errno, "Large mmap failed");
+
+ if ((uintptr_t) large_buf > 0x80000000 - 128
+ || 0x80000000 - (uintptr_t) large_buf > 0x20000000)
+ {
+ error (0, 0, "Large mmap allocated improperly");
+ ret = EXIT_UNSUPPORTED;
+ munmap ((void *) large_buf, size);
+ return;
+ }
+
+ size_t bytes_move = 0x80000000 - (uintptr_t) large_buf;
+ size_t arr_size = bytes_move / sizeof (uint32_t);
+ size_t i;
+
+ FOR_EACH_IMPL (impl, 0)
+ {
+ for (i = 0; i < arr_size; i++)
+ large_buf[i] = (uint32_t) i;
+
+ uint32_t * dst = &large_buf[33];
+
+#ifdef TEST_BCOPY
+ CALL (impl, (char *) large_buf, (char *) dst, bytes_move);
+#else
+ CALL (impl, (char *) dst, (char *) large_buf, bytes_move);
+#endif
+
+ for (i = 0; i < arr_size; i++)
+ {
+ if (dst[i] != (uint32_t) i)
+ {
+ error (0, 0,
+ "Wrong result in function %s dst \"%p\" src \"%p\" offset \"%zd\"",
+ impl->name, dst, large_buf, i);
+ ret = 1;
+ break;
+ }
+ }
+ }
+
+ munmap ((void *) large_buf, size);
+}
+
int
test_main (void)
{
@@ -284,6 +339,9 @@ test_main (void)
}
do_random_tests ();
+
+ do_test2 ();
+
return ret;
}
Index: glibc-2.27/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
===================================================================
--- glibc-2.27.orig/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
+++ glibc-2.27/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
@@ -72,7 +72,7 @@ ENTRY (MEMCPY)
cmp %edx, %eax
# ifdef USE_AS_MEMMOVE
- jg L(check_forward)
+ ja L(check_forward)
L(mm_len_0_or_more_backward):
/* Now do checks for lengths. We do [0..16], [16..32], [32..64], [64..128]
@@ -81,7 +81,7 @@ L(mm_len_0_or_more_backward):
jbe L(mm_len_0_16_bytes_backward)
cmpl $32, %ecx
- jg L(mm_len_32_or_more_backward)
+ ja L(mm_len_32_or_more_backward)
/* Copy [0..32] and return. */
movdqu (%eax), %xmm0
@@ -92,7 +92,7 @@ L(mm_len_0_or_more_backward):
L(mm_len_32_or_more_backward):
cmpl $64, %ecx
- jg L(mm_len_64_or_more_backward)
+ ja L(mm_len_64_or_more_backward)
/* Copy [0..64] and return. */
movdqu (%eax), %xmm0
@@ -107,7 +107,7 @@ L(mm_len_32_or_more_backward):
L(mm_len_64_or_more_backward):
cmpl $128, %ecx
- jg L(mm_len_128_or_more_backward)
+ ja L(mm_len_128_or_more_backward)
/* Copy [0..128] and return. */
movdqu (%eax), %xmm0
@@ -132,7 +132,7 @@ L(mm_len_128_or_more_backward):
add %ecx, %eax
cmp %edx, %eax
movl SRC(%esp), %eax
- jle L(forward)
+ jbe L(forward)
PUSH (%esi)
PUSH (%edi)
PUSH (%ebx)
@@ -269,7 +269,7 @@ L(check_forward):
add %edx, %ecx
cmp %eax, %ecx
movl LEN(%esp), %ecx
- jle L(forward)
+ jbe L(forward)
/* Now do checks for lengths. We do [0..16], [0..32], [0..64], [0..128]
separately. */

View File

@ -1,281 +0,0 @@
2018-03-03 Adhemerval Zanella <adhemerval.zanella@linaro.org>
[BZ #21269]
* sysdeps/unix/sysv/linux/i386/Makefile (tests): Add tst-bz21269.
* sysdeps/unix/sysv/linux/i386/sigaction.c (SET_SA_RESTORER): Clear
sa_restorer for vDSO case.
* sysdeps/unix/sysv/linux/i386/tst-bz21269.c: New file.
Index: glibc-2.27/sysdeps/unix/sysv/linux/i386/Makefile
===================================================================
--- glibc-2.27.orig/sysdeps/unix/sysv/linux/i386/Makefile
+++ glibc-2.27/sysdeps/unix/sysv/linux/i386/Makefile
@@ -3,6 +3,9 @@ default-abi := 32
ifeq ($(subdir),misc)
sysdep_routines += ioperm iopl vm86
+
+tests += tst-bz21269
+$(objpfx)tst-bz21269: $(shared-thread-library)
endif
ifeq ($(subdir),elf)
Index: glibc-2.27/sysdeps/unix/sysv/linux/i386/sigaction.c
===================================================================
--- glibc-2.27.orig/sysdeps/unix/sysv/linux/i386/sigaction.c
+++ glibc-2.27/sysdeps/unix/sysv/linux/i386/sigaction.c
@@ -42,7 +42,6 @@ extern void restore_rt (void) asm ("__re
#endif
extern void restore (void) asm ("__restore") attribute_hidden;
-
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
int
@@ -65,6 +64,8 @@ __libc_sigaction (int sig, const struct
kact.sa_restorer = ((act->sa_flags & SA_SIGINFO)
? &restore_rt : &restore);
}
+ else
+ kact.sa_restorer = NULL;
}
/* XXX The size argument hopefully will have to be changed to the
Index: glibc-2.27/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
===================================================================
--- /dev/null
+++ glibc-2.27/sysdeps/unix/sysv/linux/i386/tst-bz21269.c
@@ -0,0 +1,233 @@
+/* Test for i386 sigaction sa_restorer handling (BZ#21269)
+ Copyright (C) 2017 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/>. */
+
+/* This is based on Linux test tools/testing/selftests/x86/ldt_gdt.c,
+ more specifically in do_multicpu_tests function. The main changes
+ are:
+
+ - C11 atomics instead of plain access.
+ - Remove x86_64 support which simplifies the syscall handling
+ and fallbacks.
+ - Replicate only the test required to trigger the issue for the
+ BZ#21269. */
+
+#include <stdatomic.h>
+
+#include <asm/ldt.h>
+#include <linux/futex.h>
+
+#include <setjmp.h>
+#include <signal.h>
+#include <errno.h>
+#include <sys/syscall.h>
+#include <sys/mman.h>
+
+#include <support/xunistd.h>
+#include <support/check.h>
+#include <support/xthread.h>
+
+static int
+xset_thread_area (struct user_desc *u_info)
+{
+ long ret = syscall (SYS_set_thread_area, u_info);
+ TEST_VERIFY_EXIT (ret == 0);
+ return ret;
+}
+
+static void
+xmodify_ldt (int func, const void *ptr, unsigned long bytecount)
+{
+ TEST_VERIFY_EXIT (syscall (SYS_modify_ldt, 1, ptr, bytecount) == 0);
+}
+
+static int
+futex (int *uaddr, int futex_op, int val, void *timeout, int *uaddr2,
+ int val3)
+{
+ return syscall (SYS_futex, uaddr, futex_op, val, timeout, uaddr2, val3);
+}
+
+static void
+xsethandler (int sig, void (*handler)(int, siginfo_t *, void *), int flags)
+{
+ struct sigaction sa = { 0 };
+ sa.sa_sigaction = handler;
+ sa.sa_flags = SA_SIGINFO | flags;
+ TEST_VERIFY_EXIT (sigemptyset (&sa.sa_mask) == 0);
+ TEST_VERIFY_EXIT (sigaction (sig, &sa, 0) == 0);
+}
+
+static jmp_buf jmpbuf;
+
+static void
+sigsegv_handler (int sig, siginfo_t *info, void *ctx_void)
+{
+ siglongjmp (jmpbuf, 1);
+}
+
+/* Points to an array of 1024 ints, each holding its own index. */
+static const unsigned int *counter_page;
+static struct user_desc *low_user_desc;
+static struct user_desc *low_user_desc_clear; /* Used to delete GDT entry. */
+static int gdt_entry_num;
+
+static void
+setup_counter_page (void)
+{
+ long page_size = sysconf (_SC_PAGE_SIZE);
+ TEST_VERIFY_EXIT (page_size > 0);
+ unsigned int *page = xmmap (NULL, page_size, PROT_READ | PROT_WRITE,
+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1);
+ for (int i = 0; i < (page_size / sizeof (unsigned int)); i++)
+ page[i] = i;
+ counter_page = page;
+}
+
+static void
+setup_low_user_desc (void)
+{
+ low_user_desc = xmmap (NULL, 2 * sizeof (struct user_desc),
+ PROT_READ | PROT_WRITE,
+ MAP_ANONYMOUS | MAP_PRIVATE | MAP_32BIT, -1);
+
+ low_user_desc->entry_number = -1;
+ low_user_desc->base_addr = (unsigned long) &counter_page[1];
+ low_user_desc->limit = 0xffff;
+ low_user_desc->seg_32bit = 1;
+ low_user_desc->contents = 0;
+ low_user_desc->read_exec_only = 0;
+ low_user_desc->limit_in_pages = 1;
+ low_user_desc->seg_not_present = 0;
+ low_user_desc->useable = 0;
+
+ xset_thread_area (low_user_desc);
+
+ low_user_desc_clear = low_user_desc + 1;
+ low_user_desc_clear->entry_number = gdt_entry_num;
+ low_user_desc_clear->read_exec_only = 1;
+ low_user_desc_clear->seg_not_present = 1;
+}
+
+/* Possible values of futex:
+ 0: thread is idle.
+ 1: thread armed.
+ 2: thread should clear LDT entry 0.
+ 3: thread should exit. */
+static atomic_uint ftx;
+
+static void *
+threadproc (void *ctx)
+{
+ while (1)
+ {
+ futex ((int *) &ftx, FUTEX_WAIT, 1, NULL, NULL, 0);
+ while (atomic_load (&ftx) != 2)
+ {
+ if (atomic_load (&ftx) >= 3)
+ return NULL;
+ }
+
+ /* clear LDT entry 0. */
+ const struct user_desc desc = { 0 };
+ xmodify_ldt (1, &desc, sizeof (desc));
+
+ /* If ftx == 2, set it to zero, If ftx == 100, quit. */
+ if (atomic_fetch_add (&ftx, -2) != 2)
+ return NULL;
+ }
+}
+
+
+/* As described in testcase, for historical reasons x86_32 Linux (and compat
+ on x86_64) interprets SA_RESTORER clear with nonzero sa_restorer as a
+ request for stack switching if the SS segment is 'funny' (this is default
+ scenario for vDSO system). This means that anything that tries to mix
+ signal handling with segmentation should explicit clear the sa_restorer.
+
+ This testcase check if sigaction in fact does it by changing the local
+ descriptor table (LDT) through the modify_ldt syscall and triggering
+ a synchronous segfault on iret fault by trying to install an invalid
+ segment. With a correct zeroed sa_restorer it should not trigger an
+ 'real' SEGSEGV and allows the siglongjmp in signal handler. */
+
+static int
+do_test (void)
+{
+ setup_counter_page ();
+ setup_low_user_desc ();
+
+ pthread_t thread;
+ unsigned short orig_ss;
+
+ xsethandler (SIGSEGV, sigsegv_handler, 0);
+ /* 32-bit kernels send SIGILL instead of SIGSEGV on IRET faults. */
+ xsethandler (SIGILL, sigsegv_handler, 0);
+
+ thread = xpthread_create (0, threadproc, 0);
+
+ asm volatile ("mov %%ss, %0" : "=rm" (orig_ss));
+
+ for (int i = 0; i < 5; i++)
+ {
+ if (sigsetjmp (jmpbuf, 1) != 0)
+ continue;
+
+ /* Make sure the thread is ready after the last test. */
+ while (atomic_load (&ftx) != 0)
+ ;
+
+ struct user_desc desc = {
+ .entry_number = 0,
+ .base_addr = 0,
+ .limit = 0xffff,
+ .seg_32bit = 1,
+ .contents = 0,
+ .read_exec_only = 0,
+ .limit_in_pages = 1,
+ .seg_not_present = 0,
+ .useable = 0
+ };
+
+ xmodify_ldt (0x11, &desc, sizeof (desc));
+
+ /* Arm the thread. */
+ ftx = 1;
+ futex ((int*) &ftx, FUTEX_WAKE, 0, NULL, NULL, 0);
+
+ asm volatile ("mov %0, %%ss" : : "r" (0x7));
+
+ /* Fire up thread modify_ldt call. */
+ atomic_store (&ftx, 2);
+
+ while (atomic_load (&ftx) != 0)
+ ;
+
+ /* On success, modify_ldt will segfault us synchronously and we will
+ escape via siglongjmp. */
+ support_record_failure ();
+ }
+
+ atomic_store (&ftx, 100);
+ futex ((int*) &ftx, FUTEX_WAKE, 0, NULL, NULL, 0);
+
+ xpthread_join (thread);
+
+ return 0;
+}
+
+#include <support/test-driver.c>

View File

@ -17,13 +17,12 @@ Index: glibc-2.27/iconv/Makefile
=================================================================== ===================================================================
--- glibc-2.27.orig/iconv/Makefile --- glibc-2.27.orig/iconv/Makefile
+++ glibc-2.27/iconv/Makefile +++ glibc-2.27/iconv/Makefile
@@ -43,7 +43,8 @@ CFLAGS-charmap.c += -DCHARMAP_PATH='"$(i @@ -44,7 +44,7 @@ CFLAGS-charmap.c += -DCHARMAP_PATH='"$(i
CFLAGS-linereader.c += -DNO_TRANSLITERATION
CFLAGS-simple-hash.c += -I../locale CFLAGS-simple-hash.c += -I../locale
-tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \
+tests = tst-iconv1 tst-iconv2 tst-iconv3 tst-iconv4 tst-iconv5 tst-iconv6 \ - tst-iconv-mt
+ tst-iconv7 + tst-iconv7 tst-iconv-mt
others = iconv_prog iconvconfig others = iconv_prog iconvconfig
install-others-programs = $(inst_bindir)/iconv install-others-programs = $(inst_bindir)/iconv

View File

@ -1,42 +0,0 @@
[BZ #23196]
CVE-2018-11237
* sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
(L(preloop_large)): Save initial destination pointer in %r11 and
use it instead of %rax after the loop.
* string/test-mempcpy.c (MIN_PAGE_SIZE): Define.
Index: glibc-2.27/string/test-mempcpy.c
===================================================================
--- glibc-2.27.orig/string/test-mempcpy.c
+++ glibc-2.27/string/test-mempcpy.c
@@ -18,6 +18,7 @@
<http://www.gnu.org/licenses/>. */
#define MEMCPY_RESULT(dst, len) (dst) + (len)
+#define MIN_PAGE_SIZE 131072
#define TEST_MAIN
#define TEST_NAME "mempcpy"
#include "test-string.h"
Index: glibc-2.27/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
===================================================================
--- glibc-2.27.orig/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
+++ glibc-2.27/sysdeps/x86_64/multiarch/memmove-avx512-no-vzeroupper.S
@@ -336,6 +336,7 @@ L(preloop_large):
vmovups (%rsi), %zmm4
vmovups 0x40(%rsi), %zmm5
+ mov %rdi, %r11
/* Align destination for access with non-temporal stores in the loop. */
mov %rdi, %r8
and $-0x80, %rdi
@@ -366,8 +367,8 @@ L(gobble_256bytes_nt_loop):
cmp $256, %rdx
ja L(gobble_256bytes_nt_loop)
sfence
- vmovups %zmm4, (%rax)
- vmovups %zmm5, 0x40(%rax)
+ vmovups %zmm4, (%r11)
+ vmovups %zmm5, 0x40(%r11)
jmp L(check)
L(preloop_large_bkw):

View File

@ -1,19 +0,0 @@
2018-03-01 DJ Delorie <dj@delorie.com>
[BZ #22342]
* nscd/netgroupcache.c (addinnetgrX): Include trailing NUL in
key value.
Index: glibc-2.27/nscd/netgroupcache.c
===================================================================
--- glibc-2.27.orig/nscd/netgroupcache.c
+++ glibc-2.27/nscd/netgroupcache.c
@@ -480,7 +480,7 @@ addinnetgrX (struct database_dyn *db, in
{
const char *group = key;
key = (char *) rawmemchr (key, '\0') + 1;
- size_t group_len = key - group - 1;
+ size_t group_len = key - group;
const char *host = *key++ ? key : NULL;
if (host != NULL)
key = (char *) rawmemchr (key, '\0') + 1;

View File

@ -1,89 +0,0 @@
2018-03-03 Andreas Schwab <schwab@linux-m68k.org>
[BZ #22918]
* nss/nsswitch.h (DEFINE_DATABASE): Don't define __nss_*_database.
* nss/nsswitch.c (DEFINE_DATABASE): Define __nss_*_database here.
* nscd/gai.c (__nss_hosts_database): Readd definition.
* posix/tst-rfc3484.c (__nss_hosts_database): Likewise.
* posix/tst-rfc3484-3.c (__nss_hosts_database): Likewise.
* posix/tst-rfc3484-2.c (__nss_hosts_database): Likewise.
Index: glibc-2.27/nscd/gai.c
===================================================================
--- glibc-2.27.orig/nscd/gai.c
+++ glibc-2.27/nscd/gai.c
@@ -45,3 +45,6 @@
#ifdef HAVE_LIBIDN
# include <libidn/idn-stub.c>
#endif
+
+/* Some variables normally defined in libc. */
+service_user *__nss_hosts_database attribute_hidden;
Index: glibc-2.27/nss/nsswitch.c
===================================================================
--- glibc-2.27.orig/nss/nsswitch.c
+++ glibc-2.27/nss/nsswitch.c
@@ -62,7 +62,7 @@ static service_library *nss_new_service
/* Declare external database variables. */
#define DEFINE_DATABASE(name) \
- extern service_user *__nss_##name##_database attribute_hidden; \
+ service_user *__nss_##name##_database attribute_hidden; \
weak_extern (__nss_##name##_database)
#include "databases.def"
#undef DEFINE_DATABASE
Index: glibc-2.27/nss/nsswitch.h
===================================================================
--- glibc-2.27.orig/nss/nsswitch.h
+++ glibc-2.27/nss/nsswitch.h
@@ -226,10 +226,10 @@ libc_hidden_proto (__nss_hostname_digits
#define MAX_NR_ADDRS 48
/* Prototypes for __nss_*_lookup2 functions. */
-#define DEFINE_DATABASE(arg) \
- service_user *__nss_##arg##_database attribute_hidden; \
- int __nss_##arg##_lookup2 (service_user **, const char *, \
- const char *, void **); \
+#define DEFINE_DATABASE(arg) \
+ extern service_user *__nss_##arg##_database attribute_hidden; \
+ int __nss_##arg##_lookup2 (service_user **, const char *, \
+ const char *, void **); \
libc_hidden_proto (__nss_##arg##_lookup2)
#include "databases.def"
#undef DEFINE_DATABASE
Index: glibc-2.27/posix/tst-rfc3484-2.c
===================================================================
--- glibc-2.27.orig/posix/tst-rfc3484-2.c
+++ glibc-2.27/posix/tst-rfc3484-2.c
@@ -58,6 +58,7 @@ _res_hconf_init (void)
#undef USE_NSCD
#include "../sysdeps/posix/getaddrinfo.c"
+service_user *__nss_hosts_database attribute_hidden;
/* This is the beginning of the real test code. The above defines
(among other things) the function rfc3484_sort. */
Index: glibc-2.27/posix/tst-rfc3484-3.c
===================================================================
--- glibc-2.27.orig/posix/tst-rfc3484-3.c
+++ glibc-2.27/posix/tst-rfc3484-3.c
@@ -58,6 +58,7 @@ _res_hconf_init (void)
#undef USE_NSCD
#include "../sysdeps/posix/getaddrinfo.c"
+service_user *__nss_hosts_database attribute_hidden;
/* This is the beginning of the real test code. The above defines
(among other things) the function rfc3484_sort. */
Index: glibc-2.27/posix/tst-rfc3484.c
===================================================================
--- glibc-2.27.orig/posix/tst-rfc3484.c
+++ glibc-2.27/posix/tst-rfc3484.c
@@ -58,6 +58,7 @@ _res_hconf_init (void)
#undef USE_NSCD
#include "../sysdeps/posix/getaddrinfo.c"
+service_user *__nss_hosts_database attribute_hidden;
/* This is the beginning of the real test code. The above defines
(among other things) the function rfc3484_sort. */

View File

@ -1,19 +0,0 @@
2018-02-07 Igor Gnatenko <ignatenko@redhat.com>
[BZ #22797]
* sysdeps/unix/sysv/linux/bits/mman-shared.h (pkey_get): Add
missing second underscore to parameter name.
Index: glibc-2.27/sysdeps/unix/sysv/linux/bits/mman-shared.h
===================================================================
--- glibc-2.27.orig/sysdeps/unix/sysv/linux/bits/mman-shared.h
+++ glibc-2.27/sysdeps/unix/sysv/linux/bits/mman-shared.h
@@ -61,7 +61,7 @@ int pkey_set (int __key, unsigned int __
/* Return the access rights for the current thread for KEY, which must
have been allocated using pkey_alloc. */
-int pkey_get (int _key) __THROW;
+int pkey_get (int __key) __THROW;
/* Free an allocated protection key, which must have been allocated
using pkey_alloc. */

View File

@ -1,59 +0,0 @@
2018-02-26 Tulio Magno Quites Machado Filho <tuliom@linux.vnet.ibm.com>
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h: Undefine Linux
macros used in __ptrace_request.
Index: glibc-2.27/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
===================================================================
--- glibc-2.27.orig/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
+++ glibc-2.27/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
@@ -24,6 +24,49 @@
__BEGIN_DECLS
+#if defined _LINUX_PTRACE_H || defined _ASM_POWERPC_PTRACE_H
+/* Do not let Linux headers macros interfere with enum __ptrace_request. */
+# undef PTRACE_ATTACH
+# undef PTRACE_CONT
+# undef PTRACE_DETACH
+# undef PTRACE_GET_DEBUGREG
+# undef PTRACE_GETEVENTMSG
+# undef PTRACE_GETEVRREGS
+# undef PTRACE_GETFPREGS
+# undef PTRACE_GETREGS
+# undef PTRACE_GETREGS64
+# undef PTRACE_GETREGSET
+# undef PTRACE_GETSIGINFO
+# undef PTRACE_GETSIGMASK
+# undef PTRACE_GETVRREGS
+# undef PTRACE_GETVSRREGS
+# undef PTRACE_INTERRUPT
+# undef PTRACE_KILL
+# undef PTRACE_LISTEN
+# undef PTRACE_PEEKDATA
+# undef PTRACE_PEEKSIGINFO
+# undef PTRACE_PEEKTEXT
+# undef PTRACE_POKEDATA
+# undef PTRACE_POKETEXT
+# undef PTRACE_SECCOMP_GET_FILTER
+# undef PTRACE_SEIZE
+# undef PTRACE_SET_DEBUGREG
+# undef PTRACE_SETEVRREGS
+# undef PTRACE_SETFPREGS
+# undef PTRACE_SETOPTIONS
+# undef PTRACE_SETREGS
+# undef PTRACE_SETREGS64
+# undef PTRACE_SETREGSET
+# undef PTRACE_SETSIGINFO
+# undef PTRACE_SETSIGMASK
+# undef PTRACE_SETVRREGS
+# undef PTRACE_SETVSRREGS
+# undef PTRACE_SINGLEBLOCK
+# undef PTRACE_SINGLESTEP
+# undef PTRACE_SYSCALL
+# undef PTRACE_TRACEME
+#endif
+
/* Type of the REQUEST argument to `ptrace.' */
enum __ptrace_request
{

View File

@ -1,95 +0,0 @@
2018-02-26 Dmitry V. Levin <ldv@altlinux.org>
[BZ #22433]
[BZ #22807]
* sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h (__ptrace_request): Add
PTRACE_GETREGS, PTRACE_SETREGS, PTRACE_GETFPREGS, PTRACE_SETFPREGS,
PTRACE_GETVRREGS, PTRACE_SETVRREGS, PTRACE_GETEVRREGS,
PTRACE_SETEVRREGS, PTRACE_GETREGS64, PTRACE_SETREGS64,
PTRACE_GET_DEBUGREG, PTRACE_SET_DEBUGREG, PTRACE_GETVSRREGS,
PTRACE_SETVSRREGS, and PTRACE_SINGLEBLOCK.
Index: glibc-2.27/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
===================================================================
--- glibc-2.27.orig/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
+++ glibc-2.27/sysdeps/unix/sysv/linux/powerpc/sys/ptrace.h
@@ -112,6 +112,22 @@ enum __ptrace_request
PTRACE_SINGLESTEP = 9,
#define PT_STEP PTRACE_SINGLESTEP
+ /* Get all general purpose registers used by a process. */
+ PTRACE_GETREGS = 12,
+#define PT_GETREGS PTRACE_GETREGS
+
+ /* Set all general purpose registers used by a process. */
+ PTRACE_SETREGS = 13,
+#define PT_SETREGS PTRACE_SETREGS
+
+ /* Get all floating point registers used by a process. */
+ PTRACE_GETFPREGS = 14,
+#define PT_GETFPREGS PTRACE_GETFPREGS
+
+ /* Set all floating point registers used by a process. */
+ PTRACE_SETFPREGS = 15,
+#define PT_SETFPREGS PTRACE_SETFPREGS
+
/* Attach to a process that is already running. */
PTRACE_ATTACH = 16,
#define PT_ATTACH PTRACE_ATTACH
@@ -120,10 +136,56 @@ enum __ptrace_request
PTRACE_DETACH = 17,
#define PT_DETACH PTRACE_DETACH
+ /* Get all altivec registers used by a process. */
+ PTRACE_GETVRREGS = 18,
+#define PT_GETVRREGS PTRACE_GETVRREGS
+
+ /* Set all altivec registers used by a process. */
+ PTRACE_SETVRREGS = 19,
+#define PT_SETVRREGS PTRACE_SETVRREGS
+
+ /* Get all SPE registers used by a process. */
+ PTRACE_GETEVRREGS = 20,
+#define PT_GETEVRREGS PTRACE_GETEVRREGS
+
+ /* Set all SPE registers used by a process. */
+ PTRACE_SETEVRREGS = 21,
+#define PT_SETEVRREGS PTRACE_SETEVRREGS
+
+ /* Same as PTRACE_GETREGS except a 32-bit process will obtain
+ the full 64-bit registers. Implemented by 64-bit kernels only. */
+ PTRACE_GETREGS64 = 22,
+#define PT_GETREGS64 PTRACE_GETREGS64
+
+ /* Same as PTRACE_SETREGS except a 32-bit process will set
+ the full 64-bit registers. Implemented by 64-bit kernels only. */
+ PTRACE_SETREGS64 = 23,
+#define PT_SETREGS64 PTRACE_SETREGS64
+
/* Continue and stop at the next entry to or return from syscall. */
PTRACE_SYSCALL = 24,
#define PT_SYSCALL PTRACE_SYSCALL
+ /* Get a debug register of a process. */
+ PTRACE_GET_DEBUGREG = 25,
+#define PT_GET_DEBUGREG PTRACE_GET_DEBUGREG
+
+ /* Set a debug register of a process. */
+ PTRACE_SET_DEBUGREG = 26,
+#define PT_SET_DEBUGREG PTRACE_SET_DEBUGREG
+
+ /* Get the first 32 VSX registers of a process. */
+ PTRACE_GETVSRREGS = 27,
+#define PT_GETVSRREGS PTRACE_GETVSRREGS
+
+ /* Set the first 32 VSX registers of a process. */
+ PTRACE_SETVSRREGS = 28,
+#define PT_SETVSRREGS PTRACE_SETVSRREGS
+
+ /* Execute process until next taken branch. */
+ PTRACE_SINGLEBLOCK = 256,
+#define PT_STEPBLOCK PTRACE_SINGLEBLOCK
+
/* Set ptrace filter options. */
PTRACE_SETOPTIONS = 0x4200,
#define PT_SETOPTIONS PTRACE_SETOPTIONS

View File

@ -1,129 +0,0 @@
2018-05-09 Paul Pluzhnikov <ppluzhnikov@google.com>
[BZ #22786]
* stdlib/canonicalize.c (__realpath): Fix overflow in path length
computation.
* stdlib/Makefile (test-bz22786): New test.
* stdlib/test-bz22786.c: New test.
Index: glibc-2.27/stdlib/Makefile
===================================================================
--- glibc-2.27.orig/stdlib/Makefile
+++ glibc-2.27/stdlib/Makefile
@@ -84,7 +84,7 @@ tests := tst-strtol tst-strtod testmb t
tst-cxa_atexit tst-on_exit test-atexit-race \
test-at_quick_exit-race test-cxa_atexit-race \
test-on_exit-race test-dlclose-exit-race \
- tst-makecontext-align
+ tst-makecontext-align test-bz22786
tests-internal := tst-strtod1i tst-strtod3 tst-strtod4 tst-strtod5i \
tst-tls-atexit tst-tls-atexit-nodelete
Index: glibc-2.27/stdlib/canonicalize.c
===================================================================
--- glibc-2.27.orig/stdlib/canonicalize.c
+++ glibc-2.27/stdlib/canonicalize.c
@@ -181,7 +181,7 @@ __realpath (const char *name, char *reso
extra_buf = __alloca (path_max);
len = strlen (end);
- if ((long int) (n + len) >= path_max)
+ if (path_max - n <= len)
{
__set_errno (ENAMETOOLONG);
goto error;
Index: glibc-2.27/stdlib/test-bz22786.c
===================================================================
--- /dev/null
+++ glibc-2.27/stdlib/test-bz22786.c
@@ -0,0 +1,90 @@
+/* Bug 22786: test for buffer overflow in realpath.
+ Copyright (C) 2018 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/>. */
+
+/* This file must be run from within a directory called "stdlib". */
+
+#include <errno.h>
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <support/test-driver.h>
+#include <libc-diag.h>
+
+static int
+do_test (void)
+{
+ const char dir[] = "bz22786";
+ const char lnk[] = "bz22786/symlink";
+
+ rmdir (dir);
+ if (mkdir (dir, 0755) != 0 && errno != EEXIST)
+ {
+ printf ("mkdir %s: %m\n", dir);
+ return EXIT_FAILURE;
+ }
+ if (symlink (".", lnk) != 0 && errno != EEXIST)
+ {
+ printf ("symlink (%s, %s): %m\n", dir, lnk);
+ return EXIT_FAILURE;
+ }
+
+ const size_t path_len = (size_t) INT_MAX + 1;
+
+ DIAG_PUSH_NEEDS_COMMENT;
+#if __GNUC_PREREQ (7, 0)
+ /* GCC 7 warns about too-large allocations; here we need such
+ allocation to succeed for the test to work. */
+ DIAG_IGNORE_NEEDS_COMMENT (7, "-Walloc-size-larger-than=");
+#endif
+ char *path = malloc (path_len);
+ DIAG_POP_NEEDS_COMMENT;
+
+ if (path == NULL)
+ {
+ printf ("malloc (%zu): %m\n", path_len);
+ return EXIT_UNSUPPORTED;
+ }
+
+ /* Construct very long path = "bz22786/symlink/aaaa....." */
+ char *p = mempcpy (path, lnk, sizeof (lnk) - 1);
+ *(p++) = '/';
+ memset (p, 'a', path_len - (path - p) - 2);
+ p[path_len - (path - p) - 1] = '\0';
+
+ /* This call crashes before the fix for bz22786 on 32-bit platforms. */
+ p = realpath (path, NULL);
+
+ if (p != NULL || errno != ENAMETOOLONG)
+ {
+ printf ("realpath: %s (%m)", p);
+ return EXIT_FAILURE;
+ }
+
+ /* Cleanup. */
+ unlink (lnk);
+ rmdir (dir);
+
+ return 0;
+}
+
+#define TEST_FUNCTION do_test
+#include <support/test-driver.c>

View File

@ -1,20 +0,0 @@
[BZ #23005]
* resolv/res_send.c (__res_context_send): Return ENOMEM if
allocation of private copy of nsaddr_list fails.
Index: glibc-2.27/resolv/res_send.c
===================================================================
--- glibc-2.27.orig/resolv/res_send.c
+++ glibc-2.27/resolv/res_send.c
@@ -471,6 +471,11 @@ __res_context_send (struct resolv_contex
'\0',
sizeof (struct sockaddr_in6)
- sizeof (struct sockaddr_in));
+ else
+ {
+ __set_errno (ENOMEM);
+ return -1;
+ }
}
EXT(statp).nscount = statp->nscount;
}

View File

@ -1,112 +0,0 @@
2018-02-22 Andrew Waterman <andrew@sifive.com>
[BZ # 22884]
* sysdeps/riscv/rvd/s_fmax.c (__fmax): Handle sNaNs correctly.
* sysdeps/riscv/rvd/s_fmin.c (__fmin): Likewise.
* sysdeps/riscv/rvf/s_fmaxf.c (__fmaxf): Likewise.
* sysdeps/riscv/rvf/s_fminf.c (__fminf): Likewise.
Index: glibc-2.27/sysdeps/riscv/rvd/s_fmax.c
===================================================================
--- glibc-2.27.orig/sysdeps/riscv/rvd/s_fmax.c
+++ glibc-2.27/sysdeps/riscv/rvd/s_fmax.c
@@ -17,12 +17,19 @@
<http://www.gnu.org/licenses/>. */
#include <math.h>
+#include <math_private.h>
#include <libm-alias-double.h>
double
__fmax (double x, double y)
{
- asm ("fmax.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
- return x;
+ double res;
+
+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN))
+ return x + y;
+ else
+ asm ("fmax.d %0, %1, %2" : "=f" (res) : "f" (x), "f" (y));
+
+ return res;
}
libm_alias_double (__fmax, fmax)
Index: glibc-2.27/sysdeps/riscv/rvd/s_fmin.c
===================================================================
--- glibc-2.27.orig/sysdeps/riscv/rvd/s_fmin.c
+++ glibc-2.27/sysdeps/riscv/rvd/s_fmin.c
@@ -17,12 +17,19 @@
<http://www.gnu.org/licenses/>. */
#include <math.h>
+#include <math_private.h>
#include <libm-alias-double.h>
double
__fmin (double x, double y)
{
- asm ("fmin.d %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
- return x;
+ double res;
+
+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN))
+ return x + y;
+ else
+ asm ("fmin.d %0, %1, %2" : "=f" (res) : "f" (x), "f" (y));
+
+ return res;
}
libm_alias_double (__fmin, fmin)
Index: glibc-2.27/sysdeps/riscv/rvf/s_fmaxf.c
===================================================================
--- glibc-2.27.orig/sysdeps/riscv/rvf/s_fmaxf.c
+++ glibc-2.27/sysdeps/riscv/rvf/s_fmaxf.c
@@ -17,12 +17,19 @@
<http://www.gnu.org/licenses/>. */
#include <math.h>
+#include <math_private.h>
#include <libm-alias-float.h>
float
__fmaxf (float x, float y)
{
- asm ("fmax.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
- return x;
+ float res;
+
+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN))
+ return x + y;
+ else
+ asm ("fmax.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y));
+
+ return res;
}
libm_alias_float (__fmax, fmax)
Index: glibc-2.27/sysdeps/riscv/rvf/s_fminf.c
===================================================================
--- glibc-2.27.orig/sysdeps/riscv/rvf/s_fminf.c
+++ glibc-2.27/sysdeps/riscv/rvf/s_fminf.c
@@ -17,12 +17,19 @@
<http://www.gnu.org/licenses/>. */
#include <math.h>
+#include <math_private.h>
#include <libm-alias-float.h>
float
__fminf (float x, float y)
{
- asm ("fmin.s %0, %1, %2" : "=f" (x) : "f" (x), "f" (y));
- return x;
+ float res;
+
+ if (__glibc_unlikely ((_FCLASS (x) | _FCLASS (y)) & _FCLASS_SNAN))
+ return x + y;
+ else
+ asm ("fmin.s %0, %1, %2" : "=f" (res) : "f" (x), "f" (y));
+
+ return res;
}
libm_alias_float (__fmin, fmin)

View File

@ -1,17 +0,0 @@
2018-04-28 Aurelien Jarno <aurelien@aurel32.net>
[BZ #23069]
* sysdeps/unix/sysv/linux/riscv/kernel_sigaction.h: New file.
Index: glibc-2.27/sysdeps/unix/sysv/linux/riscv/kernel_sigaction.h
===================================================================
--- /dev/null
+++ glibc-2.27/sysdeps/unix/sysv/linux/riscv/kernel_sigaction.h
@@ -0,0 +1,7 @@
+/* This is the sigaction structure from the RISC-V Linux 4.15 kernel. */
+
+struct kernel_sigaction {
+ __sighandler_t k_sa_handler;
+ unsigned long sa_flags;
+ sigset_t sa_mask;
+};

View File

@ -1,27 +0,0 @@
2018-02-09 DJ Delorie <dj@redhat.com>
[BZ #22827]
* sysdeps/unix/sysv/linux/riscv/readelflib.c (process_elf_file): Use
64-bit ELF type for 64-bit ELF objects.
Index: glibc-2.27/sysdeps/unix/sysv/linux/riscv/readelflib.c
===================================================================
--- glibc-2.27.orig/sysdeps/unix/sysv/linux/riscv/readelflib.c
+++ glibc-2.27/sysdeps/unix/sysv/linux/riscv/readelflib.c
@@ -43,6 +43,7 @@ process_elf_file (const char *file_name,
{
ElfW(Ehdr) *elf_header = (ElfW(Ehdr) *) file_contents;
Elf32_Ehdr *elf32_header = (Elf32_Ehdr *) elf_header;
+ Elf64_Ehdr *elf64_header = (Elf64_Ehdr *) elf_header;
int ret;
long flags;
@@ -59,7 +60,7 @@ process_elf_file (const char *file_name,
{
ret = process_elf64_file (file_name, lib, flag, osversion, soname,
file_contents, file_length);
- flags = elf32_header->e_flags;
+ flags = elf64_header->e_flags;
}
/* RISC-V linkers encode the floating point ABI as part of the ELF headers. */

View File

@ -1,51 +0,0 @@
2018-02-22 DJ Delorie <dj@delorie.com>
* sysdeps/riscv/tls-macros.h: Do not initialize $gp.
Index: glibc-2.27/sysdeps/riscv/tls-macros.h
===================================================================
--- glibc-2.27.orig/sysdeps/riscv/tls-macros.h
+++ glibc-2.27/sysdeps/riscv/tls-macros.h
@@ -23,19 +23,9 @@
#include <sysdep.h>
#include "dl-tls.h"
-#define LOAD_GP \
- ".option push\n\t" \
- ".option norelax\n\t" \
- "la gp, __global_pointer$\n\t" \
- ".option pop\n\t"
-
-#define UNLOAD_GP
-
#define TLS_GD(x) \
({ void *__result; \
- asm (LOAD_GP \
- "la.tls.gd %0, " #x "\n\t" \
- UNLOAD_GP \
+ asm ("la.tls.gd %0, " #x "\n\t" \
: "=r" (__result)); \
__tls_get_addr (__result); })
@@ -43,19 +33,15 @@
#define TLS_IE(x) \
({ void *__result; \
- asm (LOAD_GP \
- "la.tls.ie %0, " #x "\n\t" \
+ asm ("la.tls.ie %0, " #x "\n\t" \
"add %0, %0, tp\n\t" \
- UNLOAD_GP \
: "=r" (__result)); \
__result; })
#define TLS_LE(x) \
({ void *__result; \
- asm (LOAD_GP \
- "lui %0, %%tprel_hi(" #x ")\n\t" \
+ asm ("lui %0, %%tprel_hi(" #x ")\n\t" \
"add %0, %0, tp, %%tprel_add(" #x ")\n\t" \
"addi %0, %0, %%tprel_lo(" #x ")\n\t" \
- UNLOAD_GP \
: "=r" (__result)); \
__result; })