https://github.com/torvalds/linux
Revision 06a5e1268a5fb9c2b346a3da6b97e85f2eba0f07 authored by Hugh Dickins on 30 November 2018, 22:10:47 UTC, committed by Linus Torvalds on 30 November 2018, 22:56:15 UTC
collapse_shmem()'s VM_BUG_ON_PAGE(PageTransCompound) was unsafe: before
it holds page lock of the first page, racing truncation then extension
might conceivably have inserted a hugepage there already.  Fail with the
SCAN_PAGE_COMPOUND result, instead of crashing (CONFIG_DEBUG_VM=y) or
otherwise mishandling the unexpected hugepage - though later we might
code up a more constructive way of handling it, with SCAN_SUCCESS.

Link: http://lkml.kernel.org/r/alpine.LSU.2.11.1811261529310.2275@eggly.anvils
Fixes: f3f0e1d2150b2 ("khugepaged: add support of collapse for tmpfs/shmem pages")
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
Cc: Jerome Glisse <jglisse@redhat.com>
Cc: Konstantin Khlebnikov <khlebnikov@yandex-team.ru>
Cc: Matthew Wilcox <willy@infradead.org>
Cc: <stable@vger.kernel.org>	[4.8+]
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 87c460a
History
Tip revision: 06a5e1268a5fb9c2b346a3da6b97e85f2eba0f07 authored by Hugh Dickins on 30 November 2018, 22:10:47 UTC
mm/khugepaged: collapse_shmem() do not crash on Compound
Tip revision: 06a5e12
File Mode Size
apparmor
integrity
keys
loadpin
selinux
smack
tomoyo
yama
Kconfig -rw-r--r-- 9.8 KB
Makefile -rw-r--r-- 1.0 KB
commoncap.c -rw-r--r-- 39.0 KB
device_cgroup.c -rw-r--r-- 20.4 KB
inode.c -rw-r--r-- 10.5 KB
lsm_audit.c -rw-r--r-- 10.6 KB
min_addr.c -rw-r--r-- 1.3 KB
security.c -rw-r--r-- 45.3 KB

back to top