wok-current view glibc/stuff/glibc-2.21-gcc6_fix-1.patch @ rev 25785
Mass rebuild after bump to glibc 2.31, add epson printer and scanner package
author | Stanislas Leduc <shann@slitaz.org> |
---|---|
date | Tue Jul 15 20:40:17 2025 +0000 (3 months ago) |
parents | |
children |
line source
1 diff -up glibc-arm-linux-gnu-2.23/glibc-2.23/nis/nis_call.c.gcc61 glibc-arm-linux-gnu-2.23/glibc-2.23/nis/nis_call.c
2 --- glibc-2.23/nis/nis_call.c.gcc61 2016-02-18 18:54:00.000000000 +0100
3 +++ glibc-2.23/nis/nis_call.c 2016-05-19 18:44:24.288550322 +0200
4 @@ -680,6 +680,7 @@ nis_server_cache_add (const_nis_name nam
5 /* Choose which entry should be evicted from the cache. */
6 loc = &nis_server_cache[0];
7 if (*loc != NULL)
8 + {
9 for (i = 1; i < 16; ++i)
10 if (nis_server_cache[i] == NULL)
11 {
12 @@ -690,6 +691,7 @@ nis_server_cache_add (const_nis_name nam
13 || ((*loc)->uses == nis_server_cache[i]->uses
14 && (*loc)->expires > nis_server_cache[i]->expires))
15 loc = &nis_server_cache[i];
16 + }
17 old = *loc;
18 *loc = new;
20 diff -up glibc-arm-linux-gnu-2.23/glibc-2.23/stdlib/setenv.c.gcc61 glibc-arm-linux-gnu-2.23/glibc-2.23/stdlib/setenv.c
21 --- glibc-2.23/stdlib/setenv.c.gcc61 2016-02-18 18:54:00.000000000 +0100
22 +++ glibc-2.23/stdlib/setenv.c 2016-05-19 18:41:09.778640989 +0200
23 @@ -277,6 +277,7 @@ unsetenv (const char *name)
25 ep = __environ;
26 if (ep != NULL)
27 + {
28 while (*ep != NULL)
29 if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
30 {
31 @@ -290,6 +291,7 @@ unsetenv (const char *name)
32 }
33 else
34 ++ep;
35 + }
37 UNLOCK;
39 * elf/dl-open.c (_dl_open): Use __glibc_unlikely in invalid namespace
40 check. Reject NSID < 0 and NSID >= dl_nns, and check for DL_NNS==1,
41 before using NSID as an index.
43 diff --git a/elf/dl-open.c b/elf/dl-open.c
44 index 0dbe07f..2d0e082 100644
45 --- a/elf/dl-open.c
46 +++ b/elf/dl-open.c
47 @@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
48 /* Never allow loading a DSO in a namespace which is empty. Such
49 direct placements is only causing problems. Also don't allow
50 loading into a namespace used for auditing. */
51 - else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
52 - && (GL(dl_ns)[nsid]._ns_nloaded == 0
53 + else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
54 + && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
55 + /* This prevents the [NSID] index expressions from being
56 + evaluated, so the compiler won't think that we are
57 + accessing an invalid index here in the !SHARED case where
58 + DL_NNS is 1 and so any NSID != 0 is invalid. */
59 + || DL_NNS == 1
60 + || GL(dl_ns)[nsid]._ns_nloaded == 0
61 || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
62 _dl_signal_error (EINVAL, file, NULL,
63 N_("invalid target namespace in dlmopen()"));
65 * elf/dl-close.c (_dl_close_worker) [DL_NNS == 1]: Just assert that
66 IMAP->l_prev cannot be null, and #if out the code for the contrary
67 case, avoiding 'assert (nsid != LM_ID_BASE)' making the compiler
68 believe that NS (&_dl_ns[NSID]) could point outside the array.
70 diff --git a/elf/dl-close.c b/elf/dl-close.c
71 index cf8f9e0..412f71d 100644
72 --- a/elf/dl-close.c
73 +++ b/elf/dl-close.c
74 @@ -641,9 +641,16 @@ _dl_close_worker (struct link_map *map)
75 DL_UNMAP (imap);
77 /* Finally, unlink the data structure and free it. */
78 - if (imap->l_prev != NULL)
79 - imap->l_prev->l_next = imap->l_next;
80 - else
81 +#if DL_NNS == 1
82 + /* The assert in the (imap->l_prev == NULL) case gives
83 + the compiler license to warn that NS points outside
84 + the dl_ns array bounds in that case (as nsid != LM_ID_BASE
85 + is tantamount to nsid >= DL_NNS). That should be impossible
86 + in this configuration, so just assert about it instead. */
87 + assert (nsid == LM_ID_BASE);
88 + assert (imap->l_prev != NULL);
89 +#else
90 + if (imap->l_prev == NULL)
91 {
92 assert (nsid != LM_ID_BASE);
93 ns->_ns_loaded = imap->l_next;
94 @@ -652,6 +659,9 @@ _dl_close_worker (struct link_map *map)
95 we leave for debuggers to examine. */
96 r->r_map = (void *) ns->_ns_loaded;
97 }
98 + else
99 +#endif
100 + imap->l_prev->l_next = imap->l_next;
102 --ns->_ns_nloaded;
103 if (imap->l_next != NULL)