|
@@ -1027,12 +1027,15 @@ struct file *create_read_pipe(struct file *wrf)
|
|
return f;
|
|
return f;
|
|
}
|
|
}
|
|
|
|
|
|
-int do_pipe(int *fd)
|
|
|
|
|
|
+int do_pipe_flags(int *fd, int flags)
|
|
{
|
|
{
|
|
struct file *fw, *fr;
|
|
struct file *fw, *fr;
|
|
int error;
|
|
int error;
|
|
int fdw, fdr;
|
|
int fdw, fdr;
|
|
|
|
|
|
|
|
+ if (flags & ~O_CLOEXEC)
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
fw = create_write_pipe();
|
|
fw = create_write_pipe();
|
|
if (IS_ERR(fw))
|
|
if (IS_ERR(fw))
|
|
return PTR_ERR(fw);
|
|
return PTR_ERR(fw);
|
|
@@ -1041,12 +1044,12 @@ int do_pipe(int *fd)
|
|
if (IS_ERR(fr))
|
|
if (IS_ERR(fr))
|
|
goto err_write_pipe;
|
|
goto err_write_pipe;
|
|
|
|
|
|
- error = get_unused_fd();
|
|
|
|
|
|
+ error = get_unused_fd_flags(flags);
|
|
if (error < 0)
|
|
if (error < 0)
|
|
goto err_read_pipe;
|
|
goto err_read_pipe;
|
|
fdr = error;
|
|
fdr = error;
|
|
|
|
|
|
- error = get_unused_fd();
|
|
|
|
|
|
+ error = get_unused_fd_flags(flags);
|
|
if (error < 0)
|
|
if (error < 0)
|
|
goto err_fdr;
|
|
goto err_fdr;
|
|
fdw = error;
|
|
fdw = error;
|
|
@@ -1074,16 +1077,21 @@ int do_pipe(int *fd)
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+int do_pipe(int *fd)
|
|
|
|
+{
|
|
|
|
+ return do_pipe_flags(fd, 0);
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* sys_pipe() is the normal C calling standard for creating
|
|
* sys_pipe() is the normal C calling standard for creating
|
|
* a pipe. It's not the way Unix traditionally does this, though.
|
|
* a pipe. It's not the way Unix traditionally does this, though.
|
|
*/
|
|
*/
|
|
-asmlinkage long __weak sys_pipe(int __user *fildes)
|
|
|
|
|
|
+asmlinkage long __weak sys_pipe2(int __user *fildes, int flags)
|
|
{
|
|
{
|
|
int fd[2];
|
|
int fd[2];
|
|
int error;
|
|
int error;
|
|
|
|
|
|
- error = do_pipe(fd);
|
|
|
|
|
|
+ error = do_pipe_flags(fd, flags);
|
|
if (!error) {
|
|
if (!error) {
|
|
if (copy_to_user(fildes, fd, sizeof(fd))) {
|
|
if (copy_to_user(fildes, fd, sizeof(fd))) {
|
|
sys_close(fd[0]);
|
|
sys_close(fd[0]);
|
|
@@ -1094,6 +1102,11 @@ asmlinkage long __weak sys_pipe(int __user *fildes)
|
|
return error;
|
|
return error;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+asmlinkage long __weak sys_pipe(int __user *fildes)
|
|
|
|
+{
|
|
|
|
+ return sys_pipe2(fildes, 0);
|
|
|
|
+}
|
|
|
|
+
|
|
/*
|
|
/*
|
|
* pipefs should _never_ be mounted by userland - too much of security hassle,
|
|
* pipefs should _never_ be mounted by userland - too much of security hassle,
|
|
* no real gain from having the whole whorehouse mounted. So we don't need
|
|
* no real gain from having the whole whorehouse mounted. So we don't need
|