Author: viric
Date: Thu Nov 18 20:33:29 2010
New Revision: 24760
URL: https://svn.nixos.org/websvn/nix/?rev=24760&sc=1

Log:
Adding another fix for glibc, for a security hole, suggested by niksnut.

Added:
   
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.12/ignore-origin.patch
   (props changed)
      - copied unchanged from r24759, 
nixpkgs/branches/cve-2010-3856/pkgs/development/libraries/glibc-2.11/ignore-origin.patch
Modified:
   
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.12/common.nix

Modified: 
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.12/common.nix
==============================================================================
--- 
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.12/common.nix
    Thu Nov 18 20:00:39 2010        (r24759)
+++ 
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.12/common.nix
    Thu Nov 18 20:33:29 2010        (r24760)
@@ -75,8 +75,12 @@
     /* Allow nixos and nix handle the locale-archive. */
     ./nix-locale-archive.patch
 
-    /* Fix for a vulnerability, taken from upstream */
+    /* Fix for CVE-2010-3856. */
     ./audit_suid.patch
+
+    /* Fix for CVE-2010-3856. */
+    ./ignore-origin.patch
+
   ];
 
   postPatch = ''

Copied: 
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.12/ignore-origin.patch
 (from r24759, 
nixpkgs/branches/cve-2010-3856/pkgs/development/libraries/glibc-2.11/ignore-origin.patch)
==============================================================================
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ 
nixpkgs/branches/stdenv-updates/pkgs/development/libraries/glibc-2.12/ignore-origin.patch
   Thu Nov 18 20:33:29 2010        (r24760, copy of r24759, 
nixpkgs/branches/cve-2010-3856/pkgs/development/libraries/glibc-2.11/ignore-origin.patch)
@@ -0,0 +1,85 @@
+Fix for CVE-2010-3847.
+
+2010-10-18  Andreas Schwab  <[email protected]>
+
+       * elf/dl-load.c (is_dst): Remove last parameter.
+       (_dl_dst_count): Ignore $ORIGIN in privileged programs.
+       (_dl_dst_substitute): Likewise.
+---
+ elf/dl-load.c |   30 +++++++++++++-----------------
+ 1 files changed, 13 insertions(+), 17 deletions(-)
+
+diff --git a/elf/dl-load.c b/elf/dl-load.c
+index a7162eb..776f7e4 100644
+--- a/elf/dl-load.c
++++ b/elf/dl-load.c
+@@ -169,8 +169,7 @@ local_strdup (const char *s)
+ 
+ 
+ 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;
+@@ -199,11 +198,6 @@ is_dst (const char *start, const char *name, const char 
*str,
+          && (!is_path || name[len] != ':'))
+     return 0;
+ 
+-  if (__builtin_expect (secure, 0)
+-      && ((name[len] != '\0' && (!is_path || name[len] != ':'))
+-        || (name != start + 1 && (!is_path || name[-2] != ':'))))
+-    return 0;
+-
+   return len;
+ }
+ 
+@@ -218,13 +212,12 @@ _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.  */
++      /* $ORIGIN is not expanded for SUID/GUID programs.  */
+       ++name;
+-      if ((len = is_dst (start, name, "ORIGIN", is_path,
+-                       INTUSE(__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
++         && !INTUSE(__libc_enable_secure))
++        || (len = is_dst (start, name, "PLATFORM", is_path)) != 0
++        || (len = is_dst (start, name, "LIB", is_path)) != 0)
+       ++cnt;
+ 
+       name = strchr (name + len, '$');
+@@ -256,9 +249,12 @@ _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,
+-                           INTUSE(__libc_enable_secure))) != 0)
++        if ((len = is_dst (start, name, "ORIGIN", is_path)) != 0)
+           {
++            /* Ignore this path element in SUID/SGID programs.  */
++            if (INTUSE(__libc_enable_secure))
++              repl = (const char *) -1;
++            else
+ #ifndef SHARED
+             if (l == NULL)
+               repl = _dl_get_origin ();
+@@ -266,9 +262,9 @@ _dl_dst_substitute (struct link_map *l, const char *name, 
char *result,
+ #endif
+               repl = l->l_origin;
+           }
+-        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)
+-- 
+1.7.2.3
_______________________________________________
nix-commits mailing list
[email protected]
http://mail.cs.uu.nl/mailman/listinfo/nix-commits

Reply via email to