lkml.org 
[lkml]   [2013]   [Apr]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] kernel: move exit_task_work() past exit_notify()
On 04/12, Andrey Vagin wrote:
> exit_task_work() must be called after exit_notify, because
> exit_task_namespaces() may release a file and fput() enqueues a work.
>
> exit_notify
> exit_task_namespaces
> free_ipc_ns
> shm_destroy
> fput
> task_work_add
>
> so if task works don't run after exit_notify(), a few files may leak.
>
> Cc: Andrew Morton <akpm@linux-foundation.org>
> Cc: "Eric W. Biederman" <ebiederm@xmission.com>
> Cc: Al Viro <viro@zeniv.linux.org.uk>
> Cc: Oleg Nesterov <oleg@redhat.com>
> Cc: David Howells <dhowells@redhat.com>
> Signed-off-by: Andrey Vagin <avagin@openvz.org>
> ---
> kernel/exit.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/kernel/exit.c b/kernel/exit.c
> index 60bc027..1d1129b 100644
> --- a/kernel/exit.c
> +++ b/kernel/exit.c
> @@ -795,7 +795,6 @@ void do_exit(long code)
> exit_shm(tsk);
> exit_files(tsk);
> exit_fs(tsk);
> - exit_task_work(tsk);
> check_stack_usage();
> exit_thread();
>
> @@ -822,6 +821,7 @@ void do_exit(long code)
> ptrace_put_breakpoints(tsk);
>
> exit_notify(tsk, group_dead);
> + exit_task_work(tsk);

I am not comfortable with this change...

The task is "really dead" after exit_notify(), even release_task(current)
can be called.

Let me think a bit... It seems that we have the alternative.

Oleg.



\
 
 \ /
  Last update: 2013-04-13 16:41    [W:1.235 / U:0.160 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site