New version 2.28

Sync patches with OpenMandriva
This commit is contained in:
Andrey Bondrov 2019-04-12 16:38:20 +10:00
parent 21231c26dc
commit 2bb20c2d90
77 changed files with 693 additions and 17950 deletions

View file

@ -1,6 +1,4 @@
sources:
crypt_blowfish-1.3.tar.gz: 461ba876ebacd5f7dc95f1eb3c5286d6e0983ae0
crypt_blowfish-1.3.tar.gz.sign: 96336a263160d3efdd56d983cd9d5e18145271bf
glibc-2.24.tar.xz: e5d9725d94d59475d9a6869a4447a70c1bf3ef78
glibc-2.24.tar.xz.sig: 9903f9767edcd089731299a6f4774a2dafd0846b
glibc-manpages.tar.bz2: ca54bfb832b703c8e35170fcc1c1f5470b45ff0f
glibc-2.28.tar.xz: ccb5dc9e51a9884df8488f86982439d47b283b2a
glibc-2.28.tar.xz.sig: 07b523938b615bf2a0c85461b4e5bbadd3f590ef

29
alternate_trim.patch Normal file
View file

@ -0,0 +1,29 @@
diff --git a/malloc/malloc.c b/malloc/malloc.c
index f8e7250..de6d7fa 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -4146,6 +4146,7 @@ _int_free (mstate av, mchunkptr p, int have_lock)
mchunkptr bck; /* misc temp for linking */
mchunkptr fwd; /* misc temp for linking */
+ static int alternate;
size = chunksize (p);
/* Little security check which won't hurt performance: the
@@ -4364,8 +4365,14 @@ _int_free (mstate av, mchunkptr p, int have_lock)
if (av == &main_arena) {
#ifndef MORECORE_CANNOT_TRIM
if ((unsigned long)(chunksize(av->top)) >=
- (unsigned long)(mp_.trim_threshold))
- systrim(mp_.top_pad, av);
+ (unsigned long)(mp_.trim_threshold)) {
+ if (alternate) {
+ systrim(mp_.top_pad, av);
+ alternate = 0;
+ } else {
+ alternate = 1;
+ }
+ }
#endif
} else {
/* Always try heap_trim(), even if the top chunk is not

View file

@ -1,29 +0,0 @@
Don't use '@progbits' on arm
Proper declaration should be %progbits as '@' is used for comments.
Most of other arches allow % or @ so use %
Signed-off-by: Arnaud Patard <rtp@mageia.org>
Index: glibc-2.14.1/crypt/x86.S
===================================================================
--- glibc-2.14.1.orig/crypt/x86.S
+++ glibc-2.14.1/crypt/x86.S
@@ -199,5 +199,5 @@ BF_die:
#endif
#if defined(__ELF__) && defined(__linux__)
-.section .note.GNU-stack,"",@progbits
+.section .note.GNU-stack,"",%progbits
#endif
Index: glibc-2.14.1/crypt_blowfish-1.3/x86.S
===================================================================
--- glibc-2.14.1.orig/crypt_blowfish-1.3/x86.S
+++ glibc-2.14.1/crypt_blowfish-1.3/x86.S
@@ -199,5 +199,5 @@ BF_die:
#endif
#if defined(__ELF__) && defined(__linux__)
-.section .note.GNU-stack,"",@progbits
+.section .note.GNU-stack,"",%progbits
#endif

View file

@ -1,811 +0,0 @@
/*
* This version is derived from the original implementation of FreeSec
* (release 1.1) by David Burren. I've reviewed the changes made in
* OpenBSD (as of 2.7) and modified the original code in a similar way
* where applicable. I've also made it reentrant and made a number of
* other changes.
* - Solar Designer <solar at openwall.com>
*/
/*
* FreeSec: libcrypt for NetBSD
*
* Copyright (c) 1994 David Burren
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the author nor the names of other contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Owl: Owl/packages/glibc/crypt_freesec.c,v 1.8 2014/07/07 15:44:50 solar Exp $
* $Id: crypt.c,v 1.15 1994/09/13 04:58:49 davidb Exp $
*
* This is an original implementation of the DES and the crypt(3) interfaces
* by David Burren <davidb at werj.com.au>.
*
* An excellent reference on the underlying algorithm (and related
* algorithms) is:
*
* B. Schneier, Applied Cryptography: protocols, algorithms,
* and source code in C, John Wiley & Sons, 1994.
*
* Note that in that book's description of DES the lookups for the initial,
* pbox, and final permutations are inverted (this has been brought to the
* attention of the author). A list of errata for this book has been
* posted to the sci.crypt newsgroup by the author and is available for FTP.
*
* ARCHITECTURE ASSUMPTIONS:
* This code used to have some nasty ones, but these have been removed
* by now. The code requires a 32-bit integer type, though.
*/
#include <sys/types.h>
#include <string.h>
#ifdef TEST
#include <stdio.h>
#endif
#include "crypt_freesec.h"
#define _PASSWORD_EFMT1 '_'
static u_char IP[64] = {
58, 50, 42, 34, 26, 18, 10, 2, 60, 52, 44, 36, 28, 20, 12, 4,
62, 54, 46, 38, 30, 22, 14, 6, 64, 56, 48, 40, 32, 24, 16, 8,
57, 49, 41, 33, 25, 17, 9, 1, 59, 51, 43, 35, 27, 19, 11, 3,
61, 53, 45, 37, 29, 21, 13, 5, 63, 55, 47, 39, 31, 23, 15, 7
};
static u_char key_perm[56] = {
57, 49, 41, 33, 25, 17, 9, 1, 58, 50, 42, 34, 26, 18,
10, 2, 59, 51, 43, 35, 27, 19, 11, 3, 60, 52, 44, 36,
63, 55, 47, 39, 31, 23, 15, 7, 62, 54, 46, 38, 30, 22,
14, 6, 61, 53, 45, 37, 29, 21, 13, 5, 28, 20, 12, 4
};
static u_char key_shifts[16] = {
1, 1, 2, 2, 2, 2, 2, 2, 1, 2, 2, 2, 2, 2, 2, 1
};
static u_char comp_perm[48] = {
14, 17, 11, 24, 1, 5, 3, 28, 15, 6, 21, 10,
23, 19, 12, 4, 26, 8, 16, 7, 27, 20, 13, 2,
41, 52, 31, 37, 47, 55, 30, 40, 51, 45, 33, 48,
44, 49, 39, 56, 34, 53, 46, 42, 50, 36, 29, 32
};
/*
* No E box is used, as it's replaced by some ANDs, shifts, and ORs.
*/
static u_char sbox[8][64] = {
{
14, 4, 13, 1, 2, 15, 11, 8, 3, 10, 6, 12, 5, 9, 0, 7,
0, 15, 7, 4, 14, 2, 13, 1, 10, 6, 12, 11, 9, 5, 3, 8,
4, 1, 14, 8, 13, 6, 2, 11, 15, 12, 9, 7, 3, 10, 5, 0,
15, 12, 8, 2, 4, 9, 1, 7, 5, 11, 3, 14, 10, 0, 6, 13
},
{
15, 1, 8, 14, 6, 11, 3, 4, 9, 7, 2, 13, 12, 0, 5, 10,
3, 13, 4, 7, 15, 2, 8, 14, 12, 0, 1, 10, 6, 9, 11, 5,
0, 14, 7, 11, 10, 4, 13, 1, 5, 8, 12, 6, 9, 3, 2, 15,
13, 8, 10, 1, 3, 15, 4, 2, 11, 6, 7, 12, 0, 5, 14, 9
},
{
10, 0, 9, 14, 6, 3, 15, 5, 1, 13, 12, 7, 11, 4, 2, 8,
13, 7, 0, 9, 3, 4, 6, 10, 2, 8, 5, 14, 12, 11, 15, 1,
13, 6, 4, 9, 8, 15, 3, 0, 11, 1, 2, 12, 5, 10, 14, 7,
1, 10, 13, 0, 6, 9, 8, 7, 4, 15, 14, 3, 11, 5, 2, 12
},
{
7, 13, 14, 3, 0, 6, 9, 10, 1, 2, 8, 5, 11, 12, 4, 15,
13, 8, 11, 5, 6, 15, 0, 3, 4, 7, 2, 12, 1, 10, 14, 9,
10, 6, 9, 0, 12, 11, 7, 13, 15, 1, 3, 14, 5, 2, 8, 4,
3, 15, 0, 6, 10, 1, 13, 8, 9, 4, 5, 11, 12, 7, 2, 14
},
{
2, 12, 4, 1, 7, 10, 11, 6, 8, 5, 3, 15, 13, 0, 14, 9,
14, 11, 2, 12, 4, 7, 13, 1, 5, 0, 15, 10, 3, 9, 8, 6,
4, 2, 1, 11, 10, 13, 7, 8, 15, 9, 12, 5, 6, 3, 0, 14,
11, 8, 12, 7, 1, 14, 2, 13, 6, 15, 0, 9, 10, 4, 5, 3
},
{
12, 1, 10, 15, 9, 2, 6, 8, 0, 13, 3, 4, 14, 7, 5, 11,
10, 15, 4, 2, 7, 12, 9, 5, 6, 1, 13, 14, 0, 11, 3, 8,
9, 14, 15, 5, 2, 8, 12, 3, 7, 0, 4, 10, 1, 13, 11, 6,
4, 3, 2, 12, 9, 5, 15, 10, 11, 14, 1, 7, 6, 0, 8, 13
},
{
4, 11, 2, 14, 15, 0, 8, 13, 3, 12, 9, 7, 5, 10, 6, 1,
13, 0, 11, 7, 4, 9, 1, 10, 14, 3, 5, 12, 2, 15, 8, 6,
1, 4, 11, 13, 12, 3, 7, 14, 10, 15, 6, 8, 0, 5, 9, 2,
6, 11, 13, 8, 1, 4, 10, 7, 9, 5, 0, 15, 14, 2, 3, 12
},
{
13, 2, 8, 4, 6, 15, 11, 1, 10, 9, 3, 14, 5, 0, 12, 7,
1, 15, 13, 8, 10, 3, 7, 4, 12, 5, 6, 11, 0, 14, 9, 2,
7, 11, 4, 1, 9, 12, 14, 2, 0, 6, 10, 13, 15, 3, 5, 8,
2, 1, 14, 7, 4, 10, 8, 13, 15, 12, 9, 0, 3, 5, 6, 11
}
};
static u_char pbox[32] = {
16, 7, 20, 21, 29, 12, 28, 17, 1, 15, 23, 26, 5, 18, 31, 10,
2, 8, 24, 14, 32, 27, 3, 9, 19, 13, 30, 6, 22, 11, 4, 25
};
static u_int32_t bits32[32] =
{
0x80000000, 0x40000000, 0x20000000, 0x10000000,
0x08000000, 0x04000000, 0x02000000, 0x01000000,
0x00800000, 0x00400000, 0x00200000, 0x00100000,
0x00080000, 0x00040000, 0x00020000, 0x00010000,
0x00008000, 0x00004000, 0x00002000, 0x00001000,
0x00000800, 0x00000400, 0x00000200, 0x00000100,
0x00000080, 0x00000040, 0x00000020, 0x00000010,
0x00000008, 0x00000004, 0x00000002, 0x00000001
};
static u_char bits8[8] = { 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 };
static u_char ascii64[] =
"./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
/* 0000000000111111111122222222223333333333444444444455555555556666 */
/* 0123456789012345678901234567890123456789012345678901234567890123 */
static u_char m_sbox[4][4096];
static u_int32_t psbox[4][256];
static u_int32_t ip_maskl[8][256], ip_maskr[8][256];
static u_int32_t fp_maskl[8][256], fp_maskr[8][256];
static u_int32_t key_perm_maskl[8][128], key_perm_maskr[8][128];
static u_int32_t comp_maskl[8][128], comp_maskr[8][128];
/*
* We match the behavior of UFC-crypt on systems where "char" is signed by
* default (the majority), regardless of char's signedness on our system.
*/
static inline int
ascii_to_bin(char ch)
{
signed char sch = ch;
int retval;
retval = sch - '.';
if (sch >= 'A') {
retval = sch - ('A' - 12);
if (sch >= 'a')
retval = sch - ('a' - 38);
}
retval &= 0x3f;
return(retval);
}
/*
* When we choose to "support" invalid salts, nevertheless disallow those
* containing characters that would violate the passwd file format.
*/
static inline int
ascii_is_unsafe(char ch)
{
return !ch || ch == '\n' || ch == ':';
}
void
_crypt_extended_init(void)
{
int i, j, b, k, inbit, obit;
u_int32_t *p, *il, *ir, *fl, *fr;
u_int32_t *bits28, *bits24;
u_char inv_key_perm[64];
u_char inv_comp_perm[56];
u_char init_perm[64], final_perm[64];
u_char u_sbox[8][64];
u_char un_pbox[32];
bits24 = (bits28 = bits32 + 4) + 4;
/*
* Invert the S-boxes, reordering the input bits.
*/
for (i = 0; i < 8; i++)
for (j = 0; j < 64; j++) {
b = (j & 0x20) | ((j & 1) << 4) | ((j >> 1) & 0xf);
u_sbox[i][j] = sbox[i][b];
}
/*
* Convert the inverted S-boxes into 4 arrays of 8 bits.
* Each will handle 12 bits of the S-box input.
*/
for (b = 0; b < 4; b++)
for (i = 0; i < 64; i++)
for (j = 0; j < 64; j++)
m_sbox[b][(i << 6) | j] =
(u_sbox[(b << 1)][i] << 4) |
u_sbox[(b << 1) + 1][j];
/*
* Set up the initial & final permutations into a useful form, and
* initialise the inverted key permutation.
*/
for (i = 0; i < 64; i++) {
init_perm[final_perm[i] = IP[i] - 1] = i;
inv_key_perm[i] = 255;
}
/*
* Invert the key permutation and initialise the inverted key
* compression permutation.
*/
for (i = 0; i < 56; i++) {
inv_key_perm[key_perm[i] - 1] = i;
inv_comp_perm[i] = 255;
}
/*
* Invert the key compression permutation.
*/
for (i = 0; i < 48; i++) {
inv_comp_perm[comp_perm[i] - 1] = i;
}
/*
* Set up the OR-mask arrays for the initial and final permutations,
* and for the key initial and compression permutations.
*/
for (k = 0; k < 8; k++) {
for (i = 0; i < 256; i++) {
*(il = &ip_maskl[k][i]) = 0;
*(ir = &ip_maskr[k][i]) = 0;
*(fl = &fp_maskl[k][i]) = 0;
*(fr = &fp_maskr[k][i]) = 0;
for (j = 0; j < 8; j++) {
inbit = 8 * k + j;
if (i & bits8[j]) {
if ((obit = init_perm[inbit]) < 32)
*il |= bits32[obit];
else
*ir |= bits32[obit-32];
if ((obit = final_perm[inbit]) < 32)
*fl |= bits32[obit];
else
*fr |= bits32[obit - 32];
}
}
}
for (i = 0; i < 128; i++) {
*(il = &key_perm_maskl[k][i]) = 0;
*(ir = &key_perm_maskr[k][i]) = 0;
for (j = 0; j < 7; j++) {
inbit = 8 * k + j;
if (i & bits8[j + 1]) {
if ((obit = inv_key_perm[inbit]) == 255)
continue;
if (obit < 28)
*il |= bits28[obit];
else
*ir |= bits28[obit - 28];
}
}
*(il = &comp_maskl[k][i]) = 0;
*(ir = &comp_maskr[k][i]) = 0;
for (j = 0; j < 7; j++) {
inbit = 7 * k + j;
if (i & bits8[j + 1]) {
if ((obit=inv_comp_perm[inbit]) == 255)
continue;
if (obit < 24)
*il |= bits24[obit];
else
*ir |= bits24[obit - 24];
}
}
}
}
/*
* Invert the P-box permutation, and convert into OR-masks for
* handling the output of the S-box arrays setup above.
*/
for (i = 0; i < 32; i++)
un_pbox[pbox[i] - 1] = i;
for (b = 0; b < 4; b++)
for (i = 0; i < 256; i++) {
*(p = &psbox[b][i]) = 0;
for (j = 0; j < 8; j++) {
if (i & bits8[j])
*p |= bits32[un_pbox[8 * b + j]];
}
}
}
static void
des_init_local(struct _crypt_extended_data *data)
{
data->old_rawkey0 = data->old_rawkey1 = 0;
data->saltbits = 0;
data->old_salt = 0;
data->initialized = 1;
}
static void
setup_salt(u_int32_t salt, struct _crypt_extended_data *data)
{
u_int32_t obit, saltbit, saltbits;
int i;
if (salt == data->old_salt)
return;
data->old_salt = salt;
saltbits = 0;
saltbit = 1;
obit = 0x800000;
for (i = 0; i < 24; i++) {
if (salt & saltbit)
saltbits |= obit;
saltbit <<= 1;
obit >>= 1;
}
data->saltbits = saltbits;
}
static int
des_setkey(const char *key, struct _crypt_extended_data *data)
{
u_int32_t k0, k1, rawkey0, rawkey1;
int shifts, round;
rawkey0 =
(u_int32_t)(u_char)key[3] |
((u_int32_t)(u_char)key[2] << 8) |
((u_int32_t)(u_char)key[1] << 16) |
((u_int32_t)(u_char)key[0] << 24);
rawkey1 =
(u_int32_t)(u_char)key[7] |
((u_int32_t)(u_char)key[6] << 8) |
((u_int32_t)(u_char)key[5] << 16) |
((u_int32_t)(u_char)key[4] << 24);
if ((rawkey0 | rawkey1)
&& rawkey0 == data->old_rawkey0
&& rawkey1 == data->old_rawkey1) {
/*
* Already setup for this key.
* This optimisation fails on a zero key (which is weak and
* has bad parity anyway) in order to simplify the starting
* conditions.
*/
return(0);
}
data->old_rawkey0 = rawkey0;
data->old_rawkey1 = rawkey1;
/*
* Do key permutation and split into two 28-bit subkeys.
*/
k0 = key_perm_maskl[0][rawkey0 >> 25]
| key_perm_maskl[1][(rawkey0 >> 17) & 0x7f]
| key_perm_maskl[2][(rawkey0 >> 9) & 0x7f]
| key_perm_maskl[3][(rawkey0 >> 1) & 0x7f]
| key_perm_maskl[4][rawkey1 >> 25]
| key_perm_maskl[5][(rawkey1 >> 17) & 0x7f]
| key_perm_maskl[6][(rawkey1 >> 9) & 0x7f]
| key_perm_maskl[7][(rawkey1 >> 1) & 0x7f];
k1 = key_perm_maskr[0][rawkey0 >> 25]
| key_perm_maskr[1][(rawkey0 >> 17) & 0x7f]
| key_perm_maskr[2][(rawkey0 >> 9) & 0x7f]
| key_perm_maskr[3][(rawkey0 >> 1) & 0x7f]
| key_perm_maskr[4][rawkey1 >> 25]
| key_perm_maskr[5][(rawkey1 >> 17) & 0x7f]
| key_perm_maskr[6][(rawkey1 >> 9) & 0x7f]
| key_perm_maskr[7][(rawkey1 >> 1) & 0x7f];
/*
* Rotate subkeys and do compression permutation.
*/
shifts = 0;
for (round = 0; round < 16; round++) {
u_int32_t t0, t1;
shifts += key_shifts[round];
t0 = (k0 << shifts) | (k0 >> (28 - shifts));
t1 = (k1 << shifts) | (k1 >> (28 - shifts));
data->de_keysl[15 - round] =
data->en_keysl[round] = comp_maskl[0][(t0 >> 21) & 0x7f]
| comp_maskl[1][(t0 >> 14) & 0x7f]
| comp_maskl[2][(t0 >> 7) & 0x7f]
| comp_maskl[3][t0 & 0x7f]
| comp_maskl[4][(t1 >> 21) & 0x7f]
| comp_maskl[5][(t1 >> 14) & 0x7f]
| comp_maskl[6][(t1 >> 7) & 0x7f]
| comp_maskl[7][t1 & 0x7f];
data->de_keysr[15 - round] =
data->en_keysr[round] = comp_maskr[0][(t0 >> 21) & 0x7f]
| comp_maskr[1][(t0 >> 14) & 0x7f]
| comp_maskr[2][(t0 >> 7) & 0x7f]
| comp_maskr[3][t0 & 0x7f]
| comp_maskr[4][(t1 >> 21) & 0x7f]
| comp_maskr[5][(t1 >> 14) & 0x7f]
| comp_maskr[6][(t1 >> 7) & 0x7f]
| comp_maskr[7][t1 & 0x7f];
}
return(0);
}
static int
do_des(u_int32_t l_in, u_int32_t r_in, u_int32_t *l_out, u_int32_t *r_out,
int count, struct _crypt_extended_data *data)
{
/*
* l_in, r_in, l_out, and r_out are in pseudo-"big-endian" format.
*/
u_int32_t l, r, *kl, *kr, *kl1, *kr1;
u_int32_t f, r48l, r48r, saltbits;
int round;
if (count == 0) {
return(1);
} else if (count > 0) {
/*
* Encrypting
*/
kl1 = data->en_keysl;
kr1 = data->en_keysr;
} else {
/*
* Decrypting
*/
count = -count;
kl1 = data->de_keysl;
kr1 = data->de_keysr;
}
/*
* Do initial permutation (IP).
*/
l = ip_maskl[0][l_in >> 24]
| ip_maskl[1][(l_in >> 16) & 0xff]
| ip_maskl[2][(l_in >> 8) & 0xff]
| ip_maskl[3][l_in & 0xff]
| ip_maskl[4][r_in >> 24]
| ip_maskl[5][(r_in >> 16) & 0xff]
| ip_maskl[6][(r_in >> 8) & 0xff]
| ip_maskl[7][r_in & 0xff];
r = ip_maskr[0][l_in >> 24]
| ip_maskr[1][(l_in >> 16) & 0xff]
| ip_maskr[2][(l_in >> 8) & 0xff]
| ip_maskr[3][l_in & 0xff]
| ip_maskr[4][r_in >> 24]
| ip_maskr[5][(r_in >> 16) & 0xff]
| ip_maskr[6][(r_in >> 8) & 0xff]
| ip_maskr[7][r_in & 0xff];
saltbits = data->saltbits;
while (count--) {
/*
* Do each round.
*/
kl = kl1;
kr = kr1;
round = 16;
while (round--) {
/*
* Expand R to 48 bits (simulate the E-box).
*/
r48l = ((r & 0x00000001) << 23)
| ((r & 0xf8000000) >> 9)
| ((r & 0x1f800000) >> 11)
| ((r & 0x01f80000) >> 13)
| ((r & 0x001f8000) >> 15);
r48r = ((r & 0x0001f800) << 7)
| ((r & 0x00001f80) << 5)
| ((r & 0x000001f8) << 3)
| ((r & 0x0000001f) << 1)
| ((r & 0x80000000) >> 31);
/*
* Do salting for crypt() and friends, and
* XOR with the permuted key.
*/
f = (r48l ^ r48r) & saltbits;
r48l ^= f ^ *kl++;
r48r ^= f ^ *kr++;
/*
* Do sbox lookups (which shrink it back to 32 bits)
* and do the pbox permutation at the same time.
*/
f = psbox[0][m_sbox[0][r48l >> 12]]
| psbox[1][m_sbox[1][r48l & 0xfff]]
| psbox[2][m_sbox[2][r48r >> 12]]
| psbox[3][m_sbox[3][r48r & 0xfff]];
/*
* Now that we've permuted things, complete f().
*/
f ^= l;
l = r;
r = f;
}
r = l;
l = f;
}
/*
* Do final permutation (inverse of IP).
*/
*l_out = fp_maskl[0][l >> 24]
| fp_maskl[1][(l >> 16) & 0xff]
| fp_maskl[2][(l >> 8) & 0xff]
| fp_maskl[3][l & 0xff]
| fp_maskl[4][r >> 24]
| fp_maskl[5][(r >> 16) & 0xff]
| fp_maskl[6][(r >> 8) & 0xff]
| fp_maskl[7][r & 0xff];
*r_out = fp_maskr[0][l >> 24]
| fp_maskr[1][(l >> 16) & 0xff]
| fp_maskr[2][(l >> 8) & 0xff]
| fp_maskr[3][l & 0xff]
| fp_maskr[4][r >> 24]
| fp_maskr[5][(r >> 16) & 0xff]
| fp_maskr[6][(r >> 8) & 0xff]
| fp_maskr[7][r & 0xff];
return(0);
}
static int
des_cipher(const char *in, char *out, u_int32_t salt, int count,
struct _crypt_extended_data *data)
{
u_int32_t l_out, r_out, rawl, rawr;
int retval;
setup_salt(salt, data);
rawl =
(u_int32_t)(u_char)in[3] |
((u_int32_t)(u_char)in[2] << 8) |
((u_int32_t)(u_char)in[1] << 16) |
((u_int32_t)(u_char)in[0] << 24);
rawr =
(u_int32_t)(u_char)in[7] |
((u_int32_t)(u_char)in[6] << 8) |
((u_int32_t)(u_char)in[5] << 16) |
((u_int32_t)(u_char)in[4] << 24);
retval = do_des(rawl, rawr, &l_out, &r_out, count, data);
out[0] = l_out >> 24;
out[1] = l_out >> 16;
out[2] = l_out >> 8;
out[3] = l_out;
out[4] = r_out >> 24;
out[5] = r_out >> 16;
out[6] = r_out >> 8;
out[7] = r_out;
return(retval);
}
char *
_crypt_extended_r(const char *key, const char *setting,
struct _crypt_extended_data *data)
{
int i;
u_int32_t count, salt, l, r0, r1, keybuf[2];
u_char *p, *q;
if (!data->initialized)
des_init_local(data);
/*
* Copy the key, shifting each character up by one bit
* and padding with zeros.
*/
q = (u_char *) keybuf;
while (q - (u_char *) keybuf < sizeof(keybuf)) {
*q++ = *key << 1;
if (*key)
key++;
}
if (des_setkey((u_char *) keybuf, data))
return(NULL);
if (*setting == _PASSWORD_EFMT1) {
/*
* "new"-style:
* setting - underscore, 4 chars of count, 4 chars of salt
* key - unlimited characters
*/
for (i = 1, count = 0; i < 5; i++) {
int value = ascii_to_bin(setting[i]);
if (ascii64[value] != setting[i])
return(NULL);
count |= value << (i - 1) * 6;
}
if (!count)
return(NULL);
for (i = 5, salt = 0; i < 9; i++) {
int value = ascii_to_bin(setting[i]);
if (ascii64[value] != setting[i])
return(NULL);
salt |= value << (i - 5) * 6;
}
while (*key) {
/*
* Encrypt the key with itself.
*/
if (des_cipher((u_char *) keybuf, (u_char *) keybuf,
0, 1, data))
return(NULL);
/*
* And XOR with the next 8 characters of the key.
*/
q = (u_char *) keybuf;
while (q - (u_char *) keybuf < sizeof(keybuf) && *key)
*q++ ^= *key++ << 1;
if (des_setkey((u_char *) keybuf, data))
return(NULL);
}
memcpy(data->output, setting, 9);
data->output[9] = '\0';
p = (u_char *) data->output + 9;
} else {
/*
* "old"-style:
* setting - 2 chars of salt
* key - up to 8 characters
*/
count = 25;
if (ascii_is_unsafe(setting[0]) || ascii_is_unsafe(setting[1]))
return(NULL);
salt = (ascii_to_bin(setting[1]) << 6)
| ascii_to_bin(setting[0]);
data->output[0] = setting[0];
data->output[1] = setting[1];
p = (u_char *) data->output + 2;
}
setup_salt(salt, data);
/*
* Do it.
*/
if (do_des(0, 0, &r0, &r1, count, data))
return(NULL);
/*
* Now encode the result...
*/
l = (r0 >> 8);
*p++ = ascii64[(l >> 18) & 0x3f];
*p++ = ascii64[(l >> 12) & 0x3f];
*p++ = ascii64[(l >> 6) & 0x3f];
*p++ = ascii64[l & 0x3f];
l = (r0 << 16) | ((r1 >> 16) & 0xffff);
*p++ = ascii64[(l >> 18) & 0x3f];
*p++ = ascii64[(l >> 12) & 0x3f];
*p++ = ascii64[(l >> 6) & 0x3f];
*p++ = ascii64[l & 0x3f];
l = r1 << 2;
*p++ = ascii64[(l >> 12) & 0x3f];
*p++ = ascii64[(l >> 6) & 0x3f];
*p++ = ascii64[l & 0x3f];
*p = 0;
return(data->output);
}
#ifdef TEST
static char *
_crypt_extended(const char *key, const char *setting)
{
static int initialized = 0;
static struct _crypt_extended_data data;
if (!initialized) {
_crypt_extended_init();
initialized = 1;
data.initialized = 0;
}
return _crypt_extended_r(key, setting, &data);
}
#define crypt _crypt_extended
static struct {
char *hash;
char *pw;
} tests[] = {
/* "new"-style */
{"_J9..CCCCXBrJUJV154M", "U*U*U*U*"},
{"_J9..CCCCXUhOBTXzaiE", "U*U***U"},
{"_J9..CCCC4gQ.mB/PffM", "U*U***U*"},
{"_J9..XXXXvlzQGqpPPdk", "*U*U*U*U"},
{"_J9..XXXXsqM/YSSP..Y", "*U*U*U*U*"},
{"_J9..XXXXVL7qJCnku0I", "*U*U*U*U*U*U*U*U"},
{"_J9..XXXXAj8cFbP5scI", "*U*U*U*U*U*U*U*U*"},
{"_J9..SDizh.vll5VED9g", "ab1234567"},
{"_J9..SDizRjWQ/zePPHc", "cr1234567"},
{"_J9..SDizxmRI1GjnQuE", "zxyDPWgydbQjgq"},
{"_K9..SaltNrQgIYUAeoY", "726 even"},
{"_J9..SDSD5YGyRCr4W4c", ""},
{"_01234567IBjxKliXXRQ", "\xc3\x80" "1234abcd"},
{"_012345678OSGpGQRVHA", "\xc3\x80" "9234abcd"},
/* "old"-style, valid salts */
{"CCNf8Sbh3HDfQ", "U*U*U*U*"},
{"CCX.K.MFy4Ois", "U*U***U"},
{"CC4rMpbg9AMZ.", "U*U***U*"},
{"XXxzOu6maQKqQ", "*U*U*U*U"},
{"SDbsugeBiC58A", ""},
{"./xZjzHv5vzVE", "password"},
{"0A2hXM1rXbYgo", "password"},
{"A9RXdR23Y.cY6", "password"},
{"ZziFATVXHo2.6", "password"},
{"zZDDIZ0NOlPzw", "password"},
{"99PxawtsTfX56", "\xc3\x80" "1234abcd"},
{"99jcVcGxUZOWk", "\xc3\x80" "9234abcd"},
/* "old"-style, "reasonable" invalid salts, UFC-crypt behavior expected */
{"\001\002wyd0KZo65Jo", "password"},
{"a_C10Dk/ExaG.", "password"},
{"~\377.5OTsRVjwLo", "password"},
/* The below are erroneous inputs, so NULL return is expected/required */
{"", ""}, /* no salt */
{" ", ""}, /* setting string is too short */
{"a:", ""}, /* unsafe character */
{"\na", ""}, /* unsafe character */
{"_/......", ""}, /* setting string is too short for its type */
{"_........", ""}, /* zero iteration count */
{"_/!......", ""}, /* invalid character in count */
{"_/......!", ""}, /* invalid character in salt */
{NULL}
};
int main(void)
{
int i;
for (i = 0; tests[i].hash; i++) {
char *hash = crypt(tests[i].pw, tests[i].hash);
if (!hash && strlen(tests[i].hash) < 13)
continue; /* expected failure */
if (!strcmp(hash, tests[i].hash))
continue; /* expected success */
puts("FAILED");
return 1;
}
puts("PASSED");
return 0;
}
#endif

