From patchwork Fri Jun 2 16:48:25 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Jason A. Donenfeld" X-Patchwork-Id: 9763061 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 5E2FA60360 for ; Fri, 2 Jun 2017 16:48:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 504F02855C for ; Fri, 2 Jun 2017 16:48:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 42DC42858C; Fri, 2 Jun 2017 16:48:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from mother.openwall.net (mother.openwall.net [195.42.179.200]) by mail.wl.linuxfoundation.org (Postfix) with SMTP id 541B32855C for ; Fri, 2 Jun 2017 16:48:44 +0000 (UTC) Received: (qmail 25683 invoked by uid 550); 2 Jun 2017 16:48:42 -0000 Mailing-List: contact kernel-hardening-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Delivered-To: mailing list kernel-hardening@lists.openwall.com Received: (qmail 25639 invoked from network); 2 Jun 2017 16:48:38 -0000 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=zx2c4.com; h=mime-version :in-reply-to:references:from:date:message-id:subject:to :content-type; s=mail; bh=Hi0/Gc1c0wnDmswR3oX3SvkLDVE=; b=su5tKM 2Jtup13h8Yd77hCNeTMVioVq0nkY6cjLsLm91udFawuLQLDx6Kh8KnnIc2G2jlm7 vJ0fJ3ebCTSK5lKUKGqTyDc5t/Aka7ning5cFMcMTqzZFAefg/glfyBLroQQmbQ4 Ryg6ySO5a7SM9g/UQEz+QiY/aQqZ10ijv6d/JyaKR4iklZpcQOGrWH8HxjJkQ4Wu 73OAOcOrXl+d2MMj03E06r47Nt56xgo4qHMrWHeVJgRjRtnPv53f4d7ZBK09F6ZD pjRQ1rYq4WbK8GIerzjcJGVRPEWU0Hhc5mIZJi5KjVFk9YyInWk2XbGD/oz/Kkpq kmT6xZsiauAZI+zg== X-Gm-Message-State: AKS2vOy89HVTUQXOIRcnf/GLqAaEoNgSxzRihUC8OOtiA2CHhNnMEZcu HdY/9v23YdoDm6pvUkV2koyqf3aEwg== X-Received: by 10.157.31.71 with SMTP id x7mr5502674otx.249.1496422105884; Fri, 02 Jun 2017 09:48:25 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: From: "Jason A. Donenfeld" Date: Fri, 2 Jun 2017 18:48:25 +0200 X-Gmail-Original-Message-ID: Message-ID: To: Stephan Mueller , "Theodore Ts'o" , Linux Crypto Mailing List , LKML , kernel-hardening@lists.openwall.com, Herbert Xu Subject: [kernel-hardening] Re: get_random_bytes returns bad randomness before seeding is complete X-Virus-Scanned: ClamAV using ClamSMTP Further investigations: if the whack-a-mole approach is desirable, perhaps many of those get_random_bytes calls should be converted to get_blocking_random_bytes. In that case, this commit, which removed this helpful API, should be reverted: commit c2719503f5e1e6213d716bb078bdad01e28ebcbf Author: Herbert Xu Date: Tue Jun 9 18:19:42 2015 +0800 random: Remove kernel blocking API This patch removes the kernel blocking API as it has been completely replaced by the callback API. Signed-off-by: Herbert Xu diff --git a/drivers/char/random.c b/drivers/char/random.c index a1576ed1d88e..d0da5d852d41 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1265,18 +1265,6 @@ void get_random_bytes(void *buf, int nbytes) EXPORT_SYMBOL(get_random_bytes); /* - * Equivalent function to get_random_bytes with the difference that this - * function blocks the request until the nonblocking_pool is initialized. - */ -void get_blocking_random_bytes(void *buf, int nbytes) -{ - if (unlikely(nonblocking_pool.initialized == 0)) - wait_event(urandom_init_wait, nonblocking_pool.initialized); - extract_entropy(&nonblocking_pool, buf, nbytes, 0, 0); -} -EXPORT_SYMBOL(get_blocking_random_bytes); - -/*