<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/kernel/head64.c, branch linux-6.10.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.10.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-10-04T14:32:38Z</updated>
<entry>
<title>x86/boot/64: Strip percpu address space when setting up GDT descriptors</title>
<updated>2024-10-04T14:32:38Z</updated>
<author>
<name>Uros Bizjak</name>
</author>
<published>2024-08-19T08:33:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4b3ae12d46d740a64ed2c4d495d3ab9ab7bde765'/>
<id>urn:sha1:4b3ae12d46d740a64ed2c4d495d3ab9ab7bde765</id>
<content type='text'>
[ Upstream commit b51207dc02ec3aeaa849e419f79055d7334845b6 ]

init_per_cpu_var() returns a pointer in the percpu address space while
rip_rel_ptr() expects a pointer in the generic address space.

When strict address space checks are enabled, GCC's named address space
checks fail:

  asm.h:124:63: error: passing argument 1 of 'rip_rel_ptr' from
                       pointer to non-enclosed address space

Add a explicit cast to remove address space of the returned pointer.

Fixes: 11e36b0f7c21 ("x86/boot/64: Load the final kernel GDT during early boot directly, remove startup_gdt[]")
Signed-off-by: Uros Bizjak &lt;ubizjak@gmail.com&gt;
Signed-off-by: Thomas Gleixner &lt;tglx@linutronix.de&gt;
Link: https://lore.kernel.org/all/20240819083334.148536-1-ubizjak@gmail.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86/boot/64: Move 5-level paging global variable assignments back</title>
<updated>2024-03-24T04:00:36Z</updated>
<author>
<name>Tom Lendacky</name>
</author>
<published>2024-03-22T15:41:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=9843231c97267d72be38a0409f5097987bc2cfa4'/>
<id>urn:sha1:9843231c97267d72be38a0409f5097987bc2cfa4</id>
<content type='text'>
Commit 63bed9660420 ("x86/startup_64: Defer assignment of 5-level paging
global variables") moved assignment of 5-level global variables to later
in the boot in order to avoid having to use RIP relative addressing in
order to set them. However, when running with 5-level paging and SME
active (mem_encrypt=on), the variables are needed as part of the page
table setup needed to encrypt the kernel (using pgd_none(), p4d_offset(),
etc.). Since the variables haven't been set, the page table manipulation
is done as if 4-level paging is active, causing the system to crash on
boot.

While only a subset of the assignments that were moved need to be set
early, move all of the assignments back into check_la57_support() so that
these assignments aren't spread between two locations. Instead of just
reverting the fix, this uses the new RIP_REL_REF() macro when assigning
the variables.

Fixes: 63bed9660420 ("x86/startup_64: Defer assignment of 5-level paging global variables")
Signed-off-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Reviewed-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Link: https://lore.kernel.org/r/2ca419f4d0de719926fd82353f6751f717590a86.1711122067.git.thomas.lendacky@amd.com
</content>
</entry>
<entry>
<title>x86/boot/64: Apply encryption mask to 5-level pagetable update</title>
<updated>2024-03-24T04:00:35Z</updated>
<author>
<name>Tom Lendacky</name>
</author>
<published>2024-03-22T15:41:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4d0d7e7852752ea56375ac8645f0239e21ca2b50'/>
<id>urn:sha1:4d0d7e7852752ea56375ac8645f0239e21ca2b50</id>
<content type='text'>
When running with 5-level page tables, the kernel mapping PGD entry is
updated to point to the P4D table. The assignment uses _PAGE_TABLE_NOENC,
which, when SME is active (mem_encrypt=on), results in a page table
entry without the encryption mask set, causing the system to crash on
boot.

Change the assignment to use _PAGE_TABLE instead of _PAGE_TABLE_NOENC so
that the encryption mask is set for the PGD entry.

Fixes: 533568e06b15 ("x86/boot/64: Use RIP_REL_REF() to access early_top_pgt[]")
Signed-off-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Reviewed-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Link: https://lore.kernel.org/r/8f20345cda7dbba2cf748b286e1bc00816fe649a.1711122067.git.thomas.lendacky@amd.com
</content>
</entry>
<entry>
<title>x86/startup_64: Defer assignment of 5-level paging global variables</title>
<updated>2024-03-04T17:12:06Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2024-02-27T15:19:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=63bed96604205fa0b23c91d268df5f1f1b26faf6'/>
<id>urn:sha1:63bed96604205fa0b23c91d268df5f1f1b26faf6</id>
<content type='text'>
Assigning the 5-level paging related global variables from the earliest
C code using explicit references that use the 1:1 translation of memory
is unnecessary, as the startup code itself does not rely on them to
create the initial page tables, and this is all it should be doing. So
defer these assignments to the primary C entry code that executes via
the ordinary kernel virtual mapping.

Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Borislav Petkov (AMD) &lt;bp@alien8.de&gt;
Tested-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Link: https://lore.kernel.org/r/20240227151907.387873-13-ardb+git@google.com
</content>
</entry>
<entry>
<title>x86/boot/64: Load the final kernel GDT during early boot directly, remove startup_gdt[]</title>
<updated>2024-02-28T10:02:16Z</updated>
<author>
<name>Brian Gerst</name>
</author>
<published>2024-02-26T22:05:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=11e36b0f7c2150a6453872b79555767b43c846d0'/>
<id>urn:sha1:11e36b0f7c2150a6453872b79555767b43c846d0</id>
<content type='text'>
Instead of loading a duplicate GDT just for early boot, load the kernel
GDT from its physical address.

Signed-off-by: Brian Gerst &lt;brgerst@gmail.com&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Acked-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Cc: Kees Cook &lt;keescook@chromium.org&gt;
Cc: Andy Lutomirski &lt;luto@kernel.org&gt;
Cc: Linus Torvalds &lt;torvalds@linux-foundation.org&gt;
Cc: "H. Peter Anvin" &lt;hpa@zytor.com&gt;
Cc: Josh Poimboeuf &lt;jpoimboe@redhat.com&gt;
Link: https://lore.kernel.org/r/20240226220544.70769-1-brgerst@gmail.com
</content>
</entry>
<entry>
<title>x86/boot/64: Use RIP_REL_REF() to access early_top_pgt[]</title>
<updated>2024-02-26T11:58:35Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2024-02-21T11:35:13Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=533568e06b157b175912a960efe5ebce8710b4f9'/>
<id>urn:sha1:533568e06b157b175912a960efe5ebce8710b4f9</id>
<content type='text'>
early_top_pgt[] is assigned from code that executes from a 1:1 mapping
so it cannot use a plain access from C. Replace the use of
fixup_pointer() with RIP_REL_REF(), which is better and simpler.

For legibility and to align with the code that populates the lower page
table levels, statically initialize the root level page table with an
entry pointing to level3_kernel_pgt[], and overwrite it when needed to
enable 5-level paging.

Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20240221113506.2565718-24-ardb+git@google.com
</content>
</entry>
<entry>
<title>x86/boot/64: Use RIP_REL_REF() to access early page tables</title>
<updated>2024-02-26T11:58:35Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2024-02-21T11:35:12Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eb54c2ae4a4825c42a6a2b4022926bda7448f735'/>
<id>urn:sha1:eb54c2ae4a4825c42a6a2b4022926bda7448f735</id>
<content type='text'>
The early statically allocated page tables are populated from code that
executes from a 1:1 mapping so it cannot use plain accesses from C.
Replace the use of fixup_pointer() with RIP_REL_REF(), which is better
and simpler.

Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20240221113506.2565718-23-ardb+git@google.com
</content>
</entry>
<entry>
<title>x86/boot/64: Use RIP_REL_REF() to access '__supported_pte_mask'</title>
<updated>2024-02-26T11:58:35Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2024-02-21T11:35:11Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4f8b6cf25f5c119b117cb2a4bacb604a6cd00ff1'/>
<id>urn:sha1:4f8b6cf25f5c119b117cb2a4bacb604a6cd00ff1</id>
<content type='text'>
'__supported_pte_mask' is accessed from code that executes from a 1:1
mapping so it cannot use a plain access from C. Replace the use of
fixup_pointer() with RIP_REL_REF(), which is better and simpler.

Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20240221113506.2565718-22-ardb+git@google.com
</content>
</entry>
<entry>
<title>x86/boot/64: Use RIP_REL_REF() to access early_dynamic_pgts[]</title>
<updated>2024-02-26T11:58:35Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2024-02-21T11:35:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b0fe5fb6095be0f68b570c4cf4cd86b7e70c2e38'/>
<id>urn:sha1:b0fe5fb6095be0f68b570c4cf4cd86b7e70c2e38</id>
<content type='text'>
early_dynamic_pgts[] and next_early_pgt are accessed from code that
executes from a 1:1 mapping so it cannot use a plain access from C.
Replace the use of fixup_pointer() with RIP_REL_REF(), which is better
and simpler.

Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20240221113506.2565718-21-ardb+git@google.com
</content>
</entry>
<entry>
<title>x86/boot/64: Use RIP_REL_REF() to assign 'phys_base'</title>
<updated>2024-02-26T11:58:35Z</updated>
<author>
<name>Ard Biesheuvel</name>
</author>
<published>2024-02-21T11:35:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=d9ec1158056bedb6da8f4e02de30d300914b31f8'/>
<id>urn:sha1:d9ec1158056bedb6da8f4e02de30d300914b31f8</id>
<content type='text'>
'phys_base' is assigned from code that executes from a 1:1 mapping so it
cannot use a plain access from C. Replace the use of fixup_pointer()
with RIP_REL_REF(), which is better and simpler.

While at it, move the assignment to before the addition of the SME mask
so there is no need to subtract it again, and drop the unnecessary
addition ('phys_base' is statically initialized to 0x0)

Signed-off-by: Ard Biesheuvel &lt;ardb@kernel.org&gt;
Signed-off-by: Ingo Molnar &lt;mingo@kernel.org&gt;
Link: https://lore.kernel.org/r/20240221113506.2565718-20-ardb+git@google.com
</content>
</entry>
</feed>