View file

@ -1,55 +0,0 @@
/*
* The following notice applies to this header file (only):
*
* Copyright (c) 2002,2010 Solar Designer <solar at openwall.com>
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted.
*/
#ifndef _CRYPT_FREESEC_H
#define _CRYPT_FREESEC_H
struct _crypt_extended_data {
int initialized;
u_int32_t saltbits;
u_int32_t old_salt;
u_int32_t en_keysl[16], en_keysr[16];
u_int32_t de_keysl[16], de_keysr[16];
u_int32_t old_rawkey0, old_rawkey1;
char output[21];
};
/*
* _crypt_extended_init() must be called explicitly before first use of
* _crypt_extended_r(). Strictly speaking, _crypt_extended_init() is not
* reentrant. All it does is initialize some global variables to constant
* values, so it is unlikely that anything would go wrong if this is done
* multiple times in parallel, but correct behavior in that case is not
* guaranteed (e.g., things may go wrong if a given CPU architecture can't
* operate on 32-bit quantities natively, requiring read-modify-write
* instruction sequences operating on larger quantities and thus affecting
* nearby array elements).
*
* Before first use of the data structure, its "initialized" field must be
* set to 0. This is compatible with the requirement of some other crypt_r()
* implementations requiring the entire data structure to be initialized
* with all zero bytes, so that approach may be applied instead (e.g., this
* may be required from the callers of a wrapper function).
*
* _crypt_extended_r() returns NULL on error. Although modern standards say
* that crypt(3) does in fact return NULL on error, many applications do not
* expect that. Thus, it is recommended that a crypt(3)-like wrapper function
* translate these NULL returns into strings guaranteed to be different from
* the "setting" string, too short for matching a valid password hash, and not
* containing any characters that would be special for the passwd file format.
* Specifically, such a wrapper function may return "*0" on error as long as
* the "setting" string does not start with "*0", or "*1" otherwise.
*/
void _crypt_extended_init(void);
char *_crypt_extended_r(const char *key, const char *setting,
struct _crypt_extended_data *data);
#endif

View file

@ -1,22 +0,0 @@
From e818d7d5034bd33373aebf570402abdb8e434f6e Mon Sep 17 00:00:00 2001
From: Jakub Jelinek <jakub@redhat.com>
Date: Sat, 19 Mar 2005 20:18:00 +0000
Subject: [PATCH] Updated to fedora-glibc-20050319T1907
---
debug/tst-chk1.c | 234 ++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 229 insertions(+), 5 deletions(-)
diff --git a/debug/tst-chk1.c b/debug/tst-chk1.c
--- a/debug/tst-chk1.c
+++ b/debug/tst-chk1.c
@@ -16,6 +16,9 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+/* Hack: make sure GCC doesn't know __chk_fail () will not return. */
+#define __noreturn__
+
#include <assert.h>
#include <fcntl.h>
#include <locale.h>

View file

@ -1,11 +0,0 @@
--- crypt/x86.S 2011-07-16 11:09:42.000000000 -0400
+++ crypt/x86.S.oden 2011-11-25 04:07:23.574489383 -0500
@@ -42,7 +42,7 @@
#define DO_ALIGN(log) .align (1 << (log))
#endif
-#define BF_FRAME 0x200
+#define BF_FRAME 0x400
#define ctx %esp
#define BF_ptr (ctx)

View file

@ -1,31 +0,0 @@
--- glibc-2.23/crypt/crypt-entry.c.relocateFcrypt~ 2016-02-18 21:10:00.072228405 +0100
+++ glibc-2.23/crypt/crypt-entry.c 2016-02-18 21:10:58.203506144 +0100
@@ -168,18 +168,3 @@ crypt (const char *key, const char *salt
return __crypt_r (key, salt, &_ufc_foobar);
}
#endif
-
-
-/*
- * To make fcrypt users happy.
- * They don't need to call init_des.
- */
-#ifdef _LIBC
-weak_alias (crypt, fcrypt)
-#else
-char *
-__fcrypt (const char *key, const char *salt)
-{
- return crypt (key, salt);
-}
-#endif
--- glibc-2.23/crypt/wrapper.c.relocateFcrypt~ 2016-02-18 21:10:00.071228400 +0100
+++ glibc-2.23/crypt/wrapper.c 2016-02-18 21:10:00.072228405 +0100
@@ -325,7 +325,6 @@ 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
#ifdef TEST

View file

@ -1,95 +0,0 @@
--- glibc-2.18/sysdeps/i386/dl-hwcapinfo.h.hwcap~ 2013-08-17 14:18:10.909311979 +0200
+++ glibc-2.18/sysdeps/i386/dl-hwcapinfo.h 2013-08-17 14:18:10.909311979 +0200
@@ -0,0 +1,53 @@
+/* i386 version of processor capability definitions.
+ Copyright (C) 1998, 2000, 2003, 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@cygnus.com>, 1998.
+
+ 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, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _DL_HWCAPINFO_H
+#define _DL_HWCAPINFO_H 1
+
+enum
+{
+ HWCAP_I386_FPU = 1 << 0,
+ HWCAP_I386_VME = 1 << 1,
+ HWCAP_I386_DE = 1 << 2,
+ HWCAP_I386_PSE = 1 << 3,
+ HWCAP_I386_TSC = 1 << 4,
+ HWCAP_I386_MSR = 1 << 5,
+ HWCAP_I386_PAE = 1 << 6,
+ HWCAP_I386_MCE = 1 << 7,
+ HWCAP_I386_CX8 = 1 << 8,
+ HWCAP_I386_APIC = 1 << 9,
+ HWCAP_I386_SEP = 1 << 11,
+ HWCAP_I386_MTRR = 1 << 12,
+ HWCAP_I386_PGE = 1 << 13,
+ HWCAP_I386_MCA = 1 << 14,
+ HWCAP_I386_CMOV = 1 << 15,
+ HWCAP_I386_FCMOV = 1 << 16,
+ HWCAP_I386_MMX = 1 << 23,
+ HWCAP_I386_OSFXSR = 1 << 24,
+ HWCAP_I386_XMM = 1 << 25,
+ HWCAP_I386_XMM2 = 1 << 26,
+ HWCAP_I386_AMD3D = 1 << 31,
+
+ /* XXX Which others to add here? */
+ HWCAP_IMPORTANT = (HWCAP_I386_XMM2)
+
+};
+
+#endif /* dl-hwcapinfo.h */
--- glibc-2.18/sysdeps/i386/dl-procinfo.h.hwcap~ 2013-08-17 14:18:10.909311979 +0200
+++ glibc-2.18/sysdeps/i386/dl-procinfo.h 2013-08-17 14:26:50.222819666 +0200
@@ -31,34 +31,8 @@
#define _DL_HWCAP_PLATFORM (((1ULL << _DL_PLATFORMS_COUNT) - 1) \
<< _DL_FIRST_PLATFORM)
-enum
-{
- HWCAP_I386_FPU = 1 << 0,
- HWCAP_I386_VME = 1 << 1,
- HWCAP_I386_DE = 1 << 2,
- HWCAP_I386_PSE = 1 << 3,
- HWCAP_I386_TSC = 1 << 4,
- HWCAP_I386_MSR = 1 << 5,
- HWCAP_I386_PAE = 1 << 6,
- HWCAP_I386_MCE = 1 << 7,
- HWCAP_I386_CX8 = 1 << 8,
- HWCAP_I386_APIC = 1 << 9,
- HWCAP_I386_SEP = 1 << 11,
- HWCAP_I386_MTRR = 1 << 12,
- HWCAP_I386_PGE = 1 << 13,
- HWCAP_I386_MCA = 1 << 14,
- HWCAP_I386_CMOV = 1 << 15,
- HWCAP_I386_FCMOV = 1 << 16,
- HWCAP_I386_MMX = 1 << 23,
- HWCAP_I386_OSFXSR = 1 << 24,
- HWCAP_I386_XMM = 1 << 25,
- HWCAP_I386_XMM2 = 1 << 26,
- HWCAP_I386_AMD3D = 1 << 31,
-
- /* XXX Which others to add here? */
- HWCAP_IMPORTANT = (HWCAP_I386_XMM2)
-
-};
+/* Get HWCAP definitions */
+#include <sysdeps/i386/dl-hwcapinfo.h>
/* We cannot provide a general printing function. */
#define _dl_procinfo(type, word) -1

View file

@ -1,25 +0,0 @@
--- glibc-2.24/sysdeps/i386/dl-machine.h.0072~ 2016-08-02 04:01:36.000000000 +0200
+++ glibc-2.24/sysdeps/i386/dl-machine.h 2016-08-17 16:58:27.711996583 +0200
@@ -226,6 +226,9 @@ _dl_start_user:\n\
Prelinked libraries may use Elf32_Rela though. */
#define ELF_MACHINE_PLT_REL 1
+/* We need the definition of HWCAP_I386_CMOV. */
+#include <sysdeps/i386/dl-hwcapinfo.h>
+
/* We define an initialization functions. This is called very early in
_dl_sysdep_start. */
#define DL_PLATFORM_INIT dl_platform_init ()
@@ -241,6 +244,12 @@ dl_platform_init (void)
/* init_cpu_features has been called early from __libc_start_main in
static executable. */
init_cpu_features (&GLRO(dl_x86_cpu_features));
+
+ if (GLRO(dl_platform) != NULL
+ && GLRO(dl_platform)[1] >= '6' && (GLRO(dl_hwcap) & HWCAP_I386_CMOV) == 0)
+ /* Avoid i686 compiled libraries to be loaded if the host doesn't
+ support CMOV instructions. */
+ GLRO(dl_platform) = "i586";
#endif
}

View file

