jym@NetBSD.org
2013-Nov-29 10:39 UTC
[PATCH] Fix ptr calculation when converting from a VA
From: Jean-Yves Migeon <jym@NetBSD.org> The ptr calculation shall take the offset into the page into account when ptr is valid. Reported regression on NetBSD''s port-xen with last known working libxen being rev 2.9. This corrupts the kernel symbol table when the table is not loaded on a page boundary. Issue was tracked down by FastIce and Jeff Rizzo. See also http://mail-index.netbsd.org/port-xen/2013/10/16/msg008088.html Signed-off-by: Jean-Yves Migeon <jym@NetBSD.org> --- tools/libxc/xc_dom.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/libxc/xc_dom.h b/tools/libxc/xc_dom.h index a183e62..7099cee 100644 --- a/tools/libxc/xc_dom.h +++ b/tools/libxc/xc_dom.h @@ -342,7 +342,7 @@ static inline void *xc_dom_vaddr_to_ptr(struct xc_dom_image *dom, if ( ptr == NULL ) return ptr; *safe_region_out = (safe_region_count << XC_DOM_PAGE_SHIFT(dom)) - offset; - return ptr; + return ptr + offset; } static inline xen_pfn_t xc_dom_p2m_host(struct xc_dom_image *dom, xen_pfn_t pfn) -- 1.8.1.5
Jan Beulich
2013-Nov-29 10:54 UTC
Re: [PATCH] Fix ptr calculation when converting from a VA
>>> On 29.11.13 at 11:39, <jym@NetBSD.org> wrote: > From: Jean-Yves Migeon <jym@NetBSD.org> > > The ptr calculation shall take the offset into the page into account > when ptr is valid. > > Reported regression on NetBSD''s port-xen with last known working libxen > being rev 2.9. This corrupts the kernel symbol table when the table is > not loaded on a page boundary. > > Issue was tracked down by FastIce and Jeff Rizzo. See also > http://mail-index.netbsd.org/port-xen/2013/10/16/msg008088.html > > Signed-off-by: Jean-Yves Migeon <jym@NetBSD.org>Reviewed-by: Jan Beulich <jbeulich@suse.com>> --- > tools/libxc/xc_dom.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/tools/libxc/xc_dom.h b/tools/libxc/xc_dom.h > index a183e62..7099cee 100644 > --- a/tools/libxc/xc_dom.h > +++ b/tools/libxc/xc_dom.h > @@ -342,7 +342,7 @@ static inline void *xc_dom_vaddr_to_ptr(struct > xc_dom_image *dom, > if ( ptr == NULL ) > return ptr; > *safe_region_out = (safe_region_count << XC_DOM_PAGE_SHIFT(dom)) - offset; > - return ptr; > + return ptr + offset; > } > > static inline xen_pfn_t xc_dom_p2m_host(struct xc_dom_image *dom, xen_pfn_t > pfn) > -- > 1.8.1.5 > > > _______________________________________________ > Xen-devel mailing list > Xen-devel@lists.xen.org > http://lists.xen.org/xen-devel
Ian Campbell
2013-Nov-29 11:33 UTC
Re: [PATCH] Fix ptr calculation when converting from a VA
On Fri, 2013-11-29 at 10:54 +0000, Jan Beulich wrote:> >>> On 29.11.13 at 11:39, <jym@NetBSD.org> wrote: > > From: Jean-Yves Migeon <jym@NetBSD.org> > > > > The ptr calculation shall take the offset into the page into account > > when ptr is valid. > > > > Reported regression on NetBSD''s port-xen with last known working libxen > > being rev 2.9. This corrupts the kernel symbol table when the table is > > not loaded on a page boundary. > > > > Issue was tracked down by FastIce and Jeff Rizzo. See also > > http://mail-index.netbsd.org/port-xen/2013/10/16/msg008088.html > > > > Signed-off-by: Jean-Yves Migeon <jym@NetBSD.org> > > Reviewed-by: Jan Beulich <jbeulich@suse.com>I see that Ian J also agreed this was correct in <21139.14338.814627.156401@mariner.uk.xensource.com>. Acked + applied. Thanks everyone.