Max Neklyudov | 5 Jul 2012 13:59
Picon

[PATCH 1/1] arm: Fix kernel crash problem in binfmt_flat.c

If createion of the new process is aborted due to some erros
(lack of memory in my case) kernel will crash because created process
is not terminated properly.
I just sent SIG_KILL in all such points.

Tested on my LM3S1D21 based board

Signed-off-by: Max Neklyudov <macscomp <at> gmail.com>
---
 fs/binfmt_flat.c |    5 +++++
 1 file changed, 5 insertions(+)

diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c
index 178cb70..79c9838 100644
--- a/fs/binfmt_flat.c
+++ b/fs/binfmt_flat.c
 <at>  <at>  -545,6 +545,7  <at>  <at>  static int load_flat_file(struct linux_binprm * bprm,
 		textpos = vm_mmap(bprm->file, 0, text_len, PROT_READ|PROT_EXEC,
 				  MAP_PRIVATE|MAP_EXECUTABLE, 0);
 		if (!textpos || IS_ERR_VALUE(textpos)) {
+			send_sig(SIGKILL, current, 0);
 			if (!textpos)
 				textpos = (unsigned long) -ENOMEM;
 			printk("Unable to mmap process text, errno %d\n", (int)-textpos);
 <at>  <at>  -558,6 +559,7  <at>  <at>  static int load_flat_file(struct linux_binprm * bprm,
 			PROT_READ|PROT_WRITE|PROT_EXEC, MAP_PRIVATE, 0);

 		if (realdatastart == 0 || IS_ERR_VALUE(realdatastart)) {
+			send_sig(SIGKILL, current, 0);
 			if (!realdatastart)
(Continue reading)


Gmane