aboutsummaryrefslogtreecommitdiffstats
path: root/fs/exec.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2012-08-21 22:43:47 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2012-09-26 21:09:59 -0400
commit179e037fc1370288188cb1f90b81156d75a3cb2d (patch)
tree6dcc6fc5a2b2bc9e17258a178798475c95f40544 /fs/exec.c
parentc3c073f808b22dfae15ef8412b6f7b998644139a (diff)
do_coredump(): make sure that descriptor table isn't shared
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/exec.c')
-rw-r--r--fs/exec.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/fs/exec.c b/fs/exec.c
index 3fc74681cc6c..beb05a95e4a3 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -2066,6 +2066,7 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
2066 int retval = 0; 2066 int retval = 0;
2067 int flag = 0; 2067 int flag = 0;
2068 int ispipe; 2068 int ispipe;
2069 struct files_struct *displaced;
2069 bool need_nonrelative = false; 2070 bool need_nonrelative = false;
2070 static atomic_t core_dump_count = ATOMIC_INIT(0); 2071 static atomic_t core_dump_count = ATOMIC_INIT(0);
2071 struct coredump_params cprm = { 2072 struct coredump_params cprm = {
@@ -2219,6 +2220,12 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
2219 goto close_fail; 2220 goto close_fail;
2220 } 2221 }
2221 2222
2223 /* get us an unshared descriptor table; almost always a no-op */
2224 retval = unshare_files(&displaced);
2225 if (retval)
2226 goto close_fail;
2227 if (displaced)
2228 put_files_struct(displaced);
2222 retval = binfmt->core_dump(&cprm); 2229 retval = binfmt->core_dump(&cprm);
2223 if (retval) 2230 if (retval)
2224 current->signal->group_exit_code |= 0x80; 2231 current->signal->group_exit_code |= 0x80;