Revision eecc1e426d681351a6026a7d3e7d225f38955b6c authored by Hugh Dickins on 12 January 2014, 09:25:21 UTC, committed by Linus Torvalds on 12 January 2014, 09:47:15 UTC
We see General Protection Fault on RSI in copy_page_rep: that RSI is
what you get from a NULL struct page pointer.

  RIP: 0010:[<ffffffff81154955>]  [<ffffffff81154955>] copy_page_rep+0x5/0x10
  RSP: 0000:ffff880136e15c00  EFLAGS: 00010286
  RAX: ffff880000000000 RBX: ffff880136e14000 RCX: 0000000000000200
  RDX: 6db6db6db6db6db7 RSI: db73880000000000 RDI: ffff880dd0c00000
  RBP: ffff880136e15c18 R08: 0000000000000200 R09: 000000000005987c
  R10: 000000000005987c R11: 0000000000000200 R12: 0000000000000001
  R13: ffffea00305aa000 R14: 0000000000000000 R15: 0000000000000000
  FS:  00007f195752f700(0000) GS:ffff880c7fc20000(0000) knlGS:0000000000000000
  CS:  0010 DS: 0000 ES: 0000 CR0: 0000000080050033
  CR2: 0000000093010000 CR3: 00000001458e1000 CR4: 00000000000027e0
  Call Trace:
    copy_user_huge_page+0x93/0xab
    do_huge_pmd_wp_page+0x710/0x815
    handle_mm_fault+0x15d8/0x1d70
    __do_page_fault+0x14d/0x840
    do_page_fault+0x2f/0x90
    page_fault+0x22/0x30

do_huge_pmd_wp_page() tests is_huge_zero_pmd(orig_pmd) four times: but
since shrink_huge_zero_page() can free the huge_zero_page, and we have
no hold of our own on it here (except where the fourth test holds
page_table_lock and has checked pmd_same), it's possible for it to
answer yes the first time, but no to the second or third test.  Change
all those last three to tests for NULL page.

(Note: this is not the same issue as trinity's DEBUG_PAGEALLOC BUG
in copy_page_rep with RSI: ffff88009c422000, reported by Sasha Levin
in https://lkml.org/lkml/2013/3/29/103.  I believe that one is due
to the source page being split, and a tail page freed, while copy
is in progress; and not a problem without DEBUG_PAGEALLOC, since
the pmd_same check will prevent a miscopy from being made visible.)

Fixes: 97ae17497e99 ("thp: implement refcounting for huge zero page")
Signed-off-by: Hugh Dickins <hughd@google.com>
Cc: stable@vger.kernel.org # v3.10 v3.11 v3.12
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 518d00b
History
File Mode Size
Kconfig -rw-r--r-- 19.0 KB
Kconfig.debug -rw-r--r-- 1015 bytes
Makefile -rw-r--r-- 2.0 KB
backing-dev.c -rw-r--r-- 16.5 KB
balloon_compaction.c -rw-r--r-- 9.6 KB
bootmem.c -rw-r--r-- 20.8 KB
bounce.c -rw-r--r-- 6.4 KB
cleancache.c -rw-r--r-- 12.7 KB
compaction.c -rw-r--r-- 32.5 KB
debug-pagealloc.c -rw-r--r-- 2.1 KB
dmapool.c -rw-r--r-- 13.1 KB
fadvise.c -rw-r--r-- 3.6 KB
failslab.c -rw-r--r-- 1.3 KB
filemap.c -rw-r--r-- 67.7 KB
filemap_xip.c -rw-r--r-- 11.3 KB
fremap.c -rw-r--r-- 6.8 KB
frontswap.c -rw-r--r-- 13.5 KB
highmem.c -rw-r--r-- 9.9 KB
huge_memory.c -rw-r--r-- 77.4 KB
hugetlb.c -rw-r--r-- 92.1 KB
hugetlb_cgroup.c -rw-r--r-- 10.4 KB
hwpoison-inject.c -rw-r--r-- 3.3 KB
init-mm.c -rw-r--r-- 619 bytes
internal.h -rw-r--r-- 11.2 KB
interval_tree.c -rw-r--r-- 3.2 KB
kmemcheck.c -rw-r--r-- 2.8 KB
kmemleak-test.c -rw-r--r-- 3.3 KB
kmemleak.c -rw-r--r-- 52.5 KB
ksm.c -rw-r--r-- 65.8 KB
list_lru.c -rw-r--r-- 3.1 KB
maccess.c -rw-r--r-- 1.6 KB
madvise.c -rw-r--r-- 14.2 KB
memblock.c -rw-r--r-- 33.1 KB
memcontrol.c -rw-r--r-- 187.6 KB
memory-failure.c -rw-r--r-- 46.2 KB
memory.c -rw-r--r-- 115.7 KB
memory_hotplug.c -rw-r--r-- 48.4 KB
mempolicy.c -rw-r--r-- 74.7 KB
mempool.c -rw-r--r-- 10.5 KB
migrate.c -rw-r--r-- 47.5 KB
mincore.c -rw-r--r-- 7.8 KB
mlock.c -rw-r--r-- 22.3 KB
mm_init.c -rw-r--r-- 5.0 KB
mmap.c -rw-r--r-- 85.9 KB
mmu_context.c -rw-r--r-- 1.2 KB
mmu_notifier.c -rw-r--r-- 9.5 KB
mmzone.c -rw-r--r-- 2.4 KB
mprotect.c -rw-r--r-- 9.7 KB
mremap.c -rw-r--r-- 14.8 KB
msync.c -rw-r--r-- 2.4 KB
nobootmem.c -rw-r--r-- 10.5 KB
nommu.c -rw-r--r-- 53.1 KB
oom_kill.c -rw-r--r-- 19.6 KB
page-writeback.c -rw-r--r-- 75.5 KB
page_alloc.c -rw-r--r-- 178.8 KB
page_cgroup.c -rw-r--r-- 11.9 KB
page_io.c -rw-r--r-- 8.9 KB
page_isolation.c -rw-r--r-- 7.5 KB
pagewalk.c -rw-r--r-- 5.9 KB
percpu-km.c -rw-r--r-- 2.8 KB
percpu-vm.c -rw-r--r-- 12.9 KB
percpu.c -rw-r--r-- 57.1 KB
pgtable-generic.c -rw-r--r-- 5.2 KB
process_vm_access.c -rw-r--r-- 13.2 KB
quicklist.c -rw-r--r-- 2.4 KB
readahead.c -rw-r--r-- 16.0 KB
rmap.c -rw-r--r-- 50.7 KB
shmem.c -rw-r--r-- 78.6 KB
slab.c -rw-r--r-- 109.8 KB
slab.h -rw-r--r-- 7.4 KB
slab_common.c -rw-r--r-- 15.4 KB
slob.c -rw-r--r-- 15.7 KB
slub.c -rw-r--r-- 126.0 KB
sparse-vmemmap.c -rw-r--r-- 5.9 KB
sparse.c -rw-r--r-- 20.8 KB
swap.c -rw-r--r-- 26.3 KB
swap_state.c -rw-r--r-- 11.4 KB
swapfile.c -rw-r--r-- 76.5 KB
truncate.c -rw-r--r-- 19.5 KB
util.c -rw-r--r-- 9.8 KB
vmalloc.c -rw-r--r-- 67.9 KB
vmpressure.c -rw-r--r-- 11.7 KB
vmscan.c -rw-r--r-- 106.8 KB
vmstat.c -rw-r--r-- 34.9 KB
zbud.c -rw-r--r-- 15.9 KB
zswap.c -rw-r--r-- 24.1 KB

back to top