lkml.org 
[lkml]   [2009]   [Aug]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [Patch 1/2] ia32: use generic sys_pipe()

* Amerigo Wang <amwang@redhat.com> wrote:

> As suggested by Al, it's better to use the generic sys_pipe() for
> ia32.
>
> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Ingo Molnar <mingo@elte.hu>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> CC: Linus Torvalds <torvalds@linux-foundation.org>

> --- 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


\
 
 \ /
  Last update: 2009-08-04 14:27    [W:0.077 / U:0.452 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site