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

Re: [Xen-devel] [PATCH 09/12] arm: load dom0 kernel from first boot module



At 17:24 +0000 on 29 Nov (1354209882), Ian Campbell wrote:
> On Thu, 2012-11-29 at 17:15 +0000, Tim Deegan wrote:
> > At 16:23 +0000 on 13 Nov (1352823801), Ian Campbell wrote:
> > > -static int kernel_try_zimage_prepare(struct kernel_info *info)
> > > +static int kernel_try_zimage_prepare(struct kernel_info *info,
> > > +                                     paddr_t addr, paddr_t size)
> > >  {
> > >      uint32_t *zimage = (void *)FIXMAP_ADDR(FIXMAP_MISC);
> > >      uint32_t start, end;
> > >      struct minimal_dtb_header dtb_hdr;
> > >  
> > > -    set_fixmap(FIXMAP_MISC, KERNEL_FLASH_ADDRESS >> PAGE_SHIFT, 
> > > DEV_SHARED);
> > > +    set_fixmap(FIXMAP_MISC, addr >> PAGE_SHIFT, DEV_SHARED);
> > > +
> > > +    zimage += addr & ~PAGE_MASK;
> > >  
> > >      if (zimage[ZIMAGE_MAGIC_OFFSET/4] != ZIMAGE_MAGIC)
> > > +    {
> > > +        clear_fixmap(FIXMAP_MISC);
> > >          return -EINVAL;
> > > +    }
> > >  
> > >      start = zimage[ZIMAGE_START_OFFSET/4];
> > >      end = zimage[ZIMAGE_END_OFFSET/4];
> > >  
> > >      clear_fixmap(FIXMAP_MISC);
> > >  
> > > +    if ( end > addr + size )
> > > +        return -EINVAL;
> > 
> > Should this also check for start == 0 && end > size?
> 
> Possibly ought to be checking for (end - start) > size which covers
> both?

Er, yes. :)

> > Do we want (here or elsewhere) to check that start is page-aligned?
> 
> I think kernel_try_zimage_prepare tries to do the right thing

Oh, so it does.  But kernel_zimage_load doesn't seem to -- it will copy
the data just below the start (which may be OK) but might not copy the
last part-page.   Also it won't handle the case where the 
(load_addr & 0xfff) != (source_addr & 0xfff).

Tim.

> Although you've made me look and I suspect it is buggy if start is <
> sizeof(zimage header) from the end of a page. It should probably just
> use copy_from_paddr into a local buffer.
> 
> Ian.
> 
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxx
> http://lists.xen.org/xen-devel

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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.