[PATCH] [RESEND] fs/binfmt_elf.c changes vs 2.4.5-pre3

From: Paul Mackerras (paulus@samba.org)
Date: Fri May 18 2001 - 07:35:35 EST


Linus,

This patch against 2.4.5-pre3 makes 3 changes to fs/binfmt_elf.c:

1. It fixes the csp calculation so that it actually achieves the 16
   byte final alignment that the comment claims. Previously the csp
   calculation didn't take the AT_NULL entry into account. If you
   look at the current fs/binfmt_elf.c there is a "sp -= 2" that is
   not reflected in the csp calculation, unlike all the other
   decrements of sp.

2. It allows each architecture to add extra aux table entries by
   defining DLINFO_ARCH_ITEMS and ARCH_DLINFO in <asm/elf.h>. We need
   this on PowerPC to add entries for the cache line size, and to add
   entries for compatibility with older broken glibc's.

3. It removes the extra 16 bytes that were left free for PowerPC - in
   the past we had to move the auxiliary table up to cope with broken
   glibc's (now we cope by adding special AT_IGNORE entries using the
   ARCH_DLINFO macro).

Please apply this to your tree.

Thanks,
Paul.

diff -Nru a/fs/binfmt_elf.c b/fs/binfmt_elf.c
--- a/fs/binfmt_elf.c Wed May 16 18:45:10 2001
+++ b/fs/binfmt_elf.c Wed May 16 18:45:10 2001
@@ -135,12 +135,13 @@
 
         /*
          * Force 16 byte _final_ alignment here for generality.
- * Leave an extra 16 bytes free so that on the PowerPC we
- * can move the aux table up to start on a 16-byte boundary.
          */
- sp = (elf_addr_t *)((~15UL & (unsigned long)(u_platform)) - 16UL);
+ sp = (elf_addr_t *)(~15UL & (unsigned long)(u_platform));
         csp = sp;
- csp -= DLINFO_ITEMS*2 + (k_platform ? 2 : 0);
+ csp -= (1+DLINFO_ITEMS)*2 + (k_platform ? 2 : 0);
+#ifdef DLINFO_ARCH_ITEMS
+ csp -= DLINFO_ARCH_ITEMS*2;
+#endif
         csp -= envc+1;
         csp -= argc+1;
         csp -= (!ibcs ? 3 : 1); /* argc itself */
@@ -174,6 +175,13 @@
         NEW_AUX_ENT(10, AT_EUID, (elf_addr_t) current->euid);
         NEW_AUX_ENT(11, AT_GID, (elf_addr_t) current->gid);
         NEW_AUX_ENT(12, AT_EGID, (elf_addr_t) current->egid);
+#ifdef ARCH_DLINFO
+ /*
+ * ARCH_DLINFO must come last so platform specific code can enforce
+ * special alignment requirements on the AUXV if necessary (eg. PPC).
+ */
+ ARCH_DLINFO;
+#endif
 #undef NEW_AUX_ENT
 
         sp -= envc+1;
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Wed May 23 2001 - 21:00:27 EST