[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-fc6b177dee33365ccb29fe6d2092223cf8d679f9@git.kernel.org>
Date: Tue, 6 Oct 2009 15:03:42 GMT
From: tip-bot for Peter Zijlstra <peterz@...radead.org>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, hpa@...or.com, mingo@...hat.com,
peterz@...radead.org, tglx@...utronix.de, ani@...rban.org
Subject: [tip:core/urgent] futex: Nullify robust lists after cleanup
Commit-ID: fc6b177dee33365ccb29fe6d2092223cf8d679f9
Gitweb: http://git.kernel.org/tip/fc6b177dee33365ccb29fe6d2092223cf8d679f9
Author: Peter Zijlstra <peterz@...radead.org>
AuthorDate: Mon, 5 Oct 2009 18:17:32 +0200
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Tue, 6 Oct 2009 17:00:01 +0200
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@...rban.org>
Signed-off-by: Peter Zijlstra <peterz@...radead.org>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
LKML-Reference: <new-submission>
Cc: stable@...nel.org
---
kernel/fork.c | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/kernel/fork.c b/kernel/fork.c
index bfee931..88ef51c 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists