1
0
Files
linux/arch/x86/include/asm
Mel Gorman 0ee364eb31 x86/mm: Check if PUD is large when validating a kernel address
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: stable@vger.kernel.org
Cc: linux-mm@kvack.org
Link: http://lkml.kernel.org/r/20130211145236.GX21389@suse.de
Signed-off-by: Ingo Molnar <mingo@kernel.org>
2013-02-13 10:02:55 +01:00
..
2011-08-29 13:44:12 -07:00
2012-11-29 13:23:02 -08:00
2012-03-28 18:11:12 +01:00
2012-09-19 17:26:08 +02:00
2012-03-28 18:11:12 +01:00
2012-03-28 18:11:12 +01:00
2012-11-14 15:28:11 -08:00
2011-05-02 17:24:48 +02:00
2012-03-28 18:11:12 +01:00
2012-11-29 13:23:02 -08:00
2011-04-18 09:26:48 -07:00
2012-03-20 21:48:30 +08:00
2012-12-19 18:07:41 -05:00
2011-11-11 10:22:55 +01:00
2010-10-26 16:52:08 -07:00
2012-06-25 13:48:30 +02:00
2011-02-23 22:27:52 +01:00
2011-07-22 14:39:50 +09:30
2011-05-24 14:33:35 +02:00
2012-11-29 13:23:02 -08:00
2013-01-09 14:49:02 +01:00
2012-01-26 21:23:53 +01:00
2010-11-01 15:38:34 -04:00
2012-12-11 14:28:35 +00:00
2011-03-15 15:34:15 -07:00
2011-08-29 13:44:12 -07:00
2012-02-20 12:52:05 -08:00
2012-03-28 18:11:12 +01:00
2012-12-19 18:07:41 -05:00
2012-03-28 18:11:12 +01:00
2011-06-05 21:30:32 +02:00
2012-09-21 17:18:44 -07:00