From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1YqMhi-0000RG-Gq for mharc-grub-devel@gnu.org; Thu, 07 May 2015 10:23:10 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:42703) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqMhg-0000Qo-5N for grub-devel@gnu.org; Thu, 07 May 2015 10:23:09 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YqMhe-0004cn-Vt for grub-devel@gnu.org; Thu, 07 May 2015 10:23:08 -0400 Received: from mail-wi0-x22a.google.com ([2a00:1450:400c:c05::22a]:37414) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YqMhe-0004cj-Kk for grub-devel@gnu.org; Thu, 07 May 2015 10:23:06 -0400 Received: by widdi4 with SMTP id di4so61953418wid.0 for ; Thu, 07 May 2015 07:23:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:subject:references :in-reply-to:content-type; bh=08XIUzfLHFRTyLPcHpl+JCCdKAU44bEFLq2zUT9jfg8=; b=JOeYmNmbeEKvJ0YynBwQtLnZp9doSseBCu3nOBISUH5uAF/ndlIlndZKEvxldygTjt b47XueE+9IBsz4QpkSse8284NlKCGGFdj8YW0id1HBbdDPR+uhY24tFJ135Z/uFzY/hr E0wWGzCECz43hCuXU4AufI5Dog3ndEzdpQ716kIVqyFfdDsNztRAHGGCPytK8VyuJoBj gbCNQoTk6ndiaxQQTtiJv9js2PUSedQOi9yPNLyxTahynjQA91IW1HnLs3sSLFuDJAMH wa+THDpvLsDcKZcA6iHJPLv3WDZ/STHpV1HoDE5GobYj293ay74r20i/c+jHSLIW4mIB AUdA== X-Received: by 10.180.19.100 with SMTP id d4mr7197345wie.29.1431008586091; Thu, 07 May 2015 07:23:06 -0700 (PDT) Received: from ?IPv6:2620:0:105f:fd00:863a:4bff:fe50:abc4? ([2620:0:105f:fd00:863a:4bff:fe50:abc4]) by mx.google.com with ESMTPSA id r9sm3691643wjo.26.2015.05.07.07.23.05 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 May 2015 07:23:05 -0700 (PDT) Message-ID: <554B7548.5070107@gmail.com> Date: Thu, 07 May 2015 16:23:04 +0200 From: =?UTF-8?B?VmxhZGltaXIgJ8+GLWNvZGVyL3BoY29kZXInIFNlcmJpbmVua28=?= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Icedove/31.6.0 MIME-Version: 1.0 To: The development of GNU GRUB Subject: Re: Using memdisk with grub2 and a gzip-compressed ISO References: <20150429204501.1d3e1021@opensuse.site> In-Reply-To: <20150429204501.1d3e1021@opensuse.site> Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PLRq6UqrqUNC0xePEGLMLtb2wgXOTiRvB" X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address (bad octet value). X-Received-From: 2a00:1450:400c:c05::22a X-BeenThere: grub-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list Reply-To: The development of GNU GRUB List-Id: The development of GNU GRUB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 May 2015 14:23:09 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --PLRq6UqrqUNC0xePEGLMLtb2wgXOTiRvB Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Go ahead On 29.04.2015 19:45, Andrei Borzenkov wrote: > =D0=92 Thu, 23 Apr 2015 10:23:09 -0400 > David Shaw =D0=BF=D0=B8=D1=88=D0=B5=D1=82: >=20 >> >> When booting the box with grub2 2.02, it does not work. The error is:= >> >> Ramdisk at 0x37979000, length 0x0033b290 >> gzip image: decompressed addr 0xbfff7000, len 0x00008f58: failed >> Decompression error: output buffer overrun >> >=20 > Could you test attached patch? While I'm past this message using your > archive, in qemu-kvm it hangs after "... booting ..." and in > qemu-system-i386 I get something that looks like memory corruption with= > occasional crash when initrd is uncompressed. >=20 > From: Andrei Borzenkov > Subject: [PATCH] loader/linux: do not pad initrd with zeroes at the end= >=20 > Syslinux memdisk is using initrd image and needs to know uncompressed > size in advance. For gzip uncompressed size is at the end of compressed= > stream. Grub padded each input file to 4 bytes at the end, which means > syslinux got wrong size. >=20 > Linux initramfs loader apparently does not care about trailing alignmen= t. > So change code to align beginning of each file instead which > automatically gives us the correct size for single file. >=20 > Reported-By: David Shaw >=20 > --- > grub-core/loader/linux.c | 10 +++++++--- > 1 file changed, 7 insertions(+), 3 deletions(-) >=20 > diff --git a/grub-core/loader/linux.c b/grub-core/loader/linux.c > index 117232f..35b858e 100644 > --- a/grub-core/loader/linux.c > +++ b/grub-core/loader/linux.c > @@ -161,6 +161,9 @@ grub_initrd_init (int argc, char *argv[], > for (i =3D 0; i < argc; i++) > { > const char *fname =3D argv[i]; > + > + initrd_ctx->size =3D ALIGN_UP (initrd_ctx->size, 4); > + > if (grub_memcmp (argv[i], "newc:", 5) =3D=3D 0) > { > const char *ptr, *eptr; > @@ -205,7 +208,7 @@ grub_initrd_init (int argc, char *argv[], > initrd_ctx->nfiles++; > initrd_ctx->components[i].size > =3D grub_file_size (initrd_ctx->components[i].file); > - initrd_ctx->size +=3D ALIGN_UP (initrd_ctx->components[i].size, = 4); > + initrd_ctx->size +=3D initrd_ctx->components[i].size; > } > =20 > if (newc) > @@ -253,6 +256,9 @@ grub_initrd_load (struct grub_linux_initrd_context = *initrd_ctx, > { > grub_ssize_t cursize; > =20 > + grub_memset (ptr, 0, ALIGN_UP_OVERHEAD ((grub_addr_t)ptr, 4)); > + ptr +=3D ALIGN_UP_OVERHEAD ((grub_addr_t)ptr, 4); > + > if (initrd_ctx->components[i].newc_name) > { > ptr +=3D insert_dir (initrd_ctx->components[i].newc_name, > @@ -283,8 +289,6 @@ grub_initrd_load (struct grub_linux_initrd_context = *initrd_ctx, > return grub_errno; > } > ptr +=3D cursize; > - grub_memset (ptr, 0, ALIGN_UP_OVERHEAD (cursize, 4)); > - ptr +=3D ALIGN_UP_OVERHEAD (cursize, 4); > } > if (newc) > ptr =3D make_header (ptr, "TRAILER!!!", sizeof ("TRAILER!!!") - 1,= 0, 0); >=20 --PLRq6UqrqUNC0xePEGLMLtb2wgXOTiRvB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iF4EAREKAAYFAlVLdUgACgkQmBXlbbo5nOvozQD9G3qW8YPCbWanuxoKKxJu2Vsj LrfiNzs9exaYayJQeVIA/ArE7uzPMoyTVaLV/p+rKpi4O6guZnhHUgKVi/tuUC0v =+xOz -----END PGP SIGNATURE----- --PLRq6UqrqUNC0xePEGLMLtb2wgXOTiRvB--