[IA64] Change SET_PERSONALITY to comply with comment in binfmt_elf.c.
authorRobin Holt <holt@sgi.com>
Tue, 6 Dec 2005 02:02:31 +0000 (20:02 -0600)
committerTony Luck <tony.luck@intel.com>
Tue, 6 Dec 2005 17:12:34 +0000 (09:12 -0800)
We have a customer application which trips a bug.  The problem arises
when a driver attempts to call do_munmap on an area which is mapped, but
because current->thread.task_size has been set to 0xC0000000, the call
to do_munmap fails thinking it is an unmap beyond the user's address
space.

The comment in fs/binfmt_elf.c in load_elf_library() before the call
to SET_PERSONALITY() indicates that task_size must not be changed for
the running application until flush_thread, but is for ia64 executing
ia32 binaries.

This patch moves the setting of task_size from SET_PERSONALITY() to
flush_thread() as indicated.  The customer application no longer is able
to trip the bug.

Signed-off-by: Robin Holt <holt@sgi.com>
Signed-off-by: Tony Luck <tony.luck@intel.com>
arch/ia64/ia32/binfmt_elf32.c
arch/ia64/ia32/ia32priv.h
arch/ia64/kernel/process.c
include/asm-ia64/ia32.h

index a7280d9f6c1634d80cdd7b1b48a90d6eb3a138f4..4e7a6a1ec6c7c3f9c542483cbef4071e33ef972d 100644 (file)
@@ -261,8 +261,6 @@ elf32_set_personality (void)
 {
        set_personality(PER_LINUX32);
        current->thread.map_base  = IA32_PAGE_OFFSET/3;
-       current->thread.task_size = IA32_PAGE_OFFSET;   /* use what Linux/x86 uses... */
-       set_fs(USER_DS);                                /* set addr limit for new TASK_SIZE */
 }
 
 static unsigned long
index e3e9290e3ff2f433f649daa418a2c35a0c00ed5e..68ceb4e690c7a63a91960f750ab6282094938246 100644 (file)
@@ -305,7 +305,6 @@ struct old_linux32_dirent {
 #define ELF_DATA       ELFDATA2LSB
 #define ELF_ARCH       EM_386
 
-#define IA32_PAGE_OFFSET       0xc0000000
 #define IA32_STACK_TOP         IA32_PAGE_OFFSET
 #define IA32_GATE_OFFSET       IA32_PAGE_OFFSET
 #define IA32_GATE_END          IA32_PAGE_OFFSET + PAGE_SIZE
index 2e33665d9c18db01046f41e64002db351a08f180..a4da715a360ca74c01b0a3c55f39ef43179c3fc3 100644 (file)
@@ -721,8 +721,11 @@ flush_thread (void)
        /* drop floating-point and debug-register state if it exists: */
        current->thread.flags &= ~(IA64_THREAD_FPH_VALID | IA64_THREAD_DBG_VALID);
        ia64_drop_fpu(current);
-       if (IS_IA32_PROCESS(ia64_task_regs(current)))
+       if (IS_IA32_PROCESS(ia64_task_regs(current))) {
                ia32_drop_partial_page_list(current);
+               current->thread.task_size = IA32_PAGE_OFFSET;
+               set_fs(USER_DS);
+       }
 }
 
 /*
index 8e746b2413a64fa27a76638180aa6b33cc172263..f8044a1169cd39fdb653f5c86733aba719fd8356 100644 (file)
@@ -13,6 +13,8 @@
 
 # ifdef CONFIG_IA32_SUPPORT
 
+#define IA32_PAGE_OFFSET       0xc0000000
+
 extern void ia32_cpu_init (void);
 extern void ia32_mem_init (void);
 extern void ia32_gdt_init (void);