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: <alpine.LFD.2.00.1011082247160.2900@localhost6.localdomain6>
Date:	Mon, 8 Nov 2010 22:48:21 +0100 (CET)
From:	Thomas Gleixner <tglx@...utronix.de>
To:	Darren Hart <dvhart@...ux.intel.com>
cc:	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Peter Zijlstra <peterz@...radead.org>,
	Ingo Molnar <mingo@...e.hu>,
	Eric Dumazet <eric.dumazet@...il.com>,
	John Kacur <jkacur@...hat.com>
Subject: Re: [PATCH V3] futex: add futex_q static initializer

On Mon, 8 Nov 2010, Darren Hart wrote:

> The futex_q struct has grown considerably over the last couple years. I
> believe it now merits a static initializer to avoid uninitialized data
> errors (having spent more time than I care to admit debugging an uninitialized
> q.bitset in an experimental new op code).
> 
> With the key initializer built in, several of the FUTEX_KEY_INIT calls can
> be removed.
> 
> V2: use a static variable instead of an init macro.
>     use a C99 initializer and don't rely on variable ordering in the struct.
> V3: make futex_q_init const
> 
> Signed-off-by: Darren Hart <dvhart@...ux.intel.com>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Peter Zijlstra <peterz@...radead.org>
> Cc: Ingo Molnar <mingo@...e.hu>
> CC: Eric Dumazet <eric.dumazet@...il.com>
> CC: John Kacur <jkacur@...hat.com>
> ---
>  kernel/futex.c |   25 ++++++++++---------------
>  1 files changed, 10 insertions(+), 15 deletions(-)
> 
> diff --git a/kernel/futex.c b/kernel/futex.c
> index fd3fbe1..e6df2de 100644
> --- a/kernel/futex.c
> +++ b/kernel/futex.c
> @@ -131,6 +131,12 @@ struct futex_q {
>  	u32 bitset;
>  };
>  
> +static const struct futex_q futex_q_init = {
> +	/* list gets initialized in queue_me()*/ 
> +	.key = FUTEX_KEY_INIT,
> +	.bitset = FUTEX_BITSET_MATCH_ANY
> +};
> +
>  /*
>   * Hash buckets are shared by all the futex_keys that hash to the same
>   * location.  Each key may have multiple futex_q structures, one for each task
> @@ -1751,7 +1757,6 @@ static int futex_wait_setup(u32 __user *uaddr, u32 val, unsigned int flags,
>  	 * rare, but normal.
>  	 */
>  retry:
> -	q->key = FUTEX_KEY_INIT;

You sure about that one in the retry path ?

> @@ -1906,11 +1907,7 @@ static int futex_lock_pi(u32 __user *uaddr, unsigned int flags, int detect,
>  		hrtimer_set_expires(&to->timer, *time);
>  	}
>  
> -	q.pi_state = NULL;
> -	q.rt_waiter = NULL;
> -	q.requeue_pi_key = NULL;
>  retry:
> -	q.key = FUTEX_KEY_INIT;

Ditto

Thanks,

	tglx
--
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