lkml.org 
[lkml]   [2007]   [Sep]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[PATCH] increase AT_VECTOR_SIZE to terminate saved_auxv properly

    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.
    -
    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/
    \
     
     \ /
      Last update: 2007-09-18 13:57    [W:0.026 / U:0.452 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site