Skip to content

Commit f53e2cd

Browse files
samitolvanenIngo Molnar
authored andcommitted
x86/mm: Use the correct function type for native_set_fixmap()
We call native_set_fixmap indirectly through the function pointer struct pv_mmu_ops::set_fixmap, which expects the first parameter to be 'unsigned' instead of 'enum fixed_addresses'. This patch changes the function type for native_set_fixmap to match the pointer, which fixes indirect call mismatches with Control-Flow Integrity (CFI) checking. Signed-off-by: Sami Tolvanen <[email protected]> Reviewed-by: Kees Cook <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Dave Hansen <[email protected]> Cc: H . Peter Anvin <[email protected]> Cc: H. Peter Anvin <[email protected]> Cc: Linus Torvalds <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rik van Riel <[email protected]> Cc: Thomas Gleixner <[email protected]> Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Ingo Molnar <[email protected]>
1 parent 6e48476 commit f53e2cd

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

arch/x86/include/asm/fixmap.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ extern pte_t *kmap_pte;
156156
extern pte_t *pkmap_page_table;
157157

158158
void __native_set_fixmap(enum fixed_addresses idx, pte_t pte);
159-
void native_set_fixmap(enum fixed_addresses idx,
159+
void native_set_fixmap(unsigned /* enum fixed_addresses */ idx,
160160
phys_addr_t phys, pgprot_t flags);
161161

162162
#ifndef CONFIG_PARAVIRT_XXL

arch/x86/mm/pgtable.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -643,8 +643,8 @@ void __native_set_fixmap(enum fixed_addresses idx, pte_t pte)
643643
fixmaps_set++;
644644
}
645645

646-
void native_set_fixmap(enum fixed_addresses idx, phys_addr_t phys,
647-
pgprot_t flags)
646+
void native_set_fixmap(unsigned /* enum fixed_addresses */ idx,
647+
phys_addr_t phys, pgprot_t flags)
648648
{
649649
/* Sanitize 'prot' against any unsupported bits: */
650650
pgprot_val(flags) &= __default_kernel_pte_mask;

0 commit comments

Comments
 (0)