linux-next: manual merge of the akpm tree with the tree

From: Stephen Rothwell
Date: Mon Sep 24 2012 - 09:29:26 EST


Hi Andrew,

Today's linux-next merge of the akpm tree got a conflict in fs/exec.c
between commits b40b89c2da16 ("new helper: replace_fd()") and
be28f112a5e5 ("do_coredump(): make sure that descriptor table isn't
shared") from the vfs tree and commit "coredump: move core dump
functionality into its own file" from the akpm tree.

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

--
Cheers,
Stephen Rothwell sfr@xxxxxxxxxxxxxxxx

diff --cc fs/exec.c
index 6b2e20b,d9bd87b..0000000
--- a/fs/exec.c
+++ b/fs/exec.c
diff --git a/fs/coredump.c b/fs/coredump.c
index 9692329..6ef9888 100644
--- a/fs/coredump.c
+++ b/fs/coredump.c
@@ -438,23 +438,14 @@ static void wait_for_dump_helpers(struct file *file)
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);
-
+ replace_fd(0, files[0], 0);
/* and disallow core files too */
current->signal->rlim[RLIMIT_CORE] = (struct rlimit){1, 1};

@@ -472,6 +463,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
int retval = 0;
int flag = 0;
int ispipe;
+ struct files_struct *displaced;
bool need_nonrelative = false;
static atomic_t core_dump_count = ATOMIC_INIT(0);
struct coredump_params cprm = {
@@ -625,6 +617,12 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
goto close_fail;
}

+ /* get us an unshared descriptor table; almost always a no-op */
+ retval = unshare_files(&displaced);
+ if (retval)
+ goto close_fail;
+ if (displaced)
+ put_files_struct(displaced);
retval = binfmt->core_dump(&cprm);
if (retval)
current->signal->group_exit_code |= 0x80;

Attachment: pgp00000.pgp
Description: PGP signature