linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Uprobes: Fix kernel oops with delayed_uprobe_remove()
@ 2018-11-14  8:19 Ravi Bangoria
  2018-11-14 16:06 ` Oleg Nesterov
  0 siblings, 1 reply; 9+ messages in thread
From: Ravi Bangoria @ 2018-11-14  8:19 UTC (permalink / raw)
  To: srikar, oleg, rostedt, mhiramat, liu.song.a23
  Cc: peterz, mingo, acme, alexander.shishkin, jolsa, namhyung,
	linux-kernel, ananth, alexis.berlemont, naveen.n.rao,
	linux-arm-kernel, linux-mips, linux, ralf, paul.burton,
	Ravi Bangoria

syzbot reported a kernel crash with delayed_uprobe_remove():
  https://lkml.org/lkml/2018/11/1/1244

Backtrace mentioned in the link points to a race between process
exit and uprobe_unregister(). Fix it by locking delayed_uprobe_lock
before calling delayed_uprobe_remove() from put_uprobe().

Reported-by: syzbot+cb1fb754b771caca0a88@syzkaller.appspotmail.com
Signed-off-by: Ravi Bangoria <ravi.bangoria@linux.ibm.com>
---
 kernel/events/uprobes.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
index 96fb51f3994f..e527c4753d4f 100644
--- a/kernel/events/uprobes.c
+++ b/kernel/events/uprobes.c
@@ -572,7 +572,9 @@ static void put_uprobe(struct uprobe *uprobe)
 		 * gets called, we don't get a chance to remove uprobe from
 		 * delayed_uprobe_list from remove_breakpoint(). Do it here.
 		 */
+		mutex_lock(&delayed_uprobe_lock);
 		delayed_uprobe_remove(uprobe, NULL);
+		mutex_unlock(&delayed_uprobe_lock);
 		kfree(uprobe);
 	}
 }
-- 
2.19.1


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

end of thread, other threads:[~2018-12-05 14:39 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-11-14  8:19 [PATCH] Uprobes: Fix kernel oops with delayed_uprobe_remove() Ravi Bangoria
2018-11-14 16:06 ` Oleg Nesterov
2018-11-15  4:06   ` Ravi Bangoria
2018-11-15 12:43     ` Oleg Nesterov
2018-12-03  6:22       ` Ravi Bangoria
2018-12-04  5:58         ` Steven Rostedt
2018-12-05  3:34           ` [PATCH v2] " Ravi Bangoria
2018-12-05 10:01             ` Srikar Dronamraju
2018-12-05 14:39             ` Oleg Nesterov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).