[PATCH 1/1] Documentation/x86/boot: Correct algorithm for runtime start address

From: Adrian Huang
Date: Sun Mar 07 2021 - 09:25:23 EST


From: Adrian Huang <ahuang12@xxxxxxxxxx>

Commit 8ab3820fd5b2 ("x86, kaslr: Return location from decompress_kernel")
enforces CONFIG_PHYSICAL_START as the minimum relocation address when
the kernel option CONFIG_RELOCATABLE is enabled. This change should be
included accordingly.

Signed-off-by: Adrian Huang <ahuang12@xxxxxxxxxx>
Cc: Kees Cook <keescook@xxxxxxxxxxxx>
---
Documentation/x86/boot.rst | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/Documentation/x86/boot.rst b/Documentation/x86/boot.rst
index fc844913dece..808ea181ca40 100644
--- a/Documentation/x86/boot.rst
+++ b/Documentation/x86/boot.rst
@@ -894,10 +894,16 @@ Offset/size: 0x260/4

The kernel runtime start address is determined by the following algorithm::

- if (relocatable_kernel)
- runtime_start = align_up(load_address, kernel_alignment)
- else
- runtime_start = pref_address
+ if (relocatable_kernel) {
+ runtime_start = align_up(load_address, kernel_alignment);
+
+ /* pref_address is the minimum relocation address */
+ if (runtime_start < pref_address)
+ runtime_start = pref_address;
+ } else {
+ /* Adhere to the statement describing in field 'pref_address' */
+ runtime_start = pref_address;
+ }

============ ===============
Field name: handover_offset
--
2.17.1