x86: expand irq-off region in text_poke()
Expand irq-off region to cover fixmap using code and cache synchronizing. Signed-off-by: Masami Hiramatsu <mhiramat@redhat.com> LKML-Reference: <49B54688.8090403@redhat.com> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
committed by
Ingo Molnar
parent
12e87e36e0
commit
7cf4942704
@@ -526,13 +526,12 @@ void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
|
|||||||
pages[1] = virt_to_page(addr + PAGE_SIZE);
|
pages[1] = virt_to_page(addr + PAGE_SIZE);
|
||||||
}
|
}
|
||||||
BUG_ON(!pages[0]);
|
BUG_ON(!pages[0]);
|
||||||
|
local_irq_save(flags);
|
||||||
set_fixmap(FIX_TEXT_POKE0, page_to_phys(pages[0]));
|
set_fixmap(FIX_TEXT_POKE0, page_to_phys(pages[0]));
|
||||||
if (pages[1])
|
if (pages[1])
|
||||||
set_fixmap(FIX_TEXT_POKE1, page_to_phys(pages[1]));
|
set_fixmap(FIX_TEXT_POKE1, page_to_phys(pages[1]));
|
||||||
vaddr = (char *)fix_to_virt(FIX_TEXT_POKE0);
|
vaddr = (char *)fix_to_virt(FIX_TEXT_POKE0);
|
||||||
local_irq_save(flags);
|
|
||||||
memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len);
|
memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len);
|
||||||
local_irq_restore(flags);
|
|
||||||
clear_fixmap(FIX_TEXT_POKE0);
|
clear_fixmap(FIX_TEXT_POKE0);
|
||||||
if (pages[1])
|
if (pages[1])
|
||||||
clear_fixmap(FIX_TEXT_POKE1);
|
clear_fixmap(FIX_TEXT_POKE1);
|
||||||
@@ -542,5 +541,6 @@ void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
|
|||||||
that causes hangs on some VIA CPUs. */
|
that causes hangs on some VIA CPUs. */
|
||||||
for (i = 0; i < len; i++)
|
for (i = 0; i < len; i++)
|
||||||
BUG_ON(((char *)addr)[i] != ((char *)opcode)[i]);
|
BUG_ON(((char *)addr)[i] != ((char *)opcode)[i]);
|
||||||
|
local_irq_restore(flags);
|
||||||
return addr;
|
return addr;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user