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: <1322168216.24448.61.camel@mfleming-mobl1.ger.corp.intel.com>
Date:	Thu, 24 Nov 2011 20:56:56 +0000
From:	Matt Fleming <matt@...sole-pimps.org>
To:	Maarten Lankhorst <m.b.lankhorst@...il.com>
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>,
	Peter Jones <pjones@...hat.com>
Subject: Re: [PATCH v5 10/10] x86, efi: EFI boot stub support

On Thu, 2011-11-24 at 15:43 +0100, Maarten Lankhorst wrote:
> 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.

Urrggghh.....

Thanks a lot for diagnosing this, Maarten! The copy of grub that I have
(fedora's version) looks like it uses the disk_io protocol to read from
disks, I wonder if there's a reason for this. I Cc'd Peter Jones in case
he's seen anything like this before.

Aha, read_file() in the elilo source contains this helpful comment,

	/*                                                                      
         * We load by chunks rather than a single big read because              
         * early versions of EFI had troubles loading files                     
         * from floppies in a single big request.  Breaking                     
         * the read down into chunks of 4KB fixed that                          
         * problem. While this problem has been fixed, we still prefer          
         * this method because it tells us whether or not we're making          
         * forward progress.                                                    
         */

(but reading the code it's clear it uses a chunk size of 16KB, not 4KB)

So, it looks like it's not just reading from floppies that hits this bug
in the firmware.

Maarten, could you send a patch against the 'x86/efi-stub' branch at
git://git.kernel.org/pub/scm/linux/kernel/git/mfleming/linux.git that
splits the read up into 16KB chunks and explains,

	- why we need to do the reading in chunks
	- why we chose the 16KB chunk size (because elilo said so)

That way, the bug fix will be properly documented and attributed to you.

-- 
Matt Fleming, Intel Open Source Technology Center

--
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