]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
futex: Nullify robust lists after cleanup
authorPeter Zijlstra <peterz@infradead.org>
Mon, 5 Oct 2009 16:17:32 +0000 (18:17 +0200)
committerThomas Gleixner <tglx@linutronix.de>
Tue, 6 Oct 2009 15:00:01 +0000 (17:00 +0200)
The robust list pointers of user space held futexes are kept intact
over an exec() call. When the exec'ed task exits exit_robust_list() is
called with the stale pointer. The risk of corruption is minimal, but
still it is incorrect to keep the pointers valid. Actually glibc
should uninstall the robust list before calling exec() but we have to
deal with it anyway.

Nullify the pointers after [compat_]exit_robust_list() has been
called.

Reported-by: Anirban Sinha <ani@anirban.org>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
LKML-Reference: <new-submission>
Cc: stable@kernel.org
kernel/fork.c

index bfee931ee3fbf7f91045f7b6db6f7eb75c3b4644..88ef51ca84de022059dda6145568482a4ee723b2 100644 (file)
@@ -543,11 +543,15 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm)
 
        /* Get rid of any futexes when releasing the mm */
 #ifdef CONFIG_FUTEX
-       if (unlikely(tsk->robust_list))
+       if (unlikely(tsk->robust_list)) {
                exit_robust_list(tsk);
+               tsk->robust_list = NULL;
+       }
 #ifdef CONFIG_COMPAT
-       if (unlikely(tsk->compat_robust_list))
+       if (unlikely(tsk->compat_robust_list)) {
                compat_exit_robust_list(tsk);
+               tsk->compat_robust_list = NULL;
+       }
 #endif
 #endif