lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 10 Jun 2016 09:03:10 +0200
From:	Oleg Nesterov <oleg@...hat.com>
To:	Andrea Parri <parri.andrea@...il.com>
Cc:	Peter Zijlstra <peterz@...radead.org>,
	LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] events/uprobes: move smp_read_barrier_depends() where
 needed

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.andrea@...il.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
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