Commit 2aed69ee authored by Benjamin Herrenschmidt's avatar Benjamin Herrenschmidt Committed by Linus Torvalds

[PATCH] ppc[64]: increase max auxv entries

 ... 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...

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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 9f753f1d
......@@ -227,7 +227,7 @@ struct mm_struct {
unsigned long rss, total_vm, locked_vm, shared_vm;
unsigned long exec_vm, stack_vm, reserved_vm, 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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment