aboutsummaryrefslogtreecommitdiffstats
path: root/fs/binfmt_elf_fdpic.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_elf_fdpic.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_elf_fdpic.c')
-rw-r--r--fs/binfmt_elf_fdpic.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/fs/binfmt_elf_fdpic.c b/fs/binfmt_elf_fdpic.c
index faae02189598..033861c6b8f1 100644
--- a/fs/binfmt_elf_fdpic.c
+++ b/fs/binfmt_elf_fdpic.c
@@ -75,7 +75,7 @@ static int elf_fdpic_map_file_by_direct_mmap(struct elf_fdpic_params *,
75 struct file *, struct mm_struct *); 75 struct file *, struct mm_struct *);
76 76
77#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE) 77#if defined(USE_ELF_CORE_DUMP) && defined(CONFIG_ELF_CORE)
78static int elf_fdpic_core_dump(long, struct pt_regs *, struct file *); 78static int elf_fdpic_core_dump(long, struct pt_regs *, struct file *, unsigned long limit);
79#endif 79#endif
80 80
81static struct linux_binfmt elf_fdpic_format = { 81static struct linux_binfmt elf_fdpic_format = {
@@ -1552,7 +1552,7 @@ static int elf_fdpic_dump_segments(struct file *file, size_t *size,
1552 * we just truncate. 1552 * we just truncate.
1553 */ 1553 */
1554static int elf_fdpic_core_dump(long signr, struct pt_regs *regs, 1554static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1555 struct file *file) 1555 struct file *file, unsigned long limit)
1556{ 1556{
1557#define NUM_NOTES 6 1557#define NUM_NOTES 6
1558 int has_dumped = 0; 1558 int has_dumped = 0;
@@ -1563,7 +1563,6 @@ static int elf_fdpic_core_dump(long signr, struct pt_regs *regs,
1563 struct vm_area_struct *vma; 1563 struct vm_area_struct *vma;
1564 struct elfhdr *elf = NULL; 1564 struct elfhdr *elf = NULL;
1565 loff_t offset = 0, dataoff; 1565 loff_t offset = 0, dataoff;
1566 unsigned long limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
1567 int numnote; 1566 int numnote;
1568 struct memelfnote *notes = NULL; 1567 struct memelfnote *notes = NULL;
1569 struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */ 1568 struct elf_prstatus *prstatus = NULL; /* NT_PRSTATUS */