skas-prevent-tail-call Signed-off-by: Paolo 'Blaisorblade' Giarrusso --- linux-2.6.git-broken-paolo/arch/i386/kernel/sys_i386.c | 10 +++++++++- 1 files changed, 9 insertions(+), 1 deletion(-) Index: linux-2.6.git/arch/i386/kernel/sys_i386.c =================================================================== --- linux-2.6.git.orig/arch/i386/kernel/sys_i386.c +++ linux-2.6.git/arch/i386/kernel/sys_i386.c @@ -70,7 +70,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; } /* @@ -102,6 +107,9 @@ asmlinkage int old_mmap(struct mmap_arg_ goto out; 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; }