Skip to contentSkip to conversation

+ wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space.patch added to -mm tree

PATCH [email protected] 1 participant 1 message Feb 21, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Subject: + wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space.patch added to -mm tree
To: [email protected],[email protected],[email protected],[email protected],[email protected],[email protected],[email protected]
From: [email protected]
Date: Fri, 21 Feb 2014 13:39:21 -0800

The patch titled
Subject: wait: swap EXIT_ZOMBIE and EXIT_DEAD to hide EXIT_TRACE from user-space
has been added to the -mm tree. Its filename is
wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space.patch

This patch should soon appear at
http://ozlabs.org/~akpm/mmots/broken-out/wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space.patch
and later at
http://ozlabs.org/~akpm/mmotm/broken-out/wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space.patch

Before you just go and hit "reply", please:
a) Consider who else should be cc'ed
b) Prefer to cc a suitable mailing list as well
c) Ideally: find the original patch on the mailing list and do a reply-to-all to that, adding suitable additional cc's

*** Remember to use Documentation/SubmitChecklist when testing your code ***

The -mm tree is included into linux-next and is updated there every 3-4 working days

------------------------------------------------------
From: Oleg Nesterov <[email protected]>
Subject: wait: swap EXIT_ZOMBIE and EXIT_DEAD to hide EXIT_TRACE from user-space

get_task_state() uses the most significant bit to report the state to user-space, this means that EXIT_ZOMBIE->EXIT_TRACE->EXIT_DEAD transition can be noticed via /proc as Z -> X -> Z change. Note that this was possible even before EXIT_TRACE was introduced.

This is not really bad but imho it make sense to hide EXIT_TRACE from user-space completely. So the patch simply swaps EXIT_ZOMBIE and EXIT_DEAD, this way EXIT_TRACE will be seen as EXIT_ZOMBIE by user-space.

Cc Jan Kratochvil <[email protected]>
Cc Michal Schmidt <[email protected]>
Cc Al Viro <[email protected]>
Cc Lennart Poettering <[email protected]>
Cc Roland McGrath <[email protected]>
Cc Tejun Heo <[email protected]>

---

 fs/proc/array.c       |    4 ++--
 include/linux/sched.h |    4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)
fs/proc/array.c renamed from fs/proc/array.c~wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space +2 -2
diff -puN fs/proc/array.c~wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space fs/proc/array.c
@@ -138,8 +138,8 @@ static const char * const task_state_arr
 	"D (disk sleep)",	/*   2 */
 	"T (stopped)",		/*   4 */
 	"t (tracing stop)",	/*   8 */
-	"Z (zombie)",		/*  16 */
-	"X (dead)",		/*  32 */
+	"X (dead)",		/*  16 */
+	"Z (zombie)",		/*  32 */
 };
 
 static inline const char *get_task_state(struct task_struct *tsk)
include/linux/sched.h renamed from include/linux/sched.h~wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space +2 -2
diff -puN include/linux/sched.h~wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space include/linux/sched.h
@@ -204,8 +204,8 @@ print_cfs_rq(struct seq_file *m, int cpu
 #define __TASK_STOPPED		4
 #define __TASK_TRACED		8
 /* in tsk->exit_state */
-#define EXIT_ZOMBIE		16
-#define EXIT_DEAD		32
+#define EXIT_DEAD		16
+#define EXIT_ZOMBIE		32
 #define EXIT_TRACE		(EXIT_ZOMBIE | EXIT_DEAD)
 /* in tsk->state again */
 #define TASK_DEAD		64

_

Patches currently in -mm which might be from [email protected] are

kthread-ensure-locality-of-task_struct-allocations.patch wait-fix-reparent_leader-vs-exit_dead-exit_zombie-race.patch wait-introduce-exit_trace-to-avoid-the-racy-exit_dead-exit_zombie-transition.patch wait-use-exit_trace-only-if-thread_group_leaderzombie.patch wait-completely-ignore-the-exit_dead-tasks.patch wait-swap-exit_zombie-and-exit_dead-to-hide-exit_trace-from-user-space.patch linux-next.patch