Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1465951

Re: [PATCH 3.14 14/46] random: properly align get_random_int_hash

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Eric Biggers <ebiggers3@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 3.14 14/46] random: properly align get_random_int_hash
Date Fri, 19 Aug 2016 05:20:01 +0200
Message-ID <s7IvD-a1-5@gated-at.bofh.it> (permalink)
References <s7w1r-vD-3@gated-at.bofh.it> <s7w1s-vD-51@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Cb9AeQumgK5McMhTVMG2s1MbDyr3s3+mQtezsV96C+c=; b=zCIN0V+glT69QCBj3OqffWpqTn0qMP/34+dgeI2XkzUYd4ykMU7AtRnVRWUqfct4gK xRlvHS71AijiuzOpvIKLZ580sX1HjAaFtn5q9sfMSttzXm3MyZkGMIVc4lvyE48oRXPD cGT6zw4HyBjM80PO8a+8JsiSKr8qs8/nvrjFxpojXA/JAMuQjtlKoqxLlZNgkF+LYsnE a3iTC4uxRICVx8RoeNyP6NTT8IPSOE0LoNugDi98mxyEaD+12ATM1G+jHKlcojMpLb+O zlg+a2fTGnLNwb7RGDa4Kq5rAuRbVjEfRaUnK8TLfteCviiGU9zhhe9EkRME999E1mnX 3vmQ==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Cb9AeQumgK5McMhTVMG2s1MbDyr3s3+mQtezsV96C+c=; b=DKT6ganRYSOGy/TPKSUSQaiE3EZk0ZajtqfVKBFbdfwfZOOMAlt76ByqPJK8cs9Ven QsEKvgpmlBmvhZelJB1w5j2Q7BwK1xnhgTKGidHP2cHr3vzGD9iYvZTAR21YZ0MKTgV2 IR4qA7Lu/oLe/5c20vaqVEXQ+WPyM1ol3aGfk3pTiCYF4q9cw1nDKoToE+qka7cUC5GR nhCROxcT7cXAs+thC8aA3gojzy0DR+kVsBfiSwWb+zlaqQx1ThlxH3QCswPi/8TWvK/2 wDfvNpgSZdLVEHNBkwg6AGIAfNZLFoEz8srjKIHYFSNnZDHu3PTSUA5uZgXOfMmx0Lh4 2gJw==
X-Gm-Message-State AEkoouuWFFBEDcSzFFvdFBnllNpQlUm6w86ilSG1XTnzvU44e3PGVBm1XGEfVSaei+xVww==
X-Received by 10.98.18.221 with SMTP id 90mr10187809pfs.3.1471576460222; Thu, 18 Aug 2016 20:14:20 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.6.2 (2016-07-01)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 46
Organization linux.* mail to news gateway
X-Original-Cc linux-kernel@vger.kernel.org, stable@vger.kernel.org, Theodore Tso <tytso@mit.edu>, Eric Biggers <ebiggers@google.com>
X-Original-Date Thu, 18 Aug 2016 20:14:17 -0700
X-Original-Message-ID <20160819031417.GA876@zzz>
X-Original-References <20160818135442.457400364@linuxfoundation.org> <20160818135444.550472497@linuxfoundation.org>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1465951

Show key headers only | View raw


get_random_long() was added in v4.5 and doesn't appear to have been backported
to any stable branches, so my patch doesn't actually need to be backported to
anything older than v4.5.  It won't break anything, though.

On Thu, Aug 18, 2016 at 03:54:36PM +0200, Greg Kroah-Hartman wrote:
> 3.14-stable review patch.  If anyone has any objections, please let me know.
> 
> ------------------
> 
> From: Eric Biggers <ebiggers3@gmail.com>
> 
> commit b1132deac01c2332d234fa821a70022796b79182 upstream.
> 
> get_random_long() reads from the get_random_int_hash array using an
> unsigned long pointer.  For this code to be guaranteed correct on all
> architectures, the array must be aligned to an unsigned long boundary.
> 
> Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
> Signed-off-by: Theodore Ts'o <tytso@mit.edu>
> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> ---
>  drivers/char/random.c |    4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> --- a/drivers/char/random.c
> +++ b/drivers/char/random.c
> @@ -1632,13 +1632,15 @@ int random_int_secret_init(void)
>  	return 0;
>  }
>  
> +static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash)
> +		__aligned(sizeof(unsigned long));
> +
>  /*
>   * Get a random word for internal kernel use only. Similar to urandom but
>   * with the goal of minimal entropy pool depletion. As a result, the random
>   * value is not cryptographically secure but for several uses the cost of
>   * depleting entropy is too high
>   */
> -static DEFINE_PER_CPU(__u32 [MD5_DIGEST_WORDS], get_random_int_hash);
>  unsigned int get_random_int(void)
>  {
>  	__u32 *hash;
> 
> 

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 3.14 14/46] random: properly align get_random_int_hash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-18 16:00 +0200
  Re: [PATCH 3.14 14/46] random: properly align get_random_int_hash Eric Biggers <ebiggers3@gmail.com> - 2016-08-19 05:20 +0200
    Re: [PATCH 3.14 14/46] random: properly align get_random_int_hash Greg Kroah-Hartman <gregkh@linuxfoundation.org> - 2016-08-19 09:40 +0200

csiph-web