Bug 560769 - fixing badness accessing /proc/self/auxv under qemu, r=vlad, a=dholbert a1.9.2.6=dveditz
authorBrian Crowder <crowderbt@gmail.com>
Fri, 23 Apr 2010 12:58:38 -0700
changeset 34384 1fcff072ea163044f085200140e58ec29b21a634
parent 34383 43bf210715d20143fd552c8aa170ea5fc872e0e5
child 34385 f2a4c8e82d16b20f380e65e90f6b924ba846507d
push id1430
push usereakhgari@mozilla.com
push dateFri, 25 Jun 2010 20:52:55 +0000
reviewersvlad, dholbert
bugs560769
milestone1.9.2.6pre
Bug 560769 - fixing badness accessing /proc/self/auxv under qemu, r=vlad, a=dholbert a1.9.2.6=dveditz
js/src/jstracer.cpp
--- a/js/src/jstracer.cpp
+++ b/js/src/jstracer.cpp
@@ -7130,46 +7130,42 @@ arm_read_auxv() {
 
     fd = open("/proc/self/auxv", O_RDONLY);
     if (fd > 0) {
         while (read(fd, &aux, sizeof(Elf32_auxv_t))) {
             if (aux.a_type == AT_HWCAP) {
                 uint32_t hwcap = aux.a_un.a_val;
                 if (getenv("ARM_FORCE_HWCAP"))
                     hwcap = strtoul(getenv("ARM_FORCE_HWCAP"), NULL, 0);
+                else if (getenv("_SBOX_DIR"))
+                    continue;  // Ignore the rest, if we're running in scratchbox
                 // hardcode these values to avoid depending on specific versions
                 // of the hwcap header, e.g. HWCAP_NEON
                 arm_has_thumb = (hwcap & 4) != 0;
                 arm_has_vfp = (hwcap & 64) != 0;
                 arm_has_iwmmxt = (hwcap & 512) != 0;
                 // this flag is only present on kernel 2.6.29
                 arm_has_neon = (hwcap & 4096) != 0;
             } else if (aux.a_type == AT_PLATFORM) {
                 const char *plat = (const char*) aux.a_un.a_val;
                 if (getenv("ARM_FORCE_PLATFORM"))
                     plat = getenv("ARM_FORCE_PLATFORM");
+                else if (getenv("_SBOX_DIR"))
+                    continue;  // Ignore the rest, if we're running in scratchbox
                 // The platform string has the form "v[0-9][lb]". The "l" or "b" indicate little-
                 // or big-endian variants and the digit indicates the version of the platform.
                 // We can only accept ARMv4 and above, but allow anything up to ARMv9 for future
                 // processors. Architectures newer than ARMv7 are assumed to be
                 // backwards-compatible with ARMv7.
                 if ((plat[0] == 'v') &&
                     (plat[1] >= '4') && (plat[1] <= '9') &&
                     ((plat[2] == 'l') || (plat[2] == 'b')))
                 {
                     arm_arch = plat[1] - '0';
                 }
-                else
-                {
-                    // For production code, ignore invalid (or unexpected) platform strings and
-                    // fall back to the default. For debug code, use an assertion to catch this
-                    // when not running in scratchbox.
-                    if (getenv("_SBOX_DIR") == NULL)
-                        JS_ASSERT(false);
-                }
             }
         }
         close (fd);
 
         // if we don't have 2.6.29, we have to do this hack; set
         // the env var to trust HWCAP.
         if (!getenv("ARM_TRUST_HWCAP") && (arm_arch >= 7))
             arm_has_neon = true;