mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Paul Mackerras <paulus@samba.org>
To: Linus Torvalds <torvalds@transmeta.com>
Cc: cort@fsmlabs.com, benh@kernel.crashing.org, linux-kernel@vger.kernel.org
Subject: [PATCH] [RESEND] fs/binfmt_elf.c changes vs 2.4.5-pre3
Date: Fri, 18 May 2001 22:35:35 +1000 (EST)	[thread overview]
Message-ID: <15109.5911.790765.946985@argo.ozlabs.ibm.com> (raw)

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;

                 reply	other threads:[~2001-05-18 12:41 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15109.5911.790765.946985@argo.ozlabs.ibm.com \
    --to=paulus@samba.org \
    --cc=benh@kernel.crashing.org \
    --cc=cort@fsmlabs.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®