[PATCH] coredump: fix pipe coredump when core limit is 0

From: bookjovi
Date: Sat Aug 20 2011 - 23:28:26 EST


From: Jovi Zhang <bookjovi@xxxxxxxxx>

Regressing from 2.6.35

In pipe coredump case, normally core limits are irrelevant,
since we're not writing to the file system, but core limit 0
is a special value, kernel should skip the dump when limit is 0.

Note that most Linux distribution set default core file limit as 0,
because many user don't want to get core file even process crash,
wahtever pipe coredump pattern used or not.

This error intruduced by commit c71354 in 2.6.35, that commit put
core limit zero check into non-pipe code branch.

commit c713541125002b8bc9e681af3b09118e771e2d8a
Author: Oleg Nesterov <oleg@xxxxxxxxxx>
Date: Wed May 26 14:43:05 2010 -0700

coredump: factor out the not-ispipe file checks

For non-pipe case, limit 0 also means drop the coredump, so just put
the zero limit check at do_coredump function begining.

Signed-off-by: Jovi Zhang <bookjovi@xxxxxxxxx>
---
fs/exec.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/fs/exec.c b/fs/exec.c
index 25dcbe5..c33085d 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -2119,6 +2119,10 @@ void do_coredump(long signr, int exit_code, struct pt_regs *regs)
if (!__get_dumpable(cprm.mm_flags))
goto fail;

+ /* Core limit as 0 should skip the dump */
+ if (cprm.limit == 0)
+ goto fail;
+
cred = prepare_creds();
if (!cred)
goto fail;
--
1.7.2.3

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/