skas-prevent-tail-call Signed-off-by: Paolo 'Blaisorblade' Giarrusso Index: linux-2.6.18/arch/i386/kernel/sys_i386.c =================================================================== --- linux-2.6.18.orig/arch/i386/kernel/sys_i386.c +++ linux-2.6.18/arch/i386/kernel/sys_i386.c @@ -68,7 +68,12 @@ asmlinkage long sys_mmap2(unsigned long unsigned long prot, unsigned long flags, unsigned long fd, unsigned long pgoff) { - return do_mmap2(current->mm, addr, len, prot, flags, fd, pgoff); + long ret = do_mmap2(current->mm, addr, len, prot, flags, fd, pgoff); + + /* A tail call would reorder parameters on the stack and they would then + * be restored at the wrong places. */ + prevent_tail_call(ret); + return ret; } /* @@ -101,6 +106,9 @@ asmlinkage int old_mmap(struct mmap_arg_ err = do_mmap2(current->mm, a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT); + /* A tail call would reorder parameters on the stack and they would then + * be restored at the wrong places. */ + prevent_tail_call(err); out: return err; }