<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/boot/tools, branch linux-3.11.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.11.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-3.11.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2013-06-19T11:32:19Z</updated>
<entry>
<title>x86/boot: Close opened file descriptor</title>
<updated>2013-06-19T11:32:19Z</updated>
<author>
<name>Jiri Slaby</name>
</author>
<published>2013-06-19T07:53:03Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=062f487190c8126209391ccb720a4ec943fd4a57'/>
<id>urn:sha1:062f487190c8126209391ccb720a4ec943fd4a57</id>
<content type='text'>
During build we open a file, read that but do not close it. Fix
that by sticking fclose() at the right place.

Signed-off-by: Jiri Slaby &lt;jslaby@suse.cz&gt;
Link: http://lkml.kernel.org/r/1371628383-11216-1-git-send-email-jslaby@suse.cz
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: x86@kernel.org
</content>
</entry>
<entry>
<title>x86, build: Dynamically find entry points in compressed startup code</title>
<updated>2013-01-28T04:19:37Z</updated>
<author>
<name>David Woodhouse</name>
</author>
<published>2013-01-10T14:31:59Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=99f857db8857aff691c51302f93648263ed07eb1'/>
<id>urn:sha1:99f857db8857aff691c51302f93648263ed07eb1</id>
<content type='text'>
We have historically hard-coded entry points in head.S just so it's easy
to build the executable/bzImage headers with references to them.

Unfortunately, this leads to boot loaders abusing these "known" addresses
even when they are *explicitly* told that they "should look at the ELF
header to find this address, as it may change in the future". And even
when the address in question *has* actually been changed in the past,
without fanfare or thought to compatibility.

Thus we have bootloaders doing stunningly broken things like jumping
to offset 0x200 in the kernel startup code in 64-bit mode, *hoping*
that startup_64 is still there (it has moved at least once
before). And hoping that it's actually a 64-bit kernel despite the
fact that we don't give them any indication of that fact.

This patch should hopefully remove the temptation to abuse internal
addresses in future, where sternly worded comments have not sufficed.
Instead of having hard-coded addresses and saying "please don't abuse
these", we actually pull the addresses out of the ELF payload into
zoffset.h, and make build.c shove them back into the right places in
the bzImage header.

Rather than including zoffset.h into build.c and thus having to rebuild
the tool for every kernel build, we parse it instead. The parsing code
is small and simple.

This patch doesn't actually move any of the interesting entry points, so
any offending bootloader will still continue to "work" after this patch
is applied. For some version of "work" which includes jumping into the
compressed payload and crashing, if the bzImage it's given is a 32-bit
kernel. No change there then.

[ hpa: some of the issues in the description are addressed or
  retconned by the 2.12 boot protocol.  This patch has been edited to
  only remove fixed addresses that were *not* thus retconned. ]

Signed-off-by: David Woodhouse &lt;David.Woodhouse@intel.com&gt;
Link: http://lkml.kernel.org/r/1358513837.2397.247.camel@shinybook.infradead.org
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
Cc: Matt Fleming &lt;matt.fleming@intel.com&gt;
</content>
</entry>
<entry>
<title>x86, efi stub: Add .reloc section back into image</title>
<updated>2012-06-07T16:52:33Z</updated>
<author>
<name>Jordan Justen</name>
</author>
<published>2012-06-07T16:05:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=743628e868c5992354fc80b4d1e9a6143da1c0e6'/>
<id>urn:sha1:743628e868c5992354fc80b4d1e9a6143da1c0e6</id>
<content type='text'>
Some UEFI firmware will not load a .efi with a .reloc section
with a size of 0.

Therefore, we create a .efi image with 4 main areas and 3 sections.
1. PE/COFF file header
2. .setup section (covers all setup code following the first sector)
3. .reloc section (contains 1 dummy reloc entry, created in build.c)
4. .text section (covers the remaining kernel image)

To make room for the new .setup section data, the header
bugger_off_msg had to be shortened.

