Re: [PATCH] x86: fix PAE pmd_bad bootup warning

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Nishanth Aravamudan
Date: Thursday, May 8, 2008 - 10:16 am

On 08.05.2008 [18:51:11 +0200], Hans Rosenfeld wrote:

Right, I agree *if* we allow huge pages in the walker. But AIUI, things
are broken now with hugepages in the process' address space. This is a
bug upstream and leads to hugepages leaking out of the kernel when
/proc/pid/pagemap is read. Why not, instead (as a short-term fix), skip
hugepage mappings altogether in the page-walker code?

Hrm, upon further investigation, this seems to be a pretty clear
limitation of walk_page_range(). One that is avoided in the other two
callers, i.e.

static int show_smap(struct seq_file *m, void *v)
{
...
	if (vma->vm_mm && !is_vm_hugetlb_page(vma))
		walk_page_range(vma->vm_mm, vma->vm_start, vma->vm_end,
				&smaps_walk, &mss);
...
}

static ssize_t clear_refs_write(struct file *file, const char __user *buf,
				size_t count, loff_t *ppos)
{
...
		for (vma = mm->mmap; vma; vma = vma->vm_next)
			if (!is_vm_hugetlb_page(vma))
				walk_page_range(mm, vma->vm_start, vma->vm_end,
						&clear_refs_walk, vma);
...
}

No such protection exists for

static ssize_t pagemap_read(struct file *file, char __user *buf,
			    size_t count, loff_t *ppos);

So, is there any way to either add a is_vm_hugetlb_page(vma) check into
pagemap_read()? Or can we modify walk_page_range to take the a vma and
skip the walking if is_vm_hugetlb_page(vma) is set [to avoid
complications down the road until hugepage walking is fixed]. I guess
the latter isn't possible for pagemap_read(), since we are just looking
at arbitrary addresses in the process space?

Dunno, seems quite clear that the bug is in pagemap_read(), not any
hugepage code, and that the simplest fix is to make pagemap_read() do
what the other walker-callers do, and skip hugepage regions.

Thanks,
Nish

-- 
Nishanth Aravamudan <nacc@us.ibm.com>
IBM Linux Technology Center
--
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Jeff Chua, (Mon May 5, 6:06 pm)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Ingo Molnar, (Tue May 6, 5:49 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Hugh Dickins, (Tue May 6, 6:56 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Ingo Molnar, (Tue May 6, 8:04 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Linus Torvalds, (Tue May 6, 8:09 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Ingo Molnar, (Tue May 6, 8:15 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Jeremy Fitzhardinge, (Tue May 6, 8:32 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Hugh Dickins, (Tue May 6, 9:12 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Linus Torvalds, (Tue May 6, 9:16 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Ingo Molnar, (Tue May 6, 9:30 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Linus Torvalds, (Tue May 6, 11:39 am)
Re: Linux 2.6.26-rc1 - pgtable_32.c:178 pmd_bad, Hugh Dickins, (Tue May 6, 12:43 pm)
[PATCH] x86: fix PAE pmd_bad bootup warning, Hugh Dickins, (Tue May 6, 12:49 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Linus Torvalds, (Tue May 6, 1:06 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hans Rosenfeld, (Tue May 6, 1:22 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hugh Dickins, (Tue May 6, 1:30 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hugh Dickins, (Tue May 6, 1:36 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Tue May 6, 1:42 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Jeff Chua, (Tue May 6, 9:40 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hugh Dickins, (Tue May 6, 10:30 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Nishanth Aravamudan, (Wed May 7, 4:39 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hans Rosenfeld, (Thu May 8, 7:34 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hans Rosenfeld, (Thu May 8, 7:39 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Thu May 8, 7:52 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hans Rosenfeld, (Thu May 8, 8:11 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Nishanth Aravamudan, (Thu May 8, 8:44 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Thu May 8, 8:51 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Nishanth Aravamudan, (Thu May 8, 9:07 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hans Rosenfeld, (Thu May 8, 9:19 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Nishanth Aravamudan, (Thu May 8, 9:33 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Thu May 8, 9:42 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hans Rosenfeld, (Thu May 8, 9:51 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Nishanth Aravamudan, (Thu May 8, 10:16 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Thu May 8, 11:42 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hugh Dickins, (Thu May 8, 11:48 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hugh Dickins, (Thu May 8, 11:58 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Thu May 8, 12:06 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Matt Mackall, (Thu May 8, 12:49 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Hans Rosenfeld, (Thu May 8, 1:02 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Thu May 8, 1:08 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Thu May 8, 1:16 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Dave Hansen, (Thu May 8, 4:15 pm)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Paul Mundt, (Fri May 9, 2:03 am)
Re: [PATCH] x86: fix PAE pmd_bad bootup warning, Matt Mackall, (Wed May 14, 12:01 pm)