[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181114081921.26484-1-ravi.bangoria@linux.ibm.com>
Date: Wed, 14 Nov 2018 13:49:21 +0530
From: Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
To: srikar@...ux.vnet.ibm.com, oleg@...hat.com, rostedt@...dmis.org,
mhiramat@...nel.org, liu.song.a23@...il.com
Cc: peterz@...radead.org, mingo@...hat.com, acme@...nel.org,
alexander.shishkin@...ux.intel.com, jolsa@...hat.com,
namhyung@...nel.org, linux-kernel@...r.kernel.org,
ananth@...ux.vnet.ibm.com, alexis.berlemont@...il.com,
naveen.n.rao@...ux.vnet.ibm.com,
linux-arm-kernel@...ts.infradead.org, linux-mips@...ux-mips.org,
linux@...linux.org.uk, ralf@...ux-mips.org, paul.burton@...s.com,
Ravi Bangoria <ravi.bangoria@...ux.ibm.com>
Subject: [PATCH] Uprobes: Fix kernel oops with delayed_uprobe_remove()
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@...kaller.appspotmail.com
Signed-off-by: Ravi Bangoria <ravi.bangoria@...ux.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
Powered by blists - more mailing lists