linux-uconsole/arch
Mel Gorman ec3918604c x86/mm: Check if PUD is large when validating a kernel address
commit 0ee364eb31 upstream.

A user reported the following oops when a backup process reads
/proc/kcore:

 BUG: unable to handle kernel paging request at ffffbb00ff33b000
 IP: [<ffffffff8103157e>] kern_addr_valid+0xbe/0x110
 [...]

 Call Trace:
  [<ffffffff811b8aaa>] read_kcore+0x17a/0x370
  [<ffffffff811ad847>] proc_reg_read+0x77/0xc0
  [<ffffffff81151687>] vfs_read+0xc7/0x130
  [<ffffffff811517f3>] sys_read+0x53/0xa0
  [<ffffffff81449692>] system_call_fastpath+0x16/0x1b

Investigation determined that the bug triggered when reading
system RAM at the 4G mark. On this system, that was the first
address using 1G pages for the virt->phys direct mapping so the
PUD is pointing to a physical address, not a PMD page.

The problem is that the page table walker in kern_addr_valid() is
not checking pud_large() and treats the physical address as if
it was a PMD.  If it happens to look like pmd_none then it'll
silently fail, probably returning zeros instead of real data. If
the data happens to look like a present PMD though, it will be
walked resulting in the oops above.

This patch adds the necessary pud_large() check.

Unfortunately the problem was not readily reproducible and now
they are running the backup program without accessing
/proc/kcore so the patch has not been validated but I think it
makes sense.

Signed-off-by: Mel Gorman <mgorman@suse.de>
Reviewed-by: Rik van Riel <riel@redhat.coM>
Reviewed-by: Michal Hocko <mhocko@suse.cz>
Acked-by: Johannes Weiner <hannes@cmpxchg.org>
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20130211145236.GX21389@suse.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2013-02-17 10:46:20 -08:00
..
alpha Redefine ATOMIC_INIT and ATOMIC64_INIT to drop the casts 2012-10-02 09:47:25 -07:00
arm ARM: DMA: Fix struct page iterator in dma_cache_maint() to work with sparsemem 2013-02-03 18:21:37 -06:00
avr32 avr32: select generic atomic64_t support 2012-03-12 10:32:57 -07:00
blackfin rtc: fix build warnings in defconfigs 2011-06-15 20:04:02 -07:00
cris CRIS: fix I/O macros 2013-01-11 09:03:49 -08:00
frv Merge branch 'setns' 2011-05-28 10:51:01 -07:00
h8300 Merge branch 'setns' 2011-05-28 10:51:01 -07:00
ia64 random: remove rand_initialize_irq() 2012-08-15 12:04:28 -07:00
m32r Fix node_start/end_pfn() definition for mm/page_cgroup.c 2011-06-27 14:13:09 -07:00
m68k m68k: fix sigset_t accessor functions 2012-11-26 11:34:35 -08:00
microblaze Merge branch 'setns' 2011-05-28 10:51:01 -07:00
mips kbuild: Fix gcc -x syntax 2012-11-26 11:34:37 -08:00
mn10300 mn10300: only add -mmem-funcs to KBUILD_CFLAGS if gcc supports it 2012-10-13 05:28:02 +09:00
parisc PARISC: fix user-triggerable panic on parisc 2012-12-03 12:59:13 -08:00
powerpc powerpc: fix wii_memory_fixups() compile error on 3.0.y tree 2013-01-21 11:44:59 -08:00
s390 s390/time: fix sched_clock() overflow 2013-01-21 11:44:58 -08:00
score score: fix off-by-one index into syscall table 2012-01-25 17:25:04 -08:00
sh sh: Fix FDPIC binary loader 2013-01-21 11:44:58 -08:00
sparc sparc: huge_ptep_set_* functions need to call set_huge_pte_at() 2013-01-11 09:03:47 -08:00
tile arch/tile: avoid generating .eh_frame information in modules 2012-10-28 10:02:10 -07:00
um um: Implement a custom pte_same() function 2012-06-01 15:12:55 +08:00
unicore32 unicore32: using generic-y format for one line asm-generic files 2011-06-09 16:29:52 +08:00
x86 x86/mm: Check if PUD is large when validating a kernel address 2013-02-17 10:46:20 -08:00
xtensa xtensa: prevent arbitrary read in ptrace 2011-08-04 21:58:39 -07:00
.gitignore
Kconfig mm, powerpc: move the RCU page-table freeing into generic code 2011-05-25 08:39:16 -07:00