mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rik van Riel <riel@redhat.com>
To: linux-kernel@vger.kernel.org
Cc: akpm@linux-foundation.org, peterz@infradead.org, oleg@redhat.com,
	paulmck@linux.vnet.ibm.com
Subject: [PATCH] fix sighand use after free
Date: Wed, 13 Aug 2014 11:50:00 -0400	[thread overview]
Message-ID: <20140813115000.73da6136@cuia.bos.redhat.com> (raw)

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);
 	}
 }
 


             reply	other threads:[~2014-08-13 15:51 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-13 15:50 Rik van Riel [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140813115000.73da6136@cuia.bos.redhat.com \
    --to=riel@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg@redhat.com \
    --cc=paulmck@linux.vnet.ibm.com \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®