]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
.31 patches
authorGreg Kroah-Hartman <gregkh@suse.de>
Thu, 18 Mar 2010 20:50:51 +0000 (13:50 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Thu, 18 Mar 2010 20:50:51 +0000 (13:50 -0700)
queue-2.6.31/0001-Split-flush_old_exec-into-two-functions.patch [new file with mode: 0644]
queue-2.6.31/0002-sparc-TIF_ABI_PENDING-bit-removal.patch [new file with mode: 0644]
queue-2.6.31/0003-x86-get-rid-of-the-insane-TIF_ABI_PENDING-bit.patch [new file with mode: 0644]
queue-2.6.31/0004-Fix-flush_old_exec-setup_new_exec-split.patch [new file with mode: 0644]
queue-2.6.31/0005-powerpc-TIF_ABI_PENDING-bit-removal.patch [new file with mode: 0644]
queue-2.6.31/series

diff --git a/queue-2.6.31/0001-Split-flush_old_exec-into-two-functions.patch b/queue-2.6.31/0001-Split-flush_old_exec-into-two-functions.patch
new file mode 100644 (file)
index 0000000..7a9f384
--- /dev/null
@@ -0,0 +1,246 @@
+From 23503674605e1fddbd51b19be2f4db9fffe69501 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Thu, 28 Jan 2010 22:14:42 -0800
+Subject: Split 'flush_old_exec' into two functions
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 221af7f87b97431e3ee21ce4b0e77d5411cf1549 upstream.
+
+'flush_old_exec()' is the point of no return when doing an execve(), and
+it is pretty badly misnamed.  It doesn't just flush the old executable
+environment, it also starts up the new one.
+
+Which is very inconvenient for things like setting up the new
+personality, because we want the new personality to affect the starting
+of the new environment, but at the same time we do _not_ want the new
+personality to take effect if flushing the old one fails.
+
+As a result, the x86-64 '32-bit' personality is actually done using this
+insane "I'm going to change the ABI, but I haven't done it yet" bit
+(TIF_ABI_PENDING), with SET_PERSONALITY() not actually setting the
+personality, but just the "pending" bit, so that "flush_thread()" can do
+the actual personality magic.
+
+This patch in no way changes any of that insanity, but it does split the
+'flush_old_exec()' function up into a preparatory part that can fail
+(still called flush_old_exec()), and a new part that will actually set
+up the new exec environment (setup_new_exec()).  All callers are changed
+to trivially comply with the new world order.
+
+Signed-off-by: H. Peter Anvin <hpa@zytor.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
+
+---
+ arch/sh/kernel/process_64.c |    2 +-
+ arch/x86/ia32/ia32_aout.c   |   10 ++++++----
+ fs/binfmt_aout.c            |    1 +
+ fs/binfmt_elf.c             |   27 ++-------------------------
+ fs/binfmt_elf_fdpic.c       |    3 +++
+ fs/binfmt_flat.c            |    1 +
+ fs/binfmt_som.c             |    1 +
+ fs/exec.c                   |   26 ++++++++++++++++----------
+ include/linux/binfmts.h     |    1 +
+ include/linux/sched.h       |    2 +-
+ 10 files changed, 33 insertions(+), 41 deletions(-)
+
+--- a/arch/sh/kernel/process_64.c
++++ b/arch/sh/kernel/process_64.c
+@@ -367,7 +367,7 @@ void exit_thread(void)
+ void flush_thread(void)
+ {
+-      /* Called by fs/exec.c (flush_old_exec) to remove traces of a
++      /* Called by fs/exec.c (setup_new_exec) to remove traces of a
+        * previously running executable. */
+ #ifdef CONFIG_SH_FPU
+       if (last_task_used_math == current) {
+--- a/arch/x86/ia32/ia32_aout.c
++++ b/arch/x86/ia32/ia32_aout.c
+@@ -308,15 +308,17 @@ static int load_aout_binary(struct linux
+       if (retval)
+               return retval;
+-      regs->cs = __USER32_CS;
+-      regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 =
+-              regs->r13 = regs->r14 = regs->r15 = 0;
+-
+       /* OK, This is the point of no return */
+       set_personality(PER_LINUX);
+       set_thread_flag(TIF_IA32);
+       clear_thread_flag(TIF_ABI_PENDING);
++      setup_new_exec(bprm);
++
++      regs->cs = __USER32_CS;
++      regs->r8 = regs->r9 = regs->r10 = regs->r11 = regs->r12 =
++              regs->r13 = regs->r14 = regs->r15 = 0;
++
+       current->mm->end_code = ex.a_text +
+               (current->mm->start_code = N_TXTADDR(ex));
+       current->mm->end_data = ex.a_data +
+--- a/fs/binfmt_aout.c
++++ b/fs/binfmt_aout.c
+@@ -263,6 +263,7 @@ static int load_aout_binary(struct linux
+ #else
+       set_personality(PER_LINUX);
+ #endif
++      setup_new_exec(bprm);
+       current->mm->end_code = ex.a_text +
+               (current->mm->start_code = N_TXTADDR(ex));
+--- a/fs/binfmt_elf.c
++++ b/fs/binfmt_elf.c
+@@ -662,27 +662,6 @@ static int load_elf_binary(struct linux_
+                       if (elf_interpreter[elf_ppnt->p_filesz - 1] != '\0')
+                               goto out_free_interp;
+-                      /*
+-                       * The early SET_PERSONALITY here is so that the lookup
+-                       * for the interpreter happens in the namespace of the 
+-                       * to-be-execed image.  SET_PERSONALITY can select an
+-                       * alternate root.
+-                       *
+-                       * However, SET_PERSONALITY is NOT allowed to switch
+-                       * this task into the new images's memory mapping
+-                       * policy - that is, TASK_SIZE must still evaluate to
+-                       * that which is appropriate to the execing application.
+-                       * This is because exit_mmap() needs to have TASK_SIZE
+-                       * evaluate to the size of the old image.
+-                       *
+-                       * So if (say) a 64-bit application is execing a 32-bit
+-                       * application it is the architecture's responsibility
+-                       * to defer changing the value of TASK_SIZE until the
+-                       * switch really is going to happen - do this in
+-                       * flush_thread().      - akpm
+-                       */
+-                      SET_PERSONALITY(loc->elf_ex);
+-
+                       interpreter = open_exec(elf_interpreter);
+                       retval = PTR_ERR(interpreter);
+                       if (IS_ERR(interpreter))
+@@ -730,9 +709,6 @@ static int load_elf_binary(struct linux_
+               /* Verify the interpreter has a valid arch */
+               if (!elf_check_arch(&loc->interp_elf_ex))
+                       goto out_free_dentry;
+-      } else {
+-              /* Executables without an interpreter also need a personality  */
+-              SET_PERSONALITY(loc->elf_ex);
+       }
+       /* Flush all traces of the currently running executable */
+@@ -752,7 +728,8 @@ static int load_elf_binary(struct linux_
+       if (!(current->personality & ADDR_NO_RANDOMIZE) && randomize_va_space)
+               current->flags |= PF_RANDOMIZE;
+-      arch_pick_mmap_layout(current->mm);
++
++      setup_new_exec(bprm);
+       /* Do this so that we can load the interpreter, if need be.  We will
+          change some of these later */
+--- a/fs/binfmt_elf_fdpic.c
++++ b/fs/binfmt_elf_fdpic.c
+@@ -313,6 +313,9 @@ static int load_elf_fdpic_binary(struct
+        * defunct, deceased, etc. after this point we have to exit via
+        * error_kill */
+       set_personality(PER_LINUX_FDPIC);
++
++      setup_new_exec(bprm);
++
+       set_binfmt(&elf_fdpic_format);
+       current->mm->start_code = 0;
+--- a/fs/binfmt_flat.c
++++ b/fs/binfmt_flat.c
+@@ -521,6 +521,7 @@ static int load_flat_file(struct linux_b
+               /* OK, This is the point of no return */
+               set_personality(PER_LINUX_32BIT);
++              setup_new_exec(bprm);
+       }
+       /*
+--- a/fs/binfmt_som.c
++++ b/fs/binfmt_som.c
+@@ -227,6 +227,7 @@ load_som_binary(struct linux_binprm * bp
+       /* OK, This is the point of no return */
+       current->flags &= ~PF_FORKNOEXEC;
+       current->personality = PER_HPUX;
++      setup_new_exec(bprm);
+       /* Set the task size for HP-UX processes such that
+        * the gateway page is outside the address space.
+--- a/fs/exec.c
++++ b/fs/exec.c
+@@ -928,9 +928,7 @@ void set_task_comm(struct task_struct *t
+ int flush_old_exec(struct linux_binprm * bprm)
+ {
+-      char * name;
+-      int i, ch, retval;
+-      char tcomm[sizeof(current->comm)];
++      int retval;
+       /*
+        * Make sure we have a private signal table and that
+@@ -950,6 +948,20 @@ int flush_old_exec(struct linux_binprm *
+               goto out;
+       bprm->mm = NULL;                /* We're using it now */
++      return 0;
++
++out:
++      return retval;
++}
++EXPORT_SYMBOL(flush_old_exec);
++
++void setup_new_exec(struct linux_binprm * bprm)
++{
++      int i, ch;
++      char * name;
++      char tcomm[sizeof(current->comm)];
++
++      arch_pick_mmap_layout(current->mm);
+       /* This is the point of no return */
+       current->sas_ss_sp = current->sas_ss_size = 0;
+@@ -1006,14 +1018,8 @@ int flush_old_exec(struct linux_binprm *
+                       
+       flush_signal_handlers(current, 0);
+       flush_old_files(current->files);
+-
+-      return 0;
+-
+-out:
+-      return retval;
+ }
+-
+-EXPORT_SYMBOL(flush_old_exec);
++EXPORT_SYMBOL(setup_new_exec);
+ /*
+  * Prepare credentials and lock ->cred_guard_mutex.
+--- a/include/linux/binfmts.h
++++ b/include/linux/binfmts.h
+@@ -101,6 +101,7 @@ extern int prepare_binprm(struct linux_b
+ extern int __must_check remove_arg_zero(struct linux_binprm *);
+ extern int search_binary_handler(struct linux_binprm *,struct pt_regs *);
+ extern int flush_old_exec(struct linux_binprm * bprm);
++extern void setup_new_exec(struct linux_binprm * bprm);
+ extern int suid_dumpable;
+ #define SUID_DUMP_DISABLE     0       /* No setuid dumping */
+--- a/include/linux/sched.h
++++ b/include/linux/sched.h
+@@ -1296,7 +1296,7 @@ struct task_struct {
+       char comm[TASK_COMM_LEN]; /* executable name excluding path
+                                    - access with [gs]et_task_comm (which lock
+                                      it with task_lock())
+-                                   - initialized normally by flush_old_exec */
++                                   - initialized normally by setup_new_exec */
+ /* file system info */
+       int link_count, total_link_count;
+ #ifdef CONFIG_SYSVIPC
diff --git a/queue-2.6.31/0002-sparc-TIF_ABI_PENDING-bit-removal.patch b/queue-2.6.31/0002-sparc-TIF_ABI_PENDING-bit-removal.patch
new file mode 100644 (file)
index 0000000..f49208d
--- /dev/null
@@ -0,0 +1,87 @@
+From 144e39fe9cffe29cb8574dc976edc93af1857bc8 Mon Sep 17 00:00:00 2001
+From: David Miller <davem@davemloft.net>
+Date: Thu, 28 Jan 2010 21:42:02 -0800
+Subject: sparc: TIF_ABI_PENDING bit removal
+
+From: David Miller <davem@davemloft.net>
+
+commit 94673e968cbcce07fa78dac4b0ae05d24b5816e1 upstream.
+
+Here are the sparc bits to remove TIF_ABI_PENDING now that
+set_personality() is called at the appropriate place in exec.
+
+Signed-off-by: David S. Miller <davem@davemloft.net>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
+
+---
+ arch/sparc/include/asm/elf_64.h         |   13 +++----------
+ arch/sparc/include/asm/thread_info_64.h |    4 +---
+ arch/sparc/kernel/process_64.c          |    8 --------
+ 3 files changed, 4 insertions(+), 21 deletions(-)
+
+--- a/arch/sparc/include/asm/elf_64.h
++++ b/arch/sparc/include/asm/elf_64.h
+@@ -196,17 +196,10 @@ static inline unsigned int sparc64_elf_h
+ #define ELF_PLATFORM  (NULL)
+ #define SET_PERSONALITY(ex)                           \
+-do {  unsigned long new_flags = current_thread_info()->flags; \
+-      new_flags &= _TIF_32BIT;                        \
+-      if ((ex).e_ident[EI_CLASS] == ELFCLASS32)       \
+-              new_flags |= _TIF_32BIT;                \
++do {  if ((ex).e_ident[EI_CLASS] == ELFCLASS32)       \
++              set_thread_flag(TIF_32BIT);             \
+       else                                            \
+-              new_flags &= ~_TIF_32BIT;               \
+-      if ((current_thread_info()->flags & _TIF_32BIT) \
+-          != new_flags)                               \
+-              set_thread_flag(TIF_ABI_PENDING);       \
+-      else                                            \
+-              clear_thread_flag(TIF_ABI_PENDING);     \
++              clear_thread_flag(TIF_32BIT);           \
+       /* flush_thread will update pgd cache */        \
+       if (personality(current->personality) != PER_LINUX32)   \
+               set_personality(PER_LINUX |             \
+--- a/arch/sparc/include/asm/thread_info_64.h
++++ b/arch/sparc/include/asm/thread_info_64.h
+@@ -227,12 +227,11 @@ register struct thread_info *current_thr
+ /* flag bit 8 is available */
+ #define TIF_SECCOMP           9       /* secure computing */
+ #define TIF_SYSCALL_AUDIT     10      /* syscall auditing active */
+-/* flag bit 11 is available */
+ /* NOTE: Thread flags >= 12 should be ones we have no interest
+  *       in using in assembly, else we can't use the mask as
+  *       an immediate value in instructions such as andcc.
+  */
+-#define TIF_ABI_PENDING               12
++/* flag bit 12 is available */
+ #define TIF_MEMDIE            13
+ #define TIF_POLLING_NRFLAG    14
+ #define TIF_FREEZE            15      /* is freezing for suspend */
+@@ -246,7 +245,6 @@ register struct thread_info *current_thr
+ #define _TIF_32BIT            (1<<TIF_32BIT)
+ #define _TIF_SECCOMP          (1<<TIF_SECCOMP)
+ #define _TIF_SYSCALL_AUDIT    (1<<TIF_SYSCALL_AUDIT)
+-#define _TIF_ABI_PENDING      (1<<TIF_ABI_PENDING)
+ #define _TIF_POLLING_NRFLAG   (1<<TIF_POLLING_NRFLAG)
+ #define _TIF_FREEZE           (1<<TIF_FREEZE)
+--- a/arch/sparc/kernel/process_64.c
++++ b/arch/sparc/kernel/process_64.c
+@@ -365,14 +365,6 @@ void flush_thread(void)
+       struct thread_info *t = current_thread_info();
+       struct mm_struct *mm;
+-      if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
+-              clear_ti_thread_flag(t, TIF_ABI_PENDING);
+-              if (test_ti_thread_flag(t, TIF_32BIT))
+-                      clear_ti_thread_flag(t, TIF_32BIT);
+-              else
+-                      set_ti_thread_flag(t, TIF_32BIT);
+-      }
+-
+       mm = t->task->mm;
+       if (mm)
+               tsb_context_switch(mm);
diff --git a/queue-2.6.31/0003-x86-get-rid-of-the-insane-TIF_ABI_PENDING-bit.patch b/queue-2.6.31/0003-x86-get-rid-of-the-insane-TIF_ABI_PENDING-bit.patch
new file mode 100644 (file)
index 0000000..01efd1e
--- /dev/null
@@ -0,0 +1,118 @@
+From 054add52e6312c382a8413afc72e801dbdc7b8da Mon Sep 17 00:00:00 2001
+From: H. Peter Anvin <hpa@zytor.com>
+Date: Thu, 28 Jan 2010 22:14:43 -0800
+Subject: x86: get rid of the insane TIF_ABI_PENDING bit
+
+From: H. Peter Anvin <hpa@zytor.com>
+
+commit 05d43ed8a89c159ff641d472f970e3f1baa66318 upstream.
+
+Now that the previous commit made it possible to do the personality
+setting at the point of no return, we do just that for ELF binaries.
+And suddenly all the reasons for that insane TIF_ABI_PENDING bit go
+away, and we can just make SET_PERSONALITY() just do the obvious thing
+for a 32-bit compat process.
+
+Everything becomes much more straightforward this way.
+
+Signed-off-by: H. Peter Anvin <hpa@zytor.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
+
+---
+ arch/x86/ia32/ia32_aout.c          |    1 -
+ arch/x86/include/asm/elf.h         |   10 ++--------
+ arch/x86/include/asm/thread_info.h |    2 --
+ arch/x86/kernel/process.c          |   12 ------------
+ arch/x86/kernel/process_64.c       |   11 +++++++++++
+ 5 files changed, 13 insertions(+), 23 deletions(-)
+
+--- a/arch/x86/ia32/ia32_aout.c
++++ b/arch/x86/ia32/ia32_aout.c
+@@ -311,7 +311,6 @@ static int load_aout_binary(struct linux
+       /* OK, This is the point of no return */
+       set_personality(PER_LINUX);
+       set_thread_flag(TIF_IA32);
+-      clear_thread_flag(TIF_ABI_PENDING);
+       setup_new_exec(bprm);
+--- a/arch/x86/include/asm/elf.h
++++ b/arch/x86/include/asm/elf.h
+@@ -197,14 +197,8 @@ do {                                                      \
+       set_fs(USER_DS);                                \
+ } while (0)
+-#define COMPAT_SET_PERSONALITY(ex)                    \
+-do {                                                  \
+-      if (test_thread_flag(TIF_IA32))                 \
+-              clear_thread_flag(TIF_ABI_PENDING);     \
+-      else                                            \
+-              set_thread_flag(TIF_ABI_PENDING);       \
+-      current->personality |= force_personality32;    \
+-} while (0)
++void set_personality_ia32(void);
++#define COMPAT_SET_PERSONALITY(ex) set_personality_ia32()
+ #define COMPAT_ELF_PLATFORM                   ("i686")
+--- a/arch/x86/include/asm/thread_info.h
++++ b/arch/x86/include/asm/thread_info.h
+@@ -86,7 +86,6 @@ struct thread_info {
+ #define TIF_NOTSC             16      /* TSC is not accessible in userland */
+ #define TIF_IA32              17      /* 32bit process */
+ #define TIF_FORK              18      /* ret_from_fork */
+-#define TIF_ABI_PENDING               19
+ #define TIF_MEMDIE            20
+ #define TIF_DEBUG             21      /* uses debug registers */
+ #define TIF_IO_BITMAP         22      /* uses I/O bitmap */
+@@ -110,7 +109,6 @@ struct thread_info {
+ #define _TIF_NOTSC            (1 << TIF_NOTSC)
+ #define _TIF_IA32             (1 << TIF_IA32)
+ #define _TIF_FORK             (1 << TIF_FORK)
+-#define _TIF_ABI_PENDING      (1 << TIF_ABI_PENDING)
+ #define _TIF_DEBUG            (1 << TIF_DEBUG)
+ #define _TIF_IO_BITMAP                (1 << TIF_IO_BITMAP)
+ #define _TIF_FREEZE           (1 << TIF_FREEZE)
+--- a/arch/x86/kernel/process.c
++++ b/arch/x86/kernel/process.c
+@@ -94,18 +94,6 @@ void flush_thread(void)
+ {
+       struct task_struct *tsk = current;
+-#ifdef CONFIG_X86_64
+-      if (test_tsk_thread_flag(tsk, TIF_ABI_PENDING)) {
+-              clear_tsk_thread_flag(tsk, TIF_ABI_PENDING);
+-              if (test_tsk_thread_flag(tsk, TIF_IA32)) {
+-                      clear_tsk_thread_flag(tsk, TIF_IA32);
+-              } else {
+-                      set_tsk_thread_flag(tsk, TIF_IA32);
+-                      current_thread_info()->status |= TS_COMPAT;
+-              }
+-      }
+-#endif
+-
+       clear_tsk_thread_flag(tsk, TIF_DEBUG);
+       tsk->thread.debugreg0 = 0;
+--- a/arch/x86/kernel/process_64.c
++++ b/arch/x86/kernel/process_64.c
+@@ -534,6 +534,17 @@ sys_clone(unsigned long clone_flags, uns
+       return do_fork(clone_flags, newsp, regs, 0, parent_tid, child_tid);
+ }
++void set_personality_ia32(void)
++{
++      /* inherit personality from parent */
++
++      /* Make sure to be in 32bit mode */
++      set_thread_flag(TIF_IA32);
++
++      /* Prepare the first "return" to user space */
++      current_thread_info()->status |= TS_COMPAT;
++}
++
+ unsigned long get_wchan(struct task_struct *p)
+ {
+       unsigned long stack;
diff --git a/queue-2.6.31/0004-Fix-flush_old_exec-setup_new_exec-split.patch b/queue-2.6.31/0004-Fix-flush_old_exec-setup_new_exec-split.patch
new file mode 100644 (file)
index 0000000..6f81dd9
--- /dev/null
@@ -0,0 +1,72 @@
+From 2af637c2e0606dc40e5feea64726f74859bdcc80 Mon Sep 17 00:00:00 2001
+From: Linus Torvalds <torvalds@linux-foundation.org>
+Date: Tue, 2 Feb 2010 12:37:44 -0800
+Subject: [PATCH 4/5] Fix 'flush_old_exec()/setup_new_exec()' split
+
+From: Linus Torvalds <torvalds@linux-foundation.org>
+
+commit 7ab02af428c2d312c0cf8fb0b01cc1eb21131a3d upstream.
+
+Commit 221af7f87b9 ("Split 'flush_old_exec' into two functions") split
+the function at the point of no return - ie right where there were no
+more error cases to check.  That made sense from a technical standpoint,
+but when we then also combined it with the actual personality setting
+going in between flush_old_exec() and setup_new_exec(), it needs to be a
+bit more careful.
+
+In particular, we need to make sure that we really flush the old
+personality bits in the 'flush' stage, rather than later in the 'setup'
+stage, since otherwise we might be flushing the _new_ personality state
+that we're just setting up.
+
+So this moves the flags and personality flushing (and 'flush_thread()',
+which is the arch-specific function that generally resets lazy FP state
+etc) of the old process into flush_old_exec(), so that it doesn't affect
+any state that execve() is setting up for the new process environment.
+
+This was reported by Michal Simek as breaking his Microblaze qemu
+environment.
+
+Reported-and-tested-by: Michal Simek <michal.simek@petalogix.com>
+Cc: Peter Anvin <hpa@zytor.com>
+Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
+
+---
+ fs/exec.c |   10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+--- a/fs/exec.c
++++ b/fs/exec.c
+@@ -948,6 +948,11 @@ int flush_old_exec(struct linux_binprm *
+               goto out;
+       bprm->mm = NULL;                /* We're using it now */
++
++      current->flags &= ~PF_RANDOMIZE;
++      flush_thread();
++      current->personality &= ~bprm->per_clear;
++
+       return 0;
+ out:
+@@ -984,9 +989,6 @@ void setup_new_exec(struct linux_binprm
+       tcomm[i] = '\0';
+       set_task_comm(current, tcomm);
+-      current->flags &= ~PF_RANDOMIZE;
+-      flush_thread();
+-
+       /* Set the new mm task size. We have to do that late because it may
+        * depend on TIF_32BIT which is only updated in flush_thread() on
+        * some architectures like powerpc
+@@ -1002,8 +1004,6 @@ void setup_new_exec(struct linux_binprm
+               set_dumpable(current->mm, suid_dumpable);
+       }
+-      current->personality &= ~bprm->per_clear;
+-
+       /*
+        * Flush performance counters when crossing a
+        * security domain:
diff --git a/queue-2.6.31/0005-powerpc-TIF_ABI_PENDING-bit-removal.patch b/queue-2.6.31/0005-powerpc-TIF_ABI_PENDING-bit-removal.patch
new file mode 100644 (file)
index 0000000..2acd438
--- /dev/null
@@ -0,0 +1,81 @@
+From fa0898b8e2bae16e4374838d4e2e9dd2265002ad Mon Sep 17 00:00:00 2001
+From: Andreas Schwab <schwab@linux-m68k.org>
+Date: Sat, 30 Jan 2010 10:20:59 +0000
+Subject: powerpc: TIF_ABI_PENDING bit removal
+
+From: Andreas Schwab <schwab@linux-m68k.org>
+
+commit 94f28da8409c6059135e89ac64a0839993124155 upstream.
+
+Here are the powerpc bits to remove TIF_ABI_PENDING now that
+set_personality() is called at the appropriate place in exec.
+
+Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
+Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
+Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
+
+---
+ arch/powerpc/include/asm/elf.h         |    8 ++------
+ arch/powerpc/include/asm/thread_info.h |    2 --
+ arch/powerpc/kernel/process.c          |   12 ------------
+ 3 files changed, 2 insertions(+), 20 deletions(-)
+
+--- a/arch/powerpc/include/asm/elf.h
++++ b/arch/powerpc/include/asm/elf.h
+@@ -236,14 +236,10 @@ typedef elf_vrregset_t elf_fpxregset_t;
+ #ifdef __powerpc64__
+ # define SET_PERSONALITY(ex)                                  \
+ do {                                                          \
+-      unsigned long new_flags = 0;                            \
+       if ((ex).e_ident[EI_CLASS] == ELFCLASS32)               \
+-              new_flags = _TIF_32BIT;                         \
+-      if ((current_thread_info()->flags & _TIF_32BIT)         \
+-          != new_flags)                                       \
+-              set_thread_flag(TIF_ABI_PENDING);               \
++              set_thread_flag(TIF_32BIT);                     \
+       else                                                    \
+-              clear_thread_flag(TIF_ABI_PENDING);             \
++              clear_thread_flag(TIF_32BIT);                   \
+       if (personality(current->personality) != PER_LINUX32)   \
+               set_personality(PER_LINUX |                     \
+                       (current->personality & (~PER_MASK)));  \
+--- a/arch/powerpc/include/asm/thread_info.h
++++ b/arch/powerpc/include/asm/thread_info.h
+@@ -111,7 +111,6 @@ static inline struct thread_info *curren
+ #define TIF_NOTIFY_RESUME     13      /* callback before returning to user */
+ #define TIF_FREEZE            14      /* Freezing for suspend */
+ #define TIF_RUNLATCH          15      /* Is the runlatch enabled? */
+-#define TIF_ABI_PENDING               16      /* 32/64 bit switch needed */
+ /* as above, but as bit values */
+ #define _TIF_SYSCALL_TRACE    (1<<TIF_SYSCALL_TRACE)
+@@ -129,7 +128,6 @@ static inline struct thread_info *curren
+ #define _TIF_NOTIFY_RESUME    (1<<TIF_NOTIFY_RESUME)
+ #define _TIF_FREEZE           (1<<TIF_FREEZE)
+ #define _TIF_RUNLATCH         (1<<TIF_RUNLATCH)
+-#define _TIF_ABI_PENDING      (1<<TIF_ABI_PENDING)
+ #define _TIF_SYSCALL_T_OR_A   (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
+ #define _TIF_USER_WORK_MASK   (_TIF_SIGPENDING | _TIF_NEED_RESCHED | \
+--- a/arch/powerpc/kernel/process.c
++++ b/arch/powerpc/kernel/process.c
+@@ -554,18 +554,6 @@ void exit_thread(void)
+ void flush_thread(void)
+ {
+-#ifdef CONFIG_PPC64
+-      struct thread_info *t = current_thread_info();
+-
+-      if (test_ti_thread_flag(t, TIF_ABI_PENDING)) {
+-              clear_ti_thread_flag(t, TIF_ABI_PENDING);
+-              if (test_ti_thread_flag(t, TIF_32BIT))
+-                      clear_ti_thread_flag(t, TIF_32BIT);
+-              else
+-                      set_ti_thread_flag(t, TIF_32BIT);
+-      }
+-#endif
+-
+       discard_lazy_cpu_state();
+       if (current->thread.dabr) {
index 1eaa520adae7e2b07d2eabc63bc03f36ed0b53cd..296e58b041e596c1874b22cf49c4adcb15cbfb97 100644 (file)
@@ -72,3 +72,8 @@ mpt2sas-delete-volume-before-hba-detach.patch
 v4l-dvb-video-pwc-fix-regression-in-pwc_set_shutter_speed-caused-by-bad-constant-sizeof-conversion.patch
 x86-fix-sci-on-ioapic-0.patch
 x86-ia32_aout-do-not-kill-argument-mapping.patch
+0001-Split-flush_old_exec-into-two-functions.patch
+0002-sparc-TIF_ABI_PENDING-bit-removal.patch
+0003-x86-get-rid-of-the-insane-TIF_ABI_PENDING-bit.patch
+0004-Fix-flush_old_exec-setup_new_exec-split.patch
+0005-powerpc-TIF_ABI_PENDING-bit-removal.patch