|
@@ -1697,6 +1697,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
|
|
int fsuid = current->fsuid;
|
|
int fsuid = current->fsuid;
|
|
int flag = 0;
|
|
int flag = 0;
|
|
int ispipe = 0;
|
|
int ispipe = 0;
|
|
|
|
+ unsigned long core_limit = current->signal->rlim[RLIMIT_CORE].rlim_cur;
|
|
|
|
|
|
audit_core_dumps(signr);
|
|
audit_core_dumps(signr);
|
|
|
|
|
|
@@ -1730,9 +1731,6 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
|
|
*/
|
|
*/
|
|
clear_thread_flag(TIF_SIGPENDING);
|
|
clear_thread_flag(TIF_SIGPENDING);
|
|
|
|
|
|
- if (current->signal->rlim[RLIMIT_CORE].rlim_cur < binfmt->min_coredump)
|
|
|
|
- goto fail_unlock;
|
|
|
|
-
|
|
|
|
/*
|
|
/*
|
|
* lock_kernel() because format_corename() is controlled by sysctl, which
|
|
* lock_kernel() because format_corename() is controlled by sysctl, which
|
|
* uses lock_kernel()
|
|
* uses lock_kernel()
|
|
@@ -1740,7 +1738,20 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
|
|
lock_kernel();
|
|
lock_kernel();
|
|
ispipe = format_corename(corename, core_pattern, signr);
|
|
ispipe = format_corename(corename, core_pattern, signr);
|
|
unlock_kernel();
|
|
unlock_kernel();
|
|
|
|
+ /*
|
|
|
|
+ * Don't bother to check the RLIMIT_CORE value if core_pattern points
|
|
|
|
+ * to a pipe. Since we're not writing directly to the filesystem
|
|
|
|
+ * RLIMIT_CORE doesn't really apply, as no actual core file will be
|
|
|
|
+ * created unless the pipe reader choses to write out the core file
|
|
|
|
+ * at which point file size limits and permissions will be imposed
|
|
|
|
+ * as it does with any other process
|
|
|
|
+ */
|
|
|
|
+ if ((!ispipe) &&
|
|
|
|
+ (core_limit < binfmt->min_coredump))
|
|
|
|
+ goto fail_unlock;
|
|
|
|
+
|
|
if (ispipe) {
|
|
if (ispipe) {
|
|
|
|
+ core_limit = RLIM_INFINITY;
|
|
/* SIGPIPE can happen, but it's just never processed */
|
|
/* SIGPIPE can happen, but it's just never processed */
|
|
if(call_usermodehelper_pipe(corename+1, NULL, NULL, &file)) {
|
|
if(call_usermodehelper_pipe(corename+1, NULL, NULL, &file)) {
|
|
printk(KERN_INFO "Core dump to %s pipe failed\n",
|
|
printk(KERN_INFO "Core dump to %s pipe failed\n",
|
|
@@ -1770,7 +1781,7 @@ int do_coredump(long signr, int exit_code, struct pt_regs * regs)
|
|
if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
|
|
if (!ispipe && do_truncate(file->f_path.dentry, 0, 0, file) != 0)
|
|
goto close_fail;
|
|
goto close_fail;
|
|
|
|
|
|
- retval = binfmt->core_dump(signr, regs, file);
|
|
|
|
|
|
+ retval = binfmt->core_dump(signr, regs, file, core_limit);
|
|
|
|
|
|
if (retval)
|
|
if (retval)
|
|
current->signal->group_exit_code |= 0x80;
|
|
current->signal->group_exit_code |= 0x80;
|