On 27/09/16 14:09, Sven Köhler wrote:
> Am 27.09.2016 um 14:02 schrieb Juergen Gross:
>> On 27/09/16 13:13, Sven Köhler wrote:
>>> Am 27.09.2016 um 07:31 schrieb Juergen Gross:
>>>> On 27/09/16 00:48, Sven Köhler wrote:
>>>>> Am 26.09.2016 um 07:43 schrieb Juergen Gross:
>>>>>> On 25/09/16 18:04, Sven Köhler wrote:
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm experiencing the bug below which was discussed on xen-devel December
>>>>>>> last year buy Ian and Juergen. I'm using xen-pvgrub-4.7.0 on Gentoo.
>>>>>>>
>>>>>>> The bug only seems to occur with the last domU booted on my machine.
>>>>>>> Where do I find a patch that fixes that?
>>>>>>
>>>>>> The issue back in December was fixed by commit
>>>>>> c8eb0ec277ae387e78d685523e0fee633e46f046 which is included in Xen 4.7.
>>>>>> Either gentoo didn't update to the official Xen 4.7 release (including
>>>>>> pvgrub) or you are seeing a new issue.
>>>>>
>>>>> From the looks of it, the Gentoo package is using the grub from the
>>>>> xen-4.7.0 tarball.
>>>>>
>>>>> I downgraded to pvgrub 4.6.3 and the problem went away.
>>>>>
>>>>> So I assume I'm seeing a new issue. How do I debug it?
>>>>
>>>> Interesting. Just tested it on upstream Xen and saw the same problem
>>>> with a rather old guest kernel (3.0 based, xen flavor), while a newer
>>>> kernel (4.1, pvops) is working.
>>>>
>>>> Can you give me some more details about the kernel you are trying to
>>>> boot?
>>>
>>> It's an unmodified 4.4.21 kernel which I compile by hand. The config is
>>> attached. Does that help?
>>
>> Not really. OTOH I think I don't need more help, as I've found a problem
>> in pvgrub. I have a patch which seems to correct the issue. Are you fine
>> with me adding you as the original reporter of the problem in the patch?
> 
> Yes, I'm fine with adding me as the reporter.
> Do you want me to test the patch first?

Sure. The attached patch is for Xen upstream, but I think it should
apply to Xen 4.7, too.


Juergen

>From 62a69c20e2184a630efdaff87ddbb768d75c73be Mon Sep 17 00:00:00 2001
From: Juergen Gross <jgr...@suse.com>
Date: Tue, 27 Sep 2016 14:03:09 +0200
Subject: [PATCH] pvgrub: fix crash when booting kernel with p2m list outside
 kernel mapping

When trying to boot a kernel with the p2m list not mapped by the
initial kernel mapping it can happen that pvgrub is failing as it is
keeping some page tables mapped.

Unmap the additional page tables created for the special p2m mapping
will avoid this failure.

Reported-by: Sven Koehler <sven.koeh...@gmail.com>
Signed-off-by: Juergen Gross <jgr...@suse.com>
---
This is a backport candidate for 4.7
---
 stubdom/grub/kexec.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/stubdom/grub/kexec.c b/stubdom/grub/kexec.c
index 2ed4f6c..437a0a9 100644
--- a/stubdom/grub/kexec.c
+++ b/stubdom/grub/kexec.c
@@ -347,6 +347,8 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
     /* Unmap libxc's projection of the boot page table */
     seg = xc_dom_seg_to_ptr(dom, &dom->pgtables_seg);
     munmap(seg, dom->pgtables_seg.vend - dom->pgtables_seg.vstart);
+    seg = xc_dom_seg_to_ptr(dom, &dom->p2m_seg);
+    munmap(seg, dom->p2m_seg.vend - dom->p2m_seg.vstart);
 
     /* Unmap day0 pages to avoid having a r/w mapping of the future page table */
     for (pfn = 0; pfn < allocated; pfn++)
-- 
2.6.6

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xen.org
https://lists.xen.org/xen-devel

Reply via email to