[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240819083334.148536-1-ubizjak@gmail.com>
Date: Mon, 19 Aug 2024 10:33:13 +0200
From: Uros Bizjak <ubizjak@...il.com>
To: x86@...nel.org,
linux-kernel@...r.kernel.org
Cc: Uros Bizjak <ubizjak@...il.com>,
Brian Gerst <brgerst@...il.com>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...nel.org>,
Borislav Petkov <bp@...en8.de>,
Dave Hansen <dave.hansen@...ux.intel.com>,
"H. Peter Anvin" <hpa@...or.com>
Subject: [PATCH -tip] x86/boot/64: Strip percpu address space from gdt kernel load
init_per_cpu_var() returns pointer in the percpu address space while
rip_rel_ptr() expects pointer in the generic address space, resulting
in:
asm.h:124:63: error: passing argument 1 of ‘rip_rel_ptr’ from pointer to non-enclosed address space
when strict address space checks are enabled.
Add explicit casts to remove address space of the returned pointer.
Found by GCC's named address space checks.
There were no changes in the resulting object file.
Fixes: 11e36b0f7c21 ("x86/boot/64: Load the final kernel GDT during early boot directly, remove startup_gdt[]")
Signed-off-by: Uros Bizjak <ubizjak@...il.com>
Cc: Brian Gerst <brgerst@...il.com>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Ingo Molnar <mingo@...nel.org>
Cc: Borislav Petkov <bp@...en8.de>
Cc: Dave Hansen <dave.hansen@...ux.intel.com>
Cc: "H. Peter Anvin" <hpa@...or.com>
---
arch/x86/kernel/head64.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/arch/x86/kernel/head64.c b/arch/x86/kernel/head64.c
index a817ed0724d1..2b7a4e28e72f 100644
--- a/arch/x86/kernel/head64.c
+++ b/arch/x86/kernel/head64.c
@@ -560,9 +560,11 @@ void early_setup_idt(void)
void __head startup_64_setup_gdt_idt(void)
{
void *handler = NULL;
+ struct desc_struct *gdt =
+ (void *)(__force unsigned long)init_per_cpu_var(gdt_page.gdt);
struct desc_ptr startup_gdt_descr = {
- .address = (unsigned long)&RIP_REL_REF(init_per_cpu_var(gdt_page.gdt)),
+ .address = (unsigned long)&RIP_REL_REF(*gdt),
.size = GDT_SIZE - 1,
};
--
2.46.0
Powered by blists - more mailing lists