SKAS3: add locking around ->mm for PTRACE_SWITCH_MM From: Paolo 'Blaisorblade' Giarrusso I just discovered that task_lock() and task_unlock() is used to protect task_struct->mm... so this patch makes sure it is used for this purpose in SKAS code. Seeing this comment: /* * Protects ->fs, ->files, ->mm, ->ptrace, ->group_info, ->comm and * synchronises with wait4(). * * Nests both inside and outside of read_lock(&tasklist_lock). * It must not be nested with write_lock_irq(&tasklist_lock), * neither inside nor outside. */ static inline void task_lock(struct task_struct *p) I've verified to some extent that it is called even without holding tasklist_lock (for instance during execve). Signed-off-by: Paolo 'Blaisorblade' Giarrusso Index: linux-2.6.14/arch/i386/kernel/ptrace.c =================================================================== --- linux-2.6.14.orig/arch/i386/kernel/ptrace.c 2005-10-29 05:50:05.000000000 +0200 +++ linux-2.6.14/arch/i386/kernel/ptrace.c 2005-10-29 05:50:24.000000000 +0200 @@ -702,8 +702,10 @@ } atomic_inc(&new->mm_users); + task_lock(child); child->mm = new; child->active_mm = new; + task_unlock(child); mmput(old); ret = 0; break;