Kirill A. Shutemov
d7af03159b
shmem: pin the file in shmem_fault() if mmap_sem is dropped
...
[ Upstream commit 8897c1b1a1795cab23d5ac13e4e23bf0b5f4e0c6 ]
syzbot found the following crash:
BUG: KASAN: use-after-free in perf_trace_lock_acquire+0x401/0x530 include/trace/events/lock.h:13
Read of size 8 at addr ffff8880a5cf2c50 by task syz-executor.0/26173
CPU: 0 PID: 26173 Comm: syz-executor.0 Not tainted 5.3.0-rc6 #146
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
perf_trace_lock_acquire+0x401/0x530 include/trace/events/lock.h:13
trace_lock_acquire include/trace/events/lock.h:13 [inline]
lock_acquire+0x2de/0x410 kernel/locking/lockdep.c:4411
__raw_spin_lock include/linux/spinlock_api_smp.h:142 [inline]
_raw_spin_lock+0x2f/0x40 kernel/locking/spinlock.c:151
spin_lock include/linux/spinlock.h:338 [inline]
shmem_fault+0x5ec/0x7b0 mm/shmem.c:2034
__do_fault+0x111/0x540 mm/memory.c:3083
do_shared_fault mm/memory.c:3535 [inline]
do_fault mm/memory.c:3613 [inline]
handle_pte_fault mm/memory.c:3840 [inline]
__handle_mm_fault+0x2adf/0x3f20 mm/memory.c:3964
handle_mm_fault+0x1b5/0x6b0 mm/memory.c:4001
do_user_addr_fault arch/x86/mm/fault.c:1441 [inline]
__do_page_fault+0x536/0xdd0 arch/x86/mm/fault.c:1506
do_page_fault+0x38/0x590 arch/x86/mm/fault.c:1530
page_fault+0x39/0x40 arch/x86/entry/entry_64.S:1202
It happens if the VMA got unmapped under us while we dropped mmap_sem
and inode got freed.
Pinning the file if we drop mmap_sem fixes the issue.
Link: http://lkml.kernel.org/r/20190927083908.rhifa4mmaxefc24r@box
Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Reported-by: syzbot+03ee87124ee05af991bd@syzkaller.appspotmail.com
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Reviewed-by: Matthew Wilcox (Oracle) <willy@infradead.org>
Cc: Hillf Danton <hdanton@sina.com>
Cc: Hugh Dickins <hughd@google.com>
Cc: Josef Bacik <josef@toxicpanda.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2020-01-09 10:19:54 +01:00
..
2019-09-24 15:54:08 -07:00
2019-10-06 09:11:35 -06:00
2019-09-04 07:42:01 -04:00
2019-07-12 12:24:03 -07:00
2019-05-14 09:47:45 -07:00
2019-07-16 19:23:21 -07:00
2019-10-14 15:04:01 -07:00
2019-11-15 18:34:00 -08:00
2019-07-12 11:05:46 -07:00
2019-08-30 22:43:58 -07:00
2019-07-12 11:05:43 -07:00
2019-10-19 06:32:32 -04:00
2019-09-25 17:51:41 -07:00
2019-06-19 17:09:52 +02:00
2019-05-14 09:47:45 -07:00
2019-10-19 06:32:32 -04:00
2018-12-28 12:11:47 -08:00
2019-09-07 04:28:04 -03:00
2019-10-19 06:32:32 -04:00
2019-11-15 18:34:00 -08:00
2019-10-19 06:32:32 -04:00
2019-06-03 15:39:40 +02:00
2019-10-19 06:32:32 -04:00
2019-09-25 17:51:41 -07:00
2019-06-19 17:09:08 +02:00
2019-09-24 15:54:11 -07:00
2019-09-24 15:54:08 -07:00
2019-11-15 18:34:00 -08:00
2019-06-05 17:37:06 +02:00
2019-10-14 08:56:16 -07:00
2019-11-22 09:11:18 -08:00
2019-07-12 11:05:44 -07:00
2019-07-18 11:51:00 -07:00
2019-11-15 18:33:59 -08:00
2019-09-24 15:54:10 -07:00
2019-10-19 06:32:32 -04:00
2019-11-15 18:34:00 -08:00
2019-09-24 15:54:08 -07:00
2019-11-22 09:11:18 -08:00
2019-10-19 06:32:31 -04:00
2019-09-24 15:54:09 -07:00
2019-11-15 18:33:59 -08:00
2019-03-05 21:07:20 -08:00
2019-10-19 06:32:32 -04:00
2019-09-25 17:51:41 -07:00
2019-09-25 17:51:41 -07:00
2019-09-25 17:51:41 -07:00
2019-05-21 10:50:45 +02:00
2019-09-25 17:51:41 -07:00
2019-09-24 15:54:09 -07:00
2019-11-06 08:47:50 -08:00
2019-09-25 17:51:41 -07:00
2019-09-25 17:51:41 -07:00
2019-09-25 17:51:41 -07:00
2019-09-24 15:54:08 -07:00
2019-09-25 17:51:41 -07:00
2019-11-06 08:47:50 -08:00
2018-06-07 17:34:36 -07:00
2019-10-14 15:04:00 -07:00
2019-06-29 16:43:45 +08:00
2019-11-15 18:34:00 -08:00
2019-07-12 11:05:43 -07:00
2019-10-19 06:32:31 -04:00
2019-09-24 15:54:08 -07:00
2019-09-24 15:54:08 -07:00
2019-08-27 09:22:38 -06:00
2019-09-07 04:28:04 -03:00
2019-03-13 12:25:31 -07:00
2019-06-05 17:37:16 +02:00
2019-06-05 17:37:16 +02:00
2019-06-05 17:37:16 +02:00
2019-09-04 13:40:49 -07:00
2018-10-09 16:51:11 +02:00
2019-05-30 11:26:32 -07:00
2019-05-21 10:50:45 +02:00
2019-10-19 06:32:32 -04:00
2019-06-05 17:37:17 +02:00
2020-01-09 10:19:54 +01:00
2019-10-07 15:47:19 -07:00
2019-05-14 19:52:48 -07:00
2019-12-17 19:56:49 +01:00
2019-10-14 15:04:01 -07:00
2019-11-06 08:47:50 -08:00
2019-10-07 15:47:20 -07:00
2019-11-15 18:34:00 -08:00
2019-07-18 17:08:07 -07:00
2019-10-07 15:47:19 -07:00
2018-08-22 10:52:44 -07:00
2019-09-24 15:54:08 -07:00
2019-09-25 17:51:41 -07:00
2019-08-20 07:55:16 -07:00
2019-10-19 06:32:33 -04:00
2019-09-17 15:20:17 -07:00
2019-06-19 17:09:53 +02:00
2019-09-24 15:54:11 -07:00
2018-09-13 15:18:04 -10:00
2019-09-25 17:51:39 -07:00
2019-10-07 15:47:19 -07:00
2019-12-31 16:46:07 +01:00
2019-11-06 08:47:50 -08:00
2019-08-13 16:06:52 -07:00
2019-10-07 15:47:19 -07:00
2019-05-21 10:50:45 +02:00
2019-09-24 15:54:12 -07:00
2019-09-24 15:54:12 -07:00
2019-09-24 15:54:12 -07:00