The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Benjamin Herrenschmidt <benh@kernel.crashing.org>
To: Andrew Morton <akpm@osdl.org>
Cc: Linux Kernel list <linux-kernel@vger.kernel.org>,
	Paul Mackerras <paulus@samba.org>
Subject: [PATCH] Quick fix for AUXV problem
Date: Thu, 02 Sep 2004 17:18:47 +1000	[thread overview]
Message-ID: <1094109526.2579.39.camel@gaston> (raw)

 ... but a better solution should probably be found, that's saved_auxv
in struct mm_struct is ... hrm... disgusting at least ;)

So the problem is that we currently do

	unsigned long saved_auxv[40];

That is we assume that all archs will have an AUXV entry of no more than
2 unsigned longs and we'll have no more than 20 entries in the table.

Unfortunately, this is wrong.

PPC/PPC64 adds 5 platform entries. then we add 14 in the common code,
and then we have 

	if (k_platform) {
		NEW_AUX_ENT(AT_PLATFORM, (elf_addr_t)(unsigned long)u_platform);
	}
	if (bprm->interp_flags & BINPRM_FLAGS_EXECFD) {
		NEW_AUX_ENT(AT_EXECFD, (elf_addr_t) bprm->interp_data);
	}

which may add a 20th entry... which means we are already out of room for
the terminating AT_NULL entry... bad bad bad.

Now I'm adding AT_SYSINFO_EHDR to ppc/ppc64 and it breaks all the time.

The quick fix is to bump the number of entries in struct mm_struct to 42,
though that's worth a big BOLD comment in binfmt_elf in case anybody adds
a new entry in there. (Patch below). I wonder if we shouldn't add a
ARCH_MAX_AUXV_ENTRIES macro to the asm-arch/elf.h though to get the max
amount of entry the arch may add to the normal count, and have the mm
struct array use that plus the number of "normal" entries...

Ben.

This patch increase the max amount of auxv entries in struct mm_struct
to 42 so that ppc & ppc64 don't get a chance to blow the array up.

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>

===== include/linux/sched.h 1.245 vs edited =====
--- 1.245/include/linux/sched.h	2004-08-26 10:37:26 +10:00
+++ edited/include/linux/sched.h	2004-09-02 17:17:31 +10:00
@@ -227,7 +227,7 @@
 	unsigned long rss, total_vm, locked_vm;
 	unsigned long def_flags;
 
-	unsigned long saved_auxv[40]; /* for /proc/PID/auxv */
+	unsigned long saved_auxv[42]; /* for /proc/PID/auxv */
 
 	unsigned dumpable:1;
 	cpumask_t cpu_vm_mask;
  


                 reply	other threads:[~2004-09-02  7:25 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=1094109526.2579.39.camel@gaston \
    --to=benh@kernel.crashing.org \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=paulus@samba.org \
    /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