diff options
author | Peter Zijlstra <peterz@infradead.org> | 2009-10-05 12:17:32 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2009-10-06 11:00:01 -0400 |
commit | fc6b177dee33365ccb29fe6d2092223cf8d679f9 (patch) | |
tree | 849fcb60282bc6c0a01c3113dfc617c7f03f97d3 /kernel | |
parent | eaaea8036d0261d87d7072c5bc88c7ea730c18ac (diff) |
futex: Nullify robust lists after cleanup
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
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/fork.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/kernel/fork.c b/kernel/fork.c index bfee931ee3fb..88ef51ca84de 100644 --- a/kernel/fork.c +++ b/kernel/fork.c | |||
@@ -543,11 +543,15 @@ void mm_release(struct task_struct *tsk, struct mm_struct *mm) | |||
543 | 543 | ||
544 | /* Get rid of any futexes when releasing the mm */ | 544 | /* Get rid of any futexes when releasing the mm */ |
545 | #ifdef CONFIG_FUTEX | 545 | #ifdef CONFIG_FUTEX |
546 | if (unlikely(tsk->robust_list)) | 546 | if (unlikely(tsk->robust_list)) { |
547 | exit_robust_list(tsk); | 547 | exit_robust_list(tsk); |
548 | tsk->robust_list = NULL; | ||
549 | } | ||
548 | #ifdef CONFIG_COMPAT | 550 | #ifdef CONFIG_COMPAT |
549 | if (unlikely(tsk->compat_robust_list)) | 551 | if (unlikely(tsk->compat_robust_list)) { |
550 | compat_exit_robust_list(tsk); | 552 | compat_exit_robust_list(tsk); |
553 | tsk->compat_robust_list = NULL; | ||
554 | } | ||
551 | #endif | 555 | #endif |
552 | #endif | 556 | #endif |
553 | 557 | ||