Re: [Patch 1/2] ia32: use generic sys_pipe()

From: Ingo Molnar
Date: Tue Aug 04 2009 - 08:25:00 EST



* Amerigo Wang <amwang@xxxxxxxxxx> wrote:

> As suggested by Al, it's better to use the generic sys_pipe() for
> ia32.
>
> Signed-off-by: WANG Cong <amwang@xxxxxxxxxx>
> Cc: Ingo Molnar <mingo@xxxxxxx>
> Cc: Al Viro <viro@xxxxxxxxxxxxxxxxxx>
> CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>

> --- a/arch/x86/ia32/sys_ia32.c
> +++ b/arch/x86/ia32/sys_ia32.c
> @@ -189,20 +189,6 @@ asmlinkage long sys32_mprotect(unsigned long start, size_t len,
> return sys_mprotect(start, len, prot);
> }
>
> -asmlinkage long sys32_pipe(int __user *fd)
> -{
> - int retval;
> - int fds[2];
> -
> - retval = do_pipe_flags(fds, 0);
> - if (retval)
> - goto out;
> - if (copy_to_user(fd, fds, sizeof(fds)))
> - retval = -EFAULT;
> -out:
> - return retval;
> -}

Please _ALWAYS_ mention the change in behavior in the changelog,
just in case someone ends up bisecting it. I only found out when i
reviewed the two syscalls out of caution.

The syscall you remove kept stale fd's around in case of -EFAULT
from copy_to_user(). The generic version does an explicit close of
those files:

sys_close(fd[0]);
sys_close(fd[1]);
error = -EFAULT;

The generic version looks like the better choice to me but this
difference should be mentioned in the changelog nevertheless, just
in case some buggy app runs into this issue.

Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/