Reported-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
Signed-off-by: Jordan Justen &lt;jordan.l.justen@intel.com&gt;
Link: http://lkml.kernel.org/r/1339085121-12760-1-git-send-email-jordan.l.justen@intel.com
Tested-by: Lee G Rosenbaum &lt;lee.g.rosenbaum@intel.com&gt;
Tested-by: Henrik Rydberg &lt;rydberg@euromail.se&gt;
Cc: Matt Fleming &lt;matt.fleming@intel.com&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip</title>
<updated>2012-05-23T17:40:34Z</updated>
<author>
<name>Linus Torvalds</name>
</author>
<published>2012-05-23T17:40:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=8ca038dc10eec80f280d9d483f1835ac2763a787'/>
<id>urn:sha1:8ca038dc10eec80f280d9d483f1835ac2763a787</id>
<content type='text'>
Pull x86 EFI updates from Ingo Molnar:
 "This patchset makes changes to the bzImage EFI header, so that it can
  be signed with a secure boot signature tool.  It should not affect
  anyone who is not using the EFI self-boot feature in any way."

* 'x86-efi-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
  x86, efi: Fix NumberOfRvaAndSizes field in PE32 header for EFI_STUB
  x86, efi: Fix .text section overlapping image header for EFI_STUB
  x86, efi: Fix issue of overlapping .reloc section for EFI_STUB
</content>
</entry>
<entry>
<title>x86, efi: Add dedicated EFI stub entry point</title>
<updated>2012-04-16T18:41:44Z</updated>
<author>
<name>Matt Fleming</name>
</author>
<published>2012-04-15T15:06:04Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b1994304fc399f5d3a5368c81111d713490c4799'/>
<id>urn:sha1:b1994304fc399f5d3a5368c81111d713490c4799</id>
<content type='text'>
The method used to work out whether we were booted by EFI firmware or
via a boot loader is broken. Because efi_main() is always executed
when booting from a boot loader we will dereference invalid pointers
either on the stack (CONFIG_X86_32) or contained in %rdx
(CONFIG_X86_64) when searching for an EFI System Table signature.

Instead of dereferencing these invalid system table pointers, add a
new entry point that is only used when booting from EFI firmware, when
we know the pointer arguments will be valid. With this change legacy
boot loaders will no longer execute efi_main(), but will instead skip
EFI stub initialisation completely.

[ hpa: Marking this for urgent/stable since it is a regression when
  the option is enabled; without the option the patch has no effect ]

Signed-off-by: Matt Fleming &lt;matt.hfleming@intel.com&gt;
Link: http://lkml.kernel.org/r/1334584744.26997.14.camel@mfleming-mobl1.ger.corp.intel.com
Reported-by: Jordan Justen &lt;jordan.l.justen@intel.com&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
Cc: &lt;stable@vger.kernel.org&gt; v3.3
</content>
</entry>
<entry>
<title>Merge branch x86/build into x86/efi and fix up arch/x86/boot/tools/build.c</title>
<updated>2012-03-28T20:11:36Z</updated>
<author>
<name>H. Peter Anvin</name>
</author>
<published>2012-03-28T20:11:36Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a9aff3eaaf0966c2a1bb3717d811363d81e52c76'/>
<id>urn:sha1:a9aff3eaaf0966c2a1bb3717d811363d81e52c76</id>
<content type='text'>
Reason for merge:
       The updates to the EFI boot stub generation conflicted with the
       changes to properly use the get/put_unaligned_le*() macros to
       generate images.

       This merge commit completes the conversion in
       arch/x86/boot/tools/build.c including the places in the code
       which had been changed on the x86/efi branch.

Resolved Conflicts:
	arch/x86/boot/tools/build.c

Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, efi: Fix .text section overlapping image header for EFI_STUB</title>
<updated>2012-03-26T20:10:01Z</updated>
<author>
<name>Matt Fleming</name>
</author>
<published>2012-03-23T16:35:05Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e31be363df3092821bf179cf4baa076f501b8ae6'/>
<id>urn:sha1:e31be363df3092821bf179cf4baa076f501b8ae6</id>
<content type='text'>
This change modifes the PE .text section to start after
the first sector of the kernel image.

The header may be modified by the UEFI secure boot signing,
so it is not appropriate for it to be included in one of the
image sections. Since the sections are part of the secure
boot hash, this modification to the .text section contents
would invalidate the secure boot signed hash.

Note: UEFI secure boot does hash the image header, but
fields that are changed by the signing process are excluded
from the hash calculation.  This exclusion process is only
handled for the image header, and not image sections.

