linux-next.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* linux-next: manual merge of the signal tree with the vfs tree
@ 2013-04-04  5:41 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2013-04-04  5:41 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 6198 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got conflicts in
fs/read_write.c and fs/read_write.h between commit 1fd193fd030a ("switch
compat readv/writev variants to COMPAT_SYSCALL_DEFINE") from the vfs tree
and commit 19f4fc3aee18 ("convert sendfile{,64} to
COMPAT_SYSCALL_DEFINE") from the signal tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/read_write.c
index e7d7bde,f738e4d..0000000
--- a/fs/read_write.c
+++ b/fs/read_write.c
@@@ -903,203 -853,8 +887,203 @@@ SYSCALL_DEFINE5(pwritev, unsigned long
  	return ret;
  }
  
 +#ifdef CONFIG_COMPAT
 +
 +static ssize_t compat_do_readv_writev(int type, struct file *file,
 +			       const struct compat_iovec __user *uvector,
 +			       unsigned long nr_segs, loff_t *pos)
 +{
 +	compat_ssize_t tot_len;
 +	struct iovec iovstack[UIO_FASTIOV];
 +	struct iovec *iov = iovstack;
 +	ssize_t ret;
 +	io_fn_t fn;
 +	iov_fn_t fnv;
 +
 +	ret = -EINVAL;
 +	if (!file->f_op)
 +		goto out;
 +
 +	ret = -EFAULT;
 +	if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
 +		goto out;
 +
 +	ret = compat_rw_copy_check_uvector(type, uvector, nr_segs,
 +					       UIO_FASTIOV, iovstack, &iov);
 +	if (ret <= 0)
 +		goto out;
 +
 +	tot_len = ret;
 +	ret = rw_verify_area(type, file, pos, tot_len);
 +	if (ret < 0)
 +		goto out;
 +
 +	fnv = NULL;
 +	if (type == READ) {
 +		fn = file->f_op->read;
 +		fnv = file->f_op->aio_read;
 +	} else {
 +		fn = (io_fn_t)file->f_op->write;
 +		fnv = file->f_op->aio_write;
 +		file_start_write(file);
 +	}
 +
 +	if (fnv)
 +		ret = do_sync_readv_writev(file, iov, nr_segs, tot_len,
 +						pos, fnv);
 +	else
 +		ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn);
 +
 +	if (type != READ)
 +		file_end_write(file);
 +
 +out:
 +	if (iov != iovstack)
 +		kfree(iov);
 +	if ((ret + (type == READ)) > 0) {
 +		if (type == READ)
 +			fsnotify_access(file);
 +		else
 +			fsnotify_modify(file);
 +	}
 +	return ret;
 +}
 +
 +static size_t compat_readv(struct file *file,
 +			   const struct compat_iovec __user *vec,
 +			   unsigned long vlen, loff_t *pos)
 +{
 +	ssize_t ret = -EBADF;
 +
 +	if (!(file->f_mode & FMODE_READ))
 +		goto out;
 +
 +	ret = -EINVAL;
 +	if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read))
 +		goto out;
 +
 +	ret = compat_do_readv_writev(READ, file, vec, vlen, pos);
 +
 +out:
 +	if (ret > 0)
 +		add_rchar(current, ret);
 +	inc_syscr(current);
 +	return ret;
 +}
 +
 +COMPAT_SYSCALL_DEFINE3(readv, unsigned long, fd,
 +		const struct compat_iovec __user *,vec,
 +		unsigned long, vlen)
 +{
 +	struct fd f = fdget(fd);
 +	ssize_t ret;
 +	loff_t pos;
 +
 +	if (!f.file)
 +		return -EBADF;
 +	pos = f.file->f_pos;
 +	ret = compat_readv(f.file, vec, vlen, &pos);
 +	f.file->f_pos = pos;
 +	fdput(f);
 +	return ret;
 +}
 +
 +COMPAT_SYSCALL_DEFINE4(preadv64, unsigned long, fd,
 +		const struct compat_iovec __user *,vec,
 +		unsigned long, vlen, loff_t, pos)
 +{
 +	struct fd f;
 +	ssize_t ret;
 +
 +	if (pos < 0)
 +		return -EINVAL;
 +	f = fdget(fd);
 +	if (!f.file)
 +		return -EBADF;
 +	ret = -ESPIPE;
 +	if (f.file->f_mode & FMODE_PREAD)
 +		ret = compat_readv(f.file, vec, vlen, &pos);
 +	fdput(f);
 +	return ret;
 +}
 +
 +COMPAT_SYSCALL_DEFINE5(preadv, unsigned long, fd,
 +		const struct compat_iovec __user *,vec,
 +		unsigned long, vlen, u32, pos_low, u32, pos_high)
 +{
 +	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
 +	return compat_sys_preadv64(fd, vec, vlen, pos);
 +}
 +
 +static size_t compat_writev(struct file *file,
 +			    const struct compat_iovec __user *vec,
 +			    unsigned long vlen, loff_t *pos)
 +{
 +	ssize_t ret = -EBADF;
 +
 +	if (!(file->f_mode & FMODE_WRITE))
 +		goto out;
 +
 +	ret = -EINVAL;
 +	if (!file->f_op || (!file->f_op->aio_write && !file->f_op->write))
 +		goto out;
 +
 +	ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos);
 +
 +out:
 +	if (ret > 0)
 +		add_wchar(current, ret);
 +	inc_syscw(current);
 +	return ret;
 +}
 +
 +COMPAT_SYSCALL_DEFINE3(writev, unsigned long, fd,
 +		const struct compat_iovec __user *, vec,
 +		unsigned long, vlen)
 +{
 +	struct fd f = fdget(fd);
 +	ssize_t ret;
 +	loff_t pos;
 +
 +	if (!f.file)
 +		return -EBADF;
 +	pos = f.file->f_pos;
 +	ret = compat_writev(f.file, vec, vlen, &pos);
 +	f.file->f_pos = pos;
 +	fdput(f);
 +	return ret;
 +}
 +
 +COMPAT_SYSCALL_DEFINE4(pwritev64, unsigned long, fd,
 +		const struct compat_iovec __user *,vec,
 +		unsigned long, vlen, loff_t, pos)
 +{
 +	struct fd f;
 +	ssize_t ret;
 +
 +	if (pos < 0)
 +		return -EINVAL;
 +	f = fdget(fd);
 +	if (!f.file)
 +		return -EBADF;
 +	ret = -ESPIPE;
 +	if (f.file->f_mode & FMODE_PWRITE)
 +		ret = compat_writev(f.file, vec, vlen, &pos);
 +	fdput(f);
 +	return ret;
 +}
 +
 +COMPAT_SYSCALL_DEFINE5(pwritev, unsigned long, fd,
 +		const struct compat_iovec __user *,vec,
 +		unsigned long, vlen, u32, pos_low, u32, pos_high)
 +{
 +	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
 +	return compat_sys_pwritev64(fd, vec, vlen, pos);
 +}
 +#endif
 +
- ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, size_t count,
- 		    loff_t max)
+ static ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos,
+ 		  	   size_t count, loff_t max)
  {
  	struct fd in, out;
  	struct inode *in_inode, *out_inode;
diff --cc fs/read_write.h
index b987806,d07b954..0000000
--- a/fs/read_write.h
+++ b/fs/read_write.h
@@@ -8,5 -8,7 +8,3 @@@ typedef ssize_t (*io_fn_t)(struct file 
  typedef ssize_t (*iov_fn_t)(struct kiocb *, const struct iovec *,
  		unsigned long, loff_t);
  
- ssize_t do_sendfile(int out_fd, int in_fd, loff_t *ppos, size_t count,
- 		    loff_t max);
 -ssize_t do_sync_readv_writev(struct file *filp, const struct iovec *iov,
 -		unsigned long nr_segs, size_t len, loff_t *ppos, iov_fn_t fn);
 -ssize_t do_loop_readv_writev(struct file *filp, struct iovec *iov,
 -		unsigned long nr_segs, loff_t *ppos, io_fn_t fn);

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2013-04-04  5:41 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2013-04-04  5:41 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 5978 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in fs/compat.c
between commit 1fd193fd030a ("switch compat readv/writev variants to
COMPAT_SYSCALL_DEFINE") from the vfs tree and commit 76b021d053ed
("convert vmsplice to COMPAT_SYSCALL_DEFINE") from the signal tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/compat.c
index 5058345,b7a89b9..0000000
--- a/fs/compat.c
+++ b/fs/compat.c
@@@ -1069,26 -1064,195 +1068,6 @@@ asmlinkage long compat_sys_getdents64(u
  }
  #endif /* ! __ARCH_OMIT_COMPAT_SYS_GETDENTS64 */
  
- asmlinkage long
- compat_sys_vmsplice(int fd, const struct compat_iovec __user *iov32,
- 		    unsigned int nr_segs, unsigned int flags)
- {
- 	unsigned i;
- 	struct iovec __user *iov;
- 	if (nr_segs > UIO_MAXIOV)
- 		return -EINVAL;
- 	iov = compat_alloc_user_space(nr_segs * sizeof(struct iovec));
- 	for (i = 0; i < nr_segs; i++) {
- 		struct compat_iovec v;
- 		if (get_user(v.iov_base, &iov32[i].iov_base) ||
- 		    get_user(v.iov_len, &iov32[i].iov_len) ||
- 		    put_user(compat_ptr(v.iov_base), &iov[i].iov_base) ||
- 		    put_user(v.iov_len, &iov[i].iov_len))
- 			return -EFAULT;
- 	}
- 	return sys_vmsplice(fd, iov, nr_segs, flags);
- }
- 
 -static ssize_t compat_do_readv_writev(int type, struct file *file,
 -			       const struct compat_iovec __user *uvector,
 -			       unsigned long nr_segs, loff_t *pos)
 -{
 -	compat_ssize_t tot_len;
 -	struct iovec iovstack[UIO_FASTIOV];
 -	struct iovec *iov = iovstack;
 -	ssize_t ret;
 -	io_fn_t fn;
 -	iov_fn_t fnv;
 -
 -	ret = -EINVAL;
 -	if (!file->f_op)
 -		goto out;
 -
 -	ret = -EFAULT;
 -	if (!access_ok(VERIFY_READ, uvector, nr_segs*sizeof(*uvector)))
 -		goto out;
 -
 -	tot_len = compat_rw_copy_check_uvector(type, uvector, nr_segs,
 -					       UIO_FASTIOV, iovstack, &iov);
 -	if (tot_len == 0) {
 -		ret = 0;
 -		goto out;
 -	}
 -
 -	ret = rw_verify_area(type, file, pos, tot_len);
 -	if (ret < 0)
 -		goto out;
 -
 -	fnv = NULL;
 -	if (type == READ) {
 -		fn = file->f_op->read;
 -		fnv = file->f_op->aio_read;
 -	} else {
 -		fn = (io_fn_t)file->f_op->write;
 -		fnv = file->f_op->aio_write;
 -	}
 -
 -	if (fnv)
 -		ret = do_sync_readv_writev(file, iov, nr_segs, tot_len,
 -						pos, fnv);
 -	else
 -		ret = do_loop_readv_writev(file, iov, nr_segs, pos, fn);
 -
 -out:
 -	if (iov != iovstack)
 -		kfree(iov);
 -	if ((ret + (type == READ)) > 0) {
 -		if (type == READ)
 -			fsnotify_access(file);
 -		else
 -			fsnotify_modify(file);
 -	}
 -	return ret;
 -}
 -
 -static size_t compat_readv(struct file *file,
 -			   const struct compat_iovec __user *vec,
 -			   unsigned long vlen, loff_t *pos)
 -{
 -	ssize_t ret = -EBADF;
 -
 -	if (!(file->f_mode & FMODE_READ))
 -		goto out;
 -
 -	ret = -EINVAL;
 -	if (!file->f_op || (!file->f_op->aio_read && !file->f_op->read))
 -		goto out;
 -
 -	ret = compat_do_readv_writev(READ, file, vec, vlen, pos);
 -
 -out:
 -	if (ret > 0)
 -		add_rchar(current, ret);
 -	inc_syscr(current);
 -	return ret;
 -}
 -
 -asmlinkage ssize_t
 -compat_sys_readv(unsigned long fd, const struct compat_iovec __user *vec,
 -		 unsigned long vlen)
 -{
 -	struct fd f = fdget(fd);
 -	ssize_t ret;
 -	loff_t pos;
 -
 -	if (!f.file)
 -		return -EBADF;
 -	pos = f.file->f_pos;
 -	ret = compat_readv(f.file, vec, vlen, &pos);
 -	f.file->f_pos = pos;
 -	fdput(f);
 -	return ret;
 -}
 -
 -asmlinkage ssize_t
 -compat_sys_preadv64(unsigned long fd, const struct compat_iovec __user *vec,
 -		    unsigned long vlen, loff_t pos)
 -{
 -	struct fd f;
 -	ssize_t ret;
 -
 -	if (pos < 0)
 -		return -EINVAL;
 -	f = fdget(fd);
 -	if (!f.file)
 -		return -EBADF;
 -	ret = -ESPIPE;
 -	if (f.file->f_mode & FMODE_PREAD)
 -		ret = compat_readv(f.file, vec, vlen, &pos);
 -	fdput(f);
 -	return ret;
 -}
 -
 -asmlinkage ssize_t
 -compat_sys_preadv(unsigned long fd, const struct compat_iovec __user *vec,
 -		  unsigned long vlen, u32 pos_low, u32 pos_high)
 -{
 -	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
 -	return compat_sys_preadv64(fd, vec, vlen, pos);
 -}
 -
 -static size_t compat_writev(struct file *file,
 -			    const struct compat_iovec __user *vec,
 -			    unsigned long vlen, loff_t *pos)
 -{
 -	ssize_t ret = -EBADF;
 -
 -	if (!(file->f_mode & FMODE_WRITE))
 -		goto out;
 -
 -	ret = -EINVAL;
 -	if (!file->f_op || (!file->f_op->aio_write && !file->f_op->write))
 -		goto out;
 -
 -	ret = compat_do_readv_writev(WRITE, file, vec, vlen, pos);
 -
 -out:
 -	if (ret > 0)
 -		add_wchar(current, ret);
 -	inc_syscw(current);
 -	return ret;
 -}
 -
 -asmlinkage ssize_t
 -compat_sys_writev(unsigned long fd, const struct compat_iovec __user *vec,
 -		  unsigned long vlen)
 -{
 -	struct fd f = fdget(fd);
 -	ssize_t ret;
 -	loff_t pos;
 -
 -	if (!f.file)
 -		return -EBADF;
 -	pos = f.file->f_pos;
 -	ret = compat_writev(f.file, vec, vlen, &pos);
 -	f.file->f_pos = pos;
 -	fdput(f);
 -	return ret;
 -}
 -
 -asmlinkage ssize_t
 -compat_sys_pwritev64(unsigned long fd, const struct compat_iovec __user *vec,
 -		     unsigned long vlen, loff_t pos)
 -{
 -	struct fd f;
 -	ssize_t ret;
 -
 -	if (pos < 0)
 -		return -EINVAL;
 -	f = fdget(fd);
 -	if (!f.file)
 -		return -EBADF;
 -	ret = -ESPIPE;
 -	if (f.file->f_mode & FMODE_PWRITE)
 -		ret = compat_writev(f.file, vec, vlen, &pos);
 -	fdput(f);
 -	return ret;
 -}
 -
 -asmlinkage ssize_t
 -compat_sys_pwritev(unsigned long fd, const struct compat_iovec __user *vec,
 -		   unsigned long vlen, u32 pos_low, u32 pos_high)
 -{
 -	loff_t pos = ((loff_t)pos_high << 32) | pos_low;
 -	return compat_sys_pwritev64(fd, vec, vlen, pos);
 -}
 -
  /*
   * Exactly like fs/open.c:sys_open(), except that it doesn't set the
   * O_LARGEFILE flag.

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2012-10-12  4:09 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2012-10-12  4:09 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel, Jeff Layton

[-- Attachment #1: Type: text/plain, Size: 548 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in
arch/powerpc/kernel/sys_ppc32.c between commit 2a5e5beb88c5 ("vfs: define
struct filename and have getname() return it") from the vfs tree and
commit be6abfa769fa ("powerpc: switch to generic sys_execve()/
kernel_execve()") from the signal tree.

The latter removed removed the function that was modified by the former,
so I did that and can carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2012-10-12  4:06 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2012-10-12  4:06 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 536 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in
arch/powerpc/kernel/process.c between commit 2a5e5beb88c5 ("vfs: define
struct filename and have getname() return it") from the vfs tree and
commit be6abfa769fa ("powerpc: switch to generic sys_execve
()/kernel_execve()") from the signal tree.

The latter rewrote the function modified by the former, so I used the
latter and can carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2012-10-12  4:02 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2012-10-12  4:02 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel, Jeff Layton

[-- Attachment #1: Type: text/plain, Size: 512 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in
arch/mn10300/kernel/process.c between commit 2a5e5beb88c5 ("vfs: define
struct filename and have getname() return it") from the vfs tree and
commit 8f1597e959a3 ("mn10300: switch to generic sys_execve()") from the
signal tree.

The latter removed the function modified by the former, so I did that and
can carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2012-10-12  4:00 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2012-10-12  4:00 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel, Jeff Layton

[-- Attachment #1: Type: text/plain, Size: 524 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in
arch/m68k/kernel/process.c between commit 2a5e5beb88c5 ("vfs: define
struct filename and have getname() return it") from the vfs tree and
commit d878d6dacee2 ("m68k: switch to generic sys_execve()/kernel_execve()")
from the signal tree.

The latter removed the function that the latter modified, so I did that
and can carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2012-10-12  3:58 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2012-10-12  3:58 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel, Jeff Layton

[-- Attachment #1: Type: text/plain, Size: 545 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in
arch/frv/kernel/process.c between commit 2a5e5beb88c5 ("vfs: define
struct filename and have getname() return it") from the vfs tree and
commit 460dabab73f2 ("frv: switch to generic sys_execve()") from the
signal tree.

The latter removed the function updated by the former, so I just did that
and can carry the fix as necessary (no action is required).


-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au
http://www.canb.auug.org.au/~sfr/

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2012-10-12  3:56 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2012-10-12  3:56 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel, Jeff Layton, Mark Salter

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in
arch/c6x/kernel/process.c between commit 2a5e5beb88c5 ("vfs: define
struct filename and have getname() return it") from the vfs tree and
commit 680a14535c33 ("c6x: switch to generic sys_execve") from the signal
tree.

The latter removes the function modified by the former so I did that and
can carry the fix as necessary (no action is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2012-10-02  5:48 Stephen Rothwell
  0 siblings, 0 replies; 11+ messages in thread
From: Stephen Rothwell @ 2012-10-02  5:48 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel, Alex Kelly, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 10325 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in fs/exec.c
between commit 5b8a94d461a7 ("coredump: move core dump functionality into
its own file") from the vfs tree and commits 282124d18626 ("generic
kernel_execve()") and 38b983b3461e ("generic sys_execve()") from the signal tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/exec.c
index 48fb26e,50a1270..0000000
--- a/fs/exec.c
+++ b/fs/exec.c
@@@ -1645,3 -2031,342 +1644,55 @@@ int get_dumpable(struct mm_struct *mm
  {
  	return __get_dumpable(mm->flags);
  }
+ 
 -static void wait_for_dump_helpers(struct file *file)
 -{
 -	struct pipe_inode_info *pipe;
 -
 -	pipe = file->f_path.dentry->d_inode->i_pipe;
 -
 -	pipe_lock(pipe);
 -	pipe->readers++;
 -	pipe->writers--;
 -
 -	while ((pipe->readers > 1) && (!signal_pending(current))) {
 -		wake_up_interruptible_sync(&pipe->wait);
 -		kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
 -		pipe_wait(pipe);
 -	}
 -
 -	pipe->readers--;
 -	pipe->writers++;
 -	pipe_unlock(pipe);
 -
 -}
 -
 -
 -/*
 - * umh_pipe_setup
 - * helper function to customize the process used
 - * to collect the core in userspace.  Specifically
 - * it sets up a pipe and installs it as fd 0 (stdin)
 - * for the process.  Returns 0 on success, or
 - * PTR_ERR on failure.
 - * Note that it also sets the core limit to 1.  This
 - * is a special value that we use to trap recursive
 - * core dumps
 - */
 -static int umh_pipe_setup(struct subprocess_info *info, struct cred *new)
 -{
 -	struct file *files[2];
 -	struct fdtable *fdt;
 -	struct coredump_params *cp = (struct coredump_params *)info->data;
 -	struct files_struct *cf = current->files;
 -	int err = create_pipe_files(files, 0);
 -	if (err)
 -		return err;
 -
 -	cp->file = files[1];
 -
 -	sys_close(0);
 -	fd_install(0, files[0]);
 -	spin_lock(&cf->file_lock);
 -	fdt = files_fdtable(cf);
 -	__set_open_fd(0, fdt);
 -	__clear_close_on_exec(0, fdt);
 -	spin_unlock(&cf->file_lock);
 -
 -	/* and disallow core files too */
 -	current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1};
 -
 -	return 0;
 -}
 -
 -void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 -{
 -	struct core_state core_state;
 -	struct core_name cn;
 -	struct mm_struct *mm = current->mm;
 -	struct linux_binfmt * binfmt;
 -	const struct cred *old_cred;
 -	struct cred *cred;
 -	int retval = 0;
 -	int flag = 0;
 -	int ispipe;
 -	bool need_nonrelative = false;
 -	static atomic_t core_dump_count = ATOMIC_INIT(0);
 -	struct coredump_params cprm = {
 -		.signr = signr,
 -		.regs = regs,
 -		.limit = rlimit(RLIMIT_CORE),
 -		/*
 -		 * We must use the same mm->flags while dumping core to avoid
 -		 * inconsistency of bit flags, since this flag is not protected
 -		 * by any locks.
 -		 */
 -		.mm_flags = mm->flags,
 -	};
 -
 -	audit_core_dumps(signr);
 -
 -	binfmt = mm->binfmt;
 -	if (!binfmt || !binfmt->core_dump)
 -		goto fail;
 -	if (!__get_dumpable(cprm.mm_flags))
 -		goto fail;
 -
 -	cred = prepare_creds();
 -	if (!cred)
 -		goto fail;
 -	/*
 -	 * We cannot trust fsuid as being the "true" uid of the process
 -	 * nor do we know its entire history. We only know it was tainted
 -	 * so we dump it as root in mode 2, and only into a controlled
 -	 * environment (pipe handler or fully qualified path).
 -	 */
 -	if (__get_dumpable(cprm.mm_flags) == SUID_DUMPABLE_SAFE) {
 -		/* Setuid core dump mode */
 -		flag = O_EXCL;		/* Stop rewrite attacks */
 -		cred->fsuid = GLOBAL_ROOT_UID;	/* Dump root private */
 -		need_nonrelative = true;
 -	}
 -
 -	retval = coredump_wait(exit_code, &core_state);
 -	if (retval < 0)
 -		goto fail_creds;
 -
 -	old_cred = override_creds(cred);
 -
 -	/*
 -	 * Clear any false indication of pending signals that might
 -	 * be seen by the filesystem code called to write the core file.
 -	 */
 -	clear_thread_flag(TIF_SIGPENDING);
 -
 -	ispipe = format_corename(&cn, signr);
 -
 - 	if (ispipe) {
 -		int dump_count;
 -		char **helper_argv;
 -
 -		if (ispipe < 0) {
 -			printk(KERN_WARNING "format_corename failed\n");
 -			printk(KERN_WARNING "Aborting core\n");
 -			goto fail_corename;
 -		}
 -
 -		if (cprm.limit == 1) {
 -			/* See umh_pipe_setup() which sets RLIMIT_CORE = 1.
 -			 *
 -			 * Normally core limits are irrelevant to pipes, since
 -			 * we're not writing to the file system, but we use
 -			 * cprm.limit of 1 here as a speacial value, this is a
 -			 * consistent way to catch recursive crashes.
 -			 * We can still crash if the core_pattern binary sets
 -			 * RLIM_CORE = !1, but it runs as root, and can do
 -			 * lots of stupid things.
 -			 *
 -			 * Note that we use task_tgid_vnr here to grab the pid
 -			 * of the process group leader.  That way we get the
 -			 * right pid if a thread in a multi-threaded
 -			 * core_pattern process dies.
 -			 */
 -			printk(KERN_WARNING
 -				"Process %d(%s) has RLIMIT_CORE set to 1\n",
 -				task_tgid_vnr(current), current->comm);
 -			printk(KERN_WARNING "Aborting core\n");
 -			goto fail_unlock;
 -		}
 -		cprm.limit = RLIM_INFINITY;
 -
 -		dump_count = atomic_inc_return(&core_dump_count);
 -		if (core_pipe_limit && (core_pipe_limit < dump_count)) {
 -			printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
 -			       task_tgid_vnr(current), current->comm);
 -			printk(KERN_WARNING "Skipping core dump\n");
 -			goto fail_dropcount;
 -		}
 -
 -		helper_argv = argv_split(GFP_KERNEL, cn.corename+1, NULL);
 -		if (!helper_argv) {
 -			printk(KERN_WARNING "%s failed to allocate memory\n",
 -			       __func__);
 -			goto fail_dropcount;
 -		}
 -
 -		retval = call_usermodehelper_fns(helper_argv[0], helper_argv,
 -					NULL, UMH_WAIT_EXEC, umh_pipe_setup,
 -					NULL, &cprm);
 -		argv_free(helper_argv);
 -		if (retval) {
 - 			printk(KERN_INFO "Core dump to %s pipe failed\n",
 -			       cn.corename);
 -			goto close_fail;
 - 		}
 -	} else {
 -		struct inode *inode;
 -
 -		if (cprm.limit < binfmt->min_coredump)
 -			goto fail_unlock;
 -
 -		if (need_nonrelative && cn.corename[0] != '/') {
 -			printk(KERN_WARNING "Pid %d(%s) can only dump core "\
 -				"to fully qualified path!\n",
 -				task_tgid_vnr(current), current->comm);
 -			printk(KERN_WARNING "Skipping core dump\n");
 -			goto fail_unlock;
 -		}
 -
 -		cprm.file = filp_open(cn.corename,
 -				 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
 -				 0600);
 -		if (IS_ERR(cprm.file))
 -			goto fail_unlock;
 -
 -		inode = cprm.file->f_path.dentry->d_inode;
 -		if (inode->i_nlink > 1)
 -			goto close_fail;
 -		if (d_unhashed(cprm.file->f_path.dentry))
 -			goto close_fail;
 -		/*
 -		 * AK: actually i see no reason to not allow this for named
 -		 * pipes etc, but keep the previous behaviour for now.
 -		 */
 -		if (!S_ISREG(inode->i_mode))
 -			goto close_fail;
 -		/*
 -		 * Dont allow local users get cute and trick others to coredump
 -		 * into their pre-created files.
 -		 */
 -		if (!uid_eq(inode->i_uid, current_fsuid()))
 -			goto close_fail;
 -		if (!cprm.file->f_op || !cprm.file->f_op->write)
 -			goto close_fail;
 -		if (do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file))
 -			goto close_fail;
 -	}
 -
 -	retval = binfmt->core_dump(&cprm);
 -	if (retval)
 -		current->signal->group_exit_code |= 0x80;
 -
 -	if (ispipe && core_pipe_limit)
 -		wait_for_dump_helpers(cprm.file);
 -close_fail:
 -	if (cprm.file)
 -		filp_close(cprm.file, NULL);
 -fail_dropcount:
 -	if (ispipe)
 -		atomic_dec(&core_dump_count);
 -fail_unlock:
 -	kfree(cn.corename);
 -fail_corename:
 -	coredump_finish(mm);
 -	revert_creds(old_cred);
 -fail_creds:
 -	put_cred(cred);
 -fail:
 -	return;
 -}
 -
 -/*
 - * Core dumping helper functions.  These are the only things you should
 - * do on a core-file: use only these functions to write out all the
 - * necessary info.
 - */
 -int dump_write(struct file *file, const void *addr, int nr)
 -{
 -	return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr;
 -}
 -EXPORT_SYMBOL(dump_write);
 -
 -int dump_seek(struct file *file, loff_t off)
 -{
 -	int ret = 1;
 -
 -	if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
 -		if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
 -			return 0;
 -	} else {
 -		char *buf = (char *)get_zeroed_page(GFP_KERNEL);
 -
 -		if (!buf)
 -			return 0;
 -		while (off > 0) {
 -			unsigned long n = off;
 -
 -			if (n > PAGE_SIZE)
 -				n = PAGE_SIZE;
 -			if (!dump_write(file, buf, n)) {
 -				ret = 0;
 -				break;
 -			}
 -			off -= n;
 -		}
 -		free_page((unsigned long)buf);
 -	}
 -	return ret;
 -}
 -EXPORT_SYMBOL(dump_seek);
 -
