]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] Add mm->task_size and fix powerpc vdso
authorBenjamin Herrenschmidt <benh@kernel.crashing.org>
Wed, 1 Mar 2006 00:59:19 +0000 (16:59 -0800)
committerLinus Torvalds <torvalds@g5.osdl.org>
Wed, 1 Mar 2006 04:53:44 +0000 (20:53 -0800)
This patch adds mm->task_size to keep track of the task size of a given mm
and uses that to fix the powerpc vdso so that it uses the mm task size to
decide what pages to fault in instead of the current thread flags (which
broke when ptracing).

(akpm: I expect that mm_struct.task_size will become the way in which we
finally sort out the confusion between 32-bit processes and 32-bit mm's.  It
may need tweaks, but at this stage this patch is powerpc-only.)

Signed-off-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
arch/powerpc/kernel/vdso.c
fs/exec.c
include/linux/sched.h

index f0c47dab09030266d799bbf2544e94a6a2c0e872..04f7df39ffbb7fc5b595dfff76a63f640bee4afc 100644 (file)
@@ -182,8 +182,8 @@ static struct page * vdso_vma_nopage(struct vm_area_struct * vma,
        unsigned long offset = address - vma->vm_start;
        struct page *pg;
 #ifdef CONFIG_PPC64
-       void *vbase = test_thread_flag(TIF_32BIT) ?
-               vdso32_kbase : vdso64_kbase;
+       void *vbase = (vma->vm_mm->task_size > TASK_SIZE_USER32) ?
+               vdso64_kbase : vdso32_kbase;
 #else
        void *vbase = vdso32_kbase;
 #endif
index 0e1c95074d4201b33bda839d1fe41566bb69e5ec..0b515ac531348650a59c61c8de6b362953b7bea7 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -885,6 +885,12 @@ int flush_old_exec(struct linux_binprm * bprm)
        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
+        */
+       current->mm->task_size = TASK_SIZE;
+
        if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || 
            file_permission(bprm->file, MAY_READ) ||
            (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
index b6f51e3a38ecdf990b018f38344afefa0a0110cc..ff2e09c953b9414ad4cc12dab212ad38d4aab76b 100644 (file)
@@ -298,8 +298,9 @@ struct mm_struct {
                                unsigned long addr, unsigned long len,
                                unsigned long pgoff, unsigned long flags);
        void (*unmap_area) (struct mm_struct *mm, unsigned long addr);
-        unsigned long mmap_base;               /* base of mmap area */
-        unsigned long cached_hole_size;         /* if non-zero, the largest hole below free_area_cache */
+       unsigned long mmap_base;                /* base of mmap area */
+       unsigned long task_size;                /* size of task vm space */
+       unsigned long cached_hole_size;         /* if non-zero, the largest hole below free_area_cache */
        unsigned long free_area_cache;          /* first hole of size cached_hole_size or larger */
        pgd_t * pgd;
        atomic_t mm_users;                      /* How many users with user space? */