Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp2636041iog; Mon, 20 Jun 2022 01:05:36 -0700 (PDT) X-Google-Smtp-Source: AGRyM1touC1V5Paj74l7u8Zx7feR1wOxRsF0lj3/bkp+bxfrO1YRvoAWYYfyw6XA6SxiI8cjIBHq X-Received: by 2002:a17:903:248:b0:168:cf03:eefe with SMTP id j8-20020a170903024800b00168cf03eefemr22201596plh.124.1655712336395; Mon, 20 Jun 2022 01:05:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1655712336; cv=none; d=google.com; s=arc-20160816; b=BxHNPIEuQ9/1UxueKtSWs7xKy49ibFuZbc2bafcEP0urpL8WyMf5BQclU/Vy1fBjHQ XJUBvguM8yXT4fkDdb5lcQzKARHHUn+p4AL50FYRB2vZpM+PBJk6nBRlgyTwnpa5wC6Z 4DL8v7eQ9HaqWXwuzsgwGBM8nwTSOIqNqNYApj+Xcozu6cUqe030WZVo50Q1Jqhmka25 6b6Bm8uEhUBriIDsEi7H/BnvsiBBiMwayk2uZWxwesI0X8S6HURV79NLpjsUmGRDQ5RB zmY/DBxrpupSkMGdO2E07EQtUiythKhfWQg4e1TYracrRaKtZ8hiBYU8Hg9qx5nHJILh gu6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:dkim-signature :dkim-signature:date; bh=tva4ntyPqz0jZawiKVHe9/LFqzvlD7thGRd/uzxp3aQ=; b=O4P2VZDx5945/eltm195BujyAE6BmJB0PmOdnf5Y0DuLcpXeodMKjq079B44r2X2zI LI2G202NrUvhniRMJ3IA4NJeCIxgCV1fJvkt4fNiT5n4jRNh3izSUCvsUBUW9ChxJ0x6 mCKwH671pEAOw/LcfPgzaxoJKbvjVtZ/MKXVISQiVm8Wc75A4+XHGQgjlMZtMWWdTrY7 I2rDfhuRNuopnwRVdn+WZtR+G4pP7fxItmvWzVqasHMqX3oCsPk8pxqfaH8xvDdpSwDl EoAbQu1+sXpWnseY51brCQR42lfeOgItOGGtwSAWDynnPKxU3phtFSg2bg4xmqEousrH Ou9w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=BQkcXel5; dkim=neutral (no key) header.i=@linutronix.de header.b=ZuXwDhnk; 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=QUARANTINE dis=NONE) header.from=linutronix.de Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id k12-20020a17090a404c00b001ec79b80891si9964789pjg.72.2022.06.20.01.05.22; Mon, 20 Jun 2022 01:05:36 -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=@linutronix.de header.s=2020 header.b=BQkcXel5; dkim=neutral (no key) header.i=@linutronix.de header.b=ZuXwDhnk; 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=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239491AbiFTHoG (ORCPT + 99 others); Mon, 20 Jun 2022 03:44:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42584 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S238584AbiFTHoD (ORCPT ); Mon, 20 Jun 2022 03:44:03 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC04A6418 for ; Mon, 20 Jun 2022 00:44:02 -0700 (PDT) Date: Mon, 20 Jun 2022 09:43:56 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1655711037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tva4ntyPqz0jZawiKVHe9/LFqzvlD7thGRd/uzxp3aQ=; b=BQkcXel5o+3EitcZszx/LwEAGktHbx37NIWRfldX30Xi6yFks2AukopJv1+FYkLL5A01nj JM9tiamiPalesGuUB7oBOz36P0lfyOx9apJMriulEvjcYiW3rE9fYy0D7ZZl9CMdwjqAhy 5k9vbymyHIYMro4ScOZotzaGCTW8unujDgHFsaXprTJ7WbBcXXXgOAubM+3c3Dj2fIlhIv PWexEpIkwpfxjzhHbf3qiIljQUppluylewE4u5b8hWYn0NGdvSg3DSVJL8iFHBpgI5D1rN XzwO9WmVt8wh00g/wcVXh+J+srMlRMrnoyWS85mFiVgWwQm4osclJJElEeXxNg== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1655711037; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=tva4ntyPqz0jZawiKVHe9/LFqzvlD7thGRd/uzxp3aQ=; b=ZuXwDhnkaVL3HQjjIZKwc3xjxocOY43gq98f0wYInqdgRh75oOtHcDkUDWTTRuJfuA7N49 6oAkCXzW800rC0Dg== From: Sebastian Siewior To: "Jason A. Donenfeld" Cc: Jann Horn , Theodore Ts'o , LKML , Thomas Gleixner , Linus Torvalds Subject: Re: [PATCH] random: Fix signal_pending() usage Message-ID: References: <20220405163931.1108442-1-jannh@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,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 On 2022-06-18 00:47:12 [+0200], Jason A. Donenfeld wrote: > Hi Sebastian, Hi Jason, > You're a bit late to the thread :). It used to be 256. Now it's page > size. PAGE_SIZE is also what /dev/zero and others in mem.c use. Just managed to get to that part of the inbox ;) > As for your suggestion to drop it entirely: that'd be nice, in that it'd > add a guarantee that currently doesn't exist. But it can lead to > somewhat large delays if somebody tries to read 2 gigabytes at a time > and hits Ctrl+C during it. That seems potentially bad? So on my x86 box which runs a Debian kernel (based on v5.18.2): | ~$ dd if=/dev/random of=/dev/null bs=2147483648 count=1 | 0+1 records in | 0+1 records out | 2147479552 bytes (2,1 GB, 2,0 GiB) copied, 5,97452 s, 359 MB/s almost 6 secs. On a smaller box it might take 12s or more. Your implementation change ensured that it does not block for unpredicted amount of time. Previously it would block until the random pool is filled with enough entropy and this could take an unforeseen amount of time. That read now makes more or less constant progress since it depends only on CPU time. Based on that, I don't see a problem dropping that signal check especially that requests larger than 4KiB are most likely exotic. > Or that's not bad, which would be quite nice, as I would really love to > add that guarantee. So if you have an argument that not responding to > signals for that amount of time is fine, I'd be interested to hear it. Just my two cents. > Jason Sebastian