+ #ifdef __ARCH_WANT_SYS_EXECVE
+ SYSCALL_DEFINE3(execve,
+ 		const char __user *, filename,
+ 		const char __user *const __user *, argv,
+ 		const char __user *const __user *, envp)
+ {
+ 	const char *path = getname(filename);
+ 	int error = PTR_ERR(path);
+ 	if (!IS_ERR(path)) {
+ 		error = do_execve(path, argv, envp, current_pt_regs());
+ 		putname(path);
+ 	}
+ 	return error;
+ }
+ #ifdef CONFIG_COMPAT
+ asmlinkage long compat_sys_execve(const char __user * filename,
+ 	const compat_uptr_t __user * argv,
+ 	const compat_uptr_t __user * envp)
+ {
+ 	const char *path = getname(filename);
+ 	int error = PTR_ERR(path);
+ 	if (!IS_ERR(path)) {
+ 		error = compat_do_execve(path, argv, envp, current_pt_regs());
+ 		putname(path);
+ 	}
+ 	return error;
+ }
+ #endif
+ #endif
+ 
+ #ifdef __ARCH_WANT_KERNEL_EXECVE
+ int kernel_execve(const char *filename,
+ 		  const char *const argv[],
+ 		  const char *const envp[])
+ {
+ 	struct pt_regs *p = current_pt_regs();
+ 	int ret;
+ 
+ 	ret = do_execve(filename,
+ 			(const char __user *const __user *)argv,
+ 			(const char __user *const __user *)envp, p);
+ 	if (ret < 0)
+ 		return ret;
+ 
+ 	/*
+ 	 * We were successful.  We won't be returning to our caller, but
+ 	 * instead to user space by manipulating the kernel stack.
+ 	 */
+ 	ret_from_kernel_execve(p);
+ }
+ #endif

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: linux-next: manual merge of the signal tree with the vfs tree
  2012-09-28  5:56 Stephen Rothwell
