lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <4ECE5803.3060203@gmail.com>
Date:	Thu, 24 Nov 2011 15:43:15 +0100
From:	Maarten Lankhorst <m.b.lankhorst@...il.com>
To:	Matt Fleming <matt@...sole-pimps.org>
CC:	"H. Peter Anvin" <hpa@...ux.intel.com>,
	Matthew Garrett <mjg@...hat.com>, linux-kernel@...r.kernel.org,
	Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
	Mike Waychison <mikew@...gle.com>,
	Andi Kleen <andi@...stfloor.org>
Subject: Re: [PATCH v5 10/10] x86, efi: EFI boot stub support

Hey Matt,

On 11/23/2011 08:27 PM, Matt Fleming wrote:

> On Wed, 2011-11-23 at 01:44 +0100, Maarten Lankhorst wrote:
>> When I tested this with v3.2-rc2 it didn't boot, it hung before it
>> initialized the kernel.
>> Without initrd it works fine, though.
> Bah, so this change actually makes booting worse? You said before that
> you almost made it to userspace but this seems to hang much earlier now.
> Is that correct?
>
> ... back to the drawing board.
I was looking at why grub2 could boot, seems to be it reads in chunks of
256 kilobytes. I seem to be able to get it to boot with chunks of 4 mb
as well, but didn't test beyond that.

So the fix is to simply read the file in parts, otherwise efi hangs..
As a nice side effect, short reads are also handled, but the efi
firmware seems to choke over huge reads and dies.

diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
index 8627a56..9b076f0 100644
--- a/arch/x86/boot/compressed/eboot.c
+++ b/arch/x86/boot/compressed/eboot.c
@@ -695,14 +695,16 @@ grow:
 			u64 size;
 
 			size = initrds[j].size;
-			status = efi_call_phys3(fh->read, initrds[j].handle,
-						&size, addr);
-			if (status != EFI_SUCCESS)
-				goto free_initrd_total;
-
+			while (size) {
+				u64 toread = size > 1024 * 1024 ? 1024 * 1024 : size;
+				status = efi_call_phys3(fh->read, initrds[j].handle,
+							&toread, addr);
+				if (status != EFI_SUCCESS)
+					goto free_initrd_total;
+				size -= toread;
+				addr += toread;
+			}
 			efi_call_phys1(fh->close, initrds[j].handle);
-
-			addr += size;
 		}
 
 	}


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