@ -1,18 +1,11 @@
localedef --add-to-archive doesn't follow symbolic links, thus if you have any
locale with symlinked files to save disk space, for example:
/usr/share/locale/pt_BR/LC_CTYPE -> ../ISO-8859-1/LC_CTYPE
"localedef --add-to-archive /usr/share/locale/pt_BR" will not work, because
current locarchive.c code doesn't consider symlink case.
diff -p -up glibc-2.11.1/locale/programs/locarchive.c.orig glibc-2.11.1/locale/programs/locarchive.c
--- glibc-2.11.1/locale/programs/locarchive.c.orig 2010-04-08 14:10:46.515770746 -0300
+++ glibc-2.11.1/locale/programs/locarchive.c 2010-04-08 14:11:55.587520585 -0300
@@ -1323,7 +1323,7 @@ add_locales_to_archive (nlist, list, rep
--- glibc-2.27/locale/programs/locarchive.c.0100~ 2018-02-02 20:28:32.043266608 +0100
+++ glibc-2.27/locale/programs/locarchive.c 2018-02-02 20:29:20.894352169 +0100
@@ -1391,7 +1391,7 @@ add_locales_to_archive (size_t nlist, ch
{
char fullname[fnamelen + 2 * strlen (d->d_name) + 7];
#ifdef _DIRENT_HAVE_D_TYPE
- if (d_type == DT_UNKNOWN)
+ if (d_type == DT_UNKNOWN || d_type == DT_LNK)
#endif
{
strcpy (stpcpy (stpcpy (fullname, fname), "/"),
d->d_name);

View file

@ -1,56 +0,0 @@
--- glibc-2.23/crypt/crypt-entry.c.owlCrypt~ 2016-02-18 18:54:00.000000000 +0100
+++ glibc-2.23/crypt/crypt-entry.c 2016-02-18 21:09:26.589068442 +0100
@@ -71,8 +71,8 @@ extern struct crypt_data _ufc_foobar;
*/
char *
-__crypt_r (const char *key, const char *salt,
- struct crypt_data * __restrict data)
+__des_crypt_r (const char *key, const char *salt,
+ struct crypt_data * __restrict data)
{
ufc_long res[4];
char ktab[9];
@@ -143,6 +143,7 @@ __crypt_r (const char *key, const char *
_ufc_output_conversion_r (res[0], res[1], salt, data);
return data->crypt_3_buf;
}
+#if 0
weak_alias (__crypt_r, crypt_r)
char *
@@ -166,6 +167,7 @@ crypt (const char *key, const char *salt
return __crypt_r (key, salt, &_ufc_foobar);
}
+#endif
/*
--- glibc-2.23/crypt/Makefile.owlCrypt~ 2016-02-18 18:54:00.000000000 +0100
+++ glibc-2.23/crypt/Makefile 2016-02-18 21:08:03.819673066 +0100
@@ -22,13 +22,13 @@ subdir := crypt
include ../Makeconfig
-headers := crypt.h
+headers := crypt.h gnu-crypt.h ow-crypt.h
extra-libs := libcrypt
extra-libs-others := $(extra-libs)
libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
- crypt_util
+ crypt_util crypt_blowfish x86 crypt_gensalt wrapper
tests := cert md5c-test sha256c-test sha512c-test badsalttest
--- glibc-2.23/crypt/Versions.owlCrypt~ 2016-02-18 18:54:00.000000000 +0100
+++ glibc-2.23/crypt/Versions 2016-02-18 21:08:03.819673066 +0100
@@ -1,5 +1,6 @@
libcrypt {
GLIBC_2.0 {
crypt; crypt_r; encrypt; encrypt_r; fcrypt; setkey; setkey_r;
+ crypt_rn; crypt_ra; crypt_gensalt; crypt_gensalt_rn; crypt_gensalt_ra;
}
}

View file

@ -1,125 +0,0 @@
--- glibc-2.18/crypt/Makefile.freesec~ 2013-08-17 14:40:57.281229979 +0200
+++ glibc-2.18/crypt/Makefile 2013-08-17 14:41:29.929821815 +0200
@@ -26,7 +26,7 @@ extra-libs := libcrypt
extra-libs-others := $(extra-libs)
libcrypt-routines := crypt-entry md5-crypt sha256-crypt sha512-crypt crypt \
- crypt_util crypt_blowfish x86 crypt_gensalt wrapper
+ crypt_util crypt_blowfish x86 crypt_gensalt crypt_freesec wrapper
tests := cert md5c-test sha256c-test sha512c-test badsalttest
--- glibc-2.18/crypt/wrapper.c.freesec~ 2011-07-16 17:07:22.000000000 +0200
+++ glibc-2.18/crypt/wrapper.c 2013-08-17 14:40:57.282229966 +0200
@@ -103,32 +103,72 @@ static char *_crypt_retval_magic(char *r
* its initialization code. Thus, it is important that our multiple hashing
* algorithms either don't conflict with each other in their use of the
* data area or reset the initialized field themselves whenever required.
- * Currently, the hashing algorithms simply have no conflicts: the first
- * field of struct crypt_data is the 128-byte large DES key schedule which
- * __des_crypt_r() calculates each time it is called while the two other
- * hashing algorithms use less than 128 bytes of the data area.
+ * Currently, three of the four supported hashing algorithms simply have no
+ * conflicts: the first field of struct crypt_data is the 128-byte large
+ * DES key schedule which __des_crypt_r() calculates each time it is called
+ * while two other hashing algorithms use less than 128 bytes of the data
+ * area.
*/
+#include "crypt_freesec.h"
+
+#include <signal.h>
+#include <libc-lock.h>
+
+__libc_lock_define_initialized (static, _crypt_extended_init_lock)
+
+static void _crypt_extended_init_r(void)
+{
+ static volatile sig_atomic_t initialized = 0;
+
+ if (initialized) return;
+
+ __libc_lock_lock(_crypt_extended_init_lock);
+ if (!initialized) {
+ _crypt_extended_init();
+ initialized = 1;
+ }
+ __libc_lock_unlock(_crypt_extended_init_lock);
+}
+
char *__crypt_rn(__const char *key, __const char *setting,
void *data, int size)
{
+ char *retval;
+
if (setting[0] == '$' && setting[1] == '2')
return _crypt_blowfish_rn(key, setting, (char *)data, size);
if (setting[0] == '$' && setting[1] == '1')
return __md5_crypt_r(key, setting, (char *)data, size);
- if (setting[0] == '$' || setting[0] == '_') {
- __set_errno(EINVAL);
- return NULL;
- }
+ if (setting[0] == '$') goto out_einval;
+ if (setting[0] == '_') {
+ if (size < sizeof(struct _crypt_extended_data)) goto out_erange;
+ _crypt_extended_init_r();
+ ((struct _crypt_extended_data *)data)->initialized = 0;
+ if (size >= sizeof(struct crypt_data))
+ ((struct crypt_data *)data)->initialized = 0;
+ retval = _crypt_extended_r(key, setting,
+ (struct _crypt_extended_data *)data);
+ if (!retval) goto out_einval;
+ return retval;
+ }
if (size >= sizeof(struct crypt_data))
return __des_crypt_r(key, setting, (struct crypt_data *)data);
+
+out_erange:
__set_errno(ERANGE);
return NULL;
+
+out_einval:
+ __set_errno(EINVAL);
+ return NULL;
}
char *__crypt_ra(__const char *key, __const char *setting,
void **data, int *size)
{
+ char *retval;
+
if (setting[0] == '$' && setting[1] == '2') {
if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
return NULL;
@@ -139,13 +179,27 @@ char *__crypt_ra(__const char *key, __co
return NULL;
return __md5_crypt_r(key, setting, (char *)*data, *size);
}
- if (setting[0] == '$' || setting[0] == '_') {
- __set_errno(EINVAL);
- return NULL;
+ if (setting[0] == '$') goto out_einval;
+ if (setting[0] == '_') {
+ if (_crypt_data_alloc(data, size,
+ sizeof(struct _crypt_extended_data)))
+ return NULL;
+ _crypt_extended_init_r();
+ ((struct _crypt_extended_data *)*data)->initialized = 0;
+ if (*size >= sizeof(struct crypt_data))
+ ((struct crypt_data *)*data)->initialized = 0;
+ retval = _crypt_extended_r(key, setting,
+ (struct _crypt_extended_data *)*data);
+ if (!retval) goto out_einval;
+ return retval;
}
if (_crypt_data_alloc(data, size, sizeof(struct crypt_data)))
return NULL;
return __des_crypt_r(key, setting, (struct crypt_data *)*data);
+
+out_einval:
+ __set_errno(EINVAL);
+ return NULL;
}
char *__crypt_r(__const char *key, __const char *setting,

View file

@ -1,151 +0,0 @@
diff -Naurp glibc-2.14-121-g5551a7b/crypt/crypt_gensalt.c glibc-2.14-121-g5551a7b.oden/crypt/crypt_gensalt.c
--- glibc-2.14-121-g5551a7b/crypt/crypt_gensalt.c 2011-07-16 11:06:53.000000000 -0400
+++ glibc-2.14-121-g5551a7b.oden/crypt/crypt_gensalt.c 2011-11-25 04:08:39.264489146 -0500
@@ -122,3 +122,78 @@ char *_crypt_gensalt_md5_rn(const char *
return output;
}
+
+char *_crypt_gensalt_sha256c_rn(unsigned long count,
+ const char *input, int size, char *output, int output_size)
+{
+ unsigned long value;
+
+ if (size < 3 || output_size < 3 + 4 + 1 || (count && count != 1000)) {
+ if (output_size > 0) output[0] = '\0';
+ __set_errno((output_size < 3 + 4 + 1) ? ERANGE : EINVAL);
+ return NULL;
+ }
+
+ output[0] = '$';
+ output[1] = '5';
+ output[2] = '$';
+ value = (unsigned long)(unsigned char)input[0] |
+ ((unsigned long)(unsigned char)input[1] << 8) |
+ ((unsigned long)(unsigned char)input[2] << 16);
+ output[3] = _crypt_itoa64[value & 0x3f];
+ output[4] = _crypt_itoa64[(value >> 6) & 0x3f];
+ output[5] = _crypt_itoa64[(value >> 12) & 0x3f];
+ output[6] = _crypt_itoa64[(value >> 18) & 0x3f];
+ output[7] = '\0';
+
+ if (size >= 6 && output_size >= 3 + 4 + 4 + 1) {
+ value = (unsigned long)(unsigned char)input[3] |
+ ((unsigned long)(unsigned char)input[4] << 8) |
+ ((unsigned long)(unsigned char)input[5] << 16);
+ output[7] = _crypt_itoa64[value & 0x3f];
+ output[8] = _crypt_itoa64[(value >> 6) & 0x3f];
+ output[9] = _crypt_itoa64[(value >> 12) & 0x3f];
+ output[10] = _crypt_itoa64[(value >> 18) & 0x3f];
+ output[11] = '\0';
+ }
+
+ return output;
+}
+
+
+char *_crypt_gensalt_sha512c_rn(unsigned long count,
+ const char *input, int size, char *output, int output_size)
+{
+ unsigned long value;
+
+ if (size < 3 || output_size < 3 + 4 + 1 || (count && count != 1000)) {
+ if (output_size > 0) output[0] = '\0';
+ __set_errno((output_size < 3 + 4 + 1) ? ERANGE : EINVAL);
+ return NULL;
+ }
+
+ output[0] = '$';
+ output[1] = '6';
+ output[2] = '$';
+ value = (unsigned long)(unsigned char)input[0] |
+ ((unsigned long)(unsigned char)input[1] << 8) |
+ ((unsigned long)(unsigned char)input[2] << 16);
+ output[3] = _crypt_itoa64[value & 0x3f];
+ output[4] = _crypt_itoa64[(value >> 6) & 0x3f];
+ output[5] = _crypt_itoa64[(value >> 12) & 0x3f];
+ output[6] = _crypt_itoa64[(value >> 18) & 0x3f];
+ output[7] = '\0';
+
+ if (size >= 6 && output_size >= 3 + 4 + 4 + 1) {
+ value = (unsigned long)(unsigned char)input[3] |
+ ((unsigned long)(unsigned char)input[4] << 8) |
+ ((unsigned long)(unsigned char)input[5] << 16);
+ output[7] = _crypt_itoa64[value & 0x3f];
+ output[8] = _crypt_itoa64[(value >> 6) & 0x3f];
+ output[9] = _crypt_itoa64[(value >> 12) & 0x3f];
+ output[10] = _crypt_itoa64[(value >> 18) & 0x3f];
+ output[11] = '\0';
+ }
+
+ return output;
+}
diff -Naurp glibc-2.14-121-g5551a7b/crypt/crypt_gensalt.h glibc-2.14-121-g5551a7b.oden/crypt/crypt_gensalt.h
--- glibc-2.14-121-g5551a7b/crypt/crypt_gensalt.h 2011-07-16 10:58:39.000000000 -0400
+++ glibc-2.14-121-g5551a7b.oden/crypt/crypt_gensalt.h 2011-11-25 04:13:34.984489216 -0500
@@ -26,5 +26,8 @@ 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_sha256c_rn(unsigned long count,
+ const char *input, int size, char *output, int output_size);
+extern char *_crypt_gensalt_sha512c_rn(unsigned long count,
+ const char *input, int size, char *output, int output_size);
#endif
diff -Naurp glibc-2.14-121-g5551a7b/crypt/wrapper.c glibc-2.14-121-g5551a7b.oden/crypt/wrapper.c
--- glibc-2.14-121-g5551a7b/crypt/wrapper.c 2011-11-25 04:08:23.654489356 -0500
+++ glibc-2.14-121-g5551a7b.oden/crypt/wrapper.c 2011-11-25 04:08:39.264489146 -0500
@@ -55,6 +55,11 @@ extern char *__md5_crypt_r(const char *k
extern char *__des_crypt_r(const char *key, const char *salt,
struct crypt_data *data);
extern struct crypt_data _ufc_foobar;
+/* support for sha256-crypt and sha512-crypt */
+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);
#endif
static int _crypt_data_alloc(void **data, int *size, int need)
@@ -140,6 +145,10 @@ char *__crypt_rn(__const char *key, __co
return _crypt_blowfish_rn(key, setting, (char *)data, size);
if (setting[0] == '$' && setting[1] == '1')
return __md5_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] == '6')
+ return __sha512_crypt_r(key, setting, (char *)data, size);
if (setting[0] == '$') goto out_einval;
if (setting[0] == '_') {
if (size < sizeof(struct _crypt_extended_data)) goto out_erange;
@@ -179,6 +188,16 @@ char *__crypt_ra(__const char *key, __co
return NULL;
return __md5_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] == '6') {
+ if (_crypt_data_alloc(data, size, CRYPT_OUTPUT_SIZE))
+ return NULL;
+ return __sha512_crypt_r(key, setting, (char *)*data, *size);
+ }
if (setting[0] == '$') goto out_einval;
if (setting[0] == '_') {
if (_crypt_data_alloc(data, size,
@@ -270,6 +289,12 @@ char *__crypt_gensalt_rn(const char *pre
if (!strncmp(prefix, "$1$", 3))
use = _crypt_gensalt_md5_rn;
else
+ if (!strncmp(prefix, "$5$", 3))
+ use = _crypt_gensalt_sha256c_rn;
+ else
+ if (!strncmp(prefix, "$6$", 3))
+ use = _crypt_gensalt_sha512c_rn;
+ else
if (prefix[0] == '_')
use = _crypt_gensalt_extended_rn;
else

View file

@ -1,11 +0,0 @@
--- glibc-2.24/scripts/check-local-headers.sh.biarch~ 2016-08-17 16:52:14.092668284 +0200
+++ glibc-2.24/scripts/check-local-headers.sh 2016-08-17 16:55:02.911984338 +0200
@@ -33,7 +33,7 @@ exec ${AWK} -v includedir="$includedir"
BEGIN {
status = 0
exclude = "^" includedir \
- "/(.*-.*-.*/|.*-.*/|)(asm[-/]|arch|linux/|selinux/|mach/|device/|hurd/(((hurd|ioctl)_types|paths)\\.h|ioctls\\.defs|ihash\\.h)|cthreads\\.h|gd|nss3/|c\\+\\+/|sys/(capability|sdt(|-config))\\.h|libaudit\\.h)"
+ "/(.*-.*-.*/|.*-.*/|)(asm[-/]|arch|linux/|selinux/|mach/|device/|hurd/(((hurd|ioctl)_types|paths)\\.h|ioctls\\.defs|ihash\\.h)|cthreads\\.h|multiarch-|gd|nss3/|c\\+\\+/|sys/(capability|sdt(|-config))\\.h|libaudit\\.h)"
}
/^[^ ]/ && $1 ~ /.*:/ { obj = $1 }
{

View file

@ -1,36 +0,0 @@
--- glibc-2.15-a316c1f/misc/sys/cdefs.h.orig 2012-02-11 15:42:05.510993089 -0200
+++ glibc-2.15-a316c1f/misc/sys/cdefs.h 2012-02-11 15:42:48.358183501 -0200
@@ -38,30 +38,20 @@
#ifdef __GNUC__
-/* All functions, except those with callbacks or those that
- synchronize memory, are leaf functions. */
-# if __GNUC_PREREQ (4, 6) && !defined _LIBC
-# define __LEAF , __leaf__
-# define __LEAF_ATTR __attribute__ ((__leaf__))
-# else
-# define __LEAF
-# define __LEAF_ATTR
-# endif
-
/* GCC can always grok prototypes. For C++ programs we add throw()
to help it optimize the function calls. But this works only with
gcc 2.8.x and egcs. For gcc 3.2 and up we even mark C functions
as non-throwing using a function attribute since programs can use
the -fexceptions options for C code as well. */
# if !defined __cplusplus && __GNUC_PREREQ (3, 3)
-# define __THROW __attribute__ ((__nothrow__ __LEAF))
+# define __THROW __attribute__ ((__nothrow__))
# define __THROWNL __attribute__ ((__nothrow__))
-# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
+# define __NTH(fct) __attribute__ ((__nothrow__)) fct
# else
# if defined __cplusplus && __GNUC_PREREQ (2,8)
# define __THROW throw ()
# define __THROWNL throw ()
-# define __NTH(fct) __LEAF_ATTR fct throw ()
+# define __NTH(fct) fct throw ()
# else
# define __THROW
# define __THROWNL

View file

@ -15,12 +15,27 @@
+#
+# Legal entries are:
+#
+# compat Use compatibility setup
+# nisplus or nis+ Use NIS+ (NIS version 3)
+# nis or yp Use NIS (NIS version 2), also called YP
+# compat Use compatibility setup for NIS
+# db Use the local database (.db) files
+# dns Use DNS (Domain Name Service)
+# files Use the local files
+# db Use the local database (.db) files
+# hesiod Use Hesiod for user lookups
+# ldap Use LDAP for user lookups
+# mdns Use Multicast DNS (aka Zeroconf/Rendezvous) for host lookups
+# mdns_minimal Like mdns, but only resolve *.local
+# mdns4 Like mdns, but only for IPv4
+# mdns6 Like mdns, but only for IPv6
+# mdns4_minimal Like mdns4, but only resolve *.local
+# mdns6_minimal Like mdns6, but only resolve *.local
+# myhostname Resolves local name
+# nis or yp Use NIS (NIS version 2), also called YP
+# nisplus or nis+ Use NIS+ (NIS version 3)
+# pgsql Use NetBIOS for host lookups
+# sss Use SSSD (System Security Services Daemon)
+# tcb Use TCB for host lookups
+# tinycdb Use a constant database for user lookups
+# wins Use NetBIOS for host lookups
+# winbind Uses a Windows or Samba domain controller for host lookups
+# [NOTFOUND=return] Stop searching if not found so far
+#
+# For more information, please read the nsswitch.conf.5 manual page.
@ -30,11 +45,11 @@
+# shadow: files nis
+# group: files nis
+
+passwd: compat
+passwd: files compat winbind mymachines systemd
+shadow: files nis
+group: compat
+group: files compat winbind mymachines systemd
+
+hosts: files nis dns wins myhostname
+hosts: files mymachines resolve [!UNAVAIL=return] dns myhostname nis wins mdns4_minimal
+networks: files
+
+services: files

View file

@ -1,19 +0,0 @@
--- glibc-2.21/po/pt_BR.po.ptBR~ 2015-02-07 14:28:42.147072936 +0100
+++ glibc-2.21/po/pt_BR.po 2015-02-07 14:29:29.831312393 +0100
@@ -4693,11 +4693,14 @@ msgstr ""
"cache %s:\n"
"\n"
"%15s cache está habilitado\n"
-"%15Zd tamanho sugerido%15ld segundos de vida para entradas positivas\n"
+"%15Zd tamanho sugerido\n"
+"%15ld segundos de vida para entradas positivas\n"
"%15ld segundos de vida para entradas negativas\n"
"%15ld hits do cache para entradas positivas\n"
"%15ld hits do cache para entradas negativas\n"
-"%15ld%% quantidade de hits no cache\n"
+"%15ld ausências no cache para entradas positivas\n"
+"%15ld ausências no cache para entradas negativas\n"
+"%15ld%% taxa de hits no cache\n"
"%15s verifique o arquivo /etc/%s para mudanças\n"
#: nscd/pwdcache.c:428

View file

@ -0,0 +1,66 @@
--- glibc-2.23/aclocal.m4.shareLocale~ 2016-02-18 20:59:26.420203855 +0100
+++ glibc-2.23/aclocal.m4 2016-02-18 21:01:00.898654328 +0100
@@ -296,7 +296,7 @@ case "$prefix" in
if test "$libdir" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/$1';
# Locale data can be shared between 32-bit and 64-bit libraries.
- libc_cv_complocaledir='${exec_prefix}/lib/locale'
+ libc_cv_complocaledir='${exec_prefix}/share/locale'
fi
;;
esac])
--- glibc-2.23/Makeconfig.shareLocale~ 2016-02-18 20:59:26.421203860 +0100
+++ glibc-2.23/Makeconfig 2016-02-18 21:01:25.644772357 +0100
@@ -193,7 +193,7 @@ inst_zonedir = $(install_root)$(zonedir)
# Where to install the compiled binary locale archive and compiled
# binary locale files.
ifndef complocaledir
-complocaledir = $(libdir)/locale
+complocaledir = $(datadir)/locale
endif
inst_complocaledir = $(install_root)$(complocaledir)
--- glibc-2.23/sysdeps/gnu/configure.shareLocale~ 2016-02-18 20:59:26.421203860 +0100
+++ glibc-2.23/sysdeps/gnu/configure 2016-02-18 21:01:45.136865335 +0100
@@ -14,7 +14,7 @@ case "$prefix" in
if test "$libdir" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/lib';
# Locale data can be shared between 32-bit and 64-bit libraries.
- libc_cv_complocaledir='${exec_prefix}/lib/locale'
+ libc_cv_complocaledir='${exec_prefix}/share/locale'
fi
;;
esac
--- glibc-2.23/sysdeps/unix/sysv/linux/aarch64/configure.shareLocale~ 2016-02-18 20:59:26.421203860 +0100
+++ glibc-2.23/sysdeps/unix/sysv/linux/aarch64/configure 2016-02-18 21:02:09.247980359 +0100
@@ -11,7 +11,7 @@ case "$prefix" in
if test "$libdir" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/lib64';
# Locale data can be shared between 32-bit and 64-bit libraries.
- libc_cv_complocaledir='${exec_prefix}/lib/locale'
+ libc_cv_complocaledir='${exec_prefix}/share/locale'
fi
;;
esac
--- glibc-2.23/sysdeps/unix/sysv/linux/x86_64/64/configure.shareLocale~ 2016-02-18 20:59:26.421203860 +0100
+++ glibc-2.23/sysdeps/unix/sysv/linux/x86_64/64/configure 2016-02-18 21:03:10.050270476 +0100
@@ -9,7 +9,7 @@ case "$prefix" in
if test "$libdir" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/lib64';
# Locale data can be shared between 32-bit and 64-bit libraries.
- libc_cv_complocaledir='${exec_prefix}/lib/locale'
+ libc_cv_complocaledir='${exec_prefix}/share/locale'
fi
;;
esac
--- glibc-2.23/sysdeps/unix/sysv/linux/x86_64/x32/configure.shareLocale~ 2016-02-18 20:59:26.422203865 +0100
+++ glibc-2.23/sysdeps/unix/sysv/linux/x86_64/x32/configure 2016-02-18 21:03:27.015351438 +0100
@@ -11,7 +11,7 @@ case "$prefix" in
if test "$libdir" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/libx32';
# Locale data can be shared between 32-bit and 64-bit libraries.
- libc_cv_complocaledir='${exec_prefix}/lib/locale'
+ libc_cv_complocaledir='${exec_prefix}/share/locale'
fi
;;
esac

View file

@ -1,6 +1,6 @@
--- glibc-2.20/stdlib/Makefile.ldbl~ 2014-09-08 21:30:48.771678525 +0200
+++ glibc-2.20/stdlib/Makefile 2014-09-08 21:34:51.842639720 +0200
@@ -125,9 +125,16 @@ test-canon-ARGS = --test-dir=${common-ob
--- glibc-2.27/stdlib/Makefile.0118~ 2018-02-02 20:31:07.402589690 +0100
+++ glibc-2.27/stdlib/Makefile 2018-02-02 20:31:53.077710331 +0100
@@ -190,9 +190,16 @@ test-canon-ARGS = --test-dir=${common-ob
bug-fmtmsg1-ENV = SEV_LEVEL=foo,11,newsev
@ -12,7 +12,7 @@
+
$(objpfx)isomac.out: $(objpfx)isomac
$(dir $<)$(notdir $<) '$(CC)' \
'-I../include $(+sysdep-includes) $(sysincludes) -I..' > $<.out; \
'-I../include $(+sysdep-includes) $(sysincludes) -I..' > $@; \
+ '$(isomac-includes)' > $<.out \
$(evaluate-test)

28
gcc-8-fix.patch Normal file
View file

@ -0,0 +1,28 @@
Subject: [PATCH] Replace strncpy with memccpy to fix -Wstringop-truncation
From : https://patchwork.sourceware.org/patch/26437/
---
diff --git a/nis/nss_nisplus/nisplus-parser.c b/nis/nss_nisplus/nisplus-parser.c
index 8dc021e73d..b53284f889 100644
--- a/nis/nss_nisplus/nisplus-parser.c
+++ b/nis/nss_nisplus/nisplus-parser.c
@@ -87,7 +87,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
if (len >= room_left)
goto no_more_room;
- strncpy (first_unused, numstr, len);
+ memcpy (first_unused, numstr, len);
first_unused[len] = '\0';
numstr = first_unused;
}
@@ -103,7 +103,7 @@ _nss_nisplus_parse_pwent (nis_result *result, struct passwd *pw,
if (len >= room_left)
goto no_more_room;
- strncpy (first_unused, numstr, len);
+ memcpy (first_unused, numstr, len);
first_unused[len] = '\0';
numstr = first_unused;
}

View file

@ -1,19 +0,0 @@
--- glibc-2.21/configure.ac.gold~ 2015-02-07 14:30:19.652562579 +0100
+++ glibc-2.21/configure.ac 2015-02-07 14:31:12.232826621 +0100
@@ -912,6 +912,16 @@ AC_CHECK_PROG_VER(AS, $AS, --version,
[GNU assembler.* \([0-9]*\.[0-9.]*\)],
[2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],
AS=: critic_missing="$critic_missing as")
+# If the system defaulted to using gold, and the compiler has suggested
+# we use a linker that is actually gold, then we ignore the suggestion
+# and use ld.bfd instead. This won't fix the implicit uses of gold by
+# the compiler, but it will correctly use the bfd ld for assembling
+# the library.
+gnu_ld_name="`$LD --version | sed -n 's/^GNU \(gold\).*$/\1/p'`"
+if test "$gnu_ld_name" = "gold"; then
+ AC_MSG_NOTICE([$LD is actually gold using ld.bfd instead])
+ LD=ld.bfd
+fi
AC_CHECK_PROG_VER(LD, $LD, --version,
[GNU ld.* \([0-9][0-9]*\.[0-9.]*\)],
[2.1[0-9][0-9]*|2.2[2-9]*|2.[3-9][0-9]*|[3-9].*|[1-9][0-9]*],

View file

@ -0,0 +1,11 @@
--- glibc-2.19/misc/sys/cdefs.h.omv~ 2014-06-22 14:53:05.862531155 +0200
+++ glibc-2.19/misc/sys/cdefs.h 2014-06-22 14:53:21.560531205 +0200
@@ -328,7 +328,7 @@
/* GCC 4.3 and above allow passing all anonymous arguments of an
__extern_always_inline function to some other vararg function. */
-#if __GNUC_PREREQ (4,3)
+#if __GNUC_PREREQ (4,3) && !defined(__clang__)
# define __va_arg_pack() __builtin_va_arg_pack ()
# define __va_arg_pack_len() __builtin_va_arg_pack_len ()
#endif

View file

@ -0,0 +1,15 @@
--- glibc-2.19/nscd/nscd-client.h.runpath~ 2014-06-04 13:30:35.700671072 +0200
+++ glibc-2.19/nscd/nscd-client.h 2014-06-04 13:30:00.783702730 +0200
@@ -34,10 +34,10 @@
#define NSCD_VERSION 2
/* Path of the file where the PID of the running system is stored. */
-#define _PATH_NSCDPID "/var/run/nscd/nscd.pid"
+#define _PATH_NSCDPID "/run/nscd/nscd.pid"
/* Path for the Unix domain socket. */
-#define _PATH_NSCDSOCKET "/var/run/nscd/socket"
+#define _PATH_NSCDSOCKET "/run/nscd/socket"
/* Path for the configuration file. */
#define _PATH_NSCDCONF "/etc/nscd.conf"

View file

@ -1,122 +0,0 @@
2011-2014 Thomas Backlund <tmb@mageia.org>
* Rebased / adapted for new glibc
2006-05-17 Gwenole Beauchesne <gbeauchesne@mandriva.com>
* Update and simplify for glibc 2.4.90.
2002-12-07 Gwenole Beauchesne <gbeauchesne@mandrakesoft.com>
Let an i586 rtld load i686 libraries (especially libpthread)
* elf/rtld.c (HP_TIMING_AVAIL): Redefine to HP_TIMING_HWCAP_AVAIL
since early statistics require high-precision timers.
* sysdeps/generic/ldsodefs.h (rtld_global): Declare
_dl_cpuclock_offset if HP_TIMING_HWCAP_AVAIL is defined too.
* sysdeps/unix/sysv/linux/i386/i586/Makefile: New file.
* sysdeps/unix/sysv/linux/i386/i586/hp-timing.c: New file.
* sysdeps/unix/sysv/linux/i386/i586/hp-timing.h: New file.
---
elf/rtld.c | 12 ++++++++++-
sysdeps/generic/ldsodefs.h | 2 -
sysdeps/i386/i586/Makefile | 4 +++
sysdeps/i386/i586/hp-timing.c | 2 +
sysdeps/i386/i586/hp-timing.h | 43 ++++++++++++++++++++++++++++++++++++++++++
diff -Nurp glibc-2.20.orig/elf/rtld.c glibc-2.20/elf/rtld.c
--- glibc-2.20.orig/elf/rtld.c 2014-09-07 11:09:09.000000000 +0300
+++ glibc-2.20/elf/rtld.c 2014-09-08 18:12:17.640928030 +0300
@@ -16,6 +16,9 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
+/* Early statistics require high-precision timing. */
+#define NEED_HP_TIMING_HWCAP_AVAIL 1
+
#include <errno.h>
#include <dlfcn.h>
#include <fcntl.h>
@@ -195,6 +198,12 @@ static void dl_main (const ElfW(Phdr) *p
static struct libname_list _dl_rtld_libname;
static struct libname_list _dl_rtld_libname2;
+/* Run-time detect availability of high-precision timer? */
+#ifdef HP_TIMING_HWCAP_AVAIL
+# undef HP_SMALL_TIMING_AVAIL
+# define HP_SMALL_TIMING_AVAIL HP_TIMING_HWCAP_AVAIL
+#endif
+
/* Variable for statistics. */
#ifndef HP_TIMING_NONAVAIL
static hp_timing_t relocate_time;
@@ -296,7 +305,8 @@ _dl_start_final (void *arg, struct dl_st
# endif
#endif
- HP_TIMING_NOW (GL(dl_cpuclock_offset));
+ if (HP_SMALL_TIMING_AVAIL)
+ HP_TIMING_NOW (GL(dl_cpuclock_offset));
/* Initialize the stack end variable. */
__libc_stack_end = __builtin_frame_address (0);
diff -Nurp glibc-2.20.orig/sysdeps/generic/ldsodefs.h glibc-2.20/sysdeps/generic/ldsodefs.h
--- glibc-2.20.orig/sysdeps/generic/ldsodefs.h 2014-09-07 11:09:09.000000000 +0300
+++ glibc-2.20/sysdeps/generic/ldsodefs.h 2014-09-08 18:17:19.655631175 +0300
@@ -319,7 +319,7 @@ struct rtld_global
/* The object to be initialized first. */
EXTERN struct link_map *_dl_initfirst;
-#if HP_SMALL_TIMING_AVAIL
+#if HP_SMALL_TIMING_AVAIL || defined HP_TIMING_HWCAP_AVAIL
/* Start time on CPU clock. */
EXTERN hp_timing_t _dl_cpuclock_offset;
#endif
diff -Nurp glibc-2.20.orig/sysdeps/i386/i586/hp-timing.h glibc-2.20/sysdeps/i386/i586/hp-timing.h
--- glibc-2.20.orig/sysdeps/i386/i586/hp-timing.h 1970-01-01 02:00:00.000000000 +0200
+++ glibc-2.20/sysdeps/i386/i586/hp-timing.h 2014-09-08 18:07:38.466353624 +0300
@@ -0,0 +1,43 @@
+#ifndef _HP_HWCAP_TIMING_H
+#define _HP_HWCAP_TIMING_H 1
+
+/* We can use the i686 implementation with slight changes. */
+#include <sysdeps/i386/i686/hp-timing.h>
+
+/* We need the definition of HWCAP_I386_TSC. */
+#include <sysdeps/i386/dl-hwcapinfo.h>
+
+/* We need to perform a runtime check for the timestamp register. */
+#undef HP_SMALL_TIMING_AVAIL
+#define HP_SMALL_TIMING_AVAIL (0)
+
+/* HP_TIMING_HWCAP_AVAIL: this macro performs a run-time check for the
+ capability. */
+#define HP_TIMING_HWCAP_AVAIL (_dl_hp_timing_avail())
+
+/* Perform the TSC check. */
+#ifdef NEED_HP_TIMING_HWCAP_AVAIL
+static inline
+unsigned int
+_dl_cpuid_edx (unsigned int op)
+{
+ unsigned int edx;
+ __asm__ __volatile__("push %%ebx ; cpuid ; pop %%ebx"
+ : "=d" (edx) : "a" (op) : "ecx");
+ return edx;
+}
+
+static int
+internal_function
+_dl_hp_timing_avail (void)
+{
+ static int has_tsc = -1;
+
+ if (__builtin_expect (has_tsc == -1, 0))
+ has_tsc = (_dl_cpuid_edx(1) & HWCAP_I386_TSC) == HWCAP_I386_TSC;
+
+ return has_tsc;
+}
+#endif
+
+#endif /* hp-timing.h */

View file

@ -1,92 +0,0 @@
--- glibc-2.24/sysdeps/unix/sysv/linux/x86/elision-conf.c.0091~ 2016-08-02 04:01:36.000000000 +0200
+++ glibc-2.24/sysdeps/unix/sysv/linux/x86/elision-conf.c 2016-08-17 17:04:53.815350950 +0200
@@ -66,8 +66,11 @@ elision_init (int argc __attribute__ ((u
#ifdef ENABLE_LOCK_ELISION
__pthread_force_elision = __libc_enable_secure ? 0 : __elision_available;
#endif
- if (!HAS_CPU_FEATURE (RTM))
+ if (!HAS_CPU_FEATURE (RTM)) {
__elision_aconf.retry_try_xbegin = 0; /* Disable elision on rwlocks */
+ __elision_available = 0;
+ __pthread_force_elision = 0;
+ }
}
#ifdef SHARED
--- glibc-2.24/sysdeps/x86/cpu-features.c.0091~ 2016-08-02 04:01:36.000000000 +0200
+++ glibc-2.24/sysdeps/x86/cpu-features.c 2016-08-17 17:10:06.401454187 +0200
@@ -22,7 +22,7 @@
static void
get_common_indeces (struct cpu_features *cpu_features,
unsigned int *family, unsigned int *model,
- unsigned int *extended_model)
+ unsigned int *extended_model, unsigned int *stepping)
{
if (family)
{
@@ -34,6 +34,7 @@ get_common_indeces (struct cpu_features
*family = (eax >> 8) & 0x0f;
*model = (eax >> 4) & 0x0f;
*extended_model = (eax >> 12) & 0xf0;
+ *stepping = eax & 0x0f;
if (*family == 0x0f)
{
*family += (eax >> 20) & 0xff;
@@ -97,6 +98,7 @@ init_cpu_features (struct cpu_features *
unsigned int ebx, ecx, edx;
unsigned int family = 0;
unsigned int model = 0;
+ unsigned int stepping = 0;
enum cpu_features_kind kind;
#if !HAS_CPUID
@@ -116,7 +118,7 @@ init_cpu_features (struct cpu_features *
kind = arch_kind_intel;
- get_common_indeces (cpu_features, &family, &model, &extended_model);
+ get_common_indeces (cpu_features, &family, &model, &extended_model, &stepping);
if (family == 0x06)
{
@@ -213,7 +215,7 @@ init_cpu_features (struct cpu_features *
kind = arch_kind_amd;
- get_common_indeces (cpu_features, &family, &model, &extended_model);
+ get_common_indeces (cpu_features, &family, &model, &extended_model, &stepping);
ecx = cpu_features->cpuid[COMMON_CPUID_INDEX_1].ecx;
@@ -250,7 +252,7 @@ init_cpu_features (struct cpu_features *
else
{
kind = arch_kind_other;
- get_common_indeces (cpu_features, NULL, NULL, NULL);
+ get_common_indeces (cpu_features, NULL, NULL, NULL, NULL);
}
/* Support i586 if CX8 is available. */
@@ -265,6 +267,12 @@ init_cpu_features (struct cpu_features *
no_cpuid:
#endif
+ /* Disable Intel TSX (HLE and RTM) due to erratum HSD136/HSW136
+ on Haswell processors */
+ if (kind == arch_kind_intel && family == 6 &&
+ ((model == 63 && stepping <= 2) || (model == 60 && stepping <= 3) ||
+ (model == 69 && stepping <= 1) || (model == 70 && stepping <= 1)))
+ cpu_features->cpuid[COMMON_CPUID_INDEX_7].ebx &= ~(bit_cpu_RTM | bit_cpu_HLE);
cpu_features->family = family;
cpu_features->model = model;
cpu_features->kind = kind;
--- glibc-2.24/sysdeps/x86/cpu-features.h.0091~ 2016-08-02 04:01:36.000000000 +0200
+++ glibc-2.24/sysdeps/x86/cpu-features.h 2016-08-17 17:04:53.815350950 +0200
@@ -57,6 +57,7 @@
/* COMMON_CPUID_INDEX_7. */
#define bit_cpu_ERMS (1 << 9)
#define bit_cpu_RTM (1 << 11)
+#define bit_cpu_HLE (1 << 4)
#define bit_cpu_AVX2 (1 << 5)
#define bit_cpu_AVX512F (1 << 16)
#define bit_cpu_AVX512DQ (1 << 17)

View file

@ -1,31 +0,0 @@
From a76376df7c07e577a9515c3faa5dbd50bda5da07 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Fri, 20 Oct 2017 18:41:14 +0200
Subject: [PATCH] CVE-2017-15670: glob: Fix one-byte overflow [BZ #22320]
(cherry picked from commit c369d66e5426a30e4725b100d5cd28e372754f90)
Upstream-Status: Backport
CVE: CVE-2017-15670
Affects: glibc < 2.27
signed-off-by: Armin Kuster <akuster@mvista.com>
---
ChangeLog | 6 ++++++
NEWS | 5 +++++
posix/glob.c | 2 +-
3 files changed, 12 insertions(+), 1 deletion(-)
Index: git/posix/glob.c
===================================================================
--- git.orig/posix/glob.c
+++ git/posix/glob.c
@@ -843,7 +843,7 @@ glob (const char *pattern, int flags, in
*p = '\0';
}
else
- *((char *) mempcpy (newp, dirname + 1, end_name - dirname))
+ *((char *) mempcpy (newp, dirname + 1, end_name - dirname - 1))
= '\0';
user_name = newp;
}

View file

@ -1,34 +0,0 @@
From 94825c8924b80518214ad9e3ca1f6589f209592c Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 22 Oct 2017 10:00:57 +0200
Subject: [PATCH] glob: Fix buffer overflow during GLOB_TILDE unescaping [BZ
#22332]
(cherry picked from commit a159b53fa059947cc2548e3b0d5bdcf7b9630ba8)
---
ChangeLog | 6 ++++++
NEWS | 4 ++++
posix/glob.c | 4 ++--
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/posix/glob.c b/posix/glob.c
index 026bc06..f3fa807 100644
--- a/posix/glob.c
+++ b/posix/glob.c
@@ -863,11 +863,11 @@ glob (const char *pattern, int flags, int (*errfunc) (const char *, int),
char *p = mempcpy (newp, dirname + 1,
unescape - dirname - 1);
char *q = unescape;
- while (*q != '\0')
+ while (q != end_name)
{
if (*q == '\\')
{
- if (q[1] == '\0')
+ if (q + 1 == end_name)
{
/* "~fo\\o\\" unescape to user_name "foo\\",
but "~fo\\o\\/" unescape to user_name
--
2.9.3

View file

@ -1,114 +0,0 @@
From 1998843fb78d9b3ebc0216757042ce4b00dd08a1 Mon Sep 17 00:00:00 2001
From: Aurelien Jarno <aurelien@aurel32.net>
Date: Sat, 30 Dec 2017 10:54:23 +0100
Subject: [PATCH] elf: Check for empty tokens before dynamic string token
expansion [BZ #22625]
The fillin_rpath function in elf/dl-load.c loops over each RPATH or
RUNPATH tokens and interprets empty tokens as the current directory
("./"). In practice the check for empty token is done *after* the
dynamic string token expansion. The expansion process can return an
empty string for the $ORIGIN token if __libc_enable_secure is set
or if the path of the binary can not be determined (/proc not mounted).
Fix that by moving the check for empty tokens before the dynamic string
token expansion. In addition, check for NULL pointer or empty strings
return by expand_dynamic_string_token.
The above changes highlighted a bug in decompose_rpath, an empty array
is represented by the first element being NULL at the fillin_rpath
level, but by using a -1 pointer in decompose_rpath and other functions.
Changelog:
[BZ #22625]
* elf/dl-load.c (fillin_rpath): Check for empty tokens before dynamic
string token expansion. Check for NULL pointer or empty string possibly
returned by expand_dynamic_string_token.
(decompose_rpath): Check for empty path after dynamic string
token expansion.
(cherry picked from commit 3e3c904daef69b8bf7d5cc07f793c9f07c3553ef)
---
ChangeLog | 10 ++++++++++
NEWS | 4 ++++
elf/dl-load.c | 49 +++++++++++++++++++++++++++++++++----------------
3 files changed, 47 insertions(+), 16 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index ec8cefb..58e7220 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -434,31 +434,40 @@ fillin_rpath (char *rpath, struct r_search_path_elem **result, const char *sep,
{
char *cp;
size_t nelems = 0;
- char *to_free;
while ((cp = __strsep (&rpath, sep)) != NULL)
{
struct r_search_path_elem *dirp;
+ char *to_free = NULL;
+ size_t len = 0;
- to_free = cp = expand_dynamic_string_token (l, cp, 1);
+ /* `strsep' can pass an empty string. */
+ if (*cp != '\0')
+ {
+ to_free = cp = expand_dynamic_string_token (l, cp, 1);
- size_t len = strlen (cp);
+ /* expand_dynamic_string_token can return NULL in case of empty
+ path or memory allocation failure. */
+ if (cp == NULL)
+ continue;
- /* `strsep' can pass an empty string. This has to be
- interpreted as `use the current directory'. */
- if (len == 0)
- {
- static const char curwd[] = "./";
- cp = (char *) curwd;
- }
+ /* Compute the length after dynamic string token expansion and
+ ignore empty paths. */
+ len = strlen (cp);
+ if (len == 0)
+ {
+ free (to_free);
+ continue;
+ }
- /* Remove trailing slashes (except for "/"). */
- while (len > 1 && cp[len - 1] == '/')
- --len;
+ /* Remove trailing slashes (except for "/"). */
+ while (len > 1 && cp[len - 1] == '/')
+ --len;
- /* Now add one if there is none so far. */
- if (len > 0 && cp[len - 1] != '/')
- cp[len++] = '/';
+ /* Now add one if there is none so far. */
+ if (len > 0 && cp[len - 1] != '/')
+ cp[len++] = '/';
+ }
/* Make sure we don't use untrusted directories if we run SUID. */
if (__glibc_unlikely (check_trusted) && !is_trusted_path (cp, len))
@@ -622,6 +631,14 @@ decompose_rpath (struct r_search_path_struct *sps,
necessary. */
free (copy);
+ /* There is no path after expansion. */
+ if (result[0] == NULL)
+ {
+ free (result);
+ sps->dirs = (struct r_search_path_elem **) -1;
+ return false;
+ }
+
sps->dirs = result;
/* The caller will change this value if we haven't used a real malloc. */
sps->malloced = 1;
--
2.9.3

View file

@ -1,159 +0,0 @@
From cd66c0e584c6d692bc8347b5e72723d02b8a8ada Mon Sep 17 00:00:00 2001
From: Andrew Senkevich <andrew.n.senkevich@gmail.com>
Date: Fri, 23 Mar 2018 16:19:45 +0100
Subject: [PATCH 1/1] Fix i386 memmove issue (bug 22644).
[BZ #22644]
* sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S: Fixed
branch conditions.
* string/test-memmove.c (do_test2): New testcase.
---
ChangeLog | 8 +++
string/test-memmove.c | 58 ++++++++++++++++++++++
.../i386/i686/multiarch/memcpy-sse2-unaligned.S | 12 ++---
3 files changed, 72 insertions(+), 6 deletions(-)
diff --git a/string/test-memmove.c b/string/test-memmove.c
index edc7a4c..64e3651 100644
--- a/string/test-memmove.c
+++ b/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;
}
diff --git a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S b/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
index 9c3bbe7..9aa17de 100644
--- a/sysdeps/i386/i686/multiarch/memcpy-sse2-unaligned.S
+++ b/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. */
--
2.9.3

View file

@ -1,67 +0,0 @@
From 52a713fdd0a30e1bd79818e2e3c4ab44ddca1a94 Mon Sep 17 00:00:00 2001
From: "Dmitry V. Levin" <ldv@altlinux.org>
Date: Sun, 7 Jan 2018 02:03:41 +0000
Subject: [PATCH] linux: make getcwd(3) fail if it cannot obtain an absolute
path [BZ #22679]
Currently getcwd(3) can succeed without returning an absolute path
because the underlying getcwd syscall, starting with linux commit
v2.6.36-rc1~96^2~2, may succeed without returning an absolute path.
This is a conformance issue because "The getcwd() function shall
place an absolute pathname of the current working directory
in the array pointed to by buf, and return buf".
This is also a security issue because a non-absolute path returned
by getcwd(3) causes a buffer underflow in realpath(3).
Fix this by checking the path returned by getcwd syscall and falling
back to generic_getcwd if the path is not absolute, effectively making
getcwd(3) fail with ENOENT. The error code is chosen for consistency
with the case when the current directory is unlinked.
[BZ #22679]
CVE-2018-1000001
* sysdeps/unix/sysv/linux/getcwd.c (__getcwd): Fall back to
generic_getcwd if the path returned by getcwd syscall is not absolute.
* io/tst-getcwd-abspath.c: New test.
* io/Makefile (tests): Add tst-getcwd-abspath.
---
ChangeLog | 9 ++++++
NEWS | 4 +++
io/Makefile | 2 +-
io/tst-getcwd-abspath.c | 66 ++++++++++++++++++++++++++++++++++++++++
sysdeps/unix/sysv/linux/getcwd.c | 8 ++---
5 files changed, 84 insertions(+), 5 deletions(-)
create mode 100644 io/tst-getcwd-abspath.c
diff --git a/sysdeps/unix/sysv/linux/getcwd.c b/sysdeps/unix/sysv/linux/getcwd.c
index f545106..866b9d2 100644
--- a/sysdeps/unix/sysv/linux/getcwd.c
+++ b/sysdeps/unix/sysv/linux/getcwd.c
@@ -76,7 +76,7 @@ __getcwd (char *buf, size_t size)
int retval;
retval = INLINE_SYSCALL (getcwd, 2, path, alloc_size);
- if (retval >= 0)
+ if (retval > 0 && path[0] == '/')
{
#ifndef NO_ALLOCATION
if (buf == NULL && size == 0)
@@ -92,10 +92,10 @@ __getcwd (char *buf, size_t size)
return buf;
}
- /* The system call cannot handle paths longer than a page.
- Neither can the magic symlink in /proc/self. Just use the
+ /* The system call either cannot handle paths longer than a page
+ or can succeed without returning an absolute path. Just use the
generic implementation right away. */
- if (errno == ENAMETOOLONG)
+ if (retval >= 0 || errno == ENAMETOOLONG)
{
#ifndef NO_ALLOCATION
if (buf == NULL && size == 0)
--
2.9.3

View file

@ -1,37 +0,0 @@
From 5460617d1567657621107d895ee2dd83bc1f88f2 Mon Sep 17 00:00:00 2001
From: Paul Pluzhnikov <ppluzhnikov@google.com>
Date: Tue, 8 May 2018 18:12:41 -0700
Subject: [PATCH] Fix BZ 22786: integer addition overflow may cause stack
buffer overflow when realpath() input length is close to SSIZE_MAX.
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.
---
ChangeLog | 8 +++++
stdlib/Makefile | 2 +-
stdlib/canonicalize.c | 2 +-
stdlib/test-bz22786.c | 90 +++++++++++++++++++++++++++++++++++++++++++++++++++
4 files changed, 100 insertions(+), 2 deletions(-)
create mode 100644 stdlib/test-bz22786.c
diff --git a/stdlib/canonicalize.c b/stdlib/canonicalize.c
index 4135f3f..390fb43 100644
--- a/stdlib/canonicalize.c
+++ b/stdlib/canonicalize.c
@@ -181,7 +181,7 @@ __realpath (const char *name, char *resolved)
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;
--
2.9.3

View file

@ -1,86 +0,0 @@
From 8e448310d74b283c5cd02b9ed7fb997b47bf9b22 Mon Sep 17 00:00:00 2001
From: Arjun Shankar <arjun.is@lostca.se>
Date: Thu, 18 Jan 2018 16:47:06 +0000
Subject: [PATCH] Fix integer overflows in internal memalign and malloc
functions [BZ #22343]
When posix_memalign is called with an alignment less than MALLOC_ALIGNMENT
and a requested size close to SIZE_MAX, it falls back to malloc code
(because the alignment of a block returned by malloc is sufficient to
satisfy the call). In this case, an integer overflow in _int_malloc leads
to posix_memalign incorrectly returning successfully.
Upon fixing this and writing a somewhat thorough regression test, it was
discovered that when posix_memalign is called with an alignment larger than
MALLOC_ALIGNMENT (so it uses _int_memalign instead) and a requested size
close to SIZE_MAX, a different integer overflow in _int_memalign leads to
posix_memalign incorrectly returning successfully.
Both integer overflows affect other memory allocation functions that use
_int_malloc (one affected malloc in x86) or _int_memalign as well.
This commit fixes both integer overflows. In addition to this, it adds a
regression test to guard against false successful allocations by the
following memory allocation functions when called with too-large allocation
sizes and, where relevant, various valid alignments:
malloc, realloc, calloc, reallocarray, memalign, posix_memalign,
aligned_alloc, valloc, and pvalloc.
---
ChangeLog | 10 ++
malloc/Makefile | 1 +
malloc/malloc.c | 30 +++--
malloc/tst-malloc-too-large.c | 253 ++++++++++++++++++++++++++++++++++++++++++
4 files changed, 286 insertions(+), 8 deletions(-)
create mode 100644 malloc/tst-malloc-too-large.c
diff --git a/malloc/malloc.c b/malloc/malloc.c
index f5aafd2..7889fb1 100644
--- a/malloc/malloc.c
+++ b/malloc/malloc.c
@@ -1224,14 +1224,21 @@ nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
MINSIZE : \
((req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK)
-/* Same, except also perform argument check */
-
-#define checked_request2size(req, sz) \
- if (REQUEST_OUT_OF_RANGE (req)) { \
- __set_errno (ENOMEM); \
- return 0; \
- } \
- (sz) = request2size (req);
+/* Same, except also perform an argument and result check. First, we check
+ that the padding done by request2size didn't result in an integer
+ overflow. Then we check (using REQUEST_OUT_OF_RANGE) that the resulting
+ size isn't so large that a later alignment would lead to another integer
+ overflow. */
+#define checked_request2size(req, sz) \
+({ \
+ (sz) = request2size (req); \
+ if (((sz) < (req)) \
+ || REQUEST_OUT_OF_RANGE (sz)) \
+ { \
+ __set_errno (ENOMEM); \
+ return 0; \
+ } \
+})
/*
--------------- Physical chunk operations ---------------
@@ -4678,6 +4685,13 @@ _int_memalign (mstate av, size_t alignment, size_t bytes)
*/
+ /* Check for overflow. */
+ if (nb > SIZE_MAX - alignment - MINSIZE)
+ {
+ __set_errno (ENOMEM);
+ return 0;
+ }
+
/* Call malloc with worst case padding to hit alignment. */
m = (char *) (_int_malloc (av, nb + alignment + MINSIZE));
--
2.9.3

View file

@ -0,0 +1,13 @@
--- glibc-2.27/Makeconfig.0133~ 2018-02-02 20:36:50.869704855 +0100
+++ glibc-2.27/Makeconfig 2018-02-02 20:37:32.598866637 +0100
@@ -360,6 +360,10 @@ else
real-static-start-installed-name = $(static-start-installed-name)
endif
+# glibc doesn't like gold and lld
+LDFLAGS.so += -fuse-ld=bfd
+LDFLAGS-rtld += -fuse-ld=bfd
+
ifeq (yesyes,$(build-shared)$(have-z-combreloc))
combreloc-LDFLAGS = -Wl,-z,combreloc
LDFLAGS.so += $(combreloc-LDFLAGS)

View file

@ -0,0 +1,11 @@
--- glibc-2.26/misc/sys/cdefs.h.omv~ 2018-01-24 11:32:15.276543892 +0100
+++ glibc-2.26/misc/sys/cdefs.h 2018-01-24 11:32:47.208618287 +0100
@@ -38,7 +38,7 @@
/* All functions, except those with callbacks or those that
synchronize memory, are leaf functions. */
-# if __GNUC_PREREQ (4, 6) && !defined _LIBC
+# if __GNUC_PREREQ (4, 6) && !defined _LIBC && (!defined(__clang__) || __has_attribute(leaf))
# define __LEAF , __leaf__
# define __LEAF_ATTR __attribute__ ((__leaf__))
# else

View file

@ -0,0 +1,81 @@
--- glibc-2.27/bits/floatn-common.h.0134~ 2018-02-01 17:17:18.000000000 +0100
+++ glibc-2.27/bits/floatn-common.h 2018-03-03 02:32:16.924822310 +0100
@@ -28,6 +28,7 @@
where the same definitions, or definitions based only on the macros
in bits/floatn.h, are appropriate for all glibc configurations. */
+#ifndef __clang__ /* FIXME reinvestigate with clang 7 */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the right format for this type, and this
glibc includes corresponding *fN or *fNx interfaces for it. */
@@ -36,6 +37,7 @@
#define __HAVE_FLOAT64 1
#define __HAVE_FLOAT32X 1
#define __HAVE_FLOAT128X 0
+#endif
/* Defined to 1 if the corresponding __HAVE_<type> macro is 1 and the
type is the first with its format in the sequence of (the default
--- glibc-2.27/sysdeps/ieee754/ldbl-128/bits/floatn.h.0134~ 2018-02-01 17:17:18.000000000 +0100
+++ glibc-2.27/sysdeps/ieee754/ldbl-128/bits/floatn.h 2018-03-03 02:32:16.924822310 +0100
@@ -26,7 +26,11 @@
floating-point type with the IEEE 754 binary128 format, and this
glibc includes corresponding *f128 interfaces for it. */
#ifndef __NO_LONG_DOUBLE_MATH
-# define __HAVE_FLOAT128 1
+# if defined(__clang__)
+# define __HAVE_FLOAT128 0
+# else
+# define __HAVE_FLOAT128 1
+# endif
#else
/* glibc does not support _Float128 for platforms where long double is
normally binary128 when building with long double as binary64.
--- glibc-2.27/sysdeps/x86/bits/floatn.h.0134~ 2018-02-01 17:17:18.000000000 +0100
+++ glibc-2.27/sysdeps/x86/bits/floatn.h 2018-03-03 02:34:50.472771373 +0100
@@ -26,9 +26,9 @@
glibc includes corresponding *f128 interfaces for it. The required
libgcc support was added some time after the basic compiler
support, for x86_64 and x86. */
-#if (defined __x86_64__ \
+#if (!defined(__clang__) && (defined __x86_64__ \
? __GNUC_PREREQ (4, 3) \
- : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4)))
+ : (defined __GNU__ ? __GNUC_PREREQ (4, 5) : __GNUC_PREREQ (4, 4))))
# define __HAVE_FLOAT128 1
#else
# define __HAVE_FLOAT128 0
@@ -42,6 +42,7 @@
# define __HAVE_DISTINCT_FLOAT128 0
#endif
+#ifndef __clang__ /* FIXME reinvestigate with clang 7 */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the right format for _Float64x, and this
glibc includes corresponding *f64x interfaces for it. */
@@ -52,6 +53,7 @@
the format of _Float128, which must be different from that of long
double. */
#define __HAVE_FLOAT64X_LONG_DOUBLE 1
+#endif
#ifndef __ASSEMBLER__
@@ -68,7 +70,7 @@
/* Defined to a complex binary128 type if __HAVE_FLOAT128 is 1. */
# if __HAVE_FLOAT128
-# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
/* Add a typedef for older GCC compilers which don't natively support
_Complex _Float128. */
typedef _Complex float __cfloat128 __attribute__ ((__mode__ (__TC__)));
@@ -82,7 +84,7 @@ typedef _Complex float __cfloat128 __att
# if __HAVE_FLOAT128
/* The type _Float128 exists only since GCC 7.0. */
-# if !__GNUC_PREREQ (7, 0) || defined __cplusplus
+# if !__GNUC_PREREQ (7, 0) || defined __cplusplus || defined __clang__
typedef __float128 _Float128;
# endif

View file

@ -0,0 +1,11 @@
diff -up glibc-2.28/sysdeps/unix/sysv/linux/riscv/flush-icache.c.omv~ glibc-2.28/sysdeps/unix/sysv/linux/riscv/flush-icache.c
--- glibc-2.28/sysdeps/unix/sysv/linux/riscv/flush-icache.c.omv~ 2019-01-18 15:18:32.068258780 +0100
+++ glibc-2.28/sysdeps/unix/sysv/linux/riscv/flush-icache.c 2019-01-18 15:18:35.241304323 +0100
@@ -21,7 +21,6 @@
#include <stdlib.h>
#include <atomic.h>
#include <sys/cachectl.h>
-#include <asm/syscalls.h>
typedef int (*func_type) (void *, void *, unsigned long int);

View file

@ -0,0 +1,13 @@
diff --git a/sysdeps/aarch64/dl-machine.h b/sysdeps/aarch64/dl-machine.h
index 997c860..50b37b0 100644
--- a/sysdeps/aarch64/dl-machine.h
+++ b/sysdeps/aarch64/dl-machine.h
@@ -295,7 +295,7 @@ elf_machine_rela (struct link_map *map, const ElfW(Rela) *reloc,
# ifndef SHARED
CHECK_STATIC_TLS (map, sym_map);
# else
- if (!TRY_STATIC_TLS (map, sym_map))
+ if (1)
{
td->arg = _dl_make_tlsdesc_dynamic
(sym_map, sym->st_value + reloc->r_addend);

View file

@ -1,140 +0,0 @@
Index: glibc-2.22-193-g315267a/posix/bug-regex11.c
===================================================================
--- glibc-2.22-193-g315267a.orig/posix/bug-regex11.c
+++ glibc-2.22-193-g315267a/posix/bug-regex11.c
@@ -22,6 +22,7 @@
#include <regex.h>
#include <stdio.h>
#include <stdlib.h>
+#include <libc-internal.h>
/* Tests supposed to match. */
struct
@@ -119,6 +120,14 @@ main (void)
continue;
}
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not entirely possible since n is limited to
+ static nmatch which is limited to at most 5 (see tests above).
+ This is likely PR/59124 which is still not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (n = 0; n < tests[i].nmatch; ++n)
if (rm[n].rm_so != tests[i].rm[n].rm_so
|| rm[n].rm_eo != tests[i].rm[n].rm_eo)
@@ -130,6 +139,7 @@ main (void)
ret = 1;
break;
}
+ DIAG_POP_NEEDS_COMMENT
regfree (&re);
}
Index: glibc-2.22-193-g315267a/posix/bug-regex17.c
===================================================================
--- glibc-2.22-193-g315267a.orig/posix/bug-regex17.c
+++ glibc-2.22-193-g315267a/posix/bug-regex17.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
+#include <libc-internal.h>
/* Tests supposed to match. */
struct
@@ -87,6 +88,14 @@ do_test (void)
continue;
}
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not entirely possible since n is limited to
+ static nmatch which is limited to at most 5 (see tests above).
+ This is likely PR/59124 which is still not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (n = 0; n < tests[i].nmatch; ++n)
if (rm[n].rm_so != tests[i].rm[n].rm_so
|| rm[n].rm_eo != tests[i].rm[n].rm_eo)
@@ -98,6 +107,7 @@ do_test (void)
ret = 1;
break;
}
+ DIAG_POP_NEEDS_COMMENT
regfree (&re);
}
Index: glibc-2.22-193-g315267a/posix/bug-regex18.c
===================================================================
--- glibc-2.22-193-g315267a.orig/posix/bug-regex18.c
+++ glibc-2.22-193-g315267a/posix/bug-regex18.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
+#include <libc-internal.h>
/* Tests supposed to match. */
struct
@@ -80,6 +81,14 @@ main (void)
continue;
}
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not entirely possible since n is limited to
+ static nmatch which is limited to at most 5 (see tests above).
+ This is likely PR/59124 which is still not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (n = 0; n < tests[i].nmatch; ++n)
if (rm[n].rm_so != tests[i].rm[n].rm_so
|| rm[n].rm_eo != tests[i].rm[n].rm_eo)
@@ -91,6 +100,7 @@ main (void)
ret = 1;
break;
}
+ DIAG_POP_NEEDS_COMMENT
regfree (&re);
}
Index: glibc-2.22-193-g315267a/posix/bug-regex30.c
===================================================================
--- glibc-2.22-193-g315267a.orig/posix/bug-regex30.c
+++ glibc-2.22-193-g315267a/posix/bug-regex30.c
@@ -23,6 +23,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <locale.h>
+#include <libc-internal.h>
/* Tests supposed to match. */
struct
@@ -80,6 +81,14 @@ do_test (void)
continue;
}
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not entirely possible since n is limited to
+ static nmatch which is limited to at most 5 (see tests above).
+ This is likely PR/59124 which is still not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (n = 0; n < tests[i].nmatch; ++n)
if (rm[n].rm_so != tests[i].rm[n].rm_so
|| rm[n].rm_eo != tests[i].rm[n].rm_eo)
@@ -91,6 +100,7 @@ do_test (void)
ret = 1;
break;
}
+ DIAG_POP_NEEDS_COMMENT
regfree (&re);
}

6
glibc-cs-path.patch Normal file
View file

@ -0,0 +1,6 @@
diff -pruN a/sysdeps/unix/confstr.h b/sysdeps/unix/confstr.h
--- a/sysdeps/unix/confstr.h 2012-12-25 08:32:13.000000000 +0530
+++ b/sysdeps/unix/confstr.h 2014-09-05 20:02:55.698275219 +0530
@@ -1 +1 @@
-#define CS_PATH "/bin:/usr/bin"
+#define CS_PATH "/usr/bin"

View file

@ -1,32 +0,0 @@
Index: glibc-2.23-276-gb65b205/resolv/nss_dns/dns-host.c
===================================================================
--- glibc-2.23-276-gb65b205.orig/resolv/nss_dns/dns-host.c
+++ glibc-2.23-276-gb65b205/resolv/nss_dns/dns-host.c
@@ -78,6 +78,7 @@
#include <stdlib.h>
#include <stddef.h>
#include <string.h>
+#include <libc-internal.h>
#include "nsswitch.h"
@@ -566,10 +567,19 @@ addrsort (char **ap, int num)
num = MAX_NR_ADDRS;
for (i = 0; i < num; i++, p++)
{
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not entirely possible since i is limited to
+ _res.nsort which is limited to MAXRESOLVSORT. This
+ is likely PR/59124 which is still not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (j = 0 ; (unsigned)j < _res.nsort; j++)
if (_res.sort_list[j].addr.s_addr ==
(((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask))
break;
+ DIAG_POP_NEEDS_COMMENT
aval[i] = j;
if (needsort == 0 && i > 0 && j < aval[i-1])
needsort = i;

View file

@ -1,459 +0,0 @@
@@ -, +, @@
17645)
---
elf/Makefile | 1 +
elf/dl-deps.c | 143 +++++++++++++++++++++++++++++------------------
elf/dl-fini.c | 176 +++++++++++++++++++++++++++++++---------------------------
elf/dl-open.c | 74 ++++++++++++++++++++++++
4 files changed, 256 insertions(+), 138 deletions(-)
--- a/elf/Makefile
+++ a/elf/Makefile
@@ -513,6 +513,7 @@ $(objpfx)unload8mod1.so: $(objpfx)unload8mod2.so
$(objpfx)unload8mod2.so: $(objpfx)unload8mod3.so
$(objpfx)unload8mod3.so: $(libdl)
$(objpfx)tst-initordera2.so: $(objpfx)tst-initordera1.so
+$(objpfx)tst-initorderb1.so: $(objpfx)tst-initordera2.so
$(objpfx)tst-initorderb2.so: $(objpfx)tst-initorderb1.so $(objpfx)tst-initordera2.so
$(objpfx)tst-initordera3.so: $(objpfx)tst-initorderb2.so $(objpfx)tst-initorderb1.so
$(objpfx)tst-initordera4.so: $(objpfx)tst-initordera3.so
--- a/elf/dl-deps.c
+++ a/elf/dl-deps.c
@@ -139,6 +139,93 @@ cannot load auxiliary `%s' because of empty dynamic string token " \
__result; })
static void
+weight (struct link_map **maps, size_t nmaps, char *seen, unsigned int *w)
+{
+ int i, c;
+ struct link_map *m, **r;
+
+ /* Start at 1 because the first entry is the binary itself. */
+ for (i = 1; i < nmaps; ++i)
+ {
+ m = maps[i];
+ if ((r = m->l_initfini))
+ {
+ c = 0;
+ while (*r)
+ {
+
+ /* If not a self reference, not being unloaded, and not
+ already removed from the list, increment the reference
+ counter. */
+ if (*r != m && (*r)->l_idx >= 0 && !seen[(*r)->l_idx])
+ ++c;
+ ++r;
+ }
+
+ /* Update the {w}eight vector with {c}ount map(s) dependency */
+ w[i] = c;
+ }
+ else
+ w[i] = 0;
+ }
+}
+
+static void
+sort (struct link_map **maps, size_t nmaps)
+{
+ int c, i, k;
+ unsigned int w[nmaps];
+ char seen[nmaps];
+ struct link_map *t;
+ memset(seen, 0, nmaps);
+
+ /* Use the l_idx field as an unique identifier. */
+ for (i = 0; i < nmaps; ++i)
+ {
+ /* Ensure to not touch a link_map with l_idx < 0 as it is
+ used to flag a dso is being unloaded. */
+ if (maps[i]->l_idx >= 0)
+ maps[i]->l_idx = i;
+ }
+
+ /* We can skip looking for the binary itself which is at the front
+ of the search list. */
+ w[0] = 0;
+ seen[0] = 1;
+
+ /* The list is sorted in place, with entries added from end to start. */
+ weight(maps, k = nmaps, seen, w);
+ c = 0;
+ while (c < k)
+ {
+ for (i = k - 1; i >= 1; --i)
+ {
+ if (w[i] == c && maps[i]->l_idx >= 0)
+ {
+ seen[maps[i]->l_idx] = 1;
+
+ /* Reducing the number of entries or swaping entries
+ require remaking the {w}eight map. */
+ if (--k != i)
+ {
+ t = maps[k];
+ maps[k] = maps[i];
+ maps[i] = t;
+ }
+ weight(maps, k, seen, w);
+ c = -1;
+ break;
+ }
+ }
+
+ /* If c != 0, there are cycles, and the first entry in the map,
+ with the lowest reference {c}ount is removed attempting to
+ to break the cycle. */
+ ++c;
+ }
+}
+
+static void
preload (struct list *known, unsigned int *nlist, struct link_map *map)
{
known[*nlist].done = 0;
@@ -611,61 +698,7 @@ Filters not supported with LD_TRACE_PRELINKING"));
memcpy (l_initfini, map->l_searchlist.r_list,
nlist * sizeof (struct link_map *));
if (__glibc_likely (nlist > 1))
- {
- /* We can skip looking for the binary itself which is at the front
- of the search list. */
- i = 1;
- uint16_t seen[nlist];
- memset (seen, 0, nlist * sizeof (seen[0]));
- while (1)
- {
- /* Keep track of which object we looked at this round. */
- ++seen[i];
- struct link_map *thisp = l_initfini[i];
-
- /* Find the last object in the list for which the current one is
- a dependency and move the current object behind the object
- with the dependency. */
- unsigned int k = nlist - 1;
- while (k > i)
- {
- struct link_map **runp = l_initfini[k]->l_initfini;
- if (runp != NULL)
- /* Look through the dependencies of the object. */
- while (*runp != NULL)
- if (__glibc_unlikely (*runp++ == thisp))
- {
- /* Move the current object to the back past the last
- object with it as the dependency. */
- memmove (&l_initfini[i], &l_initfini[i + 1],
- (k - i) * sizeof (l_initfini[0]));
- l_initfini[k] = thisp;
-
- if (seen[i + 1] > nlist - i)
- {
- ++i;
- goto next_clear;
- }
-
- uint16_t this_seen = seen[i];
- memmove (&seen[i], &seen[i + 1],
- (k - i) * sizeof (seen[0]));
- seen[k] = this_seen;
-
- goto next;
- }
-
- --k;
- }
-
- if (++i == nlist)
- break;
- next_clear:
- memset (&seen[i], 0, (nlist - i) * sizeof (seen[0]));
-
- next:;
- }
- }
+ sort (l_initfini, nlist);
/* Terminate the list of dependencies. */
l_initfini[nlist] = NULL;
--- a/elf/dl-fini.c
+++ a/elf/dl-fini.c
@@ -26,102 +26,112 @@
typedef void (*fini_t) (void);
-void
-internal_function
-_dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns)
+static void
+weight (struct link_map **maps, size_t nmaps, char *seen, unsigned int *w, int from)
{
- /* A list of one element need not be sorted. */
- if (nmaps == 1)
- return;
+ int i, c;
+ struct link_map *m, **r;
+ for (i = from; i < nmaps; ++i)
+ {
+ m = maps[i];
+ if ((r = m->l_initfini))
+ {
+ c = 0;
+ while (*r)
+ {
+ /* If not a self reference, not being unloaded, and not
+ already removed from the list, increment the reference
+ counter. */
+ if (*r != m && (*r)->l_idx >= 0 && !seen[(*r)->l_idx])
+ ++c;
+ ++r;
+ }
+ /* Update the {w}eight vector with {c}ount map(s) dependency */
+ w[i] = c;
+ }
+ else
+ w[i] = 0;
+ }
+}
+
+
+static void
+sort (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns)
+{
+ int from;
+ int c, i, k;
+ unsigned int w[nmaps];
+ char seen[nmaps];
+ struct link_map *t;
+
+ memset(seen, 0, nmaps);
+
+ /* Use the l_idx field as an unique identifier. */
+ for (i = 0; i < nmaps; ++i)
+ {
+ /* Ensure to not touch a link_map with l_idx < 0 as it is
+ used to flag a dso is being unloaded. */
+ if (maps[i]->l_idx >= 0)
+ maps[i]->l_idx = i;
+ }
/* We can skip looking for the binary itself which is at the front
of the search list for the main namespace. */
- unsigned int i = ns == LM_ID_BASE;
- uint16_t seen[nmaps];
- memset (seen, 0, nmaps * sizeof (seen[0]));
- while (1)
+ from = ns == LM_ID_BASE;
+ if (from)
{
- /* Keep track of which object we looked at this round. */
- ++seen[i];
- struct link_map *thisp = maps[i];
-
- /* Do not handle ld.so in secondary namespaces and object which
- are not removed. */
- if (thisp != thisp->l_real || thisp->l_idx == -1)
- goto skip;
-
- /* Find the last object in the list for which the current one is
- a dependency and move the current object behind the object
- with the dependency. */
- unsigned int k = nmaps - 1;
- while (k > i)
- {
- struct link_map **runp = maps[k]->l_initfini;
- if (runp != NULL)
- /* Look through the dependencies of the object. */
- while (*runp != NULL)
- if (__glibc_unlikely (*runp++ == thisp))
- {
- move:
- /* Move the current object to the back past the last
- object with it as the dependency. */
- memmove (&maps[i], &maps[i + 1],
- (k - i) * sizeof (maps[0]));
- maps[k] = thisp;
-
- if (used != NULL)
- {
- char here_used = used[i];
- memmove (&used[i], &used[i + 1],
- (k - i) * sizeof (used[0]));
- used[k] = here_used;
- }
+ w[0] = 0;
+ seen[0] = 1;
+ }
- if (seen[i + 1] > nmaps - i)
+ /* The list is sorted in place, with entries added from end to start. */
+ weight(maps, k = nmaps, seen, w, from);
+ c = 0;
+ while (c < k)
+ {
+ for (i = k - 1; i >= from; --i)
+ {
+ t = maps[i];
+ /* Do not handle ld.so in secondary namespaces and object which
+ are not removed. */
+ if (w[i] == c && maps[i]->l_idx >= 0 && t->l_real == t)
+ {
+ seen[maps[i]->l_idx] = 1;
+ /* Reducing the number of entries or swaping entries
+ require remaking the {w}eight map. */
+ if (--k != i)
+ {
+ maps[i] = maps[k];
+ maps[k] = t;
+ if (used)
{
- ++i;
- goto next_clear;
+ char c = used[i];
+ used[i] = used[k];
+ used[k] = c;
}
-
- uint16_t this_seen = seen[i];
- memmove (&seen[i], &seen[i + 1], (k - i) * sizeof (seen[0]));
- seen[k] = this_seen;
-
- goto next;
}
-
- if (__glibc_unlikely (maps[k]->l_reldeps != NULL))
- {
- unsigned int m = maps[k]->l_reldeps->act;
- struct link_map **relmaps = &maps[k]->l_reldeps->list[0];
-
- /* Look through the relocation dependencies of the object. */
- while (m-- > 0)
- if (__glibc_unlikely (relmaps[m] == thisp))
- {
- /* If a cycle exists with a link time dependency,
- preserve the latter. */
- struct link_map **runp = thisp->l_initfini;
- if (runp != NULL)
- while (*runp != NULL)
- if (__glibc_unlikely (*runp++ == maps[k]))
- goto ignore;
- goto move;
- }
- ignore:;
+ weight(maps, k, seen, w, from);
+ c = -1;
+ break;
}
-
- --k;
}
+ /* If c != 0, there are cycles, and the first entry in the map,
+ with the lowest reference {c}ount is removed attempting to
+ to break the cycle. */
+ ++c;
+ }
+}
- skip:
- if (++i == nmaps)
- break;
- next_clear:
- memset (&seen[i], 0, (nmaps - i) * sizeof (seen[0]));
- next:;
- }
+void
+internal_function
+_dl_sort_fini (struct link_map **maps, size_t nmaps, char *used, Lmid_t ns)
+{
+ /* A list of one element need not be sorted. */
+ if (nmaps == 1)
+ return;
+
+ sort (maps, nmaps, used, ns);
}
--- a/elf/dl-open.c
+++ a/elf/dl-open.c
@@ -182,6 +182,80 @@ _dl_find_dso_for_object (const ElfW(Addr) addr)
rtld_hidden_def (_dl_find_dso_for_object);
static void
+weight (struct link_map **maps, size_t nmaps, char *seen, unsigned int *w)
+{
+ int i, c;
+ struct link_map *m, **r;
+ for (i = 0; i < nmaps; ++i)
+ {
+ m = maps[i];
+ if ((r = m->l_initfini))
+ {
+ c = 0;
+ while (*r)
+ {
+ /* If not a self reference, not being unloaded, and not
+ already removed from the list, increment the reference
+ counter. */
+ if (*r != m && (*r)->l_idx >= 0 && !seen[(*r)->l_idx])
+ ++c;
+ ++r;
+ }
+ /* Update the {w}eight vector with {c}ount map(s) dependency */
+ w[i] = c;
+ }
+ else
+ w[i] = 0;
+ }
+}
+
+static void
+sort (struct link_map **maps, size_t nmaps)
+{
+ int c, i, k;
+ unsigned int w[nmaps];
+ char seen[nmaps];
+ struct link_map *t;
+ memset(seen, 0, nmaps);
+ /* Use the l_idx field as an unique identifier. */
+ for (i = 0; i < nmaps; ++i)
+ {
+ /* Ensure to not touch a link_map with l_idx < 0 as it is
+ used to flag a dso is being unloaded. */
+ if (maps[i]->l_idx >= 0)
+ maps[i]->l_idx = i;
+ }
+ /* The list is sorted in place, with entries added from end to start. */
+ weight(maps, k = nmaps, seen, w);
+ c = 0;
+ while (c < k)
+ {
+ for (i = k - 1; i >= 0; --i)
+ {
+ if (w[i] == c && maps[i]->l_idx >= 0)
+ {
+ seen[maps[i]->l_idx] = 1;
+ /* Reducing the number of entries or swaping entries
+ require remaking the {w}eight map. */
+ if (--k != i)
+ {
+ t = maps[k];
+ maps[k] = maps[i];
+ maps[i] = t;
+ }
+ weight(maps, k, seen, w);
+ c = -1;
+ break;
+ }
+ }
+ /* If c != 0, there are cycles, and the first entry in the map,
+ with the lowest reference {c}ount is removed attempting to
+ to break the cycle. */
+ ++c;
+ }
+}
+
+static void
dl_open_worker (void *a)
{
struct dl_open_args *args = a;
--

View file

@ -1,30 +1,6 @@
#
# Upstream discussions:
# https://sourceware.org/ml/libc-alpha/2014-02/msg00580.html
#
# Based on the following commit:
#
# From 16552c01a66633c9e412984d9d92616bd4e5303c Mon Sep 17 00:00:00 2001
# From: Andreas Schwab <schwab@redhat.com>
# Date: Fri, 11 Jun 2010 11:04:11 +0200
# Subject: [PATCH] Properly set __libc_multiple_libcs
#
# * elf/rtld.c (_dl_starting_up): Always define.
# (dl_main): Always set _dl_starting_up.
# * elf/dl-support.c (_dl_starting_up): Always define.
# * elf/dl-init.c (_dl_init): Always clear _dl_starting_up.
#
# ---
# ChangeLog | 7 +++++++
# elf/dl-init.c | 4 ----
# elf/dl-support.c | 2 --
# elf/rtld.c | 4 ----
# 4 files changed, 7 insertions(+), 10 deletions(-)
#
diff -urN glibc-2.20-205-ga39208b/elf/dl-init.c glibc-2.20-205-ga39208b.mod/elf/dl-init.c
--- glibc-2.20-205-ga39208b/elf/dl-init.c 2014-11-21 16:08:32.744913590 -0500
+++ glibc-2.20-205-ga39208b.mod/elf/dl-init.c 2014-11-21 16:09:42.485708197 -0500
@@ -119,8 +119,6 @@
--- glibc-2.25.51/elf/dl-init.c.0044~ 2017-07-11 16:44:14.000000000 +0200
+++ glibc-2.25.51/elf/dl-init.c 2017-07-11 18:44:49.173115475 +0200
@@ -119,8 +119,6 @@ _dl_init (struct link_map *main_map, int
while (i-- > 0)
call_init (main_map->l_initfini[i], argc, argv, env);
@ -33,10 +9,9 @@ diff -urN glibc-2.20-205-ga39208b/elf/dl-init.c glibc-2.20-205-ga39208b.mod/elf/
_dl_starting_up = 0;
-#endif
}
diff -urN glibc-2.20-205-ga39208b/elf/dl-support.c glibc-2.20-205-ga39208b.mod/elf/dl-support.c
--- glibc-2.20-205-ga39208b/elf/dl-support.c 2014-11-19 14:35:03.000000000 -0500
+++ glibc-2.20-205-ga39208b.mod/elf/dl-support.c 2014-11-21 16:09:54.829671843 -0500
@@ -118,10 +118,8 @@
--- glibc-2.25.51/elf/dl-support.c.0044~ 2017-07-11 16:44:14.000000000 +0200
+++ glibc-2.25.51/elf/dl-support.c 2017-07-11 18:44:49.173115475 +0200
@@ -117,10 +117,8 @@ struct r_scope_elem _dl_initial_searchli
.r_nlist = 1,
};
@ -47,18 +22,17 @@ diff -urN glibc-2.20-205-ga39208b/elf/dl-support.c glibc-2.20-205-ga39208b.mod/e
/* Random data provided by the kernel. */
void *_dl_random;
diff -urN glibc-2.20-205-ga39208b/elf/rtld.c glibc-2.20-205-ga39208b.mod/elf/rtld.c
--- glibc-2.20-205-ga39208b/elf/rtld.c 2014-11-21 16:08:32.745913587 -0500
+++ glibc-2.20-205-ga39208b.mod/elf/rtld.c 2014-11-21 16:09:05.614816785 -0500
@@ -107,7 +107,6 @@
struct audit_list *next;
} *audit_list;
--- glibc-2.25.51/elf/rtld.c.0044~ 2017-07-11 16:44:14.000000000 +0200
+++ glibc-2.25.51/elf/rtld.c 2017-07-11 18:45:48.606706875 +0200
@@ -214,7 +214,6 @@ audit_list_iter_next (struct audit_list_
return iter->previous->name;
}
-#ifndef HAVE_INLINED_SYSCALLS
/* Set nonzero during loading and initialization of executable and
libraries, cleared before the executable's entry point runs. This
must not be initialized to nonzero, because the unused dynamic
@@ -117,7 +116,6 @@
@@ -224,7 +223,6 @@ audit_list_iter_next (struct audit_list_
never be called. */
int _dl_starting_up = 0;
rtld_hidden_def (_dl_starting_up)
@ -66,7 +40,7 @@ diff -urN glibc-2.20-205-ga39208b/elf/rtld.c glibc-2.20-205-ga39208b.mod/elf/rtl
/* This is the structure which defines all variables global to ld.so
(except those which cannot be added for some reason). */
@@ -776,10 +774,8 @@
@@ -898,10 +896,8 @@ dl_main (const ElfW(Phdr) *phdr,
/* Process the environment variable which control the behaviour. */
process_envvars (&mode);

View file

@ -1,101 +0,0 @@
From 207e77fd3f0a94acdf0557608dd4f10ce0e0f22f Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Mon, 9 May 2011 10:55:58 +0200
Subject: [PATCH] Never leave $ORIGIN unexpanded
* elf/dl-load.c (is_dst): Remove parameter secure, all callers
changed. Move check for valid use of $ORIGIN ...
(_dl_dst_substitute): ... here. Reset check_for_trusted when a
path element is skipped.
---
ChangeLog | 7 +++++++
elf/dl-load.c | 34 ++++++++++++++++------------------
2 files changed, 23 insertions(+), 18 deletions(-)
diff --git a/elf/dl-load.c b/elf/dl-load.c
index 18a83d2..6e16a9a 100644
--- a/elf/dl-load.c
+++ b/elf/dl-load.c
@@ -249,8 +249,7 @@ is_trusted_path_normalize (const char *path, size_t len)
static size_t
-is_dst (const char *start, const char *name, const char *str,
- int is_path, int secure)
+is_dst (const char *start, const char *name, const char *str, int is_path)
{
size_t len;
bool is_curly = false;
@@ -279,12 +278,6 @@ is_dst (const char *start, const char *name, const char *str,
&& (!is_path || name[len] != ':'))
return 0;
- if (__glibc_unlikely (secure)
- && ((name[len] != '\0' && name[len] != '/'
- && (!is_path || name[len] != ':'))
- || (name != start + 1 && (!is_path || name[-2] != ':'))))
- return 0;
-
return len;
}
@@ -299,13 +292,10 @@ _dl_dst_count (const char *name, int is_path)
{
size_t len;
- /* $ORIGIN is not expanded for SUID/GUID programs (except if it
- is $ORIGIN alone) and it must always appear first in path. */
++name;
- if ((len = is_dst (start, name, "ORIGIN", is_path,
- __libc_enable_secure)) != 0
- || (len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0
- || (len = is_dst (start, name, "LIB", is_path, 0)) != 0)
+ if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0
+ || (len = is_dst (start, name, "PLATFORM", is_path)) != 0
+ || (len = is_dst (start, name, "LIB", is_path)) != 0)
++cnt;
name = strchr (name + len, '$');
@@ -338,10 +328,18 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
size_t len;
++name;
- if ((len = is_dst (start, name, "ORIGIN", is_path,
- __libc_enable_secure)) != 0)
+ if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0)
{
- repl = l->l_origin;
+ /* For SUID/GUID programs $ORIGIN must always appear
+ first in a path element. */
+ if (__glibc_unlikely (__libc_enable_secure)
+ && ((name[len] != '\0' && name[len] != '/'
+ && (!is_path || name[len] != ':'))
+ || (name != start + 1 && (!is_path || name[-2] != ':'))))
+ repl = (const char *) -1;
+ else
+ repl = l->l_origin;
+
check_for_trusted = (__libc_enable_secure
&& l->l_type == lt_executable);
}
@@ -351,9 +348,9 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
check_for_trusted = (__libc_enable_secure
&& l->l_type == lt_executable);
}
- else if ((len = is_dst (start, name, "PLATFORM", is_path, 0)) != 0)
+ else if ((len = is_dst (start, name, "PLATFORM", is_path)) != 0)
repl = GLRO(dl_platform);
- else if ((len = is_dst (start, name, "LIB", is_path, 0)) != 0)
+ else if ((len = is_dst (start, name, "LIB", is_path)) != 0)
repl = DL_DST_LIB;
if (repl != NULL && repl != (const char *) -1)
@@ -373,6 +370,7 @@ _dl_dst_substitute (struct link_map *l, const char *name, char *result,
element, but keep an empty element at the end. */
if (wp == result && is_path && *name == ':' && name[1] != '\0')
++name;
+ check_for_trusted = false;
}
else
/* No DST we recognize. */

View file

@ -1,30 +0,0 @@
* Fri May 29 2003 Jakub Jelinek <jakub@redhat.com> 2.3.2-44
- make __init_array_start etc. symbols in elf-init.oS hidden undefined
diff -Nrup a/csu/elf-init.c b/csu/elf-init.c
--- a/csu/elf-init.c 2012-06-05 07:42:49.000000000 -0600
+++ b/csu/elf-init.c 2012-06-07 12:15:21.570319597 -0600
@@ -62,6 +62,23 @@ extern void _fini (void);
programs, this module will come from libc_nonshared.a and differs from
the libc.a module in that it doesn't call the preinit array. */
+#if defined HAVE_VISIBILITY_ATTRIBUTE \
+ && (defined SHARED || defined LIBC_NONSHARED)
+# define hidden_undef_2(x) #x
+# define hidden_undef_1(x) hidden_undef_2 (x)
+# define hidden_undef(x) \
+ __asm (hidden_undef_1 (ASM_GLOBAL_DIRECTIVE) " " #x); \
+ __asm (".hidden " #x);
+#else
+# define hidden_undef(x)
+#endif
+
+hidden_undef (__preinit_array_start)
+hidden_undef (__preinit_array_end)
+hidden_undef (__init_array_start)
+hidden_undef (__init_array_end)
+hidden_undef (__fini_array_start)
+hidden_undef (__fini_array_end)
void
__libc_csu_init (int argc, char **argv, char **envp)

View file

@ -1,15 +0,0 @@
Binary files a/elf/.rtld.c.rej.swp and b/elf/.rtld.c.rej.swp differ
diff -Nrup a/elf/setup-vdso.h b/elf/setup-vdso.h
--- a/elf/setup-vdso.h 2012-10-10 21:34:38.000000000 -0600
+++ b/elf/setup-vdso.h 2012-10-11 09:43:14.152958832 -0600
@@ -93,7 +93,9 @@ setup_vdso (struct link_map *main_map __
char *copy = malloc (len);
if (copy == NULL)
_dl_fatal_printf ("out of memory\n");
- l->l_libname->name = l->l_name = memcpy (copy, dsoname, len);
+ l->l_libname->name = memcpy (copy, dsoname, len);
+ if (GLRO(dl_debug_mask))
+ l->l_name = copy;
}
/* Add the vDSO to the object list. */

View file

@ -1,42 +0,0 @@
From 83e5edd390eabe8f8e8e0d051f929b77a30c0767 Mon Sep 17 00:00:00 2001
From: Andreas Schwab <schwab@redhat.com>
Date: Fri, 18 Mar 2011 16:22:52 +0100
Subject: [PATCH] ldd: never run file directly
* elf/ldd.bash.in: Never run file directly.
---
ChangeLog | 4 ++++
elf/ldd.bash.in | 14 +-------------
2 files changed, 5 insertions(+), 13 deletions(-)
--- a/elf/ldd.bash.in
+++ b/elf/ldd.bash.in
@@ -166,18 +166,6 @@ warning: you do not have execution permission for" "\`$file'" >&2
fi
done
case $ret in
- 0)
- # If the program exits with exit code 5, it means the process has been
- # invoked with __libc_enable_secure. Fall back to running it through
- # the dynamic linker.
- try_trace "$file"
- rc=$?
- if [ $rc = 5 ]; then
- try_trace "$RTLD" "$file"
- rc=$?
- fi
- [ $rc = 0 ] || result=1
- ;;
1)
# This can be a non-ELF binary or no binary at all.
nonelf "$file" || {
@@ -185,7 +173,7 @@ warning: you do not have execution permission for" "\`$file'" >&2
result=1
}
;;
- 2)
+ 0|2)
try_trace "$RTLD" "$file" || result=1
;;
*)

View file

@ -1,7 +1,6 @@
diff -Nrup a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcsetattr.c
--- a/sysdeps/unix/sysv/linux/tcsetattr.c 2012-06-05 07:42:49.000000000 -0600
+++ b/sysdeps/unix/sysv/linux/tcsetattr.c 2012-06-07 12:15:21.831318623 -0600
@@ -48,6 +48,7 @@ tcsetattr (fd, optional_actions, termios
--- glibc-2.25.51/sysdeps/unix/sysv/linux/tcsetattr.c.0025~ 2017-07-11 16:44:14.000000000 +0200
+++ glibc-2.25.51/sysdeps/unix/sysv/linux/tcsetattr.c 2017-07-11 18:32:38.167537430 +0200
@@ -45,6 +45,7 @@ __tcsetattr (int fd, int optional_action
{
struct __kernel_termios k_termios;
unsigned long int cmd;
@ -9,7 +8,7 @@ diff -Nrup a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcset
switch (optional_actions)
{
@@ -79,6 +80,35 @@ tcsetattr (fd, optional_actions, termios
@@ -75,7 +76,36 @@ __tcsetattr (int fd, int optional_action
memcpy (&k_termios.c_cc[0], &termios_p->c_cc[0],
__KERNEL_NCCS * sizeof (cc_t));
@ -45,4 +44,5 @@ diff -Nrup a/sysdeps/unix/sysv/linux/tcsetattr.c b/sysdeps/unix/sysv/linux/tcset
+
+ return retval;
}
weak_alias (__tcsetattr, tcsetattr)
libc_hidden_def (tcsetattr)

View file

@ -1,11 +1,12 @@
diff -Nrup a/localedata/Makefile b/localedata/Makefile
--- a/localedata/Makefile 2012-06-05 07:42:49.000000000 -0600
+++ b/localedata/Makefile 2012-06-07 12:15:21.776318827 -0600
@@ -211,6 +211,7 @@ $(INSTALL-SUPPORTED-LOCALES): install-lo
diff --git a/localedata/Makefile b/localedata/Makefile
index a5f3c92d58954dfc..56719c7c714aa0f1 100644
--- a/localedata/Makefile
+++ b/localedata/Makefile
@@ -218,6 +218,7 @@ $(INSTALL-SUPPORTED-LOCALES): install-locales-dir
echo -n '...'; \
input=`echo $$locale | sed 's/\([^.]*\)[^@]*\(.*\)/\1\2/'`; \
$(LOCALEDEF) --alias-file=../intl/locale.alias \
$(LOCALEDEF) $$flags --alias-file=../intl/locale.alias \
+ --no-archive \
-i locales/$$input -c -f charmaps/$$charset \
-i locales/$$input -f charmaps/$$charset \
$(addprefix --prefix=,$(install_root)) $$locale \
&& echo ' done'; \

View file

@ -1,20 +1,10 @@
This is a part of commit glibc-2.3.3-1492-ga891c7b,
needed for fedora/build-locale-archive.c only.
diff -Nrup a/ChangeLog.17 b/ChangeLog.17
--- a/ChangeLog.17 2012-06-05 07:42:49.000000000 -0600
+++ b/ChangeLog.17 2012-06-07 12:15:21.564319619 -0600
@@ -11818,6 +11829,10 @@ d2009-10-30 Ulrich Drepper <drepper@re
[BZ #4368]
* stdlib/stdlib.h: Remove obsolete part of comment for realpath.
2007-04-16 Jakub Jelinek <jakub@redhat.com>
* locale/programs/locarchive.c (add_alias, insert_name): Remove static.
+2007-04-16 Jakub Jelinek <jakub@redhat.com>
+
+ * locale/programs/locarchive.c (add_alias, insert_name): Remove static.
+
2007-04-16 Ulrich Drepper <drepper@redhat.com>
[BZ #4364]
diff -Nrup a/locale/programs/locarchive.c b/locale/programs/locarchive.c
--- a/locale/programs/locarchive.c 2012-06-05 07:42:49.000000000 -0600
+++ b/locale/programs/locarchive.c 2012-06-07 12:15:21.585319540 -0600

View file

@ -1,18 +1,18 @@
diff -Nrup a/nptl/Makefile b/nptl/Makefile
--- a/nptl/Makefile 2012-06-05 07:42:49.000000000 -0600
+++ b/nptl/Makefile 2012-06-07 12:15:21.816318678 -0600
@@ -529,15 +529,19 @@ $(addprefix $(objpfx), \
$(tests) $(xtests) $(test-srcs))): $(objpfx)libpthread.so \
$(objpfx)libpthread_nonshared.a
diff -up glibc-2.27.20180720/nptl/Makefile.0034~ glibc-2.27.20180720/nptl/Makefile
--- glibc-2.27.20180720/nptl/Makefile.0034~ 2018-07-20 02:29:28.763982849 +0200
+++ glibc-2.27.20180720/nptl/Makefile 2018-07-20 02:33:04.128058315 +0200
@@ -623,14 +623,18 @@ $(addprefix $(objpfx), \
$(tests) $(tests-internal) $(xtests) $(test-srcs))): \
$(objpfx)libpthread.so
$(objpfx)tst-unload: $(libdl)
-# $(objpfx)../libc.so is used instead of $(common-objpfx)libc.so,
+# $(objpfx)linklibc.so is used instead of $(common-objpfx)libc.so,
# since otherwise libpthread.so comes before libc.so when linking.
$(addprefix $(objpfx), $(tests-reverse)): \
- $(objpfx)../libc.so $(objpfx)libpthread.so \
+ $(objpfx)linklibc.so $(objpfx)libpthread.so \
$(objpfx)libpthread_nonshared.a
$(objpfx)../libc.so: $(common-objpfx)libc.so ;
- $(objpfx)../libc.so $(objpfx)libpthread.so
-$(objpfx)../libc.so: $(common-objpfx)libc.so ;
+ $(objpfx)linklibc.so $(objpfx)libpthread.so
+$(objpfx)linklibc.so: $(common-objpfx)libc.so ;
$(addprefix $(objpfx),$(tests-static) $(xtests-static)): $(objpfx)libpthread.a
$(objpfx)tst-atfork2.out: $(objpfx)tst-atfork2mod.so

View file

@ -0,0 +1,20 @@
glibc-2.3.3-1478-g37582bc
* Thu Nov 30 2006 Jakub Jelinek <jakub@redhat.com> 2.5.90-9
- on ppc64 build __libc_start_main without unwind info,
as it breaks MD_FROB_UPDATE_CONTEXT (#217729, #217775; in the
future that could be fixable just by providing .cfi_undefined r2
in __libc_start_main instead)
diff -Nrup a/sysdeps/powerpc/powerpc64/Makefile b/sysdeps/powerpc/powerpc64/Makefile
--- a/sysdeps/powerpc/powerpc64/Makefile 2012-06-05 07:42:49.000000000 -0600
+++ b/sysdeps/powerpc/powerpc64/Makefile 2012-06-07 12:15:21.828318633 -0600
@@ -35,6 +35,8 @@ CFLAGS-rtld-memmove.os = $(no-special-re
CFLAGS-rtld-memchr.os = $(no-special-regs)
CFLAGS-rtld-strnlen.os = $(no-special-regs)
+CFLAGS-libc-start.c += -fno-asynchronous-unwind-tables
+
ifeq ($(subdir),elf)
# help gcc inline asm code from dl-machine.h
+cflags += -finline-limit=2000

View file

@ -1,32 +0,0 @@
Index: glibc-2.23-276-gb65b205/resolv/gethnamaddr.c
===================================================================
--- glibc-2.23-276-gb65b205.orig/resolv/gethnamaddr.c
+++ glibc-2.23-276-gb65b205/resolv/gethnamaddr.c
@@ -68,6 +68,7 @@
#include <errno.h>
#include <stdlib.h>
#include <string.h>
+#include <libc-internal.h>
#define MAXALIASES 35
#define MAXADDRS 35
@@ -864,10 +865,19 @@ addrsort (char **ap, int num)
p = ap;
for (i = 0; i < num; i++, p++) {
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not entirely possible since i is limited to
+ _res.nsort which is limited to MAXRESOLVSORT. This
+ is likely PR/59124 which is still not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (j = 0 ; (unsigned)j < _res.nsort; j++)
if (_res.sort_list[j].addr.s_addr ==
(((struct in_addr *)(*p))->s_addr & _res.sort_list[j].mask))
break;
+ DIAG_POP_NEEDS_COMMENT
aval[i] = j;
if (needsort == 0 && i > 0 && j < aval[i-1])
needsort = i;

View file

@ -1,72 +0,0 @@
Index: glibc-2.22-193-g315267a/locale/programs/ld-ctype.c
===================================================================
--- glibc-2.22-193-g315267a.orig/locale/programs/ld-ctype.c
+++ glibc-2.22-193-g315267a/locale/programs/ld-ctype.c
@@ -31,6 +31,7 @@
#include <wctype.h>
#include <stdint.h>
#include <sys/uio.h>
+#include <libc-internal.h>
#include "localedef.h"
#include "charmap.h"
@@ -2534,9 +2535,19 @@ with character code range values one mus
{
size_t cnt;
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not possible since ctype_map_new prevents
+ map_collection_nr from being greater than MAX_NR_CHARMP which
+ is the size of mapnames. This is likely PR/59124 which is still
+ not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (cnt = 2; cnt < ctype->map_collection_nr; ++cnt)
if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0)
break;
+ DIAG_POP_NEEDS_COMMENT
if (cnt < ctype->map_collection_nr)
free (now->val.str.startmb);
@@ -2807,9 +2818,19 @@ previous definition was here")));
/* This could mean one of several things. First test whether
it's a character class name. */
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not possible since ctype_class_new prevents
+ nr_charclass from being greater than MAX_NR_CHARCLASS which
+ is the size of classnames. This is likely PR/59124 which is still
+ not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (cnt = 0; cnt < ctype->nr_charclass; ++cnt)
if (strcmp (now->val.str.startmb, ctype->classnames[cnt]) == 0)
break;
+ DIAG_POP_NEEDS_COMMENT
if (cnt < ctype->nr_charclass)
{
class_bit = _ISwbit (cnt);
@@ -2817,9 +2838,19 @@ previous definition was here")));
free (now->val.str.startmb);
goto read_charclass;
}
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not possible since ctype_map_new prevents
+ map_collection_nr from being greater than MAX_NR_CHARMP which
+ is the size of mapnames. This is likely PR/59124 which is still
+ not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
for (cnt = 0; cnt < ctype->map_collection_nr; ++cnt)
if (strcmp (now->val.str.startmb, ctype->mapnames[cnt]) == 0)
break;
+ DIAG_POP_NEEDS_COMMENT
if (cnt < ctype->map_collection_nr)
{
mapidx = cnt;

View file

@ -0,0 +1,14 @@
diff --git a/nscd/nscd.service b/nscd/nscd.service
index b7428a3..19ba185 100644
--- a/nscd/nscd.service
+++ b/nscd/nscd.service
@@ -5,7 +5,8 @@ Description=Name Service Cache Daemon
[Service]
Type=forking
-ExecStart=/usr/sbin/nscd
+EnvironmentFile=-/etc/sysconfig/nscd
+ExecStart=/usr/sbin/nscd $NSCD_OPTIONS
ExecStop=/usr/sbin/nscd --shutdown
ExecReload=/usr/sbin/nscd -i passwd
ExecReload=/usr/sbin/nscd -i group

View file

@ -1,29 +0,0 @@
Index: glibc-2.22-386-g95e8397/resolv/res_hconf.c
===================================================================
--- glibc-2.22-386-g95e8397.orig/resolv/res_hconf.c
+++ glibc-2.22-386-g95e8397/resolv/res_hconf.c
@@ -46,6 +46,7 @@
#include "res_hconf.h"
#include <wchar.h>
#include <atomic.h>
+#include <libc-internal.h>
#if IS_IN (libc)
# define fgets_unlocked __fgets_unlocked
@@ -577,7 +578,16 @@ _res_hconf_trim_domain (char *hostname)
for (i = 0; i < _res_hconf.num_trimdomains; ++i)
{
+ DIAG_PUSH_NEEDS_COMMENT
+#if __GNUC_PREREQ (5, 0)
+ /* GCC 5.0 warns about array subscript being above array bounds,
+ but that's not entirely possible since i is limited to
+ num_trimdomains which is limited to <= TRIMDOMAINS_MAX. This
+ is likely PR/59124 which is still not fixed. */
+ DIAG_IGNORE_NEEDS_COMMENT (5.0, "-Warray-bounds")
+#endif
const char *trim = _res_hconf.trimdomain[i];
+ DIAG_POP_NEEDS_COMMENT
trim_len = strlen (trim);
if (hostname_len > trim_len

View file

@ -1,90 +0,0 @@
#
# Posted upstream:
# https://sourceware.org/ml/libc-alpha/2013-10/msg00065.html
#
# This is related to bug 1013801 in that it fixes the problem
# by modifying the runtime. In bug 1013801 we have libselinux
# using pthread_atfork which pulls in libpthread, but we don't
# want that, we want libpthread to be pulled in only when
# actually needed by the application. This patch makes it
# possible to avoid requiring libpthread and still use
# pthread_atfork.
#
# The general idea for the design is in the leading comment
# in the source code.
#
diff --git a/nptl/sysdeps/unix/sysv/linux/Makefile b/nptl/sysdeps/unix/sysv/linux/Makefile
index 6078e2d..36fd50b 100644
--- a/nptl/Makefile
+++ b/nptl/Makefile
@@ -18,7 +18,9 @@
routines = alloca_cutoff forward libc-lowlevellock libc-cancellation \
libc-cleanup libc_pthread_init libc_multiple_threads \
- register-atfork unregister-atfork
+ register-atfork unregister-atfork libc_pthread_atfork
+
+static-only-routines += libc_pthread_atfork
shared-only-routines = forward
libpthread-routines = nptl-init vars events version pt-interp \
diff --git a/nptl/libc_pthread_atfork.c b/nptl/libc_pthread_atfork.c
new file mode 100644
index 0000000..667049a
--- /dev/null
+++ b/nptl/libc_pthread_atfork.c
@@ -0,0 +1,54 @@
+/* Copyright (C) 2013 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.
+
+ 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/>. */
+
+/* The standard design pattern for making it optional to link against
+ libpthread is to mark the function weak, test if the function
+ address is non-zero and call the function, otherwise use a fallback.
+ The problem with pthread_atfork is that there is no viable
+ fallback. If you need to do something during fork it has to be done
+ via pthread_atfork. This makes having libpthread optional and using
+ pthread_atfork impossible. We make it possible by providing
+ pthread_atfork in libc_nonshared.a. The real work of pthread_atfork
+ is done by __register_atfork which is already provided in
+ libc_nonshared.a. It's included in libc_nonshared.a because
+ __dso_handle has to be unique to each DSO such that unloading the DSO
+ can unregister the atfork handlers. We build pthread_atfork again
+ under a different file name and include it into libc_nonshared.a and
+ libc.a. We keep pthread_atfork in libpthread_nonshared.a and
+ libpthread.a for compatibility and completeness.
+
+ Applications that can't rely on a new glibc should use the following
+ code to optionally include libpthread and still register a function
+ via pthread_atfork i.e. use __register_atfork directly:
+
+ extern void *__dso_handle __attribute__ ((__weak__, __visibility__ ("hidden")));
+ extern int __register_atfork (void (*) (void), void (*) (void), void (*) (void), void *);
+
+ static int __app_atfork (void (*prepare) (void), void (*parent) (void), void (*child) (void))
+ {
+ return __register_atfork (prepare, parent, child,
+ &__dso_handle == NULL ? NULL : __dso_handle);
+ }
+
+ This code requires glibc 2.3.2 or newer. Previous to 2.3.2 no such
+ interfaces exist and at that point is is impossible to have an
+ optional libpthread and call pthread_atfork.
+
+ This code adds no more ABI requirements than already exist since
+ __dso_handle and __register_atfork are already part of the ABI. */
+#include <pthread_atfork.c>

File diff suppressed because it is too large Load diff

View file

@ -1,54 +0,0 @@
commit a4551b7f6ce08317220a8cd79cd3d02a03648752
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Jul 13 11:50:04 2016 +0200
sln: Preprocessor cleanups
diff --git a/elf/sln.c b/elf/sln.c
index f52cb9f..fa4ccec 100644
--- a/elf/sln.c
+++ b/elf/sln.c
@@ -16,10 +16,6 @@
License along with the GNU C Library; if not, see
<http://www.gnu.org/licenses/>. */
-#ifdef HAVE_CONFIG_H
-# include "config.h"
-#endif
-
#include <error.h>
#include <errno.h>
#include <libintl.h>
@@ -37,10 +33,6 @@
#define PACKAGE _libc_intl_domainname
-#if !defined S_ISDIR && defined S_IFDIR
-#define S_ISDIR(m) (((m) & S_IFMT) == S_IFDIR)
-#endif
-
static int makesymlink (const char *src, const char *dest);
static int makesymlinks (const char *file);
static void usage (void);
@@ -89,9 +81,6 @@ usage (void)
static int
makesymlinks (const char *file)
{
-#ifndef PATH_MAX
-#define PATH_MAX 4095
-#endif
char *buffer = NULL;
size_t bufferlen = 0;
int ret;
@@ -190,11 +179,7 @@ makesymlink (const char *src, const char *dest)
return -1;
}
-#ifdef S_ISLNK
if (symlink (src, dest) == 0)
-#else
- if (link (src, dest) == 0)
-#endif
{
/* Destination must exist by now. */
if (access (dest, F_OK))

View file

@ -1,164 +0,0 @@
commit 9f9503b56a8c7566c91d486a67be5d41792a87ca
Author: Florian Weimer <fweimer@redhat.com>
Date: Wed Jul 13 14:06:00 2016 +0200
sln: Install as a hard link to ldconfig
Implementing and sln and ldconfig with the same binary saves
around 850 KiB from a glibc installation.
The sln program is implicitly tested during the build, so no test
case is needed.
diff --git a/elf/Makefile b/elf/Makefile
index 593403c..d90f21a 100644
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -70,12 +70,8 @@ install-others = $(inst_rtlddir)/$(rtld-installed-name)
install-bin-script = ldd
endif
-others = sprof sln
+others = sprof
install-bin = sprof
-others-static = sln
-install-rootsbin = sln
-sln-modules := static-stubs
-extra-objs += $(sln-modules:=.o)
ifeq (yes,$(use-ldconfig))
ifeq (yes,$(build-shared))
@@ -83,8 +79,16 @@ others-static += ldconfig
others += ldconfig
install-rootsbin += ldconfig
-ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs
+ldconfig-modules := cache readlib xmalloc xstrdup chroot_canon static-stubs sln
extra-objs += $(ldconfig-modules:=.o)
+
+# Install sln as a hard link to ldconfig.
+install-others-programs += $(inst_rootsbindir)/sln
+others: $(objpfx)sln
+$(objpfx)sln: $(objpfx)ldconfig
+ ln -f $< $@
+$(inst_rootsbindir)/sln: $(inst_rootsbindir)/ldconfig
+ ln -f $< $@
endif
endif
@@ -466,8 +470,6 @@ $(objpfx)ldd: ldd.bash.in $(common-objpfx)soversions.mk \
$(objpfx)sprof: $(libdl)
-$(objpfx)sln: $(sln-modules:%=$(objpfx)%.o)
-
$(objpfx)ldconfig: $(ldconfig-modules:%=$(objpfx)%.o)
SYSCONF-FLAGS := -D'SYSCONFDIR="$(sysconfdir)"'
diff --git a/elf/ldconfig.c b/elf/ldconfig.c
index 467ca82..972737c 100644
--- a/elf/ldconfig.c
+++ b/elf/ldconfig.c
@@ -44,6 +44,8 @@
#include <dl-procinfo.h>
+#include "sln.h"
+
#ifdef _DL_FIRST_PLATFORM
# define _DL_FIRST_EXTRA (_DL_FIRST_PLATFORM + _DL_PLATFORMS_COUNT)
#else
@@ -1275,6 +1277,9 @@ main (int argc, char **argv)
/* Set the text message domain. */
textdomain (_libc_intl_domainname);
+ if (run_sln (argv[0]))
+ return sln_main (argc, argv);
+
/* Parse and process arguments. */
int remaining;
argp_parse (&argp, argc, argv, 0, &remaining, NULL);
diff --git a/elf/sln.c b/elf/sln.c
index fa4ccec..c6889d7 100644
--- a/elf/sln.c
+++ b/elf/sln.c
@@ -1,4 +1,4 @@
-/* `sln' program to create symbolic links between files.
+/* sln helper to create symbolic links between files, invoked from ldconfig.
Copyright (C) 1998-2016 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -31,21 +31,29 @@
#include "../version.h"
-#define PACKAGE _libc_intl_domainname
+#include "sln.h"
static int makesymlink (const char *src, const char *dest);
static int makesymlinks (const char *file);
static void usage (void);
-int
-main (int argc, char **argv)
+/* Check if we have to run sln. */
+bool
+run_sln (const char *argv0)
{
- /* Set locale via LC_ALL. */
- setlocale (LC_ALL, "");
-
- /* Set the text message domain. */
- textdomain (PACKAGE);
+ const char *slash = strrchr (argv0, '/');
+ const char *progname;
+ if (slash == NULL)
+ progname = argv0;
+ else
+ progname = slash + 1;
+ return strcmp (progname, "sln") == 0;
+}
+/* Invoked from ldconfig. */
+int
+sln_main (int argc, char **argv)
+{
switch (argc)
{
case 2:
diff --git a/elf/sln.h b/elf/sln.h
new file mode 100644
index 0000000..a3a16ab
--- /dev/null
+++ b/elf/sln.h
@@ -0,0 +1,30 @@
+/* Interface of the sln command-line tool.
+ Copyright (C) 2016 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ <http://www.gnu.org/licenses/>. */
+
+#ifndef SLN_H
+#define SLN_H
+
+#include <stdbool.h>
+
+/* Return true if main should invoke sln_main. */
+bool run_sln (const char *argv0);
+
+/* Main routine of the sln command. */
+int sln_main (int argc, char **argv);
+
+#endif /* SLN_H */

View file

@ -1,176 +0,0 @@
Revert these two upstream commits, to unbreak ASAN:
commit e91bd7465816f474617dcb4bbfe72f3594c5783c
Author: Adhemerval Zanella <adhemerval.zanella@linaro.com>
Date: Thu Mar 31 10:51:51 2016 -0300
Fix tst-dlsym-error build
This patch fixes the new test tst-dlsym-error build on aarch64
(and possible other architectures as well) due missing strchrnul
definition.
* elf/tst-dlsym-error.c: Include <string.h> for strchrnul.
commit 7d45c163d00c88d5875a112343c4ea3e61349e6b
Author: Florian Weimer <fweimer@redhat.com>
Date: Thu Mar 31 11:26:55 2016 +0200
Report dlsym, dlvsym lookup errors using dlerror [BZ #19509]
* elf/dl-lookup.c (_dl_lookup_symbol_x): Report error even if
skip_map != NULL.
* elf/tst-dlsym-error.c: New file.
* elf/Makefile (tests): Add tst-dlsym-error.
(tst-dlsym-error): Link against libdl.
Index: b/elf/Makefile
===================================================================
--- a/elf/Makefile
+++ b/elf/Makefile
@@ -149,7 +149,7 @@ tests += loadtest restest1 preloadtest l
tst-nodelete) \
tst-initorder tst-initorder2 tst-relsort1 tst-null-argv \
tst-ptrguard1 tst-tlsalign tst-tlsalign-extern tst-nodelete-opened \
- tst-nodelete2 tst-audit11 tst-audit12 tst-dlsym-error
+ tst-nodelete2 tst-audit11 tst-audit12
# reldep9
ifeq ($(build-hardcoded-path-in-tests),yes)
tests += tst-dlopen-aout
@@ -1258,5 +1258,3 @@ $(objpfx)tst-prelink-cmp.out: tst-prelin
$(objpfx)tst-ldconfig-X.out : tst-ldconfig-X.sh $(objpfx)ldconfig
$(SHELL) $< '$(common-objpfx)' '$(test-wrapper)' '$(test-wrapper-env)' > $@; \
$(evaluate-test)
-
-$(objpfx)tst-dlsym-error: $(libdl)
Index: b/elf/dl-lookup.c
===================================================================
--- a/elf/dl-lookup.c
+++ b/elf/dl-lookup.c
@@ -858,6 +858,7 @@ _dl_lookup_symbol_x (const char *undef_n
if (__glibc_unlikely (current_value.s == NULL))
{
if ((*ref == NULL || ELFW(ST_BIND) ((*ref)->st_info) != STB_WEAK)
+ && skip_map == NULL
&& !(GLRO(dl_debug_mask) & DL_DEBUG_UNUSED))
{
/* We could find no value for a strong reference. */
Index: b/elf/tst-dlsym-error.c
===================================================================
--- a/elf/tst-dlsym-error.c
+++ /dev/null
@@ -1,114 +0,0 @@
-/* Test error reporting for dlsym, dlvsym failures.
- Copyright (C) 2016 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- <http://www.gnu.org/licenses/>. */
-
-#include <dlfcn.h>
-#include <gnu/lib-names.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-/* Used to disambiguate symbol names. */
-static int counter;
-
-static void
-test_one (void *handle, const char *name, void *(func) (void *, const char *),
- const char *suffix)
-{
- ++counter;
- char symbol[32];
- snprintf (symbol, sizeof (symbol), "no_such_symbol_%d", counter);
- char *expected_message;
- if (asprintf (&expected_message, ": undefined symbol: %s%s",
- symbol, suffix) < 0)
- {
- printf ("error: asprintf: %m\n");
- abort ();
- }
-
- void *addr = func (handle, symbol);
- if (addr != NULL)
- {
- printf ("error: %s: found symbol \"no_such_symbol\"\n", name);
- abort ();
- }
- const char *message = dlerror ();
- if (message == NULL)
- {
- printf ("error: %s: missing error message\n", name);
- abort ();
- }
- const char *message_without_path = strchrnul (message, ':');
- if (strcmp (message_without_path, expected_message) != 0)
- {
- printf ("error: %s: unexpected error message: %s\n", name, message);
- abort ();
- }
- free (expected_message);
-
- message = dlerror ();
- if (message != NULL)
- {
- printf ("error: %s: unexpected error message: %s\n", name, message);
- abort ();
- }
-}
-
-static void
-test_handles (const char *name, void *(func) (void *, const char *),
- const char *suffix)
-{
- test_one (RTLD_DEFAULT, name, func, suffix);
- test_one (RTLD_NEXT, name, func, suffix);
-
- void *handle = dlopen (LIBC_SO, RTLD_LAZY);
- if (handle == NULL)
- {
- printf ("error: cannot dlopen %s: %s\n", LIBC_SO, dlerror ());
- abort ();
- }
- test_one (handle, name, func, suffix);
- dlclose (handle);
-}
-
-static void *
-dlvsym_no_such_version (void *handle, const char *name)
-{
- return dlvsym (handle, name, "NO_SUCH_VERSION");
-}
-
-static void *
-dlvsym_glibc_private (void *handle, const char *name)
-{
- return dlvsym (handle, name, "GLIBC_PRIVATE");
-}
-
-static int
-do_test (void)
-{
- test_handles ("dlsym", dlsym, "");
- test_handles ("dlvsym", dlvsym_no_such_version,
- ", version NO_SUCH_VERSION");
- test_handles ("dlvsym", dlvsym_glibc_private,
- ", version GLIBC_PRIVATE");
-
- return 0;
-}
-
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"

File diff suppressed because it is too large Load diff

View file

@ -1,167 +0,0 @@
diff -Nrup a/malloc/arena.c b/malloc/arena.c
--- a/malloc/arena.c 2012-05-29 16:45:53.000000000 -0600
+++ b/malloc/arena.c 2012-05-30 00:13:40.683514016 -0600
@@ -673,7 +673,7 @@ heap_trim(heap_info *heap, size_t pad)
heap = prev_heap;
if(!prev_inuse(p)) { /* consolidate backward */
p = prev_chunk(p);
- unlink(p, bck, fwd);
+ unlink(ar_ptr, p, bck, fwd);
}
assert(((unsigned long)((char*)p + new_size) & (pagesz-1)) == 0);
assert( ((char*)p + new_size) == ((char*)heap + heap->size) );
diff -Nrup a/malloc/hooks.c b/malloc/hooks.c
--- a/malloc/hooks.c 2012-05-29 16:45:53.000000000 -0600
+++ b/malloc/hooks.c 2012-05-30 00:13:40.684514011 -0600
@@ -191,7 +191,9 @@ top_check(void)
(char*)t + chunksize(t) == mp_.sbrk_base + main_arena.system_mem)))
return 0;
+ mutex_unlock(&main_arena);
malloc_printerr (check_action, "malloc: top chunk is corrupt", t);
+ mutex_lock(&main_arena);
/* Try to set up a new top chunk. */
brk = MORECORE(0);
diff -Nrup a/malloc/malloc.c b/malloc/malloc.c
--- a/malloc/malloc.c 2012-05-29 16:45:53.000000000 -0600
+++ b/malloc/malloc.c 2012-05-30 00:13:40.686514001 -0600
@@ -1424,12 +1424,14 @@ typedef struct malloc_chunk* mbinptr;
#define last(b) ((b)->bk)
/* Take a chunk off a bin list */
-#define unlink(P, BK, FD) { \
+#define unlink(AV, P, BK, FD) { \
FD = P->fd; \
BK = P->bk; \
- if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) \
+ if (__builtin_expect (FD->bk != P || BK->fd != P, 0)) { \
+ mutex_unlock(&(AV)->mutex); \
malloc_printerr (check_action, "corrupted double-linked list", P); \
- else { \
+ mutex_lock(&(AV)->mutex); \
+ } else { \
FD->bk = BK; \
BK->fd = FD; \
if (!in_smallbin_range (P->size) \
@@ -2511,7 +2513,9 @@ static void* sysmalloc(INTERNAL_SIZE_T n
else if (contiguous(av) && old_size && brk < old_end) {
/* Oops! Someone else killed our space.. Can't touch anything. */
+ mutex_unlock(&av->mutex);
malloc_printerr (3, "break adjusted to free malloc space", brk);
+ mutex_lock(&av->mutex);
}
/*
@@ -3345,7 +3349,9 @@ _int_malloc(mstate av, size_t bytes)
{
errstr = "malloc(): memory corruption (fast)";
errout:
+ mutex_unlock(&av->mutex);
malloc_printerr (check_action, errstr, chunk2mem (victim));
+ mutex_lock(&av->mutex);
return NULL;
}
check_remalloced_chunk(av, victim, nb);
@@ -3430,8 +3436,12 @@ _int_malloc(mstate av, size_t bytes)
bck = victim->bk;
if (__builtin_expect (victim->size <= 2 * SIZE_SZ, 0)
|| __builtin_expect (victim->size > av->system_mem, 0))
- malloc_printerr (check_action, "malloc(): memory corruption",
- chunk2mem (victim));
+ {
+ void *p = chunk2mem(victim);
+ mutex_unlock(&av->mutex);
+ malloc_printerr (check_action, "malloc(): memory corruption", p);
+ mutex_lock(&av->mutex);
+ }
size = chunksize(victim);
/*
@@ -3572,7 +3582,7 @@ _int_malloc(mstate av, size_t bytes)
victim = victim->fd;
remainder_size = size - nb;
- unlink(victim, bck, fwd);
+ unlink(av, victim, bck, fwd);
/* Exhaust */
if (remainder_size < MINSIZE) {
@@ -3670,7 +3680,7 @@ _int_malloc(mstate av, size_t bytes)
remainder_size = size - nb;
/* unlink */
- unlink(victim, bck, fwd);
+ unlink(av, victim, bck, fwd);
/* Exhaust */
if (remainder_size < MINSIZE) {
@@ -3805,9 +3815,11 @@ _int_free(mstate av, mchunkptr p, int ha
{
errstr = "free(): invalid pointer";
errout:
- if (! have_lock && locked)
+ if (have_lock || locked)
(void)mutex_unlock(&av->mutex);
malloc_printerr (check_action, errstr, chunk2mem(p));
+ if (have_lock)
+ mutex_lock(&av->mutex);
return;
}
/* We know that each chunk is at least MINSIZE bytes in size or a
@@ -3952,7 +3964,7 @@ _int_free(mstate av, mchunkptr p, int ha
prevsize = p->prev_size;
size += prevsize;
p = chunk_at_offset(p, -((long) prevsize));
- unlink(p, bck, fwd);
+ unlink(av, p, bck, fwd);
}
if (nextchunk != av->top) {
@@ -3961,7 +3973,7 @@ _int_free(mstate av, mchunkptr p, int ha
/* consolidate forward */
if (!nextinuse) {
- unlink(nextchunk, bck, fwd);
+ unlink(av, nextchunk, bck, fwd);
size += nextsize;
} else
clear_inuse_bit_at_offset(nextchunk, 0);
@@ -4122,7 +4134,7 @@ static void malloc_consolidate(mstate av
prevsize = p->prev_size;
size += prevsize;
p = chunk_at_offset(p, -((long) prevsize));
- unlink(p, bck, fwd);
+ unlink(av, p, bck, fwd);
}
if (nextchunk != av->top) {
@@ -4130,7 +4142,7 @@ static void malloc_consolidate(mstate av
if (!nextinuse) {
size += nextsize;
- unlink(nextchunk, bck, fwd);
+ unlink(av, nextchunk, bck, fwd);
} else
clear_inuse_bit_at_offset(nextchunk, 0);
@@ -4199,7 +4211,9 @@ _int_realloc(mstate av, mchunkptr oldp,
{
errstr = "realloc(): invalid old size";
errout:
+ mutex_unlock(&av->mutex);
malloc_printerr (check_action, errstr, chunk2mem(oldp));
+ mutex_lock(&av->mutex);
return NULL;
}
@@ -4241,7 +4255,7 @@ _int_realloc(mstate av, mchunkptr oldp,
(unsigned long)(newsize = oldsize + nextsize) >=
(unsigned long)(nb)) {
newp = oldp;
- unlink(next, bck, fwd);
+ unlink(av, next, bck, fwd);
}
/* allocate, copy, free */

View file

@ -16,7 +16,7 @@ index e3fa187..9fd9216 100644
- file->decided = 1;
file->data = NULL;
fd = open_not_cancel_2 (file->filename, O_RDONLY | O_CLOEXEC);
fd = __open_nocancel (file->filename, O_RDONLY | O_CLOEXEC);
@@ -278,6 +277,7 @@ _nl_load_locale (struct loaded_l10nfile *file, int category)
newdata->alloc = alloc;

View file

@ -1,181 +0,0 @@
#
# Red Hat BZ:
# https://bugzilla.redhat.com/show_bug.cgi?id=816647
#
# ChangeLog
#
#2013-04-30 Patsy Franklin <pfrankli@redhat.com>
#
# * iconv/gconv_cache.c (find_module): Demangle init_fct before
# checking for NULL. Mangle __btowc_fct if init_fct is non-NULL.
# * iconv/gconv_db.c (free_derivation): Check that __shlib_handle
# is non-NULL before demangling the end_fct. Check for NULL
# end_fct after demangling.
# (__gconv_release_step): Demangle the end_fct before checking
# it for NULL. Remove assert on __shlibc_handle != NULL.
# (gen_steps): Don't check btowc_fct for NULL before mangling.
# Demangle init_fct before checking for NULL.
# (increment_counter): Likewise
# * gconv_dl.c (__gconv_find_shlib): Don't check init_fct or
# end_fct for NULL before mangling.
# * wcsmbs/btowc.c (__btowc): Demangle btowc_fct before checking
# for NULL.
#
diff -Nrup a/iconv/gconv_cache.c b/iconv/gconv_cache.c
--- a/iconv/gconv_cache.c 2012-12-24 22:02:13.000000000 -0500
+++ b/iconv/gconv_cache.c 2013-04-30 06:43:24.788684270 -0400
@@ -207,17 +207,16 @@ find_module (const char *directory, cons
result->__data = NULL;
/* Call the init function. */
- if (result->__init_fct != NULL)
- {
- __gconv_init_fct init_fct = result->__init_fct;
+ __gconv_init_fct init_fct = result->__init_fct;
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (init_fct);
+ PTR_DEMANGLE (init_fct);
#endif
+ if (init_fct != NULL)
+ {
status = DL_CALL_FCT (init_fct, (result));
#ifdef PTR_MANGLE
- if (result->__btowc_fct != NULL)
- PTR_MANGLE (result->__btowc_fct);
+ PTR_MANGLE (result->__btowc_fct);
#endif
}
}
diff -Nrup a/iconv/gconv_db.c b/iconv/gconv_db.c
--- a/iconv/gconv_db.c 2012-12-24 22:02:13.000000000 -0500
+++ b/iconv/gconv_db.c 2013-04-30 06:37:16.886521576 -0400
@@ -179,16 +179,15 @@ free_derivation (void *p)
size_t cnt;
for (cnt = 0; cnt < deriv->nsteps; ++cnt)
- if (deriv->steps[cnt].__counter > 0
- && deriv->steps[cnt].__end_fct != NULL)
+ if ((deriv->steps[cnt].__counter > 0)
+ && (deriv->steps[cnt].__shlib_handle != NULL))
{
- assert (deriv->steps[cnt].__shlib_handle != NULL);
-
__gconv_end_fct end_fct = deriv->steps[cnt].__end_fct;
#ifdef PTR_DEMANGLE
PTR_DEMANGLE (end_fct);
#endif
- DL_CALL_FCT (end_fct, (&deriv->steps[cnt]));
+ if (end_fct != NULL)
+ DL_CALL_FCT (end_fct, (&deriv->steps[cnt]));
}
/* Free the name strings. */
@@ -212,16 +211,12 @@ __gconv_release_step (struct __gconv_ste
if (step->__shlib_handle != NULL && --step->__counter == 0)
{
/* Call the destructor. */
- if (step->__end_fct != NULL)
- {
- assert (step->__shlib_handle != NULL);
-
- __gconv_end_fct end_fct = step->__end_fct;
+ __gconv_end_fct end_fct = step->__end_fct;
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (end_fct);
+ PTR_DEMANGLE (end_fct);
#endif
- DL_CALL_FCT (end_fct, (step));
- }
+ if (end_fct != NULL)
+ DL_CALL_FCT (end_fct, (step));
#ifndef STATIC_GCONV
/* Release the loaded module. */
@@ -293,13 +288,11 @@ gen_steps (struct derivation_step *best,
/* Call the init function. */
__gconv_init_fct init_fct = result[step_cnt].__init_fct;
- if (init_fct != NULL)
- {
- assert (result[step_cnt].__shlib_handle != NULL);
-
# ifdef PTR_DEMANGLE
- PTR_DEMANGLE (init_fct);
+ PTR_DEMANGLE (init_fct);
# endif
+ if (init_fct != NULL)
+ {
status = DL_CALL_FCT (init_fct, (&result[step_cnt]));
if (__builtin_expect (status, __GCONV_OK) != __GCONV_OK)
@@ -312,8 +305,7 @@ gen_steps (struct derivation_step *best,
}
# ifdef PTR_MANGLE
- if (result[step_cnt].__btowc_fct != NULL)
- PTR_MANGLE (result[step_cnt].__btowc_fct);
+ PTR_MANGLE (result[step_cnt].__btowc_fct);
# endif
}
}
@@ -393,16 +385,15 @@ increment_counter (struct __gconv_step *
/* Call the init function. */
__gconv_init_fct init_fct = step->__init_fct;
- if (init_fct != NULL)
- {
#ifdef PTR_DEMANGLE
- PTR_DEMANGLE (init_fct);
+ PTR_DEMANGLE (init_fct);
#endif
+ if (init_fct != NULL)
+ {
DL_CALL_FCT (init_fct, (step));
#ifdef PTR_MANGLE
- if (step->__btowc_fct != NULL)
- PTR_MANGLE (step->__btowc_fct);
+ PTR_MANGLE (step->__btowc_fct);
#endif
}
}
diff -Nrup a/iconv/gconv_dl.c b/iconv/gconv_dl.c
--- a/iconv/gconv_dl.c 2012-12-24 22:02:13.000000000 -0500
+++ b/iconv/gconv_dl.c 2013-04-30 06:37:16.889521601 -0400
@@ -132,10 +132,8 @@ __gconv_find_shlib (const char *name)
#ifdef PTR_MANGLE
PTR_MANGLE (found->fct);
- if (found->init_fct != NULL)
- PTR_MANGLE (found->init_fct);
- if (found->end_fct != NULL)
- PTR_MANGLE (found->end_fct);
+ PTR_MANGLE (found->init_fct);
+ PTR_MANGLE (found->end_fct);
#endif
/* We have succeeded in loading the shared object. */
diff -Nrup a/wcsmbs/btowc.c b/wcsmbs/btowc.c
--- a/wcsmbs/btowc.c 2012-12-24 22:02:13.000000000 -0500
+++ b/wcsmbs/btowc.c 2013-04-30 06:37:16.891521619 -0400
@@ -47,15 +47,15 @@ __btowc (c)
/* Get the conversion functions. */
fcts = get_gconv_fcts (_NL_CURRENT_DATA (LC_CTYPE));
__gconv_btowc_fct btowc_fct = fcts->towc->__btowc_fct;
+#ifdef PTR_DEMANGLE
+ if (fcts->towc->__shlib_handle != NULL)
+ PTR_DEMANGLE (btowc_fct);
+#endif
if (__builtin_expect (fcts->towc_nsteps == 1, 1)
&& __builtin_expect (btowc_fct != NULL, 1))
{
/* Use the shortcut function. */
-#ifdef PTR_DEMANGLE
- if (fcts->towc->__shlib_handle != NULL)
- PTR_DEMANGLE (btowc_fct);
-#endif
return DL_CALL_FCT (btowc_fct, (fcts->towc, (unsigned char) c));
}
else

View file

@ -1,8 +1,5 @@
%define checklist %{_builddir}/%{name}-%{version}/Check.list
# crypt blowfish support
%define crypt_bf_ver 1.3
%define _slibdir /%{_lib}
%define _slibdir32 /lib
%define _libdir32 %{_prefix}/lib
@ -56,8 +53,8 @@
Summary: The GNU libc libraries
Name: glibc
Epoch: 6
Version: 2.24
Release: 11
Version: 2.28
Release: 1
License: LGPLv2+ and LGPLv2+ with exceptions and GPLv2+
Group: System/Libraries
Url: http://www.eglibc.org/
@ -76,12 +73,6 @@ Source10: libc-lock.h
# Locales
Source20: Makefile.locales
# Blowfish support
Source50: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_ver}.tar.gz
Source51: http://www.openwall.com/crypt/crypt_blowfish-%{crypt_bf_ver}.tar.gz.sign
Source52: http://cvsweb.openwall.com/cgi/cvsweb.cgi/~checkout~/Owl/packages/glibc/crypt_freesec.c
Source53: http://cvsweb.openwall.com/cgi/cvsweb.cgi/~checkout~/Owl/packages/glibc/crypt_freesec.h
Source100: %{name}.rpmlintrc
Source1000: locale-pkg
@ -90,132 +81,89 @@ Source1002: locale_uninstall.sh
#-----------------------------------------------------------------------
# fedora patches
#
# Patches that are highly unlikely to ever be accepated upstream.
#
# Configuration twiddle, not sure there's a good case to get upstream to
# change this.
Patch0: glibc-fedora-nscd.patch
# Horrible hack, never to be upstreamed. Can go away once the world
# has been rebuilt to use the new ld.so path.
Patch1: glibc-arm-hardfloat-3.patch
# All these were from the glibc-fedora.patch mega-patch and need another
# round of reviewing. Ideally they'll either be submitted upstream or
# dropped.
Patch10: glibc-fedora-__libc_multiple_libcs.patch
Patch11: glibc-fedora-elf-ORIGIN.patch
Patch12: glibc-fedora-elf-init-hidden_undef.patch
Patch13: glibc-fedora-elf-rh737223.patch
Patch14: eglibc-fedora-test-debug-gnuc-hack.patch
Patch15: glibc-fedora-i386-tls-direct-seg-refs.patch
Patch16: glibc-fedora-include-bits-ldbl.patch
Patch17: glibc-fedora-ldd.patch
Patch18: glibc-fedora-linux-tcsetattr.patch
Patch19: eglibc-fedora-locale-euro.patch
Patch21: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-i386-tls-direct-seg-refs.patch
Patch23: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-include-bits-ldbl.patch
Patch25: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-linux-tcsetattr.patch
Patch26: eglibc-fedora-locale-euro.patch
Patch27: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-localedata-rh61908.patch
# We disagree with
# glibc-fedora-streams-rh436349.patch
# http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-streams-rh436349.patch
# Therefore we don't package/apply it.
Patch20: glibc-fedora-localedata-rh61908.patch
Patch21: glibc-fedora-localedef.patch
Patch22: glibc-fedora-locarchive.patch
Patch23: glibc-fedora-manual-dircategory.patch
Patch24: glibc-fedora-nis-rh188246.patch
Patch25: glibc-fedora-nptl-linklibc.patch
Patch26: glibc-2.20-i586-hptiming.patch
Patch27: glibc-2.22-blacklist-CPUs-from-lock-elision.patch
Patch28: glibc-bug-regex-gcc5.patch
Patch29: glibc-c-utf8-locale.patch
Patch30: glibc-dns-host-gcc5.patch
# https://sourceware.org/bugzilla/show_bug.cgi?id=17645
Patch31: glibc-dso_deps.patch
Patch32: glibc-gcc-PR69537.patch
Patch33: glibc-gethnamaddr-gcc5.patch
Patch34: glibc-ld-ctype-gcc5.patch
Patch35: glibc-res-hconf-gcc5.patch
#
# Patches submitted, but not yet approved upstream.
# Each should be associated with a BZ.
# Obviously we're not there right now, but that's the goal
#
# Needs to be sent upstream
Patch40: glibc-rh697421.patch
# Build info files in the source tree, then move to the build
# tree so that they're identical for multilib builds
Patch41: glibc-rh825061.patch
Patch42: glibc-rh741105.patch
# Upstream BZ 14247
Patch43: glibc-rh827510.patch
# Upstream BZ 14185
Patch44: glibc-rh819430.patch
Patch45: glibc-rh952799.patch
Patch46: glibc-rh1009145.patch
Patch47: glibc-rh1013801.patch
Patch48: glibc-rh1070416.patch
Patch49: glibc-rh1315108.patch
Patch50: glibc-rh1315476-1.patch
Patch51: glibc-rh1315476-2.patch
Patch52: glibc-rh1324623.patch
Patch53: glibc-rh1335011.patch
Patch54: glibc-rh1351108-update-to-unicode-9.0.0.patch
Patch30: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-localedef.patch
Patch31: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-locarchive.patch
Patch32: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-manual-dircategory.patch
Patch33: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-nis-rh188246.patch
Patch34: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-nptl-linklibc.patch
Patch35: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-ppc-unwind.patch
Patch36: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-aarch64-tls-fixes.patch
Patch38: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-arm-hardfloat-3.patch
Patch40: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-c-utf8-locale.patch
Patch41: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-cs-path.patch
# We disagree with http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-disable-rwlock-elision.patch
# Patch 131 is a much nicer solution that disables rwlock elision only on CPUs that can't handle it.
Patch44: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-__libc_multiple_libcs.patch
Patch46: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-fedora-nscd.patch
Patch47: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-gcc-PR69537.patch
Patch50: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-nscd-sysconfig.patch
Patch52: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1009145.patch
Patch54: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1070416.patch
#Patch55: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1315108.patch
Patch58: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1324623.patch
#Patch59: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh1335011.patch
Patch61: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh697421.patch
Patch62: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh741105.patch
Patch63: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh819430.patch
Patch64: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh825061.patch
Patch65: http://pkgs.fedoraproject.org/cgit/rpms/glibc.git/plain/glibc-rh827510.patch
#-----------------------------------------------------------------------
# mandriva patches
Patch100: eglibc-mandriva-localedef-archive-follow-symlinks.patch
Patch101: eglibc-mandriva-fix-dns-with-broken-routers.patch
Patch102: eglibc-mandriva-nss-upgrade.patch
#Drop patch. Use default directory for locale definitions
#Patch103: eglibc-mandriva-share-locale.patch
Patch104: eglibc-mandriva-nsswitch.conf.patch
Patch105: eglibc-mandriva-xterm-xvt.patch
Patch106: eglibc-mandriva-nscd-enable.patch
Patch107: eglibc-mandriva-nscd-no-host-cache.patch
Patch108: eglibc-mandriva-i386-hwcapinfo.patch
Patch109: eglibc-mandriva-nscd-init-should-start.patch
Patch110: eglibc-mandriva-timezone.patch
Patch111: eglibc-mandriva-biarch-cpp-defines.patch
Patch112: eglibc-mandriva-ENOTTY-fr-translation.patch
Patch113: eglibc-mandriva-biarch-utils.patch
Patch114: eglibc-mandriva-multiarch.patch
Patch115: eglibc-mandriva-i586-if-no-cmov.patch
Patch116: eglibc-mandriva-pt_BR-i18nfixes.patch
Patch117: eglibc-mandriva-testsuite-ldbl-bits.patch
Patch118: eglibc-mandriva-testsuite-rt-notparallel.patch
# https://bugzilla.redhat.com/show_bug.cgi?id=638477#c275
# https://bugzilla.redhat.com/show_bug.cgi?id=696096
# https://bugzilla.redhat.com/attachment.cgi?id=491198
Patch120: eglibc-mandriva-no-leaf-attribute.patch
Patch121: eglibc-mandriva-mdv-avx-owl-crypt.patch
Patch122: eglibc-mandriva-mdv-owl-crypt_freesec.patch
Patch123: eglibc-mandriva-avx-relocate_fcrypt.patch
Patch124: eglibc-mandriva-avx-increase_BF_FRAME.patch
Patch125: eglibc-mandriva-mdv-wrapper_handle_sha.patch
# Reverts a part of eglibc-fedora-uname-getrlimit.patch that breaks the build
Patch126: nptl-getrlimit-compile.patch
# http://sourceware.org/bugzilla/show_bug.cgi?id=14995
# http://sourceware.org/bugzilla/attachment.cgi?id=6795
Patch127: glibc-2.17-gold.patch
# Crypt-blowfish patches
Patch128: crypt_blowfish-arm.patch
# Clear Linux patches
Patch83: https://github.com/clearlinux-pkgs/glibc/blob/master/alternate_trim.patch
Patch84: https://github.com/clearlinux-pkgs/glibc/blob/master/madvise-bss.patch
Patch85: https://github.com/clearlinux-pkgs/glibc/blob/master/spinaphore.patch
Patch86: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/large-page-huge-page.patch
Patch87: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/use_madv_free.patch
Patch88: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/malloc_tune.patch
Patch89: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/ldconfig-format-new.patch
# (tpg) CLR disabled this patch
#Patch90: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/ldconfig-Os.patch
# https://sourceware.org/ml/libc-alpha/2018-03/msg00504.html
Patch98: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/pause.patch
Patch99: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/gcc-8-fix.patch
Patch100: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/spin-smarter.patch
Patch101: https://raw.githubusercontent.com/clearlinux-pkgs/glibc/master/nostackshrink.patch
#
# Patches from upstream
#
Patch201: glibc-2.24-CVE-2017-18269.patch
Patch202: glibc-2.24-CVE-2018-11236.patch
Patch203: glibc-2.24-CVE-2018-6485.patch
Patch204: glibc-2.24-CVE-2018-1000001.patch
Patch205: glibc-2.24-CVE-2017-16997.patch
Patch206: glibc-2.24-CVE-2017-15670.patch
Patch208: glibc-2.24-CVE-2017-15804.patch
#-----------------------------------------------------------------------
# OpenMandriva patches
Patch1000: eglibc-mandriva-localedef-archive-follow-symlinks.patch
Patch1001: eglibc-mandriva-fix-dns-with-broken-routers.patch
Patch1002: eglibc-mandriva-nss-upgrade.patch
Patch1003: eglibc-mandriva-share-locale.patch
Patch1004: eglibc-mandriva-nsswitch.conf.patch
Patch1005: eglibc-mandriva-xterm-xvt.patch
Patch1006: eglibc-mandriva-nscd-enable.patch
Patch1007: eglibc-mandriva-nscd-no-host-cache.patch
Patch1009: eglibc-mandriva-nscd-init-should-start.patch
Patch1010: eglibc-mandriva-timezone.patch
Patch1011: eglibc-mandriva-biarch-cpp-defines.patch
Patch1012: eglibc-mandriva-ENOTTY-fr-translation.patch
Patch1013: eglibc-mandriva-biarch-utils.patch
Patch1015: glibc-2.26-no-attribute-leaf-for-clang.patch
Patch1018: eglibc-mandriva-testsuite-ldbl-bits.patch
Patch1019: eglibc-mandriva-testsuite-rt-notparallel.patch
Patch1020: glibc-2.19-no-__builtin_va_arg_pack-with-clang.patch
#Patch1021: eglibc-mandriva-no-leaf-attribute.patch
# http://sourceware.org/bugzilla/show_bug.cgi?id=14995
# http://sourceware.org/bugzilla/attachment.cgi?id=6795
Patch1029: glibc-2.19-nscd-socket-and-pid-moved-from-varrun-to-run.patch
Patch1033: glibc-2.25-force-use-ld-bfd.patch
Patch1034: glibc-2.27-clang-_Float.patch
Patch1035: glibc-2.28-riscv-compile.patch
BuildRequires: autoconf2.5
BuildRequires: gettext
@ -248,8 +196,6 @@ Requires: bash
%endif
# The dynamic linker supports DT_GNU_HASH
Provides: rtld(GNU_HASH)
Provides: glibc-crypt_blowfish = %{crypt_bf_ver}
Provides: eglibc-crypt_blowfish = %{crypt_bf_ver}
Provides: should-restart = system
# Determine minimum kernel versions (rhbz#619538)
%define enablekernel 2.6.32
@ -411,8 +357,6 @@ Requires: %{name} = %{EVRD}
Requires: %{multilibc} = %{EVRD}
%endif
Requires: kernel-headers
Provides: glibc-crypt_blowfish-devel = %{crypt_bf_ver}
Provides: eglibc-crypt_blowfish-devel = %{crypt_bf_ver}
%rename glibc-doc
%if %{with pdf}
%rename glibc-doc-pdf
@ -427,7 +371,6 @@ standard header and object files available in order to create the
executables.
%files devel
%{_mandir}/man3/*
%{_infodir}/libc.info*
%doc %{_docdir}/glibc/*
%exclude %{_docdir}/glibc/nss
@ -439,23 +382,17 @@ executables.
%{_libdir}/*.so
%{_libdir}/libc_nonshared.a
%{_libdir}/libg.a
%{_libdir}/libieee.a
%{_libdir}/libmcheck.a
%ifarch x86_64
%{_libdir}/libmvec.a
%{_libdir}/libmvec_nonshared.a
%endif
%{_libdir}/libpthread_nonshared.a
%{_libdir}/librpcsvc.a
%if %{build_multiarch}
%{_libdir32}/*.o
%{_libdir32}/*.so
%{_libdir32}/libc_nonshared.a
%{_libdir32}/libg.a
%{_libdir32}/libieee.a
%{_libdir32}/libmcheck.a
%{_libdir32}/libpthread_nonshared.a
%{_libdir32}/librpcsvc.a
%endif
#-----------------------------------------------------------------------
@ -477,7 +414,6 @@ library.
%{_libdir}/libcrypt.a
%{_libdir}/libdl.a
%{_libdir}/libm.a
%{_libdir}/libnsl.a
%{_libdir}/libpthread.a
%{_libdir}/libresolv.a
%{_libdir}/librt.a
@ -489,7 +425,6 @@ library.
%{_libdir32}/libcrypt.a
%{_libdir32}/libdl.a
%{_libdir32}/libm.a
%{_libdir32}/libnsl.a
%{_libdir32}/libpthread.a
%{_libdir32}/libresolv.a
%{_libdir32}/librt.a
@ -807,105 +742,67 @@ their ~/.profile configuration file.
########################################################################
%prep
%setup -q -a3 -a50
%setup -q -a3
%patch00 -p1
%patch01 -p1
%patch10 -p1 -b .multiple~
%patch11 -p1 -b .elfORIGIN~
%patch12 -p1
%patch13 -p1 -b .rh737223~
%patch14 -p1
%patch15 -p1
%patch16 -p1
%patch17 -p1
%patch18 -p1
%patch19 -p1 -b .curr~
%patch20 -p1 -b .locales~
%patch21 -p1
%patch22 -p1
%patch23 -p1
%patch24 -p1
%patch25 -p1
%patch26 -p1
%patch27 -p1
%patch28 -p1
%patch29 -p1
%patch30 -p1
%patch31 -p1
%patch32 -p1
%patch33 -p1
%patch34 -p1
%patch35 -p1
%patch40 -p1
%patch36 -p1
%patch38 -p1
%patch41 -p1
%patch42 -p1
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
%patch47 -p1
%patch48 -p1
%patch49 -p1
%patch50 -p1
%patch51 -p1
%patch52 -p1
%patch53 -p1
%patch54 -p1
%patch58 -p1
%patch61 -p1
%patch62 -p1
%patch63 -p1
%patch64 -p1
%patch65 -p1
%patch83 -p1
%patch84 -p1
%patch85 -p1
%patch86 -p1
%patch87 -p1
%patch88 -p1
%patch89 -p1
%patch98 -p1
%patch99 -p1
%patch100 -p1
%patch101 -p1
%patch102 -p1 -b .nssUpgrade~
#patch103 -p1
%patch104 -p1
%patch105 -p1
%patch106 -p1
%patch107 -p1 -b .hwcap~
%patch108 -p1
%patch109 -p1
%patch110 -p1
%patch111 -p1
%patch112 -p1
%patch113 -p1 -b .multiarch~
%patch114 -p1
%patch115 -p1
%patch116 -p1 -b .ldbl~
%patch117 -p1 -b .tsp~
%patch118 -p1
%patch120 -p1
# copy freesec source
cp %{SOURCE52} %{SOURCE53} crypt/
echo "Applying crypt_blowfish patch:"
%patch121 -p1 -b .owlCrypt~
mv crypt/crypt.h crypt/gnu-crypt.h
chmod 0644 crypt_blowfish-%{crypt_bf_ver}/*.[chS]
cp -a crypt_blowfish-%{crypt_bf_ver}/*.[chS] crypt/
## FreeSec support for extended/new-style/BSDI hashes in crypt(3)
%patch122 -p1 -b .freesec~
%patch123 -p1 -b .relocateFcrypt~
%patch124 -p0
# add sha256-crypt and sha512-crypt support to the Openwall wrapper
%patch125 -p1
%patch126 -p1 -b .compile~
%patch127 -p1 -b .gold~
%patch128 -p1 -b .blowfish_nonx86~
%patch201 -p1
%patch202 -p1
%patch203 -p1
%patch204 -p1
%patch205 -p1
%patch206 -p1
%patch208 -p1
%patch1000 -p1
%patch1001 -p1
%patch1002 -p1
%patch1003 -p1
%patch1004 -p1
%patch1005 -p1
%patch1006 -p1
%patch1007 -p1
%patch1009 -p1
%patch1010 -p1
%patch1011 -p1
%patch1012 -p1
%patch1013 -p1
%patch1015 -p1
%patch1018 -p1
%patch1019 -p1
%patch1020 -p1
%patch1029 -p1
%patch1033 -p1
%patch1034 -p1
%patch1035 -p1
%if %{with selinux}
# XXX kludge to build nscd with selinux support as it added -nostdinc
@ -916,7 +813,7 @@ cp -a crypt_blowfish-%{crypt_bf_ver}/*.[chS] crypt/
find . -type f -size 0 -o -name "*.orig" -exec rm -f {} \;
# Remove patch backups from files we ship in glibc packages
rm -f ChangeLog.[^0-9]*
rm -rf ChangeLog.[^0-9]*
rm -f localedata/locales/{???_??,??_??}.*
rm -f localedata/locales/[a-z_]*.*
@ -1086,8 +983,6 @@ BuildGlibc %{_target_cpu}
esac
%endif
make -C crypt_blowfish-%{crypt_bf_ver} man
# post install wrapper
gcc -static -Lbuild-%{_target_cpu}-linux %{optflags} -Os %{SOURCE2} -o build-%{_target_cpu}-linux/glibc_post_upgrade \
'-DLIBTLS="/%{_lib}/tls/"' \
@ -1190,10 +1085,6 @@ install -m 644 mandriva/nsswitch.conf %{buildroot}%{_sysconfdir}/nsswitch.conf
install -m755 -d %{buildroot}/var/db/nscd
%endif
# These man pages require special attention
mkdir -p %{buildroot}%{_mandir}/man3
install -p -m 0644 crypt_blowfish-%{crypt_bf_ver}/*.3 %{buildroot}%{_mandir}/man3/
# Useless and takes place
rm -rf %{buildroot}/%{_datadir}/zoneinfo/{posix,right}
@ -1264,15 +1155,11 @@ install -m 755 -d %{buildroot}%{_docdir}/glibc
install -m644 -D manual/libc.pdf %{buildroot}%{_docdir}/glibc/libc.pdf
%endif
popd
install -m 644 COPYING COPYING.LIB README NEWS INSTALL BUGS \
PROJECTS CONFORMANCE hesiod/README.hesiod \
ChangeLog* crypt/README.ufc-crypt nis/nss posix/gai.conf \
install -m 644 COPYING COPYING.LIB README NEWS INSTALL hesiod/README.hesiod \
ChangeLog* crypt/README.ufc-crypt nis/nss posix/gai.conf \
%{buildroot}%{_docdir}/glibc
xz -0 --text %{buildroot}%{_docdir}/glibc/ChangeLog*
install -m 644 timezone/README %{buildroot}%{_docdir}/glibc/README.timezone
install -m 755 -d %{buildroot}%{_docdir}/glibc/crypt_blowfish
install -m 644 crypt_blowfish-%{crypt_bf_ver}/{README,LINKS,PERFORMANCE} \
%{buildroot}%{_docdir}/glibc/crypt_blowfish
# Localization
%find_lang libc
@ -1282,8 +1169,6 @@ rm -f %{buildroot}%{_infodir}/dir.old*
rm -rf %{buildroot}%{_includedir}/asm-*/mach-*/
rm -f %{buildroot}%{_localedir}/locale-archive*
rm %{buildroot}%{_bindir}/rpcgen %{buildroot}%{_mandir}/man1/rpcgen.1*
# XXX: verify
#find %{buildroot}%{_localedir} -type f -name LC_\* -o -name SYS_LC_\* |xargs rm -f

View file

@ -11,6 +11,9 @@
#include <sys/stat.h>
#include <elf.h>
#define LD_SO_CONF "/etc/ld.so.conf"
#define ICONVCONFIG "/usr/sbin/iconvconfig"
#define verbose_exec(failcode, path...) \
do \
{ \
@ -24,39 +27,6 @@ __attribute__((noinline)) void sayn (long num);
__attribute__((noinline)) void message (char *const path[]);
__attribute__((noinline)) int check_elf (const char *name);
#ifdef __i386__
static int
is_ia64 (void)
{
unsigned int fl1, fl2;
/* See if we can use cpuid. */
__asm__ ("pushfl; pushfl; popl %0; movl %0,%1; xorl %2,%0;"
"pushl %0; popfl; pushfl; popl %0; popfl"
: "=&r" (fl1), "=&r" (fl2)
: "i" (0x00200000));
if (((fl1 ^ fl2) & 0x00200000) == 0)
return 0;
/* Host supports cpuid. See if cpuid gives capabilities, try
CPUID(0). Preserve %ebx and %ecx; cpuid insn clobbers these, we
don't need their CPUID values here, and %ebx may be the PIC
register. */
__asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
: "=a" (fl1) : "0" (0) : "edx", "cc");
if (fl1 == 0)
return 0;
/* Invoke CPUID(1), return %edx; caller can examine bits to
determine what's supported. */
__asm__ ("pushl %%ecx; pushl %%ebx; cpuid; popl %%ebx; popl %%ecx"
: "=d" (fl2), "=a" (fl1) : "1" (1) : "cc");
return (fl2 & (1 << 30)) != 0;
}
#else
#define is_ia64() 0
#endif
int
main (void)
{
@ -73,14 +43,23 @@ main (void)
int i, j, fd;
off_t base;
ssize_t ret;
#ifdef __i386__
const char *remove_dirs[] = { "/lib/tls", "/lib/i686", "/lib/tls/i486", "/lib/tls/i586", "/lib/tls/i686" };
#else
#ifndef LIBTLS
#define LIBTLS "/lib/tls"
#endif
const char *remove_dirs[] = { LIBTLS };
/* In order to support in-place upgrades, we must immediately remove
obsolete platform directories after installing a new glibc
version. RPM only deletes files removed by updates near the end
of the transaction. If we did not remove the obsolete platform
directories here, they would be preferred by the dynamic linker
during the execution of subsequent RPM scriptlets, likely
resulting in process startup failures. */
const char *remove_dirs[] =
{
#if defined (__i386__)
"/lib/i686",
"/lib/i686/nosegneg",
#elif defined (__powerpc64__) && _CALL_ELF != 2
"/lib64/power6",
#endif
};
for (j = 0; j < sizeof (remove_dirs) / sizeof (remove_dirs[0]); ++j)
{
size_t rmlen = strlen (remove_dirs[j]);
@ -146,30 +125,19 @@ main (void)
before running one of the lib's %post scriptlet. /sbin/ldconfig will
then be run by the other arch's %post. */
if (! access ("/sbin/ldconfig", X_OK))
verbose_exec (110, "/sbin/ldconfig", "/sbin/ldconfig");
verbose_exec (110, "/sbin/ldconfig", "/sbin/ldconfig", "-X");
if (! utimes (GCONV_MODULES_DIR "/gconv-modules.cache", NULL))
{
#ifndef ICONVCONFIG
#define ICONVCONFIG "/usr/sbin/iconvconfig"
#endif
const char *iconv_cache = GCONV_MODULES_DIR"/gconv-modules.cache";
const char *iconv_dir = GCONV_MODULES_DIR;
if (is_ia64 ())
{
iconv_cache = "/emul/ia32-linux"GCONV_MODULES_DIR"/gconv-modules.cache";
iconv_dir = "/emul/ia32-linux"GCONV_MODULES_DIR;
}
verbose_exec (113, ICONVCONFIG, "/usr/sbin/iconvconfig",
"-o", iconv_cache,
"--nostdlib", iconv_dir);
char *iconv_cache = GCONV_MODULES_DIR"/gconv-modules.cache";
char *iconv_dir = GCONV_MODULES_DIR;
verbose_exec (113, ICONVCONFIG, "/usr/sbin/iconvconfig",
"-o", iconv_cache,
"--nostdlib", iconv_dir);
}
/* Check if telinit is available and either SysVInit fifo,
or upstart telinit. */
if (access ("/sbin/telinit", X_OK)
|| ((!!access ("/dev/initctl", F_OK))
^ !access ("/sbin/initctl", X_OK)))
/* Check if systemctl is available for further systemd deamon restart*/
if (access ("/bin/systemctl", X_OK))
_exit (0);
/* Check if we are not inside of some chroot, because we'd just
@ -183,23 +151,27 @@ main (void)
/* Here's another well known way to detect chroot, at least on an
ext and xfs filesystems and assuming nothing mounted on the chroot's
root. */
root.
# (tpg) Possible 2017 solutions
# 1. check if inode for "/" is in 0 between 4096 range,
# as this may get into account almost all firesystems?
# 2. check if /proc/1/cgroup output does contain word docker or lxc
#
if (stat ("/", &statbuf) != 0
|| (statbuf.st_ino != 2
&& statbuf.st_ino != 128))
_exit (0);
_exit (0); */
if (check_elf ("/proc/1/exe"))
verbose_exec (116, "/sbin/telinit", "/sbin/telinit", "u");
verbose_exec (116, "/bin/systemctl", "/bin/systemctl", "daemon-reexec");
/* Check if we can safely condrestart sshd. */
if (access ("/sbin/service", X_OK) == 0
if (access ("/bin/systemctl", X_OK) == 0
&& access ("/usr/sbin/sshd", X_OK) == 0
&& access ("/etc/rc.d/init.d/sshd", X_OK) == 0
&& access ("/bin/bash", X_OK) == 0)
&& access ("/bin/sh", F_OK) == 0)
{
if (check_elf ("/usr/sbin/sshd"))
verbose_exec (-121, "/sbin/service", "/sbin/service", "sshd", "condrestart");
verbose_exec (-121, "/bin/systemctl", "/bin/systemctl", "-q", "try-restart", "sshd.service");
}
_exit(0);
@ -313,8 +285,6 @@ check_elf (const char *name)
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__

View file

@ -0,0 +1,11 @@
--- glibc-2.24/malloc/malloc.c~ 2016-08-02 02:01:36.000000000 +0000
+++ glibc-2.24/malloc/malloc.c 2016-08-27 04:16:33.210410956 +0000
@@ -2333,6 +2333,8 @@
if (mm != MAP_FAILED)
{
+ if (size > 8 * 1024 * 1024)
+ __madvise (mm, size , MADV_HUGEPAGE);
/*
The offset to the start of the mmapped region is stored
in the prev_size field of the chunk. This allows us to adjust

14
ldconfig-format-new.patch Normal file
View file

@ -0,0 +1,14 @@
Subject: Make ldconfig default to "new" cache format.
Index: glibc-2.21/elf/ldconfig.c
===================================================================
--- glibc-2.21.orig/elf/ldconfig.c 2015-03-03 14:53:52.206995018 +0000
+++ glibc-2.21/elf/ldconfig.c 2015-03-03 14:54:00.094995204 +0000
@@ -95,7 +95,7 @@
/* Format to support. */
/* 0: only libc5/glibc2; 1: both; 2: only glibc 2.2. */
-int opt_format = 1;
+int opt_format = 2;
/* Build cache. */
static int opt_build_cache = 1;

10
madvise-bss.patch Normal file
View file

@ -0,0 +1,10 @@
--- glibc-2.22/elf/dl-map-segments.h.org 2015-11-23 17:13:52.948724559 -0500
+++ glibc-2.22/elf/dl-map-segments.h 2015-11-23 17:14:42.434105906 -0500
@@ -139,6 +139,7 @@
-1, 0);
if (__glibc_unlikely (mapat == MAP_FAILED))
return DL_MAP_SEGMENTS_ERROR_MAP_ZERO_FILL;
+ __madvise((caddr_t) zeropage, zeroend - zeropage, MADV_MERGEABLE);
}
}

20
malloc_tune.patch Normal file
View file

@ -0,0 +1,20 @@
--- glibc-2.24/malloc/malloc.c~ 2016-11-13 22:53:14.000000000 +0000
+++ glibc-2.24/malloc/malloc.c 2016-11-13 23:01:29.750884186 +0000
@@ -858,7 +858,7 @@
#define M_TRIM_THRESHOLD -1
#ifndef DEFAULT_TRIM_THRESHOLD
-#define DEFAULT_TRIM_THRESHOLD (128 * 1024)
+#define DEFAULT_TRIM_THRESHOLD (512 * 1024)
#endif
/*
@@ -891,7 +891,7 @@
#define M_TOP_PAD -2
#ifndef DEFAULT_TOP_PAD
-#define DEFAULT_TOP_PAD (0)
+#define DEFAULT_TOP_PAD (64 * 1024)
#endif
/*

14
nostackshrink.patch Normal file
View file

@ -0,0 +1,14 @@
when this gets called the stack is likely not there; avoid the tlb flushes
--- glibc-2.28/nptl/allocatestack.c~ 2018-08-01 05:10:47.000000000 +0000
+++ glibc-2.28/nptl/allocatestack.c 2018-09-27 16:18:09.043648892 +0000
@@ -385,6 +385,8 @@
{
uintptr_t sp = (uintptr_t) CURRENT_STACK_FRAME;
size_t pagesize_m1 = __getpagesize () - 1;
+
+ return;
#if _STACK_GROWS_DOWN && !defined(NEED_SEPARATE_REGISTER_STACK)
size_t freesize = (sp - (uintptr_t) mem) & ~pagesize_m1;
assert (freesize < size);

View file

@ -1,11 +0,0 @@
--- libc/nptl/nptl-init.c.bero~ 2012-12-01 23:55:26.722754391 +0100
+++ libc/nptl/nptl-init.c 2012-12-01 23:55:42.725950817 +0100
@@ -414,7 +414,7 @@ __pthread_initialize_minimal_internal (v
/* Determine the default allowed stack size. This is the size used
in case the user does not specify one. */
struct rlimit limit;
- if (__getrlimit (RLIMIT_STACK, &limit) != 0
+ if (getrlimit (RLIMIT_STACK, &limit) != 0
|| limit.rlim_cur == RLIM_INFINITY)
/* The system limit is not usable. Use an architecture-specific
default. */

11
pause.patch Normal file
View file

@ -0,0 +1,11 @@
--- glibc-2.27/sysdeps/x86_64/atomic-machine.h~ 2018-02-01 16:17:18.000000000 +0000
+++ glibc-2.27/sysdeps/x86_64/atomic-machine.h 2018-04-28 14:19:06.374119197 +0000
@@ -409,7 +409,7 @@
__result; })
-#define atomic_spin_nop() asm ("rep; nop")
+#define atomic_spin_nop() asm ("lfence")
#define __arch_and_body(lock, mem, mask) \

17
spin-smarter.patch Normal file
View file

@ -0,0 +1,17 @@
--- glibc-2.27/nptl/pthread_mutex_lock.c~ 2018-02-01 16:17:18.000000000 +0000
+++ glibc-2.27/nptl/pthread_mutex_lock.c 2018-05-15 14:19:00.864190585 +0000
@@ -133,7 +133,13 @@
LLL_MUTEX_LOCK (mutex);
break;
}
- atomic_spin_nop ();
+ /* MO read while spinning */
+ do
+ {
+ atomic_spin_nop ();
+ }
+ while (atomic_load_relaxed (&mutex->__data.__lock) != 0 &&
+ ++cnt < max_cnt);
}
while (LLL_MUTEX_TRYLOCK (mutex) != 0);

28
spinaphore.patch Normal file
View file

@ -0,0 +1,28 @@
--- glibc-2.23/nptl/pthread_mutex_lock.c.org 2016-03-03 22:33:24.230342596 -0500
+++ glibc-2.23/nptl/pthread_mutex_lock.c 2016-03-03 22:43:18.285915880 -0500
@@ -75,9 +75,22 @@
if (__glibc_likely (type == PTHREAD_MUTEX_TIMED_NP))
{
FORCE_ELISION (mutex, goto elision);
- simple:
- /* Normal mutex. */
- LLL_MUTEX_LOCK (mutex);
+ if (LLL_MUTEX_TRYLOCK (mutex) != 0)
+ {
+ int cnt = 0;
+ do
+ {
+ if (cnt++ >= 256 || !__is_smp)
+ {
+ /* Normal mutex. */
+simple:
+ LLL_MUTEX_LOCK (mutex);
+ break;
+ }
+ atomic_spin_nop ();
+ }
+ while (LLL_MUTEX_TRYLOCK (mutex) != 0);
+ }
assert (mutex->__data.__owner == 0);
}
#ifdef HAVE_ELISION

22
use_madv_free.patch Normal file
View file

@ -0,0 +1,22 @@
--- glibc-2.24/malloc/malloc.c~ 2016-08-27 04:16:33.000000000 +0000
+++ glibc-2.24/malloc/malloc.c 2016-11-13 22:53:14.772986778 +0000
@@ -4568,7 +4568,7 @@
content. */
memset (paligned_mem, 0x89, size & ~psm1);
#endif
- __madvise (paligned_mem, size & ~psm1, MADV_DONTNEED);
+ __madvise (paligned_mem, size & ~psm1, MADV_FREE);
result = 1;
}
--- glibc-2.24/malloc/arena.c~ 2016-08-02 02:01:36.000000000 +0000
+++ glibc-2.24/malloc/arena.c 2016-11-13 22:52:52.889299846 +0000
@@ -524,7 +524,7 @@
h->mprotect_size = new_size;
}
else
- __madvise ((char *) h + new_size, diff, MADV_DONTNEED);
+ __madvise ((char *) h + new_size, diff, MADV_FREE);
/*fprintf(stderr, "shrink %p %08lx\n", h, new_size);*/
h->size = new_size;