execve: Fix ABI change on unsized binaries
authorAlan Cox <alan@linux.intel.com>
Sat, 27 Dec 2014 12:51:41 +0000 (12:51 +0000)
committerAlan Cox <alan@linux.intel.com>
Sat, 27 Dec 2014 12:51:41 +0000 (12:51 +0000)
We need to adjust by the load page *after* we have checked for zero.

Kernel/syscall_exec.c

index c25175a..a925790 100644 (file)
@@ -76,9 +76,11 @@ int16_t _execve(void)
         *      UZI binaries).
         */
        if (buf[3] == 'F' && buf[4] == 'Z' && buf[5] == 'X' && buf[6] == '1') {
-               top = buf[8] | ((unsigned int)buf[9] << 8) - PROGLOAD;
+               top = buf[8] | ((unsigned int)buf[9] << 8);
                if (top == 0)   /* Legacy 'all space' binary */
                        top = ramtop;
+               else    /* Requested an amount, so adjust for the base */
+                       top += PROGLOAD;
                emu_ino = 0;    // no emulation, thanks
                /* Don't load binaries for the wrong base page, eg spectrum
                   binaries on a sane box */