All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] fix sighand use after free
@ 2014-08-13 15:50 Rik van Riel
  2014-08-13 15:58 ` Oleg Nesterov
  0 siblings, 1 reply; 5+ messages in thread
From: Rik van Riel @ 2014-08-13 15:50 UTC (permalink / raw)
  To: linux-kernel; +Cc: akpm, peterz, oleg, paulmck

Subject: fix sighand use after free

__lock_task_sighand carefully takes the rcu_read_lock, gets
tsk->sighand with rcu_dereference, and verifies that the task
is still using the sighand_struct after taking the spinlock.

This works much better if the sighand struct is actually rcu
freed.

Signed-off-by: Rik van Riel <riel@redhat.com>
---
 kernel/fork.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/kernel/fork.c b/kernel/fork.c
index 1380d8a..754a7c6 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -1017,7 +1017,7 @@ void __cleanup_sighand(struct sighand_struct *sighand)
 {
 	if (atomic_dec_and_test(&sighand->count)) {
 		signalfd_cleanup(sighand);
-		kmem_cache_free(sighand_cachep, sighand);
+		rcu_free(sighand_cachep, sighand);
 	}
 }
 


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-08-13 16:44 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-08-13 15:50 [PATCH] fix sighand use after free Rik van Riel
2014-08-13 15:58 ` Oleg Nesterov
2014-08-13 16:09   ` Rik van Riel
2014-08-13 16:19     ` Oleg Nesterov
2014-08-13 16:43       ` Rik van Riel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.