]> git.itanic.dy.fi Git - linux-stable/commit
perf: Break deadlock involving exec_update_mutex
authorpeterz@infradead.org <peterz@infradead.org>
Fri, 28 Aug 2020 12:37:20 +0000 (14:37 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sat, 9 Jan 2021 12:44:54 +0000 (13:44 +0100)
commit71b8355ba667028557a88253096d6991a11abfba
treee1603d0b2b2bca68a6c9fc9678b96f590dc42ea2
parent732251cabeb3bfd917d453a42274d769d6883fc4
perf: Break deadlock involving exec_update_mutex

[ Upstream commit 78af4dc949daaa37b3fcd5f348f373085b4e858f ]

Syzbot reported a lock inversion involving perf. The sore point being
perf holding exec_update_mutex() for a very long time, specifically
across a whole bunch of filesystem ops in pmu::event_init() (uprobes)
and anon_inode_getfile().

This then inverts against procfs code trying to take
exec_update_mutex.

Move the permission checks later, such that we need to hold the mutex
over less code.

Reported-by: syzbot+db9cdf3dd1f64252c6ef@syzkaller.appspotmail.com
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
kernel/events/core.c