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

Re: [Xen-devel] [PATCH] make pygrub cope better with big files in guest



On Wed, 16 May 2012, Ian Campbell wrote:

On Wed, 2012-05-16 at 08:25 +0100, M A Young wrote:
On Wed, 16 May 2012, M A Young wrote:

Pygrub can use a lot of memory if the kernel or ramdisk files in a guest are
very big as it reads them into memory before writing them out again to
temporary files (these can legitimately be big for example the initrd.img
file in a Fedora 16 install is around 130MB ).

This patch allows these files to be copied in one megabyte pieces, and if it
sees any write problems it delets the files and exits. It also only reads up
to the first megabyte of configurations files for grub etc. to avoid problems
here as well (as it is a text file it should actually be much smaller).

This issue was reported by Xinli Niu in the Fedora bug report
https://bugzilla.redhat.com/show_bug.cgi?id=818412 who got it a CVE reference
CVE-2012-2625 .

I realized the first patch was flawed as I was potentially using a file
descriptor after I closed it. This is an untested correction.

I think you might want a couple of closes on datafile in here. Otherwise
it looks good to me (by inspection, I've not run it either).

I am attaching the third version of this patch. The datafile object doesn't have an explicit close so this patch uses del to clean it. I was also using unlink incorrectly which is now fixed.

I have tested it for basic functionality and also used pygrub directly to write to a very small file system and with this patch pygrub deletes the temporary files it creates if it runs out of file space.

        Michael Young

Attachment: pygrub.size.limits.patch
Description: Text document

_______________________________________________
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®.