All of lore.kernel.org
 help / color / mirror / Atom feed
From: Olaf Hering <olaf@aepfle.de>
To: linux-kernel@vger.kernel.org, Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH] increase AT_VECTOR_SIZE to terminate saved_auxv properly
Date: Tue, 18 Sep 2007 13:55:04 +0200	[thread overview]
Message-ID: <20070918115504.GA609@aepfle.de> (raw)
In-Reply-To: <20070914110057.GA10088@aepfle.de>


include/asm-powerpc/elf.h has 6 entries in ARCH_DLINFO.
fs/binfmt_elf.c has 14 unconditional NEW_AUX_ENT entries and 2
conditional NEW_AUX_ENT entries.
So in the worst case, saved_auxv does not get an AT_NULL entry at the
end.

The saved_auxv array must be terminated with an AT_NULL entry.
Make the size of mm_struct->saved_auxv arch dependend,
based on the number of ARCH_DLINFO entries.

Signed-off-by: Olaf Hering <olaf@aepfle.de>

---
 include/asm-alpha/system.h   |    1 +
 include/asm-i386/system.h    |    1 +
 include/asm-ia64/system.h    |    2 ++
 include/asm-powerpc/system.h |    1 +
 include/asm-sh/system.h      |    1 +
 include/linux/auxvec.h       |    4 +++-
 include/linux/elf.h          |    1 -
 include/linux/sched.h        |    6 +++++-
 8 files changed, 14 insertions(+), 3 deletions(-)

--- a/include/asm-alpha/system.h
+++ b/include/asm-alpha/system.h
@@ -48,6 +48,7 @@
 
 #ifndef __ASSEMBLY__
 #include <linux/kernel.h>
+#define AT_VECTOR_SIZE_ARCH 4
 
 /*
  * This is the logout header that should be common to all platforms
--- a/include/asm-i386/system.h
+++ b/include/asm-i386/system.h
@@ -7,6 +7,7 @@
 #include <asm/cmpxchg.h>
 
 #ifdef __KERNEL__
+#define AT_VECTOR_SIZE_ARCH 2
 
 struct task_struct;	/* one of the stranger aspects of C forward declarations.. */
 extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
--- a/include/asm-ia64/system.h
+++ b/include/asm-ia64/system.h
@@ -32,6 +32,8 @@
 #include <linux/kernel.h>
 #include <linux/types.h>
 
+#define AT_VECTOR_SIZE_ARCH 2
+
 struct pci_vector_struct {
 	__u16 segment;	/* PCI Segment number */
 	__u16 bus;	/* PCI Bus number */
--- a/include/asm-powerpc/system.h
+++ b/include/asm-powerpc/system.h
@@ -40,6 +40,7 @@
 #define set_mb(var, value)	do { var = value; mb(); } while (0)
 
 #ifdef __KERNEL__
+#define AT_VECTOR_SIZE_ARCH 6
 #ifdef CONFIG_SMP
 #define smp_mb()	mb()
 #define smp_rmb()	rmb()
--- a/include/asm-sh/system.h
+++ b/include/asm-sh/system.h
@@ -11,6 +11,7 @@
 #include <asm/types.h>
 #include <asm/ptrace.h>
 
+#define AT_VECTOR_SIZE_ARCH 1
 /*
  *	switch_to() should switch tasks to task nr n, first
  */
--- a/include/linux/auxvec.h
+++ b/include/linux/auxvec.h
@@ -26,6 +26,8 @@
 
 #define AT_SECURE 23   /* secure mode boolean */
 
-#define AT_VECTOR_SIZE  44 /* Size of auxiliary table.  */
+#ifdef __KERNEL__
+#define AT_VECTOR_SIZE_BASE  (14 + 2) /* generic entries in auxiliary table. */
+#endif
 
 #endif /* _LINUX_AUXVEC_H */
--- a/include/linux/elf.h
+++ b/include/linux/elf.h
@@ -2,7 +2,6 @@
 #define _LINUX_ELF_H
 
 #include <linux/types.h>
-#include <linux/auxvec.h>
 #include <linux/elf-em.h>
 #include <asm/elf.h>
 
--- a/include/linux/sched.h
+++ b/include/linux/sched.h
@@ -1,7 +1,6 @@
 #ifndef _LINUX_SCHED_H
 #define _LINUX_SCHED_H
 
-#include <linux/auxvec.h>	/* For AT_VECTOR_SIZE */
 
 /*
  * cloning flags:
@@ -90,6 +89,11 @@ struct exec_domain;
 struct futex_pi_state;
 struct bio;
 
+#include <linux/auxvec.h>
+#ifndef AT_VECTOR_SIZE_ARCH
+#define AT_VECTOR_SIZE_ARCH 0
+#endif
+#define AT_VECTOR_SIZE (2*(AT_VECTOR_SIZE_ARCH + AT_VECTOR_SIZE_BASE + 1))
 /*
  * List of flags we want to share for kernel threads,
  * if only because they are not used by them anyway.

  parent reply	other threads:[~2007-09-18 11:54 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-09-14 11:00 increase AT_VECTOR_SIZE to terminate saved_auxv properly Olaf Hering
2007-09-15 14:01 ` Jakub Jelinek
2007-09-17  8:54   ` Olaf Hering
2007-09-18 11:55 ` Olaf Hering [this message]
2007-09-20  6:44   ` [PATCH] " Andrew Morton
2007-09-20 19:19     ` Olaf Hering
2007-09-20 20:22       ` Andrew Morton

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=20070918115504.GA609@aepfle.de \
    --to=olaf@aepfle.de \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.