wok-current diff 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 diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/glibc/stuff/glibc-2.21-gcc6_fix-1.patch	Tue Jul 15 20:40:17 2025 +0000
     1.3 @@ -0,0 +1,104 @@
     1.4 +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
     1.5 +--- glibc-2.23/nis/nis_call.c.gcc61	2016-02-18 18:54:00.000000000 +0100
     1.6 ++++ glibc-2.23/nis/nis_call.c	2016-05-19 18:44:24.288550322 +0200
     1.7 +@@ -680,6 +680,7 @@ nis_server_cache_add (const_nis_name nam
     1.8 +   /* Choose which entry should be evicted from the cache.  */
     1.9 +   loc = &nis_server_cache[0];
    1.10 +   if (*loc != NULL)
    1.11 ++  {
    1.12 +     for (i = 1; i < 16; ++i)
    1.13 +       if (nis_server_cache[i] == NULL)
    1.14 + 	{
    1.15 +@@ -690,6 +691,7 @@ nis_server_cache_add (const_nis_name nam
    1.16 + 	       || ((*loc)->uses == nis_server_cache[i]->uses
    1.17 + 		   && (*loc)->expires > nis_server_cache[i]->expires))
    1.18 + 	loc = &nis_server_cache[i];
    1.19 ++  }
    1.20 +   old = *loc;
    1.21 +   *loc = new;
    1.22 + 
    1.23 +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
    1.24 +--- glibc-2.23/stdlib/setenv.c.gcc61	2016-02-18 18:54:00.000000000 +0100
    1.25 ++++ glibc-2.23/stdlib/setenv.c	2016-05-19 18:41:09.778640989 +0200
    1.26 +@@ -277,6 +277,7 @@ unsetenv (const char *name)
    1.27 + 
    1.28 +   ep = __environ;
    1.29 +   if (ep != NULL)
    1.30 ++  {
    1.31 +     while (*ep != NULL)
    1.32 +       if (!strncmp (*ep, name, len) && (*ep)[len] == '=')
    1.33 + 	{
    1.34 +@@ -290,6 +291,7 @@ unsetenv (const char *name)
    1.35 + 	}
    1.36 +       else
    1.37 + 	++ep;
    1.38 ++  }
    1.39 + 
    1.40 +   UNLOCK;
    1.41 +
    1.42 +	* elf/dl-open.c (_dl_open): Use __glibc_unlikely in invalid namespace
    1.43 +	check.  Reject NSID < 0 and NSID >= dl_nns, and check for DL_NNS==1,
    1.44 +	before using NSID as an index.
    1.45 +
    1.46 +diff --git a/elf/dl-open.c b/elf/dl-open.c
    1.47 +index 0dbe07f..2d0e082 100644
    1.48 +--- a/elf/dl-open.c
    1.49 ++++ b/elf/dl-open.c
    1.50 +@@ -619,8 +619,14 @@ no more namespaces available for dlmopen()"));
    1.51 +   /* Never allow loading a DSO in a namespace which is empty.  Such
    1.52 +      direct placements is only causing problems.  Also don't allow
    1.53 +      loading into a namespace used for auditing.  */
    1.54 +-  else if (__builtin_expect (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER, 0)
    1.55 +-	   && (GL(dl_ns)[nsid]._ns_nloaded == 0
    1.56 ++  else if (__glibc_unlikely (nsid != LM_ID_BASE && nsid != __LM_ID_CALLER)
    1.57 ++	   && (__glibc_unlikely (nsid < 0 || nsid >= GL(dl_nns))
    1.58 ++	       /* This prevents the [NSID] index expressions from being
    1.59 ++		  evaluated, so the compiler won't think that we are
    1.60 ++		  accessing an invalid index here in the !SHARED case where
    1.61 ++		  DL_NNS is 1 and so any NSID != 0 is invalid.  */
    1.62 ++	       || DL_NNS == 1
    1.63 ++	       || GL(dl_ns)[nsid]._ns_nloaded == 0
    1.64 + 	       || GL(dl_ns)[nsid]._ns_loaded->l_auditing))
    1.65 +     _dl_signal_error (EINVAL, file, NULL,
    1.66 + 		      N_("invalid target namespace in dlmopen()"));
    1.67 +
    1.68 +	* elf/dl-close.c (_dl_close_worker) [DL_NNS == 1]: Just assert that
    1.69 +	IMAP->l_prev cannot be null, and #if out the code for the contrary
    1.70 +	case, avoiding 'assert (nsid != LM_ID_BASE)' making the compiler
    1.71 +	believe that NS (&_dl_ns[NSID]) could point outside the array.
    1.72 +
    1.73 +diff --git a/elf/dl-close.c b/elf/dl-close.c
    1.74 +index cf8f9e0..412f71d 100644
    1.75 +--- a/elf/dl-close.c
    1.76 ++++ b/elf/dl-close.c
    1.77 +@@ -641,9 +641,16 @@ _dl_close_worker (struct link_map *map)
    1.78 + 	  DL_UNMAP (imap);
    1.79 + 
    1.80 + 	  /* Finally, unlink the data structure and free it.  */
    1.81 +-	  if (imap->l_prev != NULL)
    1.82 +-	    imap->l_prev->l_next = imap->l_next;
    1.83 +-	  else
    1.84 ++#if DL_NNS == 1
    1.85 ++	  /* The assert in the (imap->l_prev == NULL) case gives
    1.86 ++	     the compiler license to warn that NS points outside
    1.87 ++	     the dl_ns array bounds in that case (as nsid != LM_ID_BASE
    1.88 ++	     is tantamount to nsid >= DL_NNS).  That should be impossible
    1.89 ++	     in this configuration, so just assert about it instead.  */
    1.90 ++	  assert (nsid == LM_ID_BASE);
    1.91 ++	  assert (imap->l_prev != NULL);
    1.92 ++#else
    1.93 ++	  if (imap->l_prev == NULL)
    1.94 + 	    {
    1.95 + 	      assert (nsid != LM_ID_BASE);
    1.96 + 	      ns->_ns_loaded = imap->l_next;
    1.97 +@@ -652,6 +659,9 @@ _dl_close_worker (struct link_map *map)
    1.98 + 		 we leave for debuggers to examine.  */
    1.99 + 	      r->r_map = (void *) ns->_ns_loaded;
   1.100 + 	    }
   1.101 ++	  else
   1.102 ++#endif
   1.103 ++	    imap->l_prev->l_next = imap->l_next;
   1.104 + 
   1.105 + 	  --ns->_ns_nloaded;
   1.106 + 	  if (imap->l_next != NULL)
   1.107 +