PV-GRUB: fix blk access at end of disk
PATCH 1/1 PV-GRUB: fix blk access at end of disk
GRUB usually always loads a whole disk track, even if that means going beyond the end of the disk. We thus have to gracefully return an error, instead of letting the blkfront go panic.
stubdom/grub/mini-os.c +3 -0
@@ -126,6 +126,9 @@ biosdisk (int read, int drive, struct geometry *geometry,if (i >= blk_nb)return -1 ; +if (sector + nsec > geometry->total_sectors) +return -1 ; + aiocb.aio_dev = blk_dev[i]; aiocb.aio_buf = addr; aiocb.aio_nbytes = (size_t )nsec * blk_info[i].sector_size;
Quoted 3 lines · Samuel Thibault, le Fri 21 Mar 2014 02:56:56 +0100, a écrit :
GRUB usually always loads a whole disk track, even if that means going beyond the end of the disk. We thus have to gracefully return an error, instead of letting the blkfront go panic.
(yes I was (un)lucky enough to see a generated initrd ending up at the very end of my /...)
This fix is very worth backporting to all stable trees.
Samuel
Quoted 7 lines · Samuel Thibault
Quoted 3 lines · Samuel Thibault, le Fri 21 Mar 2014 02:56:56 +0100, a écrit :
GRUB usually always loads a whole disk track, even if that means going beyond the end of the disk. We thus have to gracefully return an error, instead of letting the blkfront go panic.
(yes I was (un)lucky enough to see a generated initrd ending up at the very end of my /...)
Urk! Acked + applied.
(but should blkfront not also catch this and return an error?)
Quoted 1 line
This fix is very worth backporting to all stable trees.
CCing Ian J and Jan, not sure who deals with stubdom backports...
Ian.
_______________________________________________
Xen-devel mailing list
[email protected]
http://lists.xen.org/xen-devel
Quoted 6 lines · Ian Campbell, le Fri 21 Mar 2014 12:20:04 +0000, a écrit :
Quoted 5 lines · Samuel Thibault
Quoted 3 lines · Samuel Thibault, le Fri 21 Mar 2014 02:56:56 +0100, a écrit :
GRUB usually always loads a whole disk track, even if that means going beyond the end of the disk. We thus have to gracefully return an error, instead of letting the blkfront go panic.
Quoted 6 lines
Quoted 2 lines
(yes I was (un)lucky enough to see a generated initrd ending up at the very end of my /...)
Urk! Acked + applied.
(but should blkfront not also catch this and return an error?)
Yes, and not only that, but also propagate errors coming from the blkback. I have added that to my TODO list.
Samuel
Ian Campbell writes ("Re: [Xen-devel] [PATCH] PV-GRUB: fix blk access at end of disk"):
Quoted 4 lines · Samuel Thibault
Quoted 1 line
This fix is very worth backporting to all stable trees.
CCing Ian J and Jan, not sure who deals with stubdom backports...
Me, probably. I have added it to my list.
Thanks,
Ian.
Ian Jackson writes ("Re: [Xen-devel] [PATCH] PV-GRUB: fix blk access at end of disk"):
Quoted 7 lines
Ian Campbell writes ("Re: [Xen-devel] [PATCH] PV-GRUB: fix blk access at end of disk"):
Quoted 4 lines · Samuel Thibault
Quoted 1 line
This fix is very worth backporting to all stable trees.
CCing Ian J and Jan, not sure who deals with stubdom backports...
Me, probably. I have added it to my list.
I have now backported this to 4.4, 4.3 and 4.2. It applied cleanly and I did a build test.
Thanks,
Ian.