alpha: flush_icache_user_range && vma (Was: uprobes need icache flush after xol write)

From: Oleg Nesterov (oleg@xxxxxxxxxx)
Date: Tue Apr 08 2014 - 11:38:10 EST


On 04/08, Oleg Nesterov wrote:
>
> Almost nobody (iirc only sparc?)

arch/alpha, I meant.

> actually uses this "vma" arguments. And
> at least the supported architectures do not (at least this is what I think
> after the quick grep).
>
> Perhaps we can rolerate the hack below?
>
> Oleg.
>
> --- x/kernel/events/uprobes.c
> +++ x/kernel/events/uprobes.c
> @@ -1295,10 +1295,10 @@ static unsigned long xol_get_insn_slot(s
> copy_to_page(area->page, xol_vaddr,
> &uprobe->arch.ixol, sizeof(uprobe->arch.ixol));
> /*
> - * We probably need flush_icache_user_range() but it needs vma.
> - * This should work on supported architectures too.
> + * The architectures we currently support do not really use vma.
> */
> - flush_dcache_page(area->page);
> + flush_icache_user_range(NULL /* vma */, area->page,
> + xol_vaddr, sizeof(uprobe->arch.ixol));
>
> return xol_vaddr;
> }


And perhaps we can change arch/alpha to accept vma == NULL?

Oleg.


--- x/arch/alpha/kernel/smp.c
+++ x/arch/alpha/kernel/smp.c
@@ -757,8 +757,13 @@ flush_icache_user_range(struct vm_area_s
{
struct mm_struct *mm = vma->vm_mm;

- if ((vma->vm_flags & VM_EXEC) == 0)
- return;
+ if (vma) {
+ if ((vma->vm_flags & VM_EXEC) == 0)
+ return;
+ mm = vma->vm_mm;
+ } else {
+ mm = current->mm;
+ }

preempt_disable();


--
To unsubscribe from this list: send the line "unsubscribe linux-alpha" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html