copy_process() && ti->flags (Was: PT_DTRACE && uml)

From: Oleg Nesterov
Date: Sun Apr 26 2009 - 19:22:21 EST


On 04/27, Oleg Nesterov wrote:
>
> Do you see other problems with this patch? (uncompiled, untested).

dup_task_struct()->setup_thread_stack() copies parent's ti->flags.

Why? Which flags should be actually copied? I must have missed
something, but whats wrong with the patch below?

OK, it is wrong. On x86 we should at least copy TIF_IA32. But
why should we copy, say, TIF_DEBUG?

Actually, I don't understand why don't we use TS_IA32 instead of
TIF_IA32. Only current can change this flag, perhaps it makes sense
to move it in thread_info->status.

copy_process()->clear_tsk_thread_flag(TIF_SIGPENDING) looks unneeded
in any case...

Oleg.


--- kernel/fork.c
+++ kernel/fork.c
@@ -241,6 +241,7 @@ static struct task_struct *dup_task_stru
goto out;

setup_thread_stack(tsk, orig);
+ ti->flags = 0;
stackend = end_of_stack(tsk);
*stackend = STACK_END_MAGIC; /* for overflow detection */

@@ -1027,7 +1028,6 @@ static struct task_struct *copy_process(
p->vfork_done = NULL;
spin_lock_init(&p->alloc_lock);

- clear_tsk_thread_flag(p, TIF_SIGPENDING);
init_sigpending(&p->pending);

p->utime = cputime_zero;
@@ -1163,14 +1163,6 @@ static struct task_struct *copy_process(
if ((clone_flags & (CLONE_VM|CLONE_VFORK)) == CLONE_VM)
p->sas_ss_sp = p->sas_ss_size = 0;

- /*
- * Syscall tracing should be turned off in the child regardless
- * of CLONE_PTRACE.
- */
- clear_tsk_thread_flag(p, TIF_SYSCALL_TRACE);
-#ifdef TIF_SYSCALL_EMU
- clear_tsk_thread_flag(p, TIF_SYSCALL_EMU);
-#endif
clear_all_latency_tracing(p);

/* ok, now we should be set up.. */

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/