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
include
.gitignore -rw-r--r-- 74 bytes
Kconfig -rw-r--r-- 2.8 KB
Makefile -rw-r--r-- 4.1 KB
apparmorfs.c -rw-r--r-- 62.9 KB
audit.c -rw-r--r-- 5.5 KB
capability.c -rw-r--r-- 4.2 KB
crypto.c -rw-r--r-- 2.5 KB
domain.c -rw-r--r-- 38.8 KB
file.c -rw-r--r-- 19.4 KB
ipc.c -rw-r--r-- 6.1 KB
label.c -rw-r--r-- 50.6 KB
lib.c -rw-r--r-- 13.1 KB
lsm.c -rw-r--r-- 44.3 KB
match.c -rw-r--r-- 18.6 KB
mount.c -rw-r--r-- 17.8 KB
net.c -rw-r--r-- 5.6 KB
nulldfa.in -rw-r--r-- 6.8 KB
path.c -rw-r--r-- 6.2 KB
policy.c -rw-r--r-- 31.7 KB
policy_ns.c -rw-r--r-- 9.9 KB
policy_unpack.c -rw-r--r-- 26.2 KB
procattr.c -rw-r--r-- 3.7 KB
resource.c -rw-r--r-- 5.2 KB
secid.c -rw-r--r-- 3.6 KB
stacksplitdfa.in -rw-r--r-- 7.3 KB
task.c -rw-r--r-- 4.3 KB

back to top