Luckily, we can still easily boot without the first sector
by initializing a few fields in arch/x86/boot/compressed/eboot.c.

Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Link: http://lkml.kernel.org/r/1332520506-6472-3-git-send-email-jordan.l.justen@intel.com
[jordan.l.justen@intel.com: set .text vma &amp; file offset]
Signed-off-by: Jordan Justen &lt;jordan.l.justen@intel.com&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@linux.intel.com&gt;
</content>
</entry>
<entry>
<title>x86, build: Fix portability issues when cross-building</title>
<updated>2012-02-29T07:40:56Z</updated>
<author>
<name>H. Peter Anvin</name>
</author>
<published>2012-02-29T07:36:21Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a51f4047758d2bcd099ea113b833ed380f4024ba'/>
<id>urn:sha1:a51f4047758d2bcd099ea113b833ed380f4024ba</id>
<content type='text'>
It would appear that we never actually generated a correct CRC when
building on a bigendian machine.  Depending on the word size, we would
either generate an all-zero CRC (64-bit machine) or a byte-swapped
CRC (32-bit machine.)  Fix the types used so we don't arbitrarily use
a 64-bit word to hold 32-bit numbers, and pass the CRC through
put_unaligned_le32() like all the other numbers.

Signed-off-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Cc: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Cc: Matt Fleming &lt;matt@console-pimps.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Nick Bowler &lt;nbowler@elliptictech.com&gt;
Link: http://lkml.kernel.org/r/20120229111322.9eb4b23ff1672e8853ad3b3b@canb.auug.org.au
</content>
</entry>
<entry>
<title>x86, tools: Remove unneeded header files from tools/build.c</title>
<updated>2012-02-29T07:40:15Z</updated>
<author>
<name>H. Peter Anvin</name>
</author>
<published>2012-02-29T07:30:58Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b8d43cb504a94f1070159a37c8cb23008276eff3'/>
<id>urn:sha1:b8d43cb504a94f1070159a37c8cb23008276eff3</id>
<content type='text'>
We include &lt;sys/sysmacros.h&gt; and &lt;asm/boot.h&gt;, but none of those
header files actually provide anything this file needs.  Furthermore,
it breaks cross-compilation, so just remove them.

Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Reported-by: Ingo Molnar &lt;mingo@elte.hu&gt;
Signed-off-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Cc: Matt Fleming &lt;matt@console-pimps.org&gt;
Cc: Andrew Morton &lt;akpm@linux-foundation.org&gt;
Cc: Nick Bowler &lt;nbowler@elliptictech.com&gt;
Link: http://lkml.kernel.org/r/20120229111322.9eb4b23ff1672e8853ad3b3b@canb.auug.org.au
</content>
</entry>
<entry>
<title>x86, efi: Fix endian issues and unaligned accesses</title>
<updated>2012-02-28T18:23:02Z</updated>
<author>
<name>Matt Fleming</name>
</author>
<published>2012-02-28T13:37:24Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=92f42c50f227ad228f815a8f4eec872524dae3a5'/>
<id>urn:sha1:92f42c50f227ad228f815a8f4eec872524dae3a5</id>
<content type='text'>
We may need to convert the endianness of the data we read from/write
to 'buf', so let's use {get,put}_unaligned_le32() to do that. Failure
to do so can result in accessing invalid memory, leading to a
segfault.  Stephen Rothwell noticed this bug while cross-building an
x86_64 allmodconfig kernel on PowerPC.

We need to read from and write to 'buf' a byte at a time otherwise
it's possible we'll perform an unaligned access, which can lead to bus
errors when cross-building an x86 kernel on risc architectures.

Cc: H. Peter Anvin &lt;hpa@zytor.com&gt;
Cc: Nick Bowler &lt;nbowler@elliptictech.com&gt;
Tested-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Reported-by: Stephen Rothwell &lt;sfr@canb.auug.org.au&gt;
Signed-off-by: Matt Fleming &lt;matt.fleming@intel.com&gt;
Link: http://lkml.kernel.org/r/1330436245-24875-6-git-send-email-matt@console-pimps.org
Signed-off-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
</content>
</entry>
</feed>