@ 2012-09-28 11:56 ` Al Viro
  0 siblings, 0 replies; 11+ messages in thread
From: Al Viro @ 2012-09-28 11:56 UTC (permalink / raw)
  To: Stephen Rothwell; +Cc: linux-next, linux-kernel, Alex Kelly, Andrew Morton

On Fri, Sep 28, 2012 at 03:56:39PM +1000, Stephen Rothwell wrote:
> Hi Al,
> 
> Today's linux-next merge of the signal tree got a conflict in fs/exec.c
> between commit 5b8a94d461a7 ("coredump: move core dump functionality into
> its own file") from the vfs tree and commits 70446600fa12 ("arm:
> introduce ret_from_kernel_execve(), switch to generic kernel_execve()")
> and 5e41814a7d8b ("arm: get rid of execve wrapper, switch to generic
> execve() implementation") from the signal tree.
> 
> I fixed it up (see below) and can carry the fix as necessary (no action
> is required).
> 
> BTW, Al, you have that vfs tree commit (and others) authored by you ...

Gyah...  Will fix ASAP; sorry, guys.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* linux-next: manual merge of the signal tree with the vfs tree
@ 2012-09-28  5:56 Stephen Rothwell
  2012-09-28 11:56 ` Al Viro
  0 siblings, 1 reply; 11+ messages in thread
