]> git.pld-linux.org Git - packages/glibc.git/blob - glibc-LD_DEBUG.patch
- added boot64 bcond
[packages/glibc.git] / glibc-LD_DEBUG.patch
1 --- sysdeps/generic/unsecvars.h 2004-08-03 18:13:13 -0400
2 +++ sysdeps/generic/unsecvars.h 2004-08-03 18:11:41 -0400
3 @@ -3,6 +3,8 @@
4     with a '\0' explicitly.  */
5  #define UNSECURE_ENVVARS \
6    "LD_PRELOAD\0"                                                             \
7 +  "LD_DEBUG\0"                                                               \
8 +  "LD_TRACE_PRELINKING\0"                                                            \
9    "LD_LIBRARY_PATH\0"                                                        \
10    "LD_ORIGIN_PATH\0"                                                         \
11    "LD_DEBUG_OUTPUT\0"                                                        \
12 --- elf/rtld.c  2003-01-07 13:47:35 -0500
13 +++ elf/rtld.c  2004-08-03 22:15:51 -0400
14 @@ -1762,6 +1762,30 @@
15    GL(dl_profile_output)
16      = &"/var/tmp\0/var/profile"[INTUSE(__libc_enable_secure) ? 9 : 0];
17  
18 +  /* Extra security for SUID binaries.  Remove all dangerous environment
19 +     variables.  */
20 +  if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
21 +    {
22 +      static const char unsecure_envvars[] =
23 +#ifdef EXTRA_UNSECURE_ENVVARS
24 +       EXTRA_UNSECURE_ENVVARS
25 +#endif
26 +       UNSECURE_ENVVARS;
27 +      const char *nextp;
28 +
29 +      nextp = unsecure_envvars;
30 +      do
31 +       {
32 +         unsetenv (nextp);
33 +         /* We could use rawmemchr but this need not be fast.  */
34 +         nextp = (char *) (strchr) (nextp, '\0') + 1;
35 +       }
36 +      while (*nextp != '\0');
37 +
38 +      if (__access ("/etc/suid-debug", F_OK) != 0)
39 +       unsetenv ("MALLOC_CHECK_");
40 +    }
41 +
42    while ((envline = _dl_next_ld_env_entry (&runp)) != NULL)
43      {
44        size_t len = 0;
45 @@ -1897,33 +1921,10 @@
46    /* The caller wants this information.  */
47    *modep = mode;
48  
49 -  /* Extra security for SUID binaries.  Remove all dangerous environment
50 -     variables.  */
51 -  if (__builtin_expect (INTUSE(__libc_enable_secure), 0))
52 -    {
53 -      static const char unsecure_envvars[] =
54 -#ifdef EXTRA_UNSECURE_ENVVARS
55 -       EXTRA_UNSECURE_ENVVARS
56 -#endif
57 -       UNSECURE_ENVVARS;
58 -      const char *nextp;
59 -
60 -      nextp = unsecure_envvars;
61 -      do
62 -       {
63 -         unsetenv (nextp);
64 -         /* We could use rawmemchr but this need not be fast.  */
65 -         nextp = (char *) (strchr) (nextp, '\0') + 1;
66 -       }
67 -      while (*nextp != '\0');
68 -
69 -      if (__access ("/etc/suid-debug", F_OK) != 0)
70 -       unsetenv ("MALLOC_CHECK_");
71 -    }
72    /* If we have to run the dynamic linker in debugging mode and the
73       LD_DEBUG_OUTPUT environment variable is given, we write the debug
74       messages to this file.  */
75 -  else if (any_debug && debug_output != NULL)
76 +  if (any_debug && debug_output != NULL)
77      {
78  #ifdef O_NOFOLLOW
79        const int flags = O_WRONLY | O_APPEND | O_CREAT | O_NOFOLLOW;
This page took 0.037003 seconds and 3 git commands to generate.