On 06/09, Andrea Parri wrote:
>
> There is no need to use the barrier if there is no dereference/
> memory access; move it where needed (currently, affecting only
> Alpha).

OK, although area == NULL is unlikely case,

> While touching this, also make the reads _ONCE().

Why? both xol_area/vaddr can't change.

> Signed-off-by: Andrea Parri <parri.and...@gmail.com>
> ---
>  kernel/events/uprobes.c | 9 +++++----
>  1 file changed, 5 insertions(+), 4 deletions(-)
> 
> diff --git a/kernel/events/uprobes.c b/kernel/events/uprobes.c
> index b7a525ab2083..b1364acd683e 100644
> --- a/kernel/events/uprobes.c
> +++ b/kernel/events/uprobes.c
> @@ -1520,10 +1520,11 @@ static unsigned long get_trampoline_vaddr(void)
>       struct xol_area *area;
>       unsigned long trampoline_vaddr = -1;
>  
> -     area = current->mm->uprobes_state.xol_area;
> -     smp_read_barrier_depends();
> -     if (area)
> -             trampoline_vaddr = area->vaddr;
> +     area = READ_ONCE(current->mm->uprobes_state.xol_area);
> +     if (area) {
> +             smp_read_barrier_depends();
> +             trampoline_vaddr = READ_ONCE(area->vaddr);
> +     }
>  
>       return trampoline_vaddr;
>  }
> -- 
> 1.9.1
> 

Reply via email to