[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Xen-devel] pygrub: verify chosen kernel really exists
On Mon, 25 Jun 2012, Ian Campbell wrote: On Fri, 2012-06-22 at 19:37 +0100, Andrew Cooper wrote:diff -r 32034d1914a6 tools/pygrub/src/pygrub --- a/tools/pygrub/src/pygrub +++ b/tools/pygrub/src/pygrub @@ -821,10 +821,15 @@ if __name__ == "__main__": if not fs: raise RuntimeError, "Unable to find partition containing kernel" + # Does the chosen kernel really exist ? + try: + data = fs.open_file(chosencfg["kernel"]).read()If you make this use .exists() and left the open/read where it was that would be more in keeping with the intended meaning of the not_really flag. Also if you are checking for the kernel, shouldn't you also check for the ramdisk if one is requested for consistency. It also hits the same area of code as the proposed protection against problems caused by huge kernels in the guests (eg. see http://lists.xen.org/archives/html/xen-devel/2012-05/msg01183.html or http://lists.xen.org/archives/html/xen-devel/2012-05/msg01499.htmland it was suggested that it might be better to use a function to do this bit of the code rather than duplicating it for both kernel and ramdisk. Michael Young _______________________________________________ Xen-devel mailing list Xen-devel@xxxxxxxxxxxxx http://lists.xen.org/xen-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |