patches/glibc/2.1.3/rh62-06-glibc-2.1.3-preload.patch
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Sat Feb 24 11:00:05 2007 +0000 (2007-02-24)
changeset 1 eeea35fbf182
permissions -rw-r--r--
Add the full crosstool-NG sources to the new repository of its own.
You might just say: 'Yeah! crosstool-NG's got its own repo!".
Unfortunately, that's because the previous repo got damaged beyond repair and I had no backup.
That means I'm putting backups in place in the afternoon.
That also means we've lost history... :-(
     1 2001-01-08  Ulrich Drepper  <drepper@redhat.com>
     2 
     3 	* elf/rtld.c (process_envvars): Place output files for profiling
     4 	in SUID binaries in /var/profile.
     5 
     6 	* elf/dl-load.c (_dl_map_object): Don't look in cache for
     7 	preloading in SUID binaries.
     8 
     9 	* elf/dl-profile.c (_dl_start_profile): Open the output file with
    10 	O_NOFOLLOW if possible.
    11 
    12 	* sysdeps/generic/segfault.c (install_handler): Check output file
    13 	name with access().
    14 
    15 --- libc/elf/rtld.c	2000/03/15 05:42:01	1.148.2.7
    16 +++ libc/elf/rtld.c	2001/01/10 07:45:19
    17 @@ -1273,7 +1273,7 @@
    18    char *debug_output = NULL;
    19  
    20    /* This is the default place for profiling data file.  */
    21 -  _dl_profile_output = "/var/tmp";
    22 +  _dl_profile_output = __libc_enable_secure ? "/var/profile" : "/var/tmp";
    23  
    24    while ((envline = _dl_next_ld_env_entry (&runp)) != NULL)
    25      {
    26 --- libc/elf/dl-load.c	1999/11/20 02:26:38	1.103.2.5
    27 +++ libc/elf/dl-load.c	2001/01/10 07:45:20
    28 @@ -1338,7 +1338,7 @@
    29        if (fd == -1 && env_path_list != NULL)
    30  	fd = open_path (name, namelen, preloaded, env_path_list, &realname);
    31  
    32 -      if (fd == -1)
    33 +      if (fd == -1 && (! preloaded || ! __libc_enable_secure))
    34  	{
    35  	  /* Check the list of libraries in the file /etc/ld.so.cache,
    36  	     for compatibility with Linux's ldconfig program.  */
    37 --- libc/elf/dl-profile.c	1998/06/07 13:35:48	1.14
    38 +++ libc/elf/dl-profile.c	2001/01/10 07:45:21
    39 @@ -263,7 +263,12 @@
    40    *cp++ = '/';
    41    __stpcpy (__stpcpy (cp, _dl_profile), ".profile");
    42  
    43 -  fd = __open (filename, O_RDWR | O_CREAT, 0666);
    44 +#ifdef O_NOFOLLOW
    45 +# define EXTRA_FLAGS | O_NOFOLLOW
    46 +#else
    47 +# define EXTRA_FLAGS
    48 +#endif
    49 +  fd = __open (filename, O_RDWR | O_CREAT EXTRA_FLAGS, 0666);
    50    if (fd == -1)
    51      {
    52        /* We cannot write the profiling data so don't do anything.  */
    53 --- libc/sysdeps/generic/segfault.c	2000/03/21 04:53:40	1.10.2.2
    54 +++ libc/sysdeps/generic/segfault.c	2001/01/10 07:45:22
    55 @@ -236,6 +236,7 @@
    56  
    57    /* Preserve the output file name if there is any given.  */
    58    name = getenv ("SEGFAULT_OUTPUT_NAME");
    59 -  if (name != NULL && name[0] != '\0')
    60 +  if (name != NULL && name[0] != '\0'
    61 +      && (!__libc_enable_secure || access (name, R_OK | W_OK) == 0))
    62      fname = __strdup (name);
    63  }
    64 
    65 --- libc/sysdeps/unix/sysv/linux/i386/dl-librecon.h.jj	Wed Feb 24 23:01:58 1999
    66 +++ libc/sysdeps/unix/sysv/linux/i386/dl-librecon.h	Mon Jan 15 04:30:57 2001
    67 @@ -49,13 +49,17 @@
    68  /* Recognizing extra environment variables.  */
    69  #define EXTRA_LD_ENVVARS \
    70    case 15:								      \
    71 -    if (memcmp (&envline[3], "LIBRARY_VERSION", 15) == 0)		      \
    72 +    if (!__libc_enable_secure						      \
    73 +	&& memcmp (&envline[3], "LIBRARY_VERSION", 15) == 0)		      \
    74        {									      \
    75  	_dl_correct_cache_id = envline[19] == '5' ? 2 : 3;		      \
    76  	break;								      \
    77        }
    78  
    79  /* Extra unsecure variables.  */
    80 -#define EXTRA_UNSECURE_ENVVARS "LD_AOUT_LIBRARY_PATH", "LD_AOUT_PRELOAD"
    81 +#define EXTRA_UNSECURE_ENVVARS	\
    82 +  "LD_AOUT_LIBRARY_PATH",	\
    83 +  "LD_AOUT_PRELOAD",		\
    84 +  "LD_LIBRARY_VERSION"
    85  
    86  #endif /* dl-librecon.h */