public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* another pagetable initialization crash on xen
@ 2011-03-28 17:26 Stefano Stabellini
  2011-03-28 19:04 ` Stefano Stabellini
  0 siblings, 1 reply; 9+ messages in thread
From: Stefano Stabellini @ 2011-03-28 17:26 UTC (permalink / raw)
  To: Yinghai Lu; +Cc: linux-kernel

Hi Yinghai,
unfortunately I found another pagetable initialization bug on xen
affecting linux 2.6.39-rc0.
The problem is that on xen we need to make sure that all the pagetable pages
are mapped read-only, in fact in xen_set_pte we have this check:

if (pfn >= pgt_buf_start && pfn < pgt_buf_end)
    /* make the pte read-only */

however pgt_buf_end is where the kernel pagetable *currently* ends, so
some kernel pagetable pages allocated after pgt_buf_end might be marked
read-write by mistake.  A simple way to fix the issue would be to use
pgt_buf_top instead:

if (pfn >= pgt_buf_start && pfn < pgt_buf_top)
    /* make the pte read-only */

however after building the kernel pagetable in init_memory_mapping we
only reserve memory between pgt_buf_start and pgt_buf_end:

if (!after_bootmem && pgt_buf_end > pgt_buf_start)
        memblock_x86_reserve_range(pgt_buf_start << PAGE_SHIFT,
                 pgt_buf_end << PAGE_SHIFT, "PGTABLE");

so feature allocations might use memory between the final value of
pgt_buf_end and pgt_buf_top that has been marked read-only in the xen
specific code, causing a crash.
The only way I could find to fix the crash is to reserve also the memory
region between pgt_buf_start and pgt_buf_top on xen, but that would
require an ugly if(xen_domain()) at the of init_memory_mapping or
the introduction of a new pvop function to reserve the pagetable memory.
I don't like the idea, but I couldn't find anything better.
Yinghai, do you have any better suggestions?

Thanks,

Stefano

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2011-04-05 13:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-03-28 17:26 another pagetable initialization crash on xen Stefano Stabellini
2011-03-28 19:04 ` Stefano Stabellini
2011-03-29 17:25   ` Stefano Stabellini
2011-03-29 18:15     ` Yinghai Lu
2011-03-30 16:26       ` Stefano Stabellini
2011-03-30 16:59         ` Stefano Stabellini
2011-03-30 17:58           ` Yinghai Lu
2011-04-05 13:47             ` Stefano Stabellini
2011-03-30 16:05     ` Konrad Rzeszutek Wilk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox