mirror of
https://github.com/torvalds/linux.git
synced 2026-05-23 14:42:08 +02:00
x86/alternatives: Rename 'poking_addr' to 'text_poke_mm_addr'
Put it into the text_poke_* namespace of <asm/text-patching.h>. Signed-off-by: Ingo Molnar <mingo@kernel.org> Cc: Juergen Gross <jgross@suse.com> Cc: "H . Peter Anvin" <hpa@zytor.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: https://lore.kernel.org/r/20250411054105.2341982-10-mingo@kernel.org
This commit is contained in:
parent
a5c832e047
commit
da364fc547
|
|
@ -129,7 +129,7 @@ void *text_gen_insn(u8 opcode, const void *addr, const void *dest)
|
|||
|
||||
extern int after_bootmem;
|
||||
extern __ro_after_init struct mm_struct *text_poke_mm;
|
||||
extern __ro_after_init unsigned long poking_addr;
|
||||
extern __ro_after_init unsigned long text_poke_mm_addr;
|
||||
|
||||
#ifndef CONFIG_UML_X86
|
||||
static __always_inline
|
||||
|
|
|
|||
|
|
@ -2192,7 +2192,7 @@ static inline temp_mm_state_t use_temporary_mm(struct mm_struct *mm)
|
|||
}
|
||||
|
||||
__ro_after_init struct mm_struct *text_poke_mm;
|
||||
__ro_after_init unsigned long poking_addr;
|
||||
__ro_after_init unsigned long text_poke_mm_addr;
|
||||
|
||||
static inline void unuse_temporary_mm(temp_mm_state_t prev_state)
|
||||
{
|
||||
|
|
@ -2266,7 +2266,7 @@ static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t l
|
|||
/*
|
||||
* The lock is not really needed, but this allows to avoid open-coding.
|
||||
*/
|
||||
ptep = get_locked_pte(text_poke_mm, poking_addr, &ptl);
|
||||
ptep = get_locked_pte(text_poke_mm, text_poke_mm_addr, &ptl);
|
||||
|
||||
/*
|
||||
* This must not fail; preallocated in poking_init().
|
||||
|
|
@ -2276,11 +2276,11 @@ static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t l
|
|||
local_irq_save(flags);
|
||||
|
||||
pte = mk_pte(pages[0], pgprot);
|
||||
set_pte_at(text_poke_mm, poking_addr, ptep, pte);
|
||||
set_pte_at(text_poke_mm, text_poke_mm_addr, ptep, pte);
|
||||
|
||||
if (cross_page_boundary) {
|
||||
pte = mk_pte(pages[1], pgprot);
|
||||
set_pte_at(text_poke_mm, poking_addr + PAGE_SIZE, ptep + 1, pte);
|
||||
set_pte_at(text_poke_mm, text_poke_mm_addr + PAGE_SIZE, ptep + 1, pte);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
@ -2290,7 +2290,7 @@ static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t l
|
|||
prev = use_temporary_mm(text_poke_mm);
|
||||
|
||||
kasan_disable_current();
|
||||
func((u8 *)poking_addr + offset_in_page(addr), src, len);
|
||||
func((u8 *)text_poke_mm_addr + offset_in_page(addr), src, len);
|
||||
kasan_enable_current();
|
||||
|
||||
/*
|
||||
|
|
@ -2299,9 +2299,9 @@ static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t l
|
|||
*/
|
||||
barrier();
|
||||
|
||||
pte_clear(text_poke_mm, poking_addr, ptep);
|
||||
pte_clear(text_poke_mm, text_poke_mm_addr, ptep);
|
||||
if (cross_page_boundary)
|
||||
pte_clear(text_poke_mm, poking_addr + PAGE_SIZE, ptep + 1);
|
||||
pte_clear(text_poke_mm, text_poke_mm_addr + PAGE_SIZE, ptep + 1);
|
||||
|
||||
/*
|
||||
* Loading the previous page-table hierarchy requires a serializing
|
||||
|
|
@ -2314,7 +2314,7 @@ static void *__text_poke(text_poke_f func, void *addr, const void *src, size_t l
|
|||
* Flushing the TLB might involve IPIs, which would require enabled
|
||||
* IRQs, but not if the mm is not used, as it is in this point.
|
||||
*/
|
||||
flush_tlb_mm_range(text_poke_mm, poking_addr, poking_addr +
|
||||
flush_tlb_mm_range(text_poke_mm, text_poke_mm_addr, text_poke_mm_addr +
|
||||
(cross_page_boundary ? 2 : 1) * PAGE_SIZE,
|
||||
PAGE_SHIFT, false);
|
||||
|
||||
|
|
|
|||
|
|
@ -835,20 +835,20 @@ void __init poking_init(void)
|
|||
* will be mapped at the same PMD. We need 2 pages, so find space for 3,
|
||||
* and adjust the address if the PMD ends after the first one.
|
||||
*/
|
||||
poking_addr = TASK_UNMAPPED_BASE;
|
||||
text_poke_mm_addr = TASK_UNMAPPED_BASE;
|
||||
if (IS_ENABLED(CONFIG_RANDOMIZE_BASE))
|
||||
poking_addr += (kaslr_get_random_long("Poking") & PAGE_MASK) %
|
||||
text_poke_mm_addr += (kaslr_get_random_long("Poking") & PAGE_MASK) %
|
||||
(TASK_SIZE - TASK_UNMAPPED_BASE - 3 * PAGE_SIZE);
|
||||
|
||||
if (((poking_addr + PAGE_SIZE) & ~PMD_MASK) == 0)
|
||||
poking_addr += PAGE_SIZE;
|
||||
if (((text_poke_mm_addr + PAGE_SIZE) & ~PMD_MASK) == 0)
|
||||
text_poke_mm_addr += PAGE_SIZE;
|
||||
|
||||
/*
|
||||
* We need to trigger the allocation of the page-tables that will be
|
||||
* needed for poking now. Later, poking may be performed in an atomic
|
||||
* section, which might cause allocation to fail.
|
||||
*/
|
||||
ptep = get_locked_pte(text_poke_mm, poking_addr, &ptl);
|
||||
ptep = get_locked_pte(text_poke_mm, text_poke_mm_addr, &ptl);
|
||||
BUG_ON(!ptep);
|
||||
pte_unmap_unlock(ptep, ptl);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user