From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 53950C3A59F for ; Fri, 30 Aug 2019 01:12:06 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 149B221874 for ; Fri, 30 Aug 2019 01:12:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567127526; bh=kHRw263jBX10OebCpVsHw8yXgkHI5XAiaesnjRNlA+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=Z2GyMNiZns4MUWYajEMq6eP3QXe2XKb8J3qJshmYWgGN0BmVdAff0Gw16H8lM3psJ bL1I2HXFHKojdyniiEmbBvRfZcKoWnD1r5+QFCnH7pDKw8XaSoBkgytZI/DFfQBjQo PD3oZFG+qIywuyr7WPMsBX4S8h+qhmI6bb22fJrk= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727814AbfH3BLx (ORCPT ); Thu, 29 Aug 2019 21:11:53 -0400 Received: from mail.kernel.org ([198.145.29.99]:58326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727413AbfH3BLr (ORCPT ); Thu, 29 Aug 2019 21:11:47 -0400 Received: from localhost (c-67-180-165-146.hsd1.ca.comcast.net [67.180.165.146]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 41C8E2189D; Fri, 30 Aug 2019 01:11:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1567127506; bh=kHRw263jBX10OebCpVsHw8yXgkHI5XAiaesnjRNlA+g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fbkyYOvJ7+6SE174CtLN8GBeT0m7LADn6b3vQbU5czZqSxsVe1MIu46Z2E/l875rz Yg5Jv6mCF1uTW6JQ7RNwnR4/5nu94xljCU3+6wE2raJhhpcx3A32FJuzw33JzaBVfA b/nlvqSvWMbfkNwKZB48nQwvea55oLLafyQtelfo= From: Andy Lutomirski To: Theodore Tso Cc: LKML , Linux API , Kees Cook , "Jason A. Donenfeld" , Andy Lutomirski Subject: [PATCH 3/7] random: Ignore GRND_RANDOM in getentropy(2) Date: Thu, 29 Aug 2019 18:11:38 -0700 Message-Id: <531cfcd62151916cc7fbade2ecd0311fbafc02a9.1567126741.git.luto@kernel.org> X-Mailer: git-send-email 2.21.0 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The separate blocking pool is going away. Start by ignoring GRND_RANDOM in getentropy(2). This should not materially break any API. Any code that worked without this change should work at least as well with this change. Signed-off-by: Andy Lutomirski --- drivers/char/random.c | 3 --- include/uapi/linux/random.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index acabb870f222..1ad2c7eaf675 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2135,9 +2135,6 @@ SYSCALL_DEFINE3(getrandom, char __user *, buf, size_t, count, if (count > INT_MAX) count = INT_MAX; - if (flags & GRND_RANDOM) - return _random_read(flags & GRND_NONBLOCK, buf, count); - if (!(flags & GRND_INSECURE) && !crng_ready()) { if (flags & GRND_NONBLOCK) return -EAGAIN; diff --git a/include/uapi/linux/random.h b/include/uapi/linux/random.h index c092d20088d3..dcc1b3e6106f 100644 --- a/include/uapi/linux/random.h +++ b/include/uapi/linux/random.h @@ -48,7 +48,7 @@ struct rand_pool_info { * Flags for getrandom(2) * * GRND_NONBLOCK Don't block and return EAGAIN instead - * GRND_RANDOM Use the /dev/random pool instead of /dev/urandom + * GRND_RANDOM No effect * GRND_INSECURE Return non-cryptographic random bytes */ #define GRND_NONBLOCK 0x0001 -- 2.21.0