MINSIGSTKSZ is defined differently for i386 and ia64. This patch improves compatibility with apps which use sigaltstack(2) with sizes between MINSIGSTKSZ_IA32 and MINSIGSTKSZ. Patches for both 2.4 and 2.6 are attached. -Arun Index: linux-2.4/arch/ia64/ia32/sys_ia32.c =================================================================== --- linux-2.4/arch/ia64/ia32/sys_ia32.c (revision 8) +++ linux-2.4/arch/ia64/ia32/sys_ia32.c (working copy) @@ -75,6 +75,7 @@ #define OFFSET4K(a) ((a) & 0xfff) #define PAGE_START(addr) ((addr) & PAGE_MASK) #define PAGE_OFF(addr) ((addr) & ~PAGE_MASK) +#define MINSIGSTKSZ_IA32 2048 extern asmlinkage long sys_execve (char *, char **, char **, struct pt_regs *); extern asmlinkage long sys_mprotect (unsigned long, size_t, unsigned long); @@ -3408,10 +3409,18 @@ return -EFAULT; uss.ss_sp = (void *) (long) buf32.ss_sp; uss.ss_flags = buf32.ss_flags; - uss.ss_size = buf32.ss_size; + /* MINSIGSTKSZ is different for ia32 vs ia64. We lie here to pass the + check and set it to the user requested value later */ + if (buf32.ss_size < MINSIGSTKSZ_IA32) { + ret = -ENOMEM; + goto out; + } + uss.ss_size = MINSIGSTKSZ; set_fs(KERNEL_DS); ret = do_sigaltstack(uss32 ? &uss : NULL, &uoss, pt->r12); + current->sas_ss_size = buf32.ss_size; set_fs(old_fs); +out: if (ret < 0) return(ret); if (uoss32) { Index: linux-2.6/arch/ia64/ia32/sys_ia32.c =================================================================== --- linux-2.6/arch/ia64/ia32/sys_ia32.c (revision 13148) +++ linux-2.6/arch/ia64/ia32/sys_ia32.c (working copy) @@ -76,6 +76,7 @@ #define OFFSET4K(a) ((a) & 0xfff) #define PAGE_START(addr) ((addr) & PAGE_MASK) +#define MINSIGSTKSZ_IA32 2048 #define high2lowuid(uid) ((uid) > 65535 ? 65534 : (uid)) #define high2lowgid(gid) ((gid) > 65535 ? 65534 : (gid)) @@ -2262,10 +2263,18 @@ return -EFAULT; uss.ss_sp = (void *) (long) buf32.ss_sp; uss.ss_flags = buf32.ss_flags; - uss.ss_size = buf32.ss_size; + /* MINSIGSTKSZ is different for ia32 vs ia64. We lie here to pass the + check and set it to the user requested value later */ + if (buf32.ss_size < MINSIGSTKSZ_IA32) { + ret = -ENOMEM; + goto out; + } + uss.ss_size = MINSIGSTKSZ; set_fs(KERNEL_DS); ret = do_sigaltstack(uss32 ? &uss : NULL, &uoss, pt->r12); + current->sas_ss_size = buf32.ss_size; set_fs(old_fs); +out: if (ret < 0) return(ret); if (uoss32) { - To unsubscribe from this list: send the line "unsubscribe linux-ia64" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.htmlReceived on Mon Sep 8 19:58:50 2003
This archive was generated by hypermail 2.1.8 : 2005-08-02 09:20:17 EST