Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NetBSD domU ksyms issue under xen 4.1.6.1 and 4.2.3, not under 4.1.2



Le 18/11/2013 13:38, FastIce a écrit :
Hello,
we have a similar problem (NetBSD 5.0 VM ).
we found out that the problem comes from the libxen.
in ../<xen>/tools/libxc/xc_dom0.h

Function (start abut line 291):
static inline void *xc_dom_vaddr_to_ptr(struct xc_dom_image *dom,
                                        xen_vaddr_t vaddr,
                                        size_t *safe_region_out)
{
    unsigned int page_size = XC_DOM_PAGE_SIZE(dom);
    xen_pfn_t page = (vaddr - dom->parms.virt_base) / page_size;
    unsigned int offset = (vaddr - dom->parms.virt_base) % page_size;
    xen_pfn_t safe_region_count;
    void *ptr;

    *safe_region_out = 0;
ptr = xc_dom_pfn_to_ptr_retcount(dom, page, 0, &safe_region_count);
    if ( ptr == NULL )
        return ptr;
*safe_region_out = (safe_region_count << XC_DOM_PAGE_SHIFT(dom)) -
offset;
/* RETURN VALUE XEN 4.1.2, libxen > 2.9 */
/*    return ptr; */
/* RETURN VALUE in 2.9 : */
    return (ptr + offset);
}

If you change ther return value back to ptr+offset all should work fine.
In our case it does.
I am not sure if this is a xen bug or a feature.

It looks like the missing offset got lost during the XSA-55 fix [1]. I cannot see a reason why the VA => ptr conversion should not take the offset in the page into account when returning the pointer; besides, the safe_region_out does take offset into account in case the upper limit is checked.

I will ask xen-devel@. Thanks for looking into it :)

[1] http://xenbits.xen.org/gitweb/?p=xen.git;a=blobdiff;f=tools/libxc/xc_dom.h;h=ad6fdd49e2b07704c07a0629bf8da59bfdb5fef2;hp=316c5cbefca4f791255bb43f5dcf4085d42d5869;hb=b5a869209998fedadfe205d37addbd50a802998b;hpb=53bfcf585b09eb4ac2240f89d1ade77421cd2451

--
Jean-Yves Migeon


Home | Main Index | Thread Index | Old Index