kexec: allocate kernel above bzImage's pref_address
Subsystems (2)
PATCH 1/1 kexec: allocate kernel above bzImage's pref_address
A relocatable kernel will relocate itself to pref_address if it is loaded below pref_address. This means a booted kernel may be relocating itself to an area with reserved memory on modern systems, potentially clobbering arbitrary data that may be important to the system.
This is often the case, as the default value of PHYSICAL_START is 0x1000000 and kernels are typically loaded at 0x100000 or above by bootloaders like iPXE or kexec. GRUB behaves like this patch does.
Also fixes the documentation around pref_address and PHYSICAL_START to be accurate.
--- Documentation/arch/x86/boot.rst | 3 ++- arch/x86/Kconfig | 10 +++++----- arch/x86/kernel/kexec-bzimage64.c | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-)
Documentation/arch/x86/boot.rst +2 -1
@@ -878,7 +878,8 @@ Protocol: 2.10+ address if possible. A non-relocatable kernel will unconditionally move itself and to run - at this address. + at this address. A relocatable kernel will move itself to this address if it + loaded below this address. ============ ======= Field name: init_size
arch/x86/Kconfig +5 -5
@@ -2109,11 +2109,11 @@ config PHYSICAL_START help This gives the physical address where the kernel is loaded. - If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then - bzImage will decompress itself to above physical address and - run from there. Otherwise, bzImage will run from the address where - it has been loaded by the boot loader and will ignore above physical - address. + If the kernel is not relocatable (CONFIG_RELOCATABLE=n) then bzImage + will decompress itself to above physical address and run from there. + Otherwise, bzImage will run from the address where it has been loaded + by the boot loader. The only exception is if it is loaded below the + above physical address, in which case it will relocate itself there. In normal kdump cases one does not have to set/change this option as now bzImage can be compiled as a completely relocatable image
arch/x86/kernel/kexec-bzimage64.c +4 -1
@@ -498,7 +498,10 @@ static void *bzImage64_load(struct kimage *image, char *kernel, kbuf.bufsz = kernel_len - kern16_size; kbuf.memsz =PAGE_ALIGN (header->init_size); kbuf.buf_align = header->kernel_alignment; - kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +if (header->pref_address <MIN_KERNEL_LOAD_ADDR ) + kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +else + kbuf.buf_min = header->pref_address; kbuf.mem =KEXEC_BUF_MEM_UNKNOWN ; ret =kexec_add_buffer (&kbuf);if (ret)
Signature · 1 line
2.43.0.472.g3155946c3a-goog
Quoted 62 lines · Chris Koch
A relocatable kernel will relocate itself to
pref_addressif it is loaded belowpref_address. This means a booted kernel may be relocating itself to an area with reserved memory on modern systems, potentially clobbering arbitrary data that may be important to the system.This is often the case, as the default value of
PHYSICAL_STARTis0x1000000and kernels are typically loaded at0x100000or above by bootloaders like iPXE or kexec. GRUB behaves like this patch does.Also fixes the documentation around
pref_addressandPHYSICAL_STARTto be accurate.Co-developed-by Cloud Hsu <[email protected]>Signed-off-by Cloud Hsu <[email protected]>Signed-off-by Chris Koch <[email protected]>---
Documentation/arch/x86/boot.rst | 3 ++- arch/x86/Kconfig | 10 +++++----- arch/x86/kernel/kexec-bzimage64.c | 5 ++++- 3 files changed, 11 insertions(+), 7 deletions(-)Documentation/arch/x86/boot.rst +2
-1@@ -878,7 +878,8 @@ Protocol: 2.10+ address if possible. A non-relocatable kernel will unconditionally move itself and to run - at this address. + at this address. A relocatable kernel will move itself to this address if it + loaded below this address.============ =======
Field name:init_sizearch/x86/Kconfig +5
-5@@ -2109,11 +2109,11 @@ config PHYSICAL_START help This gives the physical address where the kernel is loaded. - If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then - bzImage will decompress itself to above physical address and - run from there. Otherwise, bzImage will run from the address where - it has been loaded by the boot loader and will ignore above physical - address. + If the kernel is not relocatable (CONFIG_RELOCATABLE=n) then bzImage + will decompress itself to above physical address and run from there. + Otherwise, bzImage will run from the address where it has been loaded + by the boot loader. The only exception is if it is loaded below the + above physical address, in which case it will relocate itself there. In normal kdump cases one does not have to set/change this option as now bzImage can be compiled as a completely relocatable imagearch/x86/kernel/kexec-bzimage64.c +0
-0@@ -498,7 +498,10 @@ static void *bzImage64_load(struct kimage *image, char *kernel, kbuf.bufsz = kernel_len - kern16_size;
arch/x86/kernel/kexec-bzimage64.c static void *bzImage64_load(struct kimage *image, char *kernel, · line 507
Quoted 10 lines
arch/x86/kernel/kexec-bzimage64.c +4
-1kbuf.memsz =PAGE_ALIGN (header->init_size); kbuf.buf_align = header->kernel_alignment; - kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +if (header->pref_address <MIN_KERNEL_LOAD_ADDR ) + kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +else + kbuf.buf_min = header->pref_address; kbuf.mem =KEXEC_BUF_MEM_UNKNOWN ; ret =kexec_add_buffer (&kbuf);if (ret)
Quoted 11 lines · Chris Koch
A relocatable kernel will relocate itself to
pref_addressif it is loaded belowpref_address. This means a booted kernel may be relocating itself to an area with reserved memory on modern systems, potentially clobbering arbitrary data that may be important to the system.This is often the case, as the default value of
PHYSICAL_STARTis0x1000000and kernels are typically loaded at0x100000or above by bootloaders like iPXE or kexec. GRUB behaves like this patch does.Also fixes the documentation around
pref_addressandPHYSICAL_STARTto be accurate.
Are you reporting a bug and is this a bug fix? It's not super clear from the changelog.
Documentation/arch/x86/boot.rst Protocol: 2.10+ · line 882
Quoted 11 lines
Documentation/arch/x86/boot.rst +2
-1@@ -878,7 +878,8 @@ Protocol: 2.10+ address if possible. A non-relocatable kernel will unconditionally move itself and to run - at this address. + at this address. A relocatable kernel will move itself to this address if it + loaded below this address.
I think we should avoid saying the same things over and over again in different spots.
Here, it doesn't really help to enumerate the different interpretations of 'pref_address'. All that matters is that the bootloader can avoid the overhead of a later copy if it can place the kernel at 'pref_address'. The exact reasons that various kernels might decide to relocate are unimportant here.
Quoted 10 lines
Documentation/arch/x86/boot.rst +0
-0============ ======= Field name: init_sizearch/x86/Kconfig +0
-0@@ -2109,11 +2109,11 @@ config PHYSICAL_START help This gives the physical address where the kernel is loaded.
arch/x86/Kconfig config PHYSICAL_START · line 2116
Quoted 10 lines
arch/x86/Kconfig +5
-5- If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then - bzImage will decompress itself to above physical address and - run from there. Otherwise, bzImage will run from the address where - it has been loaded by the boot loader and will ignore above physical - address. + If the kernel is not relocatable (CONFIG_RELOCATABLE=n) then bzImage + will decompress itself to above physical address and run from there. + Otherwise, bzImage will run from the address where it has been loaded + by the boot loader. The only exception is if it is loaded below the + above physical address, in which case it will relocate itself there.
I kinda dislike how this is written. It's written almost like code where you're spelling out the conditions. I prefer something much higher-level.
This gives a minimum physical address at which the kernel can be loaded.
CONFIG_RELOCATABLE=n kernels will be decompressed to and must run at PHYSICAL_START exactly.
CONFIG_RELOCATABLE=y kernels can run at any address above PHYSICAL_START. If a kernel is loaded below PHYSICAL_START, it will relocate itself to PHYSICAL_START.
Quoted 8 lines
arch/x86/Kconfig +0
-0In normal kdump cases one does not have to set/change this option as now bzImage can be compiled as a completely relocatable imagearch/x86/kernel/kexec-bzimage64.c +0
-0@@ -498,7 +498,10 @@ static void *bzImage64_load(struct kimage *image, char *kernel, kbuf.bufsz = kernel_len - kern16_size;
arch/x86/kernel/kexec-bzimage64.c static void *bzImage64_load(struct kimage *image, char *kernel, · line 507
Quoted 10 lines
arch/x86/kernel/kexec-bzimage64.c +4
-1kbuf.memsz =PAGE_ALIGN (header->init_size); kbuf.buf_align = header->kernel_alignment; - kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +if (header->pref_address <MIN_KERNEL_LOAD_ADDR ) + kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +else + kbuf.buf_min = header->pref_address; kbuf.mem =KEXEC_BUF_MEM_UNKNOWN ; ret =kexec_add_buffer (&kbuf);if (ret)
Comment, please.
It isn't clear from this hunk why or how this fixes the bug. How does this manage to avoid clobbering reserved areas?
Quoted 11 lines · Dave Hansen
Quoted 9 lines · Chris Koch
A relocatable kernel will relocate itself to
pref_addressif it is loaded belowpref_address. This means a booted kernel may be relocating itself to an area with reserved memory on modern systems, potentially clobbering arbitrary data that may be important to the system.This is often the case, as the default value of
PHYSICAL_STARTis0x1000000and kernels are typically loaded at0x100000or above by bootloaders like iPXE or kexec. GRUB behaves like this patch does.
Quoted 5 lines
Quoted 2 lines
Also fixes the documentation around
pref_addressandPHYSICAL_STARTto be accurate.Are you reporting a bug and is this a bug fix? It's not super clear from the changelog.
I reported it as a bug yesterday in
https://lkml.org/lkml/2023/12/14/1529 -- I'm happy to reword this in some way that indicates it's a bug fix.
Quoted 17 lines
Documentation/arch/x86/boot.rst Protocol: 2.10+ · line 882
Quoted 13 lines
Documentation/arch/x86/boot.rst +2
-1@@ -878,7 +878,8 @@ Protocol: 2.10+ address if possible. A non-relocatable kernel will unconditionally move itself and to run - at this address. + at this address. A relocatable kernel will move itself to this address if it + loaded below this address.I think we should avoid saying the same things over and over again in different spots.
Quoted 5 lines
Here, it doesn't really help to enumerate the different interpretations of '
pref_address'. All that matters is that the bootloader can avoid the overhead of a later copy if it can place the kernel at 'pref_address'. The exact reasons that various kernels might decide to relocate are unimportant here.
I think it's important documentation for bootloader authors. It's not about avoiding overhead, it's about avoiding clobbering areas of memory that may be reserved in e820 / EFI memory map, which the kernel will do when it relocates itself to pref_address without checking what's reserved and what's not. It emphasizes the importance of choosing an address above pref_address. Happy to reword some way to reflect that.
Quoted 29 lines
Quoted 11 lines
Documentation/arch/x86/boot.rst +0
-0============ ======= Field name: init_sizearch/x86/Kconfig +0
-0@@ -2109,11 +2109,11 @@ config PHYSICAL_START help This gives the physical address where the kernel is loaded.arch/x86/Kconfig config PHYSICAL_START · line 2116
Quoted 10 lines
arch/x86/Kconfig +5
-5- If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then - bzImage will decompress itself to above physical address and - run from there. Otherwise, bzImage will run from the address where - it has been loaded by the boot loader and will ignore above physical - address. + If the kernel is not relocatable (CONFIG_RELOCATABLE=n) then bzImage + will decompress itself to above physical address and run from there. + Otherwise, bzImage will run from the address where it has been loaded + by the boot loader. The only exception is if it is loaded below the + above physical address, in which case it will relocate itself there.I kinda dislike how this is written. It's written almost like code where you're spelling out the conditions. I prefer something much higher-level.
This gives a minimum physical address at which the kernel can be loaded.
Quoted 6 lines
CONFIG_RELOCATABLE=nkernels will be decompressed to and must run atPHYSICAL_STARTexactly.
CONFIG_RELOCATABLE=ykernels can run at any address abovePHYSICAL_START. If a kernel is loaded belowPHYSICAL_START, it will relocate itself toPHYSICAL_START.
Happy to change that, yours is better.
Quoted 22 lines
Quoted 9 lines
arch/x86/Kconfig +0
-0In normal kdump cases one does not have to set/change this option as now bzImage can be compiled as a completely relocatable imagearch/x86/kernel/kexec-bzimage64.c +0
-0@@ -498,7 +498,10 @@ static void *bzImage64_load(struct kimage *image, char *kernel, kbuf.bufsz = kernel_len - kern16_size;arch/x86/kernel/kexec-bzimage64.c static void *bzImage64_load(struct kimage *image, char *kernel, · line 507
Quoted 10 lines
arch/x86/kernel/kexec-bzimage64.c +4
-1kbuf.memsz =PAGE_ALIGN (header->init_size); kbuf.buf_align = header->kernel_alignment; - kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +if (header->pref_address <MIN_KERNEL_LOAD_ADDR ) + kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +else + kbuf.buf_min = header->pref_address; kbuf.mem =KEXEC_BUF_MEM_UNKNOWN ; ret =kexec_add_buffer (&kbuf);if (ret)Comment, please.
Quoted 2 lines
It isn't clear from this hunk why or how this fixes the bug. How does this manage to avoid clobbering reserved areas?
When allocated above pref_address, the kernel will not relocate itself to an area that potentially overlaps with reserved memory. I'll add a comment.
Not sure what the etiquette is on immediately sending a patch v2, or waiting for more comments. I'll err on waiting on a couple more comments before sending v2. Thanks for the review
Chris
Quoted 1 line · Chris Koch
On Fri, Dec 15, 2023 at 1:17 PM Dave Hansen <[email protected]> wrote:
...
Quoted 6 lines
Quoted 2 lines
Are you reporting a bug and is this a bug fix? It's not super clear from the changelog.
I reported it as a bug yesterday in
https://lkml.org/lkml/2023/12/14/1529 -- I'm happy to reword this in some way that indicates it's a bug fix.
Ahh, thanks for the link!
Please do include things like this as a "Link:" tag in the changelog (and use lore.kernel.org URLs when possible).
Quoted 21 lines
Quoted 15 lines
Documentation/arch/x86/boot.rst Protocol: 2.10+ · line 882
Quoted 11 lines
Documentation/arch/x86/boot.rst +2
-1@@ -878,7 +878,8 @@ Protocol: 2.10+ address if possible. A non-relocatable kernel will unconditionally move itself and to run - at this address. + at this address. A relocatable kernel will move itself to this address if it + loaded below this address.I think we should avoid saying the same things over and over again in different spots.
Quoted 5 lines
Here, it doesn't really help to enumerate the different interpretations of '
pref_address'. All that matters is that the bootloader can avoid the overhead of a later copy if it can place the kernel at 'pref_address'. The exact reasons that various kernels might decide to relocate are unimportant here.
Quoted 7 lines
I think it's important documentation for bootloader authors. It's not about avoiding overhead, it's about avoiding clobbering areas of memory that may be reserved in e820 / EFI memory map, which the kernel will do when it relocates itself to
pref_addresswithout checking what's reserved and what's not. It emphasizes the importance of choosing an address abovepref_address. Happy to reword some way to reflect that.
Could we give this as a direction to bootloader authors? They should read 'pref_address' as a big, fat, "the kernel may blow this address away" message.
...
Quoted 21 lines
Quoted 21 lines
Quoted 8 lines
Documentation/arch/x86/boot.rst +0
-0In normal kdump cases one does not have to set/change this option as now bzImage can be compiled as a completely relocatable imagearch/x86/kernel/kexec-bzimage64.c +0
-0@@ -498,7 +498,10 @@ static void *bzImage64_load(struct kimage *image, char *kernel, kbuf.bufsz = kernel_len - kern16_size;arch/x86/kernel/kexec-bzimage64.c static void *bzImage64_load(struct kimage *image, char *kernel, · line 507
Quoted 10 lines
arch/x86/kernel/kexec-bzimage64.c +4
-1kbuf.memsz =PAGE_ALIGN (header->init_size); kbuf.buf_align = header->kernel_alignment; - kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +if (header->pref_address <MIN_KERNEL_LOAD_ADDR ) + kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +else + kbuf.buf_min = header->pref_address; kbuf.mem =KEXEC_BUF_MEM_UNKNOWN ; ret =kexec_add_buffer (&kbuf);if (ret)Comment, please.
Quoted 6 lines
Quoted 2 lines
It isn't clear from this hunk why or how this fixes the bug. How does this manage to avoid clobbering reserved areas?
When allocated above
pref_address, the kernel will not relocate itself to an area that potentially overlaps with reserved memory. I'll add a comment.
Sounds good.
Quoted 3 lines
Not sure what the etiquette is on immediately sending a patch v2, or waiting for more comments. I'll err on waiting on a couple more comments before sending v2. Thanks for the review
Please wait another few days.
H. Peter Anvin
reviewerQuoted 94 lines · Dave Hansen
Quoted 11 lines · Chris Koch
A relocatable kernel will relocate itself to
pref_addressif it is loaded belowpref_address. This means a booted kernel may be relocating itself to an area with reserved memory on modern systems, potentially clobbering arbitrary data that may be important to the system.This is often the case, as the default value of
PHYSICAL_STARTis0x1000000and kernels are typically loaded at0x100000or above by bootloaders like iPXE or kexec. GRUB behaves like this patch does.Also fixes the documentation around
pref_addressandPHYSICAL_STARTto be accurate.Are you reporting a bug and is this a bug fix? It's not super clear from the changelog.
Documentation/arch/x86/boot.rst Protocol: 2.10+ · line 882
Quoted 11 lines
Documentation/arch/x86/boot.rst +2
-1@@ -878,7 +878,8 @@ Protocol: 2.10+ address if possible. A non-relocatable kernel will unconditionally move itself and to run - at this address. + at this address. A relocatable kernel will move itself to this address if it + loaded below this address.I think we should avoid saying the same things over and over again in different spots.
Here, it doesn't really help to enumerate the different interpretations of '
pref_address'. All that matters is that the bootloader can avoid the overhead of a later copy if it can place the kernel at 'pref_address'. The exact reasons that various kernels might decide to relocate are unimportant here.Quoted 10 lines
Documentation/arch/x86/boot.rst +0
-0============ ======= Field name: init_sizearch/x86/Kconfig +0
-0@@ -2109,11 +2109,11 @@ config PHYSICAL_START help This gives the physical address where the kernel is loaded.arch/x86/Kconfig config PHYSICAL_START · line 2116
Quoted 10 lines
arch/x86/Kconfig +5
-5- If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then - bzImage will decompress itself to above physical address and - run from there. Otherwise, bzImage will run from the address where - it has been loaded by the boot loader and will ignore above physical - address. + If the kernel is not relocatable (CONFIG_RELOCATABLE=n) then bzImage + will decompress itself to above physical address and run from there. + Otherwise, bzImage will run from the address where it has been loaded + by the boot loader. The only exception is if it is loaded below the + above physical address, in which case it will relocate itself there.I kinda dislike how this is written. It's written almost like code where you're spelling out the conditions. I prefer something much higher-level.
This gives a minimum physical address at which the kernel can be loaded.
CONFIG_RELOCATABLE=nkernels will be decompressed to and must run atPHYSICAL_STARTexactly.
CONFIG_RELOCATABLE=ykernels can run at any address abovePHYSICAL_START. If a kernel is loaded belowPHYSICAL_START, it will relocate itself toPHYSICAL_START.Quoted 8 lines
arch/x86/Kconfig +0
-0In normal kdump cases one does not have to set/change this option as now bzImage can be compiled as a completely relocatable imagearch/x86/kernel/kexec-bzimage64.c +0
-0@@ -498,7 +498,10 @@ static void *bzImage64_load(struct kimage *image, char *kernel, kbuf.bufsz = kernel_len - kern16_size;arch/x86/kernel/kexec-bzimage64.c static void *bzImage64_load(struct kimage *image, char *kernel, · line 507
Quoted 10 lines
arch/x86/kernel/kexec-bzimage64.c +4
-1kbuf.memsz =PAGE_ALIGN (header->init_size); kbuf.buf_align = header->kernel_alignment; - kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +if (header->pref_address <MIN_KERNEL_LOAD_ADDR ) + kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +else + kbuf.buf_min = header->pref_address; kbuf.mem =KEXEC_BUF_MEM_UNKNOWN ; ret =kexec_add_buffer (&kbuf);if (ret)Comment, please.
Quoted 2 lines
It isn't clear from this hunk why or how this fixes the bug. How does this manage to avoid clobbering reserved areas?
It is a bug and a bug fix.
H. Peter Anvin
reviewerQuoted 94 lines · Dave Hansen
Quoted 11 lines · Chris Koch
A relocatable kernel will relocate itself to
pref_addressif it is loaded belowpref_address. This means a booted kernel may be relocating itself to an area with reserved memory on modern systems, potentially clobbering arbitrary data that may be important to the system.This is often the case, as the default value of
PHYSICAL_STARTis0x1000000and kernels are typically loaded at0x100000or above by bootloaders like iPXE or kexec. GRUB behaves like this patch does.Also fixes the documentation around
pref_addressandPHYSICAL_STARTto be accurate.Are you reporting a bug and is this a bug fix? It's not super clear from the changelog.
Documentation/arch/x86/boot.rst Protocol: 2.10+ · line 882
Quoted 11 lines
Documentation/arch/x86/boot.rst +2
-1@@ -878,7 +878,8 @@ Protocol: 2.10+ address if possible. A non-relocatable kernel will unconditionally move itself and to run - at this address. + at this address. A relocatable kernel will move itself to this address if it + loaded below this address.I think we should avoid saying the same things over and over again in different spots.
Here, it doesn't really help to enumerate the different interpretations of '
pref_address'. All that matters is that the bootloader can avoid the overhead of a later copy if it can place the kernel at 'pref_address'. The exact reasons that various kernels might decide to relocate are unimportant here.Quoted 10 lines
Documentation/arch/x86/boot.rst +0
-0============ ======= Field name: init_sizearch/x86/Kconfig +0
-0@@ -2109,11 +2109,11 @@ config PHYSICAL_START help This gives the physical address where the kernel is loaded.arch/x86/Kconfig config PHYSICAL_START · line 2116
Quoted 10 lines
arch/x86/Kconfig +5
-5- If kernel is a not relocatable (CONFIG_RELOCATABLE=n) then - bzImage will decompress itself to above physical address and - run from there. Otherwise, bzImage will run from the address where - it has been loaded by the boot loader and will ignore above physical - address. + If the kernel is not relocatable (CONFIG_RELOCATABLE=n) then bzImage + will decompress itself to above physical address and run from there. + Otherwise, bzImage will run from the address where it has been loaded + by the boot loader. The only exception is if it is loaded below the + above physical address, in which case it will relocate itself there.I kinda dislike how this is written. It's written almost like code where you're spelling out the conditions. I prefer something much higher-level.
This gives a minimum physical address at which the kernel can be loaded.
CONFIG_RELOCATABLE=nkernels will be decompressed to and must run atPHYSICAL_STARTexactly.
CONFIG_RELOCATABLE=ykernels can run at any address abovePHYSICAL_START. If a kernel is loaded belowPHYSICAL_START, it will relocate itself toPHYSICAL_START.Quoted 8 lines
arch/x86/Kconfig +0
-0In normal kdump cases one does not have to set/change this option as now bzImage can be compiled as a completely relocatable imagearch/x86/kernel/kexec-bzimage64.c +0
-0@@ -498,7 +498,10 @@ static void *bzImage64_load(struct kimage *image, char *kernel, kbuf.bufsz = kernel_len - kern16_size;arch/x86/kernel/kexec-bzimage64.c static void *bzImage64_load(struct kimage *image, char *kernel, · line 507
Quoted 10 lines
arch/x86/kernel/kexec-bzimage64.c +4
-1kbuf.memsz =PAGE_ALIGN (header->init_size); kbuf.buf_align = header->kernel_alignment; - kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +if (header->pref_address <MIN_KERNEL_LOAD_ADDR ) + kbuf.buf_min =MIN_KERNEL_LOAD_ADDR ; +else + kbuf.buf_min = header->pref_address; kbuf.mem =KEXEC_BUF_MEM_UNKNOWN ; ret =kexec_add_buffer (&kbuf);if (ret)Comment, please.
Quoted 2 lines
It isn't clear from this hunk why or how this fixes the bug. How does this manage to avoid clobbering reserved areas?
Also, this really should go to stable, so please add the appropriate Cc:.