Commit 34754b69 authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

x86: make vmap yell louder when it is used under irqs_disabled()

Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 95108fa3
...@@ -498,12 +498,12 @@ void *text_poke_early(void *addr, const void *opcode, size_t len) ...@@ -498,12 +498,12 @@ void *text_poke_early(void *addr, const void *opcode, size_t len)
*/ */
void *__kprobes text_poke(void *addr, const void *opcode, size_t len) void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
{ {
unsigned long flags;
char *vaddr; char *vaddr;
int nr_pages = 2; int nr_pages = 2;
struct page *pages[2]; struct page *pages[2];
int i; int i;
might_sleep();
if (!core_kernel_text((unsigned long)addr)) { if (!core_kernel_text((unsigned long)addr)) {
pages[0] = vmalloc_to_page(addr); pages[0] = vmalloc_to_page(addr);
pages[1] = vmalloc_to_page(addr + PAGE_SIZE); pages[1] = vmalloc_to_page(addr + PAGE_SIZE);
...@@ -517,9 +517,9 @@ void *__kprobes text_poke(void *addr, const void *opcode, size_t len) ...@@ -517,9 +517,9 @@ void *__kprobes text_poke(void *addr, const void *opcode, size_t len)
nr_pages = 1; nr_pages = 1;
vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL); vaddr = vmap(pages, nr_pages, VM_MAP, PAGE_KERNEL);
BUG_ON(!vaddr); BUG_ON(!vaddr);
local_irq_save(flags); local_irq_disable();
memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len); memcpy(&vaddr[(unsigned long)addr & ~PAGE_MASK], opcode, len);
local_irq_restore(flags); local_irq_enable();
vunmap(vaddr); vunmap(vaddr);
sync_core(); sync_core();
/* Could also do a CLFLUSH here to speed up CPU recovery; but /* Could also do a CLFLUSH here to speed up CPU recovery; but
......
...@@ -1257,6 +1257,7 @@ EXPORT_SYMBOL(vfree); ...@@ -1257,6 +1257,7 @@ EXPORT_SYMBOL(vfree);
void vunmap(const void *addr) void vunmap(const void *addr)
{ {
BUG_ON(in_interrupt()); BUG_ON(in_interrupt());
might_sleep();
__vunmap(addr, 0); __vunmap(addr, 0);
} }
EXPORT_SYMBOL(vunmap); EXPORT_SYMBOL(vunmap);
...@@ -1276,6 +1277,8 @@ void *vmap(struct page **pages, unsigned int count, ...@@ -1276,6 +1277,8 @@ void *vmap(struct page **pages, unsigned int count,
{ {
struct vm_struct *area; struct vm_struct *area;
might_sleep();
if (count > num_physpages) if (count > num_physpages)
return NULL; return NULL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment