PaX Team wrote:unfortunately i won't have time to look into xen anytime soon, so unless you guys do some background research on what xen complains about, i won't be able to fix the problems (if it's on the PaX side at all, that is).
Ok, I've spent all day trying to do some background research. I haven't gotten far, but thought I would share anyway. The PaX patched kernel is calling BUG() in pin_pagetable_pfn in arch/x86/xen/enlighten.c, line 836. The call stack is as follows:
arch/x86/xen/enlighten.c:1711 xen_start_kernel calls xen_setup_kernel_pagetable
arch/x86/xen/enlighten.c:1600 xen_setup_kernel_pagetable calls pin_pagetable_pfn
arch/x86/xen/enlighten.c:836 pin_pagetable_pfn calls BUG()
I found this thread here:
viewtopic.php?f=1&t=1913, however that seemed to be a different issue. Perhaps because I am using a later version of xen (3.3.0). In that thread, the rodata apparently got lost when the kernel was relocated and the kernel was bailing out at arch/x86/xen/enlighten.c:1667. A 2.6.27 x86_64 kernel under xen-3.3.0 passes this point so the rodata is being relocated correctly.
I have connected to both a PaX and vanilla 2.6.27.3 kernel with gdbserver-xen and traced through them both simultaneously looking for something obviously different. Nothing stood out though. I.e. one didn't have a null pointer argument while the other didn't etc. The only difference was slightly different parameters to functions called which I initially thought were due to the different size of the kernel data structures etc. Those variations were apparently important however since the vanilla kernel boots while the PaX kernel doesn't.
When the PaX guest VM calls HYPERVISOR_mmuext_op (from arch/x86/xen/enlighten.c:835), the xen hypervisor prints the following error:
(XEN) mm.c:2006:d21 Bad type (saw 00000000e8000001 != exp 0000000060000000) for mfn 12b9c9 (pfn 328)
(XEN) mm.c:794:d21 Attempt to create linear p.t. with write perms
(XEN) mm.c:1275:d21 Failure in alloc_l4_table: entry 388
(XEN) mm.c:2041:d21 Error while validating mfn 12b9cb (pfn 326) for type 0000000080000000: caf=80000003 taf=0000000080000001
(XEN) mm.c:2331:d21 Error while pinning mfn 12b9cb
Any tips on where to go from here? I'm guessing I need to dig deeper as to what happening with HYPERVISOR_mmuext_op and find out exactly what the xen hypervisor is expecting.