Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751558AbdFFMXP (ORCPT ); Tue, 6 Jun 2017 08:23:15 -0400 Received: from frisell.zx2c4.com ([192.95.5.64]:54593 "EHLO frisell.zx2c4.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751345AbdFFMXN (ORCPT ); Tue, 6 Jun 2017 08:23:13 -0400 MIME-Version: 1.0 In-Reply-To: <26642.1496743729@warthog.procyon.org.uk> References: <20170606005108.5646-1-Jason@zx2c4.com> <20170606005108.5646-6-Jason@zx2c4.com> <26642.1496743729@warthog.procyon.org.uk> From: "Jason A. Donenfeld" Date: Tue, 6 Jun 2017 14:23:09 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v3 05/13] security/keys: ensure RNG is seeded before use To: David Howells Cc: "Theodore Ts'o" , Linux Crypto Mailing List , LKML , kernel-hardening@lists.openwall.com, Greg Kroah-Hartman , David Miller , Mimi Zohar , David Safford Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 519 Lines: 12 On Tue, Jun 6, 2017 at 12:08 PM, David Howells wrote: > Jason A. Donenfeld wrote: > >> + key->serial = get_random_u32() >> 1; > > If this may sleep, it must be interruptible. That won't sleep. I could have made it get_random_u32_wait(), but we'd get into trouble at boottime. So instead, for now, I just use get_random_u32 rather than get_random_bytes, which can use the architectural random number generator, when the platform has one, which is available early on.