: Ghost tasks must not be detached in kernel
PATCH 1/1 : Ghost tasks must not be detached in kernel
Oren,
As discussed (a while ago)
https://lists.linux-foundation.org/pipermail/containers/2010-November/025905.html
here is a patch. I will send a follow-on user-cr patch to mark the task detached in user-space.
---
From: Sukadev Bhattiprolu <[email protected]>
Date: Fri, 10 Dec 2010 18:37:17 -0800
Subject: [PATCH 1/1] Ghost tasks must not be detached in kernel
Ghost tasks are "temporary" tasks created during sys_restart() to restore "orphaned" sessions/process groups (i.e. those in which the original session/pgrp leader had exited before checkpoint but other processes exist in that session/pgrp).
We only create the ghost task so we have a valid session/pgrp that the other processes in the session/pgrp can use. Once those other processes are created, the ghost tasks must silently vanish (without sending another SIGCHLD).
do_ghost_task() was setting the exit_signal to -1 so the ghosts don't send a signal. But rather than set the ->exit_signal here, the caller (i.e user-space) can create the ghost task by explicitly setting the CSIGNAL mask to 0xFF. i.e it is not something the we need to do in the kernel.
The downside of marking the task detached in do_ghost_task() is that with current/older kernels container-init does not wait for detached tasks. See:
http://lkml.org/lkml/2010/6/16/272 http://lkml.org/lkml/2010/7/12/213
This can lead to a kernel crash if the container-init pre-deceases a ghost task.
--- kernel/checkpoint/restart.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
kernel/checkpoint/restart.c +0 -1
@@ -972,7 +972,6 @@ static int do_ghost_task(void)if (ret <0 )ckpt_err (ctx, ret,"ghost restart failed\n" ); - current->exit_signal =-1 ;restore_debug_exit (ctx);ckpt_ctx_put (ctx);do_exit (0 );
Signature · 1 line
1.6.0.4
A message that is not in the archive (sent off-list or not yet received): 20101211033315.GA12292-r/[email protected]
Oren Laadan
AppliedMerged into v23-rc1.
Thanks,
Oren.
Quoted 58 lines · Sukadev Bhattiprolu
Oren,
As discussed (a while ago)
https://lists.linux-foundation.org/pipermail/containers/2010-November/025905.html
here is a patch. I will send a follow-on user-cr patch to mark the task detached in user-space.
---
From: Sukadev Bhattiprolu <[email protected]>
Date: Fri, 10 Dec 2010 18:37:17 -0800
Subject: [PATCH 1/1] Ghost tasks must not be detached in kernelGhost tasks are "temporary" tasks created during
sys_restart()to restore "orphaned" sessions/process groups (i.e. those in which the original session/pgrp leader had exited before checkpoint but other processes exist in that session/pgrp).We only create the ghost task so we have a valid session/pgrp that the other processes in the session/pgrp can use. Once those other processes are created, the ghost tasks must silently vanish (without sending another SIGCHLD).
do_ghost_task()was setting theexit_signalto -1 so the ghosts don't send a signal. But rather than set the ->exit_signal here, the caller (i.e user-space) can create the ghost task by explicitly setting the CSIGNAL mask to0xFF. i.e it is not something the we need to do in the kernel.The downside of marking the task detached in
do_ghost_task()is that with current/older kernels container-init does not wait for detached tasks. See:http://lkml.org/lkml/2010/6/16/272 http://lkml.org/lkml/2010/7/12/213This can lead to a kernel crash if the container-init pre-deceases a ghost task.
Signed-off-by Sukadev Bhattiprolu (sukadev-r/[email protected])--- kernel/checkpoint/restart.c | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)kernel/checkpoint/restart.c +0
-1@@ -972,7 +972,6 @@ static int do_ghost_task(void)if (ret <0 )ckpt_err (ctx, ret,"ghost restart failed\n" ); - current->exit_signal =-1 ;restore_debug_exit (ctx);ckpt_ctx_put (ctx);do_exit (0 );