diff options
author | Oleg Nesterov <oleg@tv-sign.ru> | 2008-07-25 04:47:37 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-07-25 13:53:39 -0400 |
commit | 7b34e4283c685f5cc6ba6d30e939906eee0d4bcf (patch) | |
tree | 6822edd5c63db79e97b8c5379a18a058bc5405ff /fs | |
parent | 3d749b9e676b26584a47e75c235aa6f69d0697ae (diff) |
introduce PF_KTHREAD flag
Introduce the new PF_KTHREAD flag to mark the kernel threads. It is set
by INIT_TASK() and copied to the forked childs (we could set it in
kthreadd() along with PF_NOFREEZE instead).
daemonize() was changed as well. In that case testing of PF_KTHREAD is
racy, but daemonize() is hopeless anyway.
This flag is cleared in do_execve(), before search_binary_handler().
Probably not the best place, we can do this in exec_mmap() or in
start_thread(), or clear it along with PF_FORKNOEXEC. But I think this
doesn't matter in practice, and if do_execve() fails kthread should die
soon.
Signed-off-by: Oleg Nesterov <oleg@tv-sign.ru>
Cc: Roland McGrath <roland@redhat.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs')
-rw-r--r-- | fs/exec.c | 1 |
1 files changed, 1 insertions, 0 deletions
@@ -1326,6 +1326,7 @@ int do_execve(char * filename, | |||
1326 | if (retval < 0) | 1326 | if (retval < 0) |
1327 | goto out; | 1327 | goto out; |
1328 | 1328 | ||
1329 | current->flags &= ~PF_KTHREAD; | ||
1329 | retval = search_binary_handler(bprm,regs); | 1330 | retval = search_binary_handler(bprm,regs); |
1330 | if (retval >= 0) { | 1331 | if (retval >= 0) { |
1331 | /* execve success */ | 1332 | /* execve success */ |