Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp6134125iog; Thu, 23 Jun 2022 12:04:04 -0700 (PDT) X-Google-Smtp-Source: AGRyM1sQJsoumYHnUmS2SwT6moCsrUUf/Ow/YrThkAM4epbIqeMbF0Xont2F1CzNuEd0rYxleWE+ X-Received: by 2002:a65:6b8a:0:b0:3db:7dc5:fec2 with SMTP id d10-20020a656b8a000000b003db7dc5fec2mr8443043pgw.223.1656011044665; Thu, 23 Jun 2022 12:04:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656011044; cv=none; d=google.com; s=arc-20160816; b=KKpeHIYsjreEASJIRR6f5146zPI5ZA+lgSckZQq1tyKAeyV+opmD7DMqNOndM9MN13 yMtCwf2suDrgFk06a3/eDd2ZiV819zSWrZtuLYQK54WJCidJRTmhnclsv32k/pc7dzwd VdUa2A5y+E/oC9e8u6ul6RJEivl7RozTTjlrgIBkROsqj2pvH7kLECS+tAPYKY4GbLdZ WPuWIRR3Jp748qlnh0BewEM3FcVfR6eBNaiFdPQVPJGQloJ908l25YH4tPt2NBIcXuI0 hS5euv4gDgYL2jpvGs8aFMsQXwvpFiuYZP+9VrHlz/NxgJW2Lz7oPGe+n5q/ZubbztvH eOjA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+qfaXQwM9dIfGsH82y6+NuX5mIWMX3EZEa5QLGDrLuY=; b=YQquD+6BYB2Xx2pzx7C8mE0wTzEacF7cwFeTwuysEFXk8JAas9nQCTiXKimsnsphMq JwSWZdW2VqxZUYBE6xwS7sjDWVmU6+Oh9szyFZVHO0LFESwy7Qubxa+4ftYui+emAg4M jfbvmXkMbmxHT6VJ39xTrvd4LG+Tr2boiXYATWMr4o7RTJ9MzR7LtPNKJffHoKQ3Htu7 2mgWJSFktIoKt1YYZ3Dd6EjUC+RZpx8vT58DabUXBxqFULC0pVfc9nhNn4FoDtBaY8PD Jl+xqSTSo+1kW0B/2J8553CdS0v79haxDaW3nyn6cchevtbeGnoD9LWliui/J3oUt4Vk SllA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ODTbryXK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s5-20020a656445000000b0040cd256b7f4si15058643pgv.407.2022.06.23.12.03.51; Thu, 23 Jun 2022 12:04:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ODTbryXK; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232606AbiFWRAU (ORCPT + 99 others); Thu, 23 Jun 2022 13:00:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49292 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232925AbiFWQt6 (ORCPT ); Thu, 23 Jun 2022 12:49:58 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CB0FE13F3D; Thu, 23 Jun 2022 09:47:59 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id DDCBCCE25D9; Thu, 23 Jun 2022 16:47:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id EC414C385A5; Thu, 23 Jun 2022 16:47:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1656002876; bh=DVqS7H5Sm67SdV6zpWpQ1W1Mj+FjSJsjD7F6bT+BDPs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ODTbryXKvY8poKwLBT11rdWYCt/KEndZgVPeLneG155xBxViqPpEK8tzcnEFhcYd6 5RmlRS0hhK2kwjwsxZYCUb8ImwslRU8QOjFVpPrCnWvSx6Z7sK+3C83B1ZFw/TolN1 cjn7InwsX513toinLyvHV3d5jt84gyvPOUitJKgI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Andy Lutomirski , Theodore Tso , "Jason A. Donenfeld" Subject: [PATCH 4.9 056/264] random: ignore GRND_RANDOM in getentropy(2) Date: Thu, 23 Jun 2022 18:40:49 +0200 Message-Id: <20220623164345.658306748@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220623164344.053938039@linuxfoundation.org> References: <20220623164344.053938039@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Andy Lutomirski commit 48446f198f9adcb499b30332488dfd5bc3f176f6 upstream. 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 Link: https://lore.kernel.org/r/705c5a091b63cc5da70c99304bb97e0109be0a26.1577088521.git.luto@kernel.org Signed-off-by: Theodore Ts'o Signed-off-by: Jason A. Donenfeld Signed-off-by: Greg Kroah-Hartman --- drivers/char/random.c | 3 --- include/uapi/linux/random.h | 2 +- 2 files changed, 1 insertion(+), 4 deletions(-) --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -2200,9 +2200,6 @@ SYSCALL_DEFINE3(getrandom, char __user * 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; --- a/include/uapi/linux/random.h +++ b/include/uapi/linux/random.h @@ -47,7 +47,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