summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosh Boyer <jwboyer@redhat.com>2012-07-30 09:33:20 -0400
committerJosh Boyer <jwboyer@redhat.com>2012-07-30 09:33:20 -0400
commitaf258da073d70ddb69fcaf62b667c40ee70950e3 (patch)
tree2478a9398752c2d4d69fa0b0fc8525023e5fcd27
parent2855840b265a3fd22df360fc39be0a71d713b45f (diff)
downloadkernel-af258da073d70ddb69fcaf62b667c40ee70950e3.tar.gz
kernel-af258da073d70ddb69fcaf62b667c40ee70950e3.tar.xz
kernel-af258da073d70ddb69fcaf62b667c40ee70950e3.zip
Fixup patches
-rw-r--r--ACPI-AC-check-the-return-value-of-power_supply_register.patch37
-rw-r--r--crypto-aesni-intel-fix-wrong-kfree-pointer.patch45
-rw-r--r--crypto-testmgr-allow-aesni-intel-and-ghash_clmulni-intel.patch122
-rw-r--r--kernel.spec19
-rw-r--r--power-x86-destdir.patch7
-rw-r--r--secure-boot-20120724.patch469
6 files changed, 8 insertions, 691 deletions
diff --git a/ACPI-AC-check-the-return-value-of-power_supply_register.patch b/ACPI-AC-check-the-return-value-of-power_supply_register.patch
deleted file mode 100644
index c9eb1a17d..000000000
--- a/ACPI-AC-check-the-return-value-of-power_supply_register.patch
+++ /dev/null
@@ -1,37 +0,0 @@
-In the ac.c, lack check return value of power_supply_register().
-This may casue that acpi driver's add() ops was called successful
-while the device may be failed to be initalized. For example, some
-ugly bios may describe two ACADs in the same dsdt. They use the same
-name which will cause the second ACAD device can no be registered.
-And then power_supply_register() failed. But acpi driver's add() ops
-is called sucessfully. The acpi device also will receive acpi notification
-and cause oops.
- https://bugzilla.redhat.com/show_bug.cgi?id=772730
-
-Signed-off-by: Lan Tianyu <tianyu.lan@intel.com>
----
- drivers/acpi/ac.c | 4 +++-
- 1 files changed, 3 insertions(+), 1 deletions(-)
-
-diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
-index 6512b20..d1fcbc0 100644
---- a/drivers/acpi/ac.c
-+++ b/drivers/acpi/ac.c
-@@ -292,7 +292,9 @@ static int acpi_ac_add(struct acpi_device *device)
- ac->charger.properties = ac_props;
- ac->charger.num_properties = ARRAY_SIZE(ac_props);
- ac->charger.get_property = get_ac_property;
-- power_supply_register(&ac->device->dev, &ac->charger);
-+ result = power_supply_register(&ac->device->dev, &ac->charger);
-+ if (result)
-+ goto end;
-
- printk(KERN_INFO PREFIX "%s [%s] (%s)\n",
- acpi_device_name(device), acpi_device_bid(device),
---
-1.7.6.rc2.8.g28eb
-
---
-To unsubscribe from this list: send the line "unsubscribe linux-acpi" in
-the body of a message to majordomo@vger.kernel.org
-More majordomo info at http://vger.kernel.org/majordomo-info.html \ No newline at end of file
diff --git a/crypto-aesni-intel-fix-wrong-kfree-pointer.patch b/crypto-aesni-intel-fix-wrong-kfree-pointer.patch
deleted file mode 100644
index e9942c06f..000000000
--- a/crypto-aesni-intel-fix-wrong-kfree-pointer.patch
+++ /dev/null
@@ -1,45 +0,0 @@
-From bf084d8f6eb4ded3f90a6ab79bb682db00ebfbd4 Mon Sep 17 00:00:00 2001
-From: Milan Broz <mbroz@redhat.com>
-Date: Thu, 28 Jun 2012 17:26:02 +0200
-Subject: [PATCH] crypto: aesni-intel - fix wrong kfree pointer
-
-kfree(new_key_mem) in rfc4106_set_key() should be called on malloced pointer,
-not on aligned one, otherwise it can cause invalid pointer on free.
-
-(Seen at least once when running tcrypt tests with debug kernel.)
-
-Signed-off-by: Milan Broz <mbroz@redhat.com>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- arch/x86/crypto/aesni-intel_glue.c | 8 ++++----
- 1 files changed, 4 insertions(+), 4 deletions(-)
-
-diff --git a/arch/x86/crypto/aesni-intel_glue.c b/arch/x86/crypto/aesni-intel_glue.c
-index d662615..34fdcff 100644
---- a/arch/x86/crypto/aesni-intel_glue.c
-+++ b/arch/x86/crypto/aesni-intel_glue.c
-@@ -529,7 +529,7 @@ static int rfc4106_set_key(struct crypto_aead *parent, const u8 *key,
- struct crypto_aead *cryptd_child = cryptd_aead_child(ctx->cryptd_tfm);
- struct aesni_rfc4106_gcm_ctx *child_ctx =
- aesni_rfc4106_gcm_ctx_get(cryptd_child);
-- u8 *new_key_mem = NULL;
-+ u8 *new_key_align, *new_key_mem = NULL;
-
- if (key_len < 4) {
- crypto_tfm_set_flags(tfm, CRYPTO_TFM_RES_BAD_KEY_LEN);
-@@ -553,9 +553,9 @@ static int rfc4106_set_key(struct crypto_aead *parent, const u8 *key,
- if (!new_key_mem)
- return -ENOMEM;
-
-- new_key_mem = PTR_ALIGN(new_key_mem, AESNI_ALIGN);
-- memcpy(new_key_mem, key, key_len);
-- key = new_key_mem;
-+ new_key_align = PTR_ALIGN(new_key_mem, AESNI_ALIGN);
-+ memcpy(new_key_align, key, key_len);
-+ key = new_key_align;
- }
-
- if (!irq_fpu_usable())
---
-1.7.6.5
-
diff --git a/crypto-testmgr-allow-aesni-intel-and-ghash_clmulni-intel.patch b/crypto-testmgr-allow-aesni-intel-and-ghash_clmulni-intel.patch
deleted file mode 100644
index 9aef14c52..000000000
--- a/crypto-testmgr-allow-aesni-intel-and-ghash_clmulni-intel.patch
+++ /dev/null
@@ -1,122 +0,0 @@
-From 6c79294f44fd7d1122cbaabff3b9815b074c0dd0 Mon Sep 17 00:00:00 2001
-From: Milan Broz <mbroz@redhat.com>
-Date: Fri, 29 Jun 2012 22:08:09 +0200
-Subject: [PATCH] crypto: testmgr - allow aesni-intel and ghash_clmulni-intel
- in fips mode
-
-Patch 863b557a88f8c033f7419fabafef4712a5055f85 added NULL entries
-for intel accelerated drivers but did not marked these fips allowed.
-This cause panic if running tests with fips=1.
-
-For ghash, fips_allowed flag was added in patch
-18c0ebd2d8194cce4b3f67e2903fa01bea892cbc.
-
-Without patch, "modprobe tcrypt" fails with
- alg: skcipher: Failed to load transform for cbc-aes-aesni: -2
- cbc-aes-aesni: cbc(aes) alg self test failed in fips mode!
- (panic)
-
-Also add missing cryptd(__driver-cbc-aes-aesni) and
-cryptd(__driver-gcm-aes-aesni) test to complement
-null tests above, otherwise system complains with
- alg: No test for __cbc-aes-aesni (cryptd(__driver-cbc-aes-aesni))
- alg: No test for __gcm-aes-aesni (cryptd(__driver-gcm-aes-aesni))
-
-Signed-off-by: Milan Broz <mbroz@redhat.com>
-Signed-off-by: Paul Wouters <pwouters@redhat.com>
-Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
----
- crypto/testmgr.c | 38 ++++++++++++++++++++++++++++++++++++++
- 1 files changed, 38 insertions(+), 0 deletions(-)
-
-diff --git a/crypto/testmgr.c b/crypto/testmgr.c
-index 36748a5..4308a11 100644
---- a/crypto/testmgr.c
-+++ b/crypto/testmgr.c
-@@ -1581,6 +1581,7 @@ static const struct alg_test_desc alg_test_descs[] = {
- }, {
- .alg = "__driver-cbc-aes-aesni",
- .test = alg_test_null,
-+ .fips_allowed = 1,
- .suite = {
- .cipher = {
- .enc = {
-@@ -1641,6 +1642,7 @@ static const struct alg_test_desc alg_test_descs[] = {
- }, {
- .alg = "__driver-ecb-aes-aesni",
- .test = alg_test_null,
-+ .fips_allowed = 1,
- .suite = {
- .cipher = {
- .enc = {
-@@ -1701,6 +1703,7 @@ static const struct alg_test_desc alg_test_descs[] = {
- }, {
- .alg = "__ghash-pclmulqdqni",
- .test = alg_test_null,
-+ .fips_allowed = 1,
- .suite = {
- .hash = {
- .vecs = NULL,
-@@ -1866,8 +1869,25 @@ static const struct alg_test_desc alg_test_descs[] = {
- }
- }
- }, {
-+ .alg = "cryptd(__driver-cbc-aes-aesni)",
-+ .test = alg_test_null,
-+ .fips_allowed = 1,
-+ .suite = {
-+ .cipher = {
-+ .enc = {
-+ .vecs = NULL,
-+ .count = 0
-+ },
-+ .dec = {
-+ .vecs = NULL,
-+ .count = 0
-+ }
-+ }
-+ }
-+ }, {
- .alg = "cryptd(__driver-ecb-aes-aesni)",
- .test = alg_test_null,
-+ .fips_allowed = 1,
- .suite = {
- .cipher = {
- .enc = {
-@@ -1926,8 +1946,25 @@ static const struct alg_test_desc alg_test_descs[] = {
- }
- }
- }, {
-+ .alg = "cryptd(__driver-gcm-aes-aesni)",
-+ .test = alg_test_null,
-+ .fips_allowed = 1,
-+ .suite = {
-+ .cipher = {
-+ .enc = {
-+ .vecs = NULL,
-+ .count = 0
-+ },
-+ .dec = {
-+ .vecs = NULL,
-+ .count = 0
-+ }
-+ }
-+ }
-+ }, {
- .alg = "cryptd(__ghash-pclmulqdqni)",
- .test = alg_test_null,
-+ .fips_allowed = 1,
- .suite = {
- .hash = {
- .vecs = NULL,
-@@ -2043,6 +2080,7 @@ static const struct alg_test_desc alg_test_descs[] = {
- }, {
- .alg = "ecb(__aes-aesni)",
- .test = alg_test_null,
-+ .fips_allowed = 1,
- .suite = {
- .cipher = {
- .enc = {
---
-1.7.6.5
-
diff --git a/kernel.spec b/kernel.spec
index 8fd9091d3..b83118c81 100644
--- a/kernel.spec
+++ b/kernel.spec
@@ -62,7 +62,7 @@ Summary: The Linux kernel
# For non-released -rc kernels, this will be appended after the rcX and
# gitX tags, so a 3 here would become part of release "0.rcX.gitX.3"
#
-%global baserelease 1
+%global baserelease 2
%global fedora_build %{baserelease}
# base_sublevel is the kernel version we're starting with and patching
@@ -738,13 +738,6 @@ Patch22000: weird-root-dentry-name-debug.patch
#selinux ptrace child permissions
Patch22001: selinux-apply-different-permission-to-ptrace-child.patch
-#Fix FIPS for aesni hardare
-Patch22050: crypto-testmgr-allow-aesni-intel-and-ghash_clmulni-intel.patch
-Patch22051: crypto-aesni-intel-fix-wrong-kfree-pointer.patch
-
-#rhbz 772730
-Patch22058: ACPI-AC-check-the-return-value-of-power_supply_register.patch
-
#rhbz 836742
Patch22059: uvcvideo-Reset-bytesused-field-when-recycling-erroneous-buffer.patch
@@ -1431,13 +1424,6 @@ ApplyPatch weird-root-dentry-name-debug.patch
#selinux ptrace child permissions
ApplyPatch selinux-apply-different-permission-to-ptrace-child.patch
-#Fix FIPS for aesni hardare
-ApplyPatch crypto-testmgr-allow-aesni-intel-and-ghash_clmulni-intel.patch
-ApplyPatch crypto-aesni-intel-fix-wrong-kfree-pointer.patch
-
-#rhbz 772730
-ApplyPatch ACPI-AC-check-the-return-value-of-power_supply_register.patch
-
#rhbz 836742
ApplyPatch uvcvideo-Reset-bytesused-field-when-recycling-erroneous-buffer.patch
@@ -2298,6 +2284,9 @@ fi
# ||----w |
# || ||
%changelog
+* Mon Jul 30 2012 Josh Boyer <jwboyer@redhat.com>
+- Fixup patches
+
* Fri Jul 27 2012 Justin M. Forbes <jforbes@redhat.com> - 3.6.0-0.rc0.git3.1
- Linux v3.5-6982-gb387e41
diff --git a/power-x86-destdir.patch b/power-x86-destdir.patch
index 5fb48ac13..97665314f 100644
--- a/power-x86-destdir.patch
+++ b/power-x86-destdir.patch
@@ -1,13 +1,14 @@
diff --git a/tools/power/x86/turbostat/Makefile b/tools/power/x86/turbostat/Makefile
-index fd8e1f1..7af5e8c 100644
+index f856495..984cc00 100644
--- a/tools/power/x86/turbostat/Makefile
+++ b/tools/power/x86/turbostat/Makefile
-@@ -1,8 +1,10 @@
+@@ -1,3 +1,5 @@
+DESTDIR ?=
+
turbostat : turbostat.c
+ CFLAGS += -Wall
- clean :
+@@ -5,5 +7,5 @@ clean :
rm -f turbostat
install :
diff --git a/secure-boot-20120724.patch b/secure-boot-20120724.patch
index 862e7e0d1..20898e1f8 100644
--- a/secure-boot-20120724.patch
+++ b/secure-boot-20120724.patch
@@ -1,472 +1,3 @@
-From 56ce13afe1b17cd2817c596b3a9e25e51937a328 Mon Sep 17 00:00:00 2001
-From: Matt Fleming <matt.fleming@intel.com>
-Date: Thu, 19 Jul 2012 10:23:48 +0100
-Subject: [PATCH 01/14] x86, efi: Handover Protocol
-
-As things currently stand, traditional EFI boot loaders and the EFI
-boot stub are carrying essentially the same initialisation code
-required to setup an EFI machine for booting a kernel. There's really
-no need to have this code in two places and the hope is that, with
-this new protocol, initialisation and booting of the kernel can be
-left solely to the kernel's EFI boot stub. The responsibilities of the
-boot loader then become,
-
- o Loading the kernel image from boot media
-
-File system code still needs to be carried by boot loaders for the
-scenario where the kernel and initrd files reside on a file system
-that the EFI firmware doesn't natively understand, such as ext4, etc.
-
- o Providing a user interface
-
-Boot loaders still need to display any menus/interfaces, for example
-to allow the user to select from a list of kernels.
-
-Bump the boot protocol number because we added the 'handover_offset'
-field to indicate the location of the handover protocol entry point.
-
-Cc: H. Peter Anvin <hpa@zytor.com>
-Cc: Matthew Garrett <mjg@redhat.com>
-Cc: Peter Jones <pjones@redhat.com>
-Cc: Ingo Molnar <mingo@kernel.org>
-Signed-off-by: Matt Fleming <matt.fleming@intel.com>
----
- Documentation/x86/boot.txt | 41 ++++++++
- arch/x86/boot/compressed/eboot.c | 198 ++++++++++++++++++++++---------------
- arch/x86/boot/compressed/head_32.S | 10 ++
- arch/x86/boot/compressed/head_64.S | 10 ++
- arch/x86/boot/header.S | 4 +-
- arch/x86/include/asm/bootparam.h | 1 +
- 6 files changed, 185 insertions(+), 79 deletions(-)
-
-diff --git a/Documentation/x86/boot.txt b/Documentation/x86/boot.txt
-index 7c3a880..c6539a4 100644
---- a/Documentation/x86/boot.txt
-+++ b/Documentation/x86/boot.txt
-@@ -54,6 +54,9 @@ Protocol 2.10: (Kernel 2.6.31) Added a protocol for relaxed alignment
- beyond the kernel_alignment added, new init_size and
- pref_address fields. Added extended boot loader IDs.
-
-+Protocol 2.11: (Kernel 3.6) Added a field for offset of EFI handover
-+ protocol entry point.
-+
- **** MEMORY LAYOUT
-
- The traditional memory map for the kernel loader, used for Image or
-@@ -189,6 +192,7 @@ Offset Proto Name Meaning
- of struct setup_data
- 0258/8 2.10+ pref_address Preferred loading address
- 0260/4 2.10+ init_size Linear memory required during initialization
-+0264/4 2.11+ handover_offset Offset of handover entry point
-
- (1) For backwards compatibility, if the setup_sects field contains 0, the
- real value is 4.
-@@ -690,6 +694,16 @@ Offset/size: 0x260/4
- else
- runtime_start = pref_address
-
-+Field name: handover_offset
-+Type: read
-+Offset/size: 0x264/4
-+
-+ This field is the offset from the beginning of the kernel image to
-+ the EFI handover protocol entry point. Boot loaders using the EFI
-+ handover protocol to boot the kernel should jump to this offset.
-+
-+ See EFI HANDOVER PROTOCOL below for more details.
-+
-
- **** THE IMAGE CHECKSUM
-
-@@ -1010,3 +1024,30 @@ segment; __BOOS_CS must have execute/read permission, and __BOOT_DS
- must have read/write permission; CS must be __BOOT_CS and DS, ES, SS
- must be __BOOT_DS; interrupt must be disabled; %esi must hold the base
- address of the struct boot_params; %ebp, %edi and %ebx must be zero.
-+
-+**** EFI HANDOVER PROTOCOL
-+
-+This protocol allows boot loaders to defer initialisation to the EFI
-+boot stub. The boot loader is required to load the kernel/initrd(s)
-+from the boot media and jump to the EFI handover protocol entry point
-+which is hdr->handover_offset bytes from the beginning of
-+startup_{32,64}.
-+
-+The function prototype for the handover entry point looks like this,
-+
-+ efi_main(void *handle, efi_system_table_t *table, struct boot_params *bp)
-+
-+'handle' is the EFI image handle passed to the boot loader by the EFI
-+firmware, 'table' is the EFI system table - these are the first two
-+arguments of the "handoff state" as described in section 2.3 of the
-+UEFI specification. 'bp' is the boot loader-allocated boot params.
-+
-+The boot loader *must* fill out the following fields in bp,
-+
-+ o hdr.code32_start
-+ o hdr.cmd_line_ptr
-+ o hdr.cmdline_size
-+ o hdr.ramdisk_image (if applicable)
-+ o hdr.ramdisk_size (if applicable)
-+
-+All other fields should be zero.
-diff --git a/arch/x86/boot/compressed/eboot.c b/arch/x86/boot/compressed/eboot.c
-index 4e85f5f..b3e0227 100644
---- a/arch/x86/boot/compressed/eboot.c
-+++ b/arch/x86/boot/compressed/eboot.c
-@@ -729,32 +729,68 @@ fail:
- * need to create one ourselves (usually the bootloader would create
- * one for us).
- */
--static efi_status_t make_boot_params(struct boot_params *boot_params,
-- efi_loaded_image_t *image,
-- void *handle)
-+struct boot_params *make_boot_params(void *handle, efi_system_table_t *_table)
- {
-- struct efi_info *efi = &boot_params->efi_info;
-- struct apm_bios_info *bi = &boot_params->apm_bios_info;
-- struct sys_desc_table *sdt = &boot_params->sys_desc_table;
-- struct e820entry *e820_map = &boot_params->e820_map[0];
-- struct e820entry *prev = NULL;
-- struct setup_header *hdr = &boot_params->hdr;
-- unsigned long size, key, desc_size, _size;
-- efi_memory_desc_t *mem_map;
-- void *options = image->load_options;
-- u32 load_options_size = image->load_options_size / 2; /* ASCII */
-+ struct boot_params *boot_params;
-+ struct sys_desc_table *sdt;
-+ struct apm_bios_info *bi;
-+ struct setup_header *hdr;
-+ struct efi_info *efi;
-+ efi_loaded_image_t *image;
-+ void *options;
-+ u32 load_options_size;
-+ efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
- int options_size = 0;
- efi_status_t status;
-- __u32 desc_version;
- unsigned long cmdline;
-- u8 nr_entries;
- u16 *s2;
- u8 *s1;
- int i;
-
-+ sys_table = _table;
-+
-+ /* Check if we were booted by the EFI firmware */
-+ if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
-+ return NULL;
-+
-+ status = efi_call_phys3(sys_table->boottime->handle_protocol,
-+ handle, &proto, (void *)&image);
-+ if (status != EFI_SUCCESS) {
-+ efi_printk("Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
-+ return NULL;
-+ }
-+
-+ status = low_alloc(0x4000, 1, (unsigned long *)&boot_params);
-+ if (status != EFI_SUCCESS) {
-+ efi_printk("Failed to alloc lowmem for boot params\n");
-+ return NULL;
-+ }
-+
-+ memset(boot_params, 0x0, 0x4000);
-+
-+ hdr = &boot_params->hdr;
-+ efi = &boot_params->efi_info;
-+ bi = &boot_params->apm_bios_info;
-+ sdt = &boot_params->sys_desc_table;
-+
-+ /* Copy the second sector to boot_params */
-+ memcpy(&hdr->jump, image->image_base + 512, 512);
-+
-+ /*
-+ * Fill out some of the header fields ourselves because the
-+ * EFI firmware loader doesn't load the first sector.
-+ */
-+ hdr->root_flags = 1;
-+ hdr->vid_mode = 0xffff;
-+ hdr->boot_flag = 0xAA55;
-+
-+ hdr->code32_start = (__u64)(unsigned long)image->image_base;
-+
- hdr->type_of_loader = 0x21;
-
- /* Convert unicode cmdline to ascii */
-+ options = image->load_options;
-+ load_options_size = image->load_options_size / 2; /* ASCII */
- cmdline = 0;
- s2 = (u16 *)options;
-
-@@ -791,18 +827,36 @@ static efi_status_t make_boot_params(struct boot_params *boot_params,
- hdr->ramdisk_image = 0;
- hdr->ramdisk_size = 0;
-
-- status = handle_ramdisks(image, hdr);
-- if (status != EFI_SUCCESS)
-- goto free_cmdline;
--
-- setup_graphics(boot_params);
--
- /* Clear APM BIOS info */
- memset(bi, 0, sizeof(*bi));
-
- memset(sdt, 0, sizeof(*sdt));
-
-- memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32));
-+ status = handle_ramdisks(image, hdr);
-+ if (status != EFI_SUCCESS)
-+ goto fail2;
-+
-+ return boot_params;
-+fail2:
-+ if (options_size)
-+ low_free(options_size, hdr->cmd_line_ptr);
-+fail:
-+ low_free(0x4000, (unsigned long)boot_params);
-+ return NULL;
-+}
-+
-+static efi_status_t exit_boot(struct boot_params *boot_params,
-+ void *handle)
-+{
-+ struct efi_info *efi = &boot_params->efi_info;
-+ struct e820entry *e820_map = &boot_params->e820_map[0];
-+ struct e820entry *prev = NULL;
-+ unsigned long size, key, desc_size, _size;
-+ efi_memory_desc_t *mem_map;
-+ efi_status_t status;
-+ __u32 desc_version;
-+ u8 nr_entries;
-+ int i;
-
- size = sizeof(*mem_map) * 32;
-
-@@ -811,7 +865,7 @@ again:
- _size = size;
- status = low_alloc(size, 1, (unsigned long *)&mem_map);
- if (status != EFI_SUCCESS)
-- goto free_cmdline;
-+ return status;
-
- status = efi_call_phys5(sys_table->boottime->get_memory_map, &size,
- mem_map, &key, &desc_size, &desc_version);
-@@ -823,6 +877,7 @@ again:
- if (status != EFI_SUCCESS)
- goto free_mem_map;
-
-+ memcpy(&efi->efi_loader_signature, EFI_LOADER_SIGNATURE, sizeof(__u32));
- efi->efi_systab = (unsigned long)sys_table;
- efi->efi_memdesc_size = desc_size;
- efi->efi_memdesc_version = desc_version;
-@@ -906,61 +961,13 @@ again:
-
- free_mem_map:
- low_free(_size, (unsigned long)mem_map);
--free_cmdline:
-- if (options_size)
-- low_free(options_size, hdr->cmd_line_ptr);
--fail:
- return status;
- }
-
--/*
-- * On success we return a pointer to a boot_params structure, and NULL
-- * on failure.
-- */
--struct boot_params *efi_main(void *handle, efi_system_table_t *_table)
-+static efi_status_t relocate_kernel(struct setup_header *hdr)
- {
-- struct boot_params *boot_params;
- unsigned long start, nr_pages;
-- struct desc_ptr *gdt, *idt;
-- efi_loaded_image_t *image;
-- struct setup_header *hdr;
- efi_status_t status;
-- efi_guid_t proto = LOADED_IMAGE_PROTOCOL_GUID;
-- struct desc_struct *desc;
--
-- sys_table = _table;
--
-- /* Check if we were booted by the EFI firmware */
-- if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
-- goto fail;
--
-- status = efi_call_phys3(sys_table->boottime->handle_protocol,
-- handle, &proto, (void *)&image);
-- if (status != EFI_SUCCESS) {
-- efi_printk("Failed to get handle for LOADED_IMAGE_PROTOCOL\n");
-- goto fail;
-- }
--
-- status = low_alloc(0x4000, 1, (unsigned long *)&boot_params);
-- if (status != EFI_SUCCESS) {
-- efi_printk("Failed to alloc lowmem for boot params\n");
-- goto fail;
-- }
--
-- memset(boot_params, 0x0, 0x4000);
--
-- hdr = &boot_params->hdr;
--
-- /* Copy the second sector to boot_params */
-- memcpy(&hdr->jump, image->image_base + 512, 512);
--
-- /*
-- * Fill out some of the header fields ourselves because the
-- * EFI firmware loader doesn't load the first sector.
-- */
-- hdr->root_flags = 1;
-- hdr->vid_mode = 0xffff;
-- hdr->boot_flag = 0xAA55;
-
- /*
- * The EFI firmware loader could have placed the kernel image
-@@ -978,16 +985,40 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table)
- if (status != EFI_SUCCESS) {
- status = low_alloc(hdr->init_size, hdr->kernel_alignment,
- &start);
-- if (status != EFI_SUCCESS) {
-+ if (status != EFI_SUCCESS)
- efi_printk("Failed to alloc mem for kernel\n");
-- goto fail;
-- }
- }
-
-+ if (status == EFI_SUCCESS)
-+ memcpy((void *)start, (void *)(unsigned long)hdr->code32_start,
-+ hdr->init_size);
-+
-+ hdr->pref_address = hdr->code32_start;
- hdr->code32_start = (__u32)start;
-- hdr->pref_address = (__u64)(unsigned long)image->image_base;
-
-- memcpy((void *)start, image->image_base, image->image_size);
-+ return status;
-+}
-+
-+/*
-+ * On success we return a pointer to a boot_params structure, and NULL
-+ * on failure.
-+ */
-+struct boot_params *efi_main(void *handle, efi_system_table_t *_table,
-+ struct boot_params *boot_params)
-+{
-+ struct desc_ptr *gdt, *idt;
-+ efi_loaded_image_t *image;
-+ struct setup_header *hdr = &boot_params->hdr;
-+ efi_status_t status;
-+ struct desc_struct *desc;
-+
-+ sys_table = _table;
-+
-+ /* Check if we were booted by the EFI firmware */
-+ if (sys_table->hdr.signature != EFI_SYSTEM_TABLE_SIGNATURE)
-+ goto fail;
-+
-+ setup_graphics(boot_params);
-
- status = efi_call_phys3(sys_table->boottime->allocate_pool,
- EFI_LOADER_DATA, sizeof(*gdt),
-@@ -1015,7 +1046,18 @@ struct boot_params *efi_main(void *handle, efi_system_table_t *_table)
- idt->size = 0;
- idt->address = 0;
-
-- status = make_boot_params(boot_params, image, handle);
-+ /*
-+ * If the kernel isn't already loaded at the preferred load
-+ * address, relocate it.
-+ */
-+ if (hdr->pref_address != hdr->code32_start) {
-+ status = relocate_kernel(hdr);
-+
-+ if (status != EFI_SUCCESS)
-+ goto fail;
-+ }
-+
-+ status = exit_boot(boot_params, handle);
- if (status != EFI_SUCCESS)
- goto fail;
-
-diff --git a/arch/x86/boot/compressed/head_32.S b/arch/x86/boot/compressed/head_32.S
-index c85e3ac..aa4aaf1 100644
---- a/arch/x86/boot/compressed/head_32.S
-+++ b/arch/x86/boot/compressed/head_32.S
-@@ -42,6 +42,16 @@ ENTRY(startup_32)
- */
- add $0x4, %esp
-
-+ call make_boot_params
-+ cmpl $0, %eax
-+ je 1f
-+ movl 0x4(%esp), %esi
-+ movl (%esp), %ecx
-+ pushl %eax
-+ pushl %esi
-+ pushl %ecx
-+
-+ .org 0x30,0x90
- call efi_main
- cmpl $0, %eax
- movl %eax, %esi
-diff --git a/arch/x86/boot/compressed/head_64.S b/arch/x86/boot/compressed/head_64.S
-index 87e03a1..2c4b171 100644
---- a/arch/x86/boot/compressed/head_64.S
-+++ b/arch/x86/boot/compressed/head_64.S
-@@ -209,6 +209,16 @@ ENTRY(startup_64)
- .org 0x210
- mov %rcx, %rdi
- mov %rdx, %rsi
-+ pushq %rdi
-+ pushq %rsi
-+ call make_boot_params
-+ cmpq $0,%rax
-+ je 1f
-+ mov %rax, %rdx
-+ popq %rsi
-+ popq %rdi
-+
-+ .org 0x230,0x90
- call efi_main
- movq %rax,%rsi
- cmpq $0,%rax
-diff --git a/arch/x86/boot/header.S b/arch/x86/boot/header.S
-index efe5acf..cd921fe 100644
---- a/arch/x86/boot/header.S
-+++ b/arch/x86/boot/header.S
-@@ -283,7 +283,7 @@ _start:
- # Part 2 of the header, from the old setup.S
-
- .ascii "HdrS" # header signature
-- .word 0x020a # header version number (>= 0x0105)
-+ .word 0x020b # header version number (>= 0x0105)
- # or else old loadlin-1.5 will fail)
- .globl realmode_swtch
- realmode_swtch: .word 0, 0 # default_switch, SETUPSEG
-@@ -401,6 +401,8 @@ pref_address: .quad LOAD_PHYSICAL_ADDR # preferred load addr
- #define INIT_SIZE VO_INIT_SIZE
- #endif
- init_size: .long INIT_SIZE # kernel initialization size
-+handover_offset: .long 0x30 # offset to the handover
-+ # protocol entry point
-
- # End of setup header #####################################################
-
-diff --git a/arch/x86/include/asm/bootparam.h b/arch/x86/include/asm/bootparam.h
-index eb45aa6..2ad874c 100644
---- a/arch/x86/include/asm/bootparam.h
-+++ b/arch/x86/include/asm/bootparam.h
-@@ -66,6 +66,7 @@ struct setup_header {
- __u64 setup_data;
- __u64 pref_address;
- __u32 init_size;
-+ __u32 handover_offset;
- } __attribute__((packed));
-
- struct sys_desc_table {
---
-1.7.11.2
-
-
From 948fbe310f85f3a51a101ea23f38c59c70792832 Mon Sep 17 00:00:00 2001
From: Matthew Garrett <mjg@redhat.com>
Date: Thu, 8 Mar 2012 09:56:33 -0500