https://github.com/torvalds/linux
Revision 655548bf6271b212cd1e4c259da9dbe616348d38 authored by Kirill A. Shutemov on 30 November 2016, 23:54:05 UTC, committed by Linus Torvalds on 01 December 2016, 00:32:52 UTC
The following program triggers BUG() in munlock_vma_pages_range(): // autogenerated by syzkaller (http://github.com/google/syzkaller) #include <sys/mman.h> int main() { mmap((void*)0x20105000ul, 0xc00000ul, 0x2ul, 0x2172ul, -1, 0); mremap((void*)0x201fd000ul, 0x4000ul, 0xc00000ul, 0x3ul, 0x203f0000ul); return 0; } The test-case constructs the situation when munlock_vma_pages_range() finds PTE-mapped THP-head in the middle of page table and, by mistake, skips HPAGE_PMD_NR pages after that. As result, on the next iteration it hits the middle of PMD-mapped THP and gets upset seeing mlocked tail page. The solution is only skip HPAGE_PMD_NR pages if the THP was mlocked during munlock_vma_page(). It would guarantee that the page is PMD-mapped as we never mlock PTE-mapeed THPs. Fixes: e90309c9f772 ("thp: allow mlocked THP again") Link: http://lkml.kernel.org/r/20161115132703.7s7rrgmwttegcdh4@black.fi.intel.com Signed-off-by: Kirill A. Shutemov <kirill.shutemov@linux.intel.com> Reported-by: Dmitry Vyukov <dvyukov@google.com> Cc: Konstantin Khlebnikov <koct9i@gmail.com> Cc: Andrey Ryabinin <aryabinin@virtuozzo.com> Cc: syzkaller <syzkaller@googlegroups.com> Cc: Andrea Arcangeli <aarcange@redhat.com> Cc: <stable@vger.kernel.org> [4.5+] Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent e1465d1
Tip revision: 655548bf6271b212cd1e4c259da9dbe616348d38 authored by Kirill A. Shutemov on 30 November 2016, 23:54:05 UTC
thp: fix corner case of munlock() of PTE-mapped THPs
thp: fix corner case of munlock() of PTE-mapped THPs
Tip revision: 655548b
File | Mode | Size |
---|---|---|
bebob | ||
dice | ||
digi00x | ||
fireworks | ||
oxfw | ||
tascam | ||
Kconfig | -rw-r--r-- | 4.1 KB |
Makefile | -rw-r--r-- | 548 bytes |
amdtp-am824.c | -rw-r--r-- | 12.7 KB |
amdtp-am824.h | -rw-r--r-- | 1.6 KB |
amdtp-stream-trace.h | -rw-r--r-- | 3.2 KB |
amdtp-stream.c | -rw-r--r-- | 23.9 KB |
amdtp-stream.h | -rw-r--r-- | 7.2 KB |
cmp.c | -rw-r--r-- | 9.4 KB |
cmp.h | -rw-r--r-- | 1.4 KB |
fcp.c | -rw-r--r-- | 10.3 KB |
fcp.h | -rw-r--r-- | 1.0 KB |
isight.c | -rw-r--r-- | 17.6 KB |
iso-resources.c | -rw-r--r-- | 6.4 KB |
iso-resources.h | -rw-r--r-- | 1.2 KB |
lib.c | -rw-r--r-- | 7.1 KB |
lib.h | -rw-r--r-- | 2.0 KB |
packets-buffer.c | -rw-r--r-- | 2.1 KB |
packets-buffer.h | -rw-r--r-- | 747 bytes |
![swh spinner](/static/img/swh-spinner.gif)
Computing file changes ...