]> git.ipfire.org Git - thirdparty/glibc.git/commitdiff
Ignore and remove LD_HWCAP_MASK for AT_SECURE programs (bug #21209)
authorSiddhesh Poyarekar <siddhesh@sourceware.org>
Tue, 7 Mar 2017 15:22:04 +0000 (20:52 +0530)
committerFlorian Weimer <fweimer@redhat.com>
Tue, 20 Jun 2017 04:07:34 +0000 (06:07 +0200)
The LD_HWCAP_MASK environment variable may alter the selection of
function variants for some architectures.  For AT_SECURE process it
means that if an outdated routine has a bug that would otherwise not
affect newer platforms by default, LD_HWCAP_MASK will allow that bug
to be exploited.

To be on the safe side, ignore and disable LD_HWCAP_MASK for setuid
binaries.

[BZ #21209]
* elf/rtld.c (process_envvars): Ignore LD_HWCAP_MASK for
AT_SECURE processes.
* sysdeps/generic/unsecvars.h: Add LD_HWCAP_MASK.

(cherry picked from commit 1c1243b6fc33c029488add276e56570a07803bfd)

ChangeLog
NEWS
elf/rtld.c
sysdeps/generic/unsecvars.h

index 1aa5867c4e4d0ebeecc412747cf080cea518516f..41f6ad184399789f3defa7a9561f1b136ff1dbc2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2017-03-07  Siddhesh Poyarekar  <siddhesh@sourceware.org>
+
+       [BZ #21209]
+       * elf/rtld.c (process_envvars): Ignore LD_HWCAP_MASK for
+       AT_SECURE processes.
+       * sysdeps/generic/unsecvars.h: Add LD_HWCAP_MASK.
+
 2017-06-19  Florian Weimer  <fweimer@redhat.com>
 
        * elf/rtld.c (audit_list_string): New variable.
diff --git a/NEWS b/NEWS
index 76a7f6a193aa56d167cd26a78b6ef03d6adf49b5..017d3c14f6f1f9750755546b96862ffd587e6dbc 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -42,6 +42,7 @@ The following bugs are resolved with this release:
     (CVE-2016-3075)
   [20177] $dp is not initialized correctly in sysdeps/hppa/start.S
   [20357] Incorrect cos result for 1.5174239687223976
+  [21209] Ignore and remove LD_HWCAP_MASK for AT_SECURE programs
   [21289] Fix symbol redirect for fts_set
   [21624] Unsafe alloca allows local attackers to alias stack and heap (CVE-2017-1000366)
 
index 302bb6362095868e8c1188cf7ba41aef50978b93..8f56d6edd3890cfa31429a140b8aea339fcd63ca 100644 (file)
@@ -2553,7 +2553,8 @@ process_envvars (enum mode *modep)
 
        case 10:
          /* Mask for the important hardware capabilities.  */
-         if (memcmp (envline, "HWCAP_MASK", 10) == 0)
+         if (!__libc_enable_secure
+             && memcmp (envline, "HWCAP_MASK", 10) == 0)
            GLRO(dl_hwcap_mask) = __strtoul_internal (&envline[11], NULL,
                                                      0, 0);
          break;
index 3e56538b51c4acefff9aa9fb805ae22c641646f1..ac57bd5db007f2d133e8dd5210e47133de53353a 100644 (file)
@@ -10,6 +10,7 @@
   "LD_DEBUG\0"                                                               \
   "LD_DEBUG_OUTPUT\0"                                                        \
   "LD_DYNAMIC_WEAK\0"                                                        \
+  "LD_HWCAP_MASK\0"                                                          \
   "LD_LIBRARY_PATH\0"                                                        \
   "LD_ORIGIN_PATH\0"                                                         \
   "LD_PRELOAD\0"                                                             \