From: Stephen Rothwell @ 2012-09-28  5:56 UTC (permalink / raw)
  To: Al Viro; +Cc: linux-next, linux-kernel, Alex Kelly, Andrew Morton

[-- Attachment #1: Type: text/plain, Size: 10582 bytes --]

Hi Al,

Today's linux-next merge of the signal tree got a conflict in fs/exec.c
between commit 5b8a94d461a7 ("coredump: move core dump functionality into
its own file") from the vfs tree and commits 70446600fa12 ("arm:
introduce ret_from_kernel_execve(), switch to generic kernel_execve()")
and 5e41814a7d8b ("arm: get rid of execve wrapper, switch to generic
execve() implementation") from the signal tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

BTW, Al, you have that vfs tree commit (and others) authored by you ...
-- 
Cheers,
Stephen Rothwell                    sfr@canb.auug.org.au

diff --cc fs/exec.c
index 48fb26e,df8b282..0000000
--- a/fs/exec.c
+++ b/fs/exec.c
@@@ -1645,3 -2031,345 +1644,58 @@@ int get_dumpable(struct mm_struct *mm
  {
  	return __get_dumpable(mm->flags);
  }
+ 
 -static void wait_for_dump_helpers(struct file *file)
 -{
 -	struct pipe_inode_info *pipe;
 -
 -	pipe = file->f_path.dentry->d_inode->i_pipe;
 -
 -	pipe_lock(pipe);
 -	pipe->readers++;
 -	pipe->writers--;
 -
 -	while ((pipe->readers > 1) && (!signal_pending(current))) {
 -		wake_up_interruptible_sync(&pipe->wait);
 -		kill_fasync(&pipe->fasync_readers, SIGIO, POLL_IN);
 -		pipe_wait(pipe);
 -	}
 -
 -	pipe->readers--;
 -	pipe->writers++;
 -	pipe_unlock(pipe);
 -
 -}
 -
 -
 -/*
 - * umh_pipe_setup
 - * helper function to customize the process used
 - * to collect the core in userspace.  Specifically
 - * it sets up a pipe and installs it as fd 0 (stdin)
 - * for the process.  Returns 0 on success, or
 - * PTR_ERR on failure.
 - * Note that it also sets the core limit to 1.  This
 - * is a special value that we use to trap recursive
 - * core dumps
 - */
 -static int umh_pipe_setup(struct subprocess_info *info, struct cred *new)
 -{
 -	struct file *files[2];
 -	struct fdtable *fdt;
 -	struct coredump_params *cp = (struct coredump_params *)info->data;
 -	struct files_struct *cf = current->files;
 -	int err = create_pipe_files(files, 0);
 -	if (err)
 -		return err;
 -
 -	cp->file = files[1];
 -
 -	sys_close(0);
 -	fd_install(0, files[0]);
 -	spin_lock(&cf->file_lock);
 -	fdt = files_fdtable(cf);
 -	__set_open_fd(0, fdt);
 -	__clear_close_on_exec(0, fdt);
 -	spin_unlock(&cf->file_lock);
 -
 -	/* and disallow core files too */
 -	current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1};
 -
 -	return 0;
 -}
 -
 -void do_coredump(long signr, int exit_code, struct pt_regs *regs)
 -{
 -	struct core_state core_state;
 -	struct core_name cn;
 -	struct mm_struct *mm = current->mm;
 -	struct linux_binfmt * binfmt;
 -	const struct cred *old_cred;
 -	struct cred *cred;
 -	int retval = 0;
 -	int flag = 0;
 -	int ispipe;
 -	bool need_nonrelative = false;
 -	static atomic_t core_dump_count = ATOMIC_INIT(0);
 -	struct coredump_params cprm = {
 -		.signr = signr,
 -		.regs = regs,
 -		.limit = rlimit(RLIMIT_CORE),
 -		/*
 -		 * We must use the same mm->flags while dumping core to avoid
 -		 * inconsistency of bit flags, since this flag is not protected
 -		 * by any locks.
 -		 */
 -		.mm_flags = mm->flags,
 -	};
 -
 -	audit_core_dumps(signr);
 -
 -	binfmt = mm->binfmt;
 -	if (!binfmt || !binfmt->core_dump)
 -		goto fail;
 -	if (!__get_dumpable(cprm.mm_flags))
 -		goto fail;
 -
 -	cred = prepare_creds();
 -	if (!cred)
 -		goto fail;
 -	/*
 -	 * We cannot trust fsuid as being the "true" uid of the process
 -	 * nor do we know its entire history. We only know it was tainted
 -	 * so we dump it as root in mode 2, and only into a controlled
 -	 * environment (pipe handler or fully qualified path).
 -	 */
 -	if (__get_dumpable(cprm.mm_flags) == SUID_DUMPABLE_SAFE) {
 -		/* Setuid core dump mode */
 -		flag = O_EXCL;		/* Stop rewrite attacks */
 -		cred->fsuid = GLOBAL_ROOT_UID;	/* Dump root private */
 -		need_nonrelative = true;
 -	}
 -
 -	retval = coredump_wait(exit_code, &core_state);
 -	if (retval < 0)
 -		goto fail_creds;
 -
 -	old_cred = override_creds(cred);
 -
 -	/*
 -	 * Clear any false indication of pending signals that might
 -	 * be seen by the filesystem code called to write the core file.
 -	 */
 -	clear_thread_flag(TIF_SIGPENDING);
 -
 -	ispipe = format_corename(&cn, signr);
 -
 - 	if (ispipe) {
 -		int dump_count;
 -		char **helper_argv;
 -
 -		if (ispipe < 0) {
 -			printk(KERN_WARNING "format_corename failed\n");
 -			printk(KERN_WARNING "Aborting core\n");
 -			goto fail_corename;
 -		}
 -
 -		if (cprm.limit == 1) {
 -			/* See umh_pipe_setup() which sets RLIMIT_CORE = 1.
 -			 *
 -			 * Normally core limits are irrelevant to pipes, since
 -			 * we're not writing to the file system, but we use
 -			 * cprm.limit of 1 here as a speacial value, this is a
 -			 * consistent way to catch recursive crashes.
 -			 * We can still crash if the core_pattern binary sets
 -			 * RLIM_CORE = !1, but it runs as root, and can do
 -			 * lots of stupid things.
 -			 *
 -			 * Note that we use task_tgid_vnr here to grab the pid
 -			 * of the process group leader.  That way we get the
 -			 * right pid if a thread in a multi-threaded
 -			 * core_pattern process dies.
 -			 */
 -			printk(KERN_WARNING
 -				"Process %d(%s) has RLIMIT_CORE set to 1\n",
 -				task_tgid_vnr(current), current->comm);
 -			printk(KERN_WARNING "Aborting core\n");
 -			goto fail_unlock;
 -		}
 -		cprm.limit = RLIM_INFINITY;
 -
 -		dump_count = atomic_inc_return(&core_dump_count);
 -		if (core_pipe_limit && (core_pipe_limit < dump_count)) {
 -			printk(KERN_WARNING "Pid %d(%s) over core_pipe_limit\n",
 -			       task_tgid_vnr(current), current->comm);
 -			printk(KERN_WARNING "Skipping core dump\n");
 -			goto fail_dropcount;
 -		}
 -
 -		helper_argv = argv_split(GFP_KERNEL, cn.corename+1, NULL);
 -		if (!helper_argv) {
 -			printk(KERN_WARNING "%s failed to allocate memory\n",
 -			       __func__);
 -			goto fail_dropcount;
 -		}
 -
 -		retval = call_usermodehelper_fns(helper_argv[0], helper_argv,
 -					NULL, UMH_WAIT_EXEC, umh_pipe_setup,
 -					NULL, &cprm);
 -		argv_free(helper_argv);
 -		if (retval) {
 - 			printk(KERN_INFO "Core dump to %s pipe failed\n",
 -			       cn.corename);
 -			goto close_fail;
 - 		}
 -	} else {
 -		struct inode *inode;
 -
 -		if (cprm.limit < binfmt->min_coredump)
 -			goto fail_unlock;
 -
 -		if (need_nonrelative && cn.corename[0] != '/') {
 -			printk(KERN_WARNING "Pid %d(%s) can only dump core "\
 -				"to fully qualified path!\n",
 -				task_tgid_vnr(current), current->comm);
 -			printk(KERN_WARNING "Skipping core dump\n");
 -			goto fail_unlock;
 -		}
 -
 -		cprm.file = filp_open(cn.corename,
 -				 O_CREAT | 2 | O_NOFOLLOW | O_LARGEFILE | flag,
 -				 0600);
 -		if (IS_ERR(cprm.file))
 -			goto fail_unlock;
 -
 -		inode = cprm.file->f_path.dentry->d_inode;
 -		if (inode->i_nlink > 1)
 -			goto close_fail;
 -		if (d_unhashed(cprm.file->f_path.dentry))
 -			goto close_fail;
 -		/*
 -		 * AK: actually i see no reason to not allow this for named
 -		 * pipes etc, but keep the previous behaviour for now.
 -		 */
 -		if (!S_ISREG(inode->i_mode))
 -			goto close_fail;
 -		/*
 -		 * Dont allow local users get cute and trick others to coredump
 -		 * into their pre-created files.
 -		 */
 -		if (!uid_eq(inode->i_uid, current_fsuid()))
 -			goto close_fail;
 -		if (!cprm.file->f_op || !cprm.file->f_op->write)
 -			goto close_fail;
 -		if (do_truncate(cprm.file->f_path.dentry, 0, 0, cprm.file))
 -			goto close_fail;
 -	}
 -
 -	retval = binfmt->core_dump(&cprm);
 -	if (retval)
 -		current->signal->group_exit_code |= 0x80;
 -
 -	if (ispipe && core_pipe_limit)
 -		wait_for_dump_helpers(cprm.file);
 -close_fail:
 -	if (cprm.file)
 -		filp_close(cprm.file, NULL);
 -fail_dropcount:
 -	if (ispipe)
 -		atomic_dec(&core_dump_count);
 -fail_unlock:
 -	kfree(cn.corename);
 -fail_corename:
 -	coredump_finish(mm);
 -	revert_creds(old_cred);
 -fail_creds:
 -	put_cred(cred);
 -fail:
 -	return;
 -}
 -
 -/*
 - * Core dumping helper functions.  These are the only things you should
 - * do on a core-file: use only these functions to write out all the
 - * necessary info.
 - */
 -int dump_write(struct file *file, const void *addr, int nr)
 -{
 -	return access_ok(VERIFY_READ, addr, nr) && file->f_op->write(file, addr, nr, &file->f_pos) == nr;
 -}
 -EXPORT_SYMBOL(dump_write);
 -
 -int dump_seek(struct file *file, loff_t off)
 -{
 -	int ret = 1;
 -
 -	if (file->f_op->llseek && file->f_op->llseek != no_llseek) {
 -		if (file->f_op->llseek(file, off, SEEK_CUR) < 0)
 -			return 0;
 -	} else {
 -		char *buf = (char *)get_zeroed_page(GFP_KERNEL);
 -
 -		if (!buf)
 -			return 0;
 -		while (off > 0) {
 -			unsigned long n = off;
 -
 -			if (n > PAGE_SIZE)
 -				n = PAGE_SIZE;
 -			if (!dump_write(file, buf, n)) {
 -				ret = 0;
 -				break;
 -			}
 -			off -= n;
 -		}
 -		free_page((unsigned long)buf);
 -	}
 -	return ret;
 -}
 -EXPORT_SYMBOL(dump_seek);
 -
+ #ifdef __ARCH_WANT_SYS_EXECVE
+ SYSCALL_DEFINE3(execve,
+ 		const char __user *, filename,
+ 		const char __user *const __user *, argv,
+ 		const char __user *const __user *, envp)
+ {
+ 	const char *path = getname(filename);
+ 	int error = PTR_ERR(path);
+ 	if (!IS_ERR(path)) {
+ 		error = do_execve(path, argv, envp, current_pt_regs());
+ 		putname(path);
+ 	}
+ 	return error;
+ }
+ #ifdef CONFIG_COMPAT
+ asmlinkage long compat_sys_execve(const char __user * filename,
+ 	const compat_uptr_t __user * argv,
+ 	const compat_uptr_t __user * envp)
+ {
+ 	const char *path = getname(filename);
+ 	int error = PTR_ERR(path);
+ 	if (!IS_ERR(path)) {
+ 		error = compat_do_execve(path, argv, envp, current_pt_regs());
+ 		putname(path);
+ 	}
+ 	return error;
+ }
+ #endif
+ #endif
+ 
+ #ifdef __ARCH_WANT_KERNEL_EXECVE
+ int kernel_execve(const char *filename,
+ 		  const char *const argv[],
+ 		  const char *const envp[])
+ {
+ 	struct pt_regs regs, *p;
+ 	int ret;
+ 
+ 	memset(&regs, 0, sizeof(struct pt_regs));
+ 	ret = do_execve(filename,
+ 			(const char __user *const __user *)argv,
+ 			(const char __user *const __user *)envp, &regs);
+ 	if (ret < 0)
+ 		return ret;
+ 
+ 	/*
+ 	 * We were successful.  We won't be returning to our caller, but
+ 	 * instead to user space by manipulating the kernel stack.
+ 	 */
+ 	p = current_pt_regs();
+ 	*p = regs;
+ 	ret_from_kernel_execve(p);
+ }
+ #endif

[-- Attachment #2: Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2013-04-04  5:41 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-04-04  5:41 linux-next: manual merge of the signal tree with the vfs tree Stephen Rothwell
  -- strict thread matches above, loose matches on Subject: below --
2013-04-04  5:41 Stephen Rothwell
2012-10-12  4:09 Stephen Rothwell
2012-10-12  4:06 Stephen Rothwell
2012-10-12  4:02 Stephen Rothwell
2012-10-12  4:00 Stephen Rothwell
2012-10-12  3:58 Stephen Rothwell
2012-10-12  3:56 Stephen Rothwell
2012-10-02  5:48 Stephen Rothwell
2012-09-28  5:56 Stephen Rothwell
2012-09-28 11:56 ` Al Viro

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).