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]
Message-ID: <20070714171644.GC6975@Krystal>
Date:	Sat, 14 Jul 2007 13:16:44 -0400
From:	Mathieu Desnoyers <mathieu.desnoyers@...ymtl.ca>
To:	Peter Zijlstra <a.p.zijlstra@...llo.nl>
Cc:	linux-kernel@...r.kernel.org, Ingo Molnar <mingo@...e.hu>,
	Thomas Gleixner <tglx@...utronix.de>,
	Oleg Nesterov <oleg@...sign.ru>,
	Steven Rostedt <rostedt@...dmis.org>,
	Christoph Lameter <clameter@....com>
Subject: Re: [PATCH -rt 4/5] use migrate_disable for __local_begin

* Peter Zijlstra (a.p.zijlstra@...llo.nl) wrote:
> Signed-off-by: Peter Zijlstra <a.p.zijlstra@...llo.nl>
> ---
>  include/asm-i386/local.h   |    7 ++++---
>  include/asm-x86_64/local.h |    7 ++++---
>  2 files changed, 8 insertions(+), 6 deletions(-)
> 
> Index: linux-2.6/include/asm-i386/local.h
> ===================================================================
> --- linux-2.6.orig/include/asm-i386/local.h
> +++ linux-2.6/include/asm-i386/local.h
> @@ -197,11 +197,12 @@ static __inline__ long local_sub_return(
>  #define __local_begin(__flags)					\
>  {								\
>  	(__flags) = 0;						\
> -	preempt_disable();					\
> +	migrate_disable();					\

Brrrr. That's wrong. Your non atomic __local*() updates only makes sense
when preempt_disable/enable() protects them from concurrent threads on
the same CPU, which is not the case of migrate_disable/enable(). This is
why I suggest that you use local_begin/end() mapped to
migrate_disable/enable() for normal local variables, and, if you really
want a __local_begin/end(), then it should be mapped to
preempt_disable/enable() and should state that it provides no protection
against interrupts.

Mathieu

>  }
>  
> -static inline void __local_end(unsigned long flags) {
> -	preempt_enable();
> +static inline void __local_end(unsigned long flags)
> +{
> +	migrate_enable();
>  }
>  
>  /* On x86, these are no better than the atomic variants. */
> Index: linux-2.6/include/asm-x86_64/local.h
> ===================================================================
> --- linux-2.6.orig/include/asm-x86_64/local.h
> +++ linux-2.6/include/asm-x86_64/local.h
> @@ -186,11 +186,12 @@ static __inline__ long local_sub_return(
>  #define __local_begin(__flags)		\
>  {					\
>  	(__flags) = 0;			\
> -	preempt_disable();		\
> +	migrate_disable();		\
>  }
>  
> -static inline void __local_end(unsigned long flags) {
> -	preempt_enable();
> +static inline void __local_end(unsigned long flags)
> +{
> +	migrate_enable();
>  }
>  
>  #define __local_inc(l)		local_inc(l)
> 
> --
> 

-- 
Mathieu Desnoyers
Computer Engineering Ph.D. Student, Ecole Polytechnique de Montreal
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F  BA06 3F25 A8FE 3BAE 9A68
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