aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>2010-10-27 18:34:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-27 21:03:13 -0400
commit98391cf4dcf893e9e74e1c14189851dbc9c5ad0d (patch)
treef76b582402e03a74628071b8190b93da274f59f4
parent478735e38887077ac77a9756121b6ce0cb956e2f (diff)
exec: don't turn PF_KTHREAD off when a target command was not found
Presently do_execve() turns PF_KTHREAD off before search_binary_handler(). THis has a theorical risk of PF_KTHREAD getting lost. We don't have to turn PF_KTHREAD off in the ENOEXEC case. This patch moves this flag modification to after the finding of the executable file. This is only a theorical issue because kthreads do not call do_execve() directly. But fixing would be better. Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com> Acked-by: Roland McGrath <roland@redhat.com> Acked-by: Oleg Nesterov <oleg@redhat.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rw-r--r--fs/exec.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/fs/exec.c b/fs/exec.c
index ca01d2d0a6d4..99d33a1371e9 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1009,7 +1009,7 @@ int flush_old_exec(struct linux_binprm * bprm)
1009 1009
1010 bprm->mm = NULL; /* We're using it now */ 1010 bprm->mm = NULL; /* We're using it now */
1011 1011
1012 current->flags &= ~PF_RANDOMIZE; 1012 current->flags &= ~(PF_RANDOMIZE | PF_KTHREAD);
1013 flush_thread(); 1013 flush_thread();
1014 current->personality &= ~bprm->per_clear; 1014 current->personality &= ~bprm->per_clear;
1015 1015
@@ -1412,7 +1412,6 @@ int do_execve(const char * filename,
1412 if (retval < 0) 1412 if (retval < 0)
1413 goto out; 1413 goto out;
1414 1414
1415 current->flags &= ~PF_KTHREAD;
1416 retval = search_binary_handler(bprm,regs); 1415 retval = search_binary_handler(bprm,regs);
1417 if (retval < 0) 1416 if (retval < 0)
1418 goto out; 1417 goto out;