• KAMEZAWA Hiroyuki's avatar
    kcore: fix vread/vwrite to be aware of holes · d0107eb0
    KAMEZAWA Hiroyuki authored
    vread/vwrite access vmalloc area without checking there is a page or not.
    In most case, this works well.
    In old ages, the caller of get_vm_ara() is only IOREMAP and there is no
    memory hole within vm_struct's [addr...addr + size - PAGE_SIZE] (
    -PAGE_SIZE is for a guard page.)
    After per-cpu-alloc patch, it uses get_vm_area() for reserve continuous
    virtual address but remap _later_.  There tend to be a hole in valid
    vmalloc area in vm_struct lists.  Then, skip the hole (not mapped page) is
    necessary.  This patch updates vread/vwrite() for avoiding memory hole.
    Routines which access vmalloc area without knowing for which addr is used
      - /proc/kcore
      - /dev/kmem
    kcore checks IOREMAP, /dev/kmem doesn't.  After this patch, IOREMAP is
    checked and /dev/kmem will avoid to read/write it.  Fixes to /proc/kcore
    will be in the next patch in series.
    Signed-off-by: default avatarKAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>
    Cc: WANG Cong <xiyou.wangcong@gmail.com>
    Cc: Mike Smith <scgtrp@gmail.com>
    Cc: Nick Piggin <nickpiggin@yahoo.com.au>
    Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
    Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
vmalloc.c 59.2 KB