Skip to content

Commit 4119622

Browse files
chleroympe
authored andcommitted
powerpc/32s: Fix kasan_early_hash_table() for CONFIG_VMAP_STACK
On book3s/32 CPUs that are handling MMU through a hash table, MMU_init_hw() function was adapted for VMAP_STACK in order to handle virtual addresses instead of physical addresses in the low level hash functions. When using KASAN, the same adaptations are required for the early hash table set up by kasan_early_hash_table() function. Fixes: cd08f10 ("powerpc/32s: Enable CONFIG_VMAP_STACK") Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/fc8390a33c2a470105f01abbcbdc7916c30c0a54.1580301269.git.christophe.leroy@c-s.fr
1 parent 76be441 commit 4119622

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

‎arch/powerpc/mm/kasan/kasan_init_32.c‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,11 @@ u8 __initdata early_hash[256 << 10] __aligned(256 << 10) = {0};
185185

186186
static void __init kasan_early_hash_table(void)
187187
{
188-
modify_instruction_site(&patch__hash_page_A0, 0xffff, __pa(early_hash) >> 16);
189-
modify_instruction_site(&patch__flush_hash_A0, 0xffff, __pa(early_hash) >> 16);
188+
unsigned int hash = IS_ENABLED(CONFIG_VMAP_STACK) ? (unsigned int)early_hash :
189+
__pa(early_hash);
190+
191+
modify_instruction_site(&patch__hash_page_A0, 0xffff, hash >> 16);
192+
modify_instruction_site(&patch__flush_hash_A0, 0xffff, hash >> 16);
190193

191194
Hash = (struct hash_pte *)early_hash;
192195
}

0 commit comments

Comments
 (0)