aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_aout.c
diff options
context:
space:
mode:
authorNeil Horman <nhorman@tuxdriver.com>2007-10-17 02:26:34 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-17 11:42:50 -0400
commit7dc0b22e3c54f1f4730354fef84a20f5944f6c5e (patch)
tree8b281ed3315699eb0b21f00b5933b6222add5b5a /fs/binfmt_aout.c
parent8e2b705649e294f43a8cd1ea79e4c594c0bd1d9d (diff)
core_pattern: ignore RLIMIT_CORE if core_pattern is a pipe
For some time /proc/sys/kernel/core_pattern has been able to set its output destination as a pipe, allowing a user space helper to receive and intellegently process a core. This infrastructure however has some shortcommings which can be enhanced. Specifically: 1) The coredump code in the kernel should ignore RLIMIT_CORE limitation when core_pattern is a pipe, since file system resources are not being consumed in this case, unless the user application wishes to save the core, at which point the app is restricted by usual file system limits and restrictions. 2) The core_pattern code should be able to parse and pass options to the user space helper as an argv array. The real core limit of the uid of the crashing proces should also be passable to the user space helper (since it is overridden to zero when called). 3) Some miscellaneous bugs need to be cleaned up (specifically the recognition of a recursive core dump, should the user mode helper itself crash. Also, the core dump code in the kernel should not wait for the user mode helper to exit, since the same context is responsible for writing to the pipe, and a read of the pipe by the user mode helper will result in a deadlock. This patch: Remove the check of RLIMIT_CORE if core_pattern is a pipe. In the event that core_pattern is a pipe, the entire core will be fed to the user mode helper. Signed-off-by: Neil Horman <nhorman@tuxdriver.com> Cc: <martin.pitt@ubuntu.com> Cc: <wwoods@redhat.com> Cc: Jeremy Fitzhardinge <jeremy@goop.org> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/binfmt_aout.c')
-rw-r--r--fs/binfmt_aout.c16
1 files changed, 6 insertions, 10 deletions
diff --git a/fs/binfmt_aout.c b/fs/binfmt_aout.c
index 813a887cd2b3..e176d195e7e5 100644
--- a/fs/binfmt_aout.c
+++ b/fs/binfmt_aout.c
@@ -31,7 +31,7 @@
31 31
32static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs); 32static int load_aout_binary(struct linux_binprm *, struct pt_regs * regs);
33static int load_aout_library(struct file*); 33static int load_aout_library(struct file*);
34static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file); 34static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit);
35 35
36static struct linux_binfmt aout_format = { 36static struct linux_binfmt aout_format = {
37 .module = THIS_MODULE, 37 .module = THIS_MODULE,
@@ -88,7 +88,7 @@ if (file->f_op->llseek) { \
88 * dumping of the process results in another error.. 88 * dumping of the process results in another error..
89 */ 89 */
90 90
91static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file) 91static int aout_core_dump(long signr, struct pt_regs *regs, struct file *file, unsigned long limit)
92{ 92{
93 mm_segment_t fs; 93 mm_segment_t fs;
94 int has_dumped = 0; 94 int has_dumped = 0;
@@ -123,23 +123,19 @@ static int aout_core_dump(long signr, struct pt_regs * regs, struct file *file)
123/* If the size of the dump file exceeds the rlimit, then see what would happen 123/* If the size of the dump file exceeds the rlimit, then see what would happen
124 if we wrote the stack, but not the data area. */ 124 if we wrote the stack, but not the data area. */
125#ifdef __sparc__ 125#ifdef __sparc__
126 if ((dump.u_dsize+dump.u_ssize) > 126 if ((dump.u_dsize + dump.u_ssize) > limit)
127 current->signal->rlim[RLIMIT_CORE].rlim_cur)
128 dump.u_dsize = 0; 127 dump.u_dsize = 0;
129#else 128#else
130 if ((dump.u_dsize+dump.u_ssize+1) * PAGE_SIZE > 129 if ((dump.u_dsize + dump.u_ssize+1) * PAGE_SIZE > limit)
131 current->signal->rlim[RLIMIT_CORE].rlim_cur)
132 dump.u_dsize = 0; 130 dump.u_dsize = 0;
133#endif 131#endif
134 132
135/* Make sure we have enough room to write the stack and data areas. */ 133/* Make sure we have enough room to write the stack and data areas. */
136#ifdef __sparc__ 134#ifdef __sparc__
137 if ((dump.u_ssize) > 135 if (dump.u_ssize > limit)
138 current->signal->rlim[RLIMIT_CORE].rlim_cur)
139 dump.u_ssize = 0; 136 dump.u_ssize = 0;
140#else 137#else
141 if ((dump.u_ssize+1) * PAGE_SIZE > 138 if ((dump.u_ssize + 1) * PAGE_SIZE > limit)
142 current->signal->rlim[RLIMIT_CORE].rlim_cur)
143 dump.u_ssize = 0; 139 dump.u_ssize = 0;
144#endif 140#endif
145 141