Received: by 2002:a05:6a10:1a4d:0:0:0:0 with SMTP id nk13csp5979219pxb; Mon, 14 Feb 2022 12:12:46 -0800 (PST) X-Google-Smtp-Source: ABdhPJwq1qW2q6BEWEeLIj5yqSPPsmKJuAAjKRwKcfIpWYTONuAGg/sUeVbCNd72GX4GmE5CKQlc X-Received: by 2002:a63:6e8d:: with SMTP id j135mr576536pgc.63.1644869566181; Mon, 14 Feb 2022 12:12:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644869566; cv=none; d=google.com; s=arc-20160816; b=hF8YJ0tPQ0M1WzVWax7I91FohhtUPbOQM9ruNyE5UyEwpTR7quq4wm2Hf4AbodM4p0 ckXw/rZ2GHpQ0ErsNJyu0Qp0/JpE0v/OdlSbL4ySY9WjMRqmUGlugjwwfjoMlQENSbY3 TBhUR1uK17RWG7OEogNS5s0SzwoJHu8URz4D8NTGAUxmcC96rY7feUpUwfdBoIQlUQxL qvuf3gPG6V+myxG3Bp4pnl1bzzm1jfMi9PedOUOot4HCKjhOPF3NNQT0AY9MrMQ2bsNG mY+WcFJCME3hr7W0NFpcL13clvO/wVeI99/X+gRbzl8tPjWQqBlIrLe6CJiTpf1sNMUo wEXg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1Eoo9ySP03OmQh4+xMpPbnYZz6lR1PXVZ6II7xXSFf0=; b=Wy2VE7bNr5Y+wqi7tLKWaOYISDawzTsGZZpT+qqVwEMnmynKZCdG/3JQEcHAgWmz5z HdNd4ArEAeCl+9wan7UO+UmzmAZZ1A5Sanv0PYCVu8lEKFbYWWeFoPLxUBHFwPj5bw+M k3cke6SDMn0CemJJsSsLq6D3ZPJD38NJ64Ffc1WzHMNO7Bkr4m8UaAY7OJClxrNAlLBS oz090/n3+B/HHnLbxMNR4N1d5MqtxtJhNp5yt05QRaVc+tYtMf8uRLVdiEe7stPuh5J6 WFJIWcZkaCgmeW55sRht/ftG14iPc84+GkCLUXIjOqJD8Y9xd+ns0SiCy8OPoDNVt36U ggUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=Lkk5yfOB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id c8si706825pgq.675.2022.02.14.12.12.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 14 Feb 2022 12:12:46 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@zx2c4.com header.s=20210105 header.b=Lkk5yfOB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zx2c4.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id DDCF0120F6B; Mon, 14 Feb 2022 11:49:36 -0800 (PST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234874AbiBLMYL (ORCPT + 99 others); Sat, 12 Feb 2022 07:24:11 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:41594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234868AbiBLMXv (ORCPT ); Sat, 12 Feb 2022 07:23:51 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 64A0E26AEE for ; Sat, 12 Feb 2022 04:23:47 -0800 (PST) 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 dfw.source.kernel.org (Postfix) with ESMTPS id ECC3C60DD7 for ; Sat, 12 Feb 2022 12:23:46 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id F1A82C340E7; Sat, 12 Feb 2022 12:23:45 +0000 (UTC) Authentication-Results: smtp.kernel.org; dkim=pass (1024-bit key) header.d=zx2c4.com header.i=@zx2c4.com header.b="Lkk5yfOB" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zx2c4.com; s=20210105; t=1644668624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=1Eoo9ySP03OmQh4+xMpPbnYZz6lR1PXVZ6II7xXSFf0=; b=Lkk5yfOBYtydDraGDyxjFHDxVtU3sZs0th0KvkXCTzLFgVFkPowKYaR9ozFwGXIrvgbOrG kFCacPIXI88RO7OtJ6JqFOrIGBW4XCNtlGyZRSVUSaqDLY+3YD/yL5NNaHNrJP6JHWhVHG efgqvJgMs8+N4jHATZVJsGuWBhgNp9I= Received: by mail.zx2c4.com (ZX2C4 Mail Server) with ESMTPSA id 9f620fc4 (TLSv1.3:AEAD-AES256-GCM-SHA384:256:NO); Sat, 12 Feb 2022 12:23:44 +0000 (UTC) From: "Jason A. Donenfeld" To: linux-kernel@vger.kernel.org, linux@dominikbrodowski.net Cc: "Jason A. Donenfeld" , Theodore Ts'o Subject: [PATCH v2 09/10] random: group sysctl functions Date: Sat, 12 Feb 2022 13:23:17 +0100 Message-Id: <20220212122318.623435-10-Jason@zx2c4.com> In-Reply-To: <20220212122318.623435-1-Jason@zx2c4.com> References: <20220212122318.623435-1-Jason@zx2c4.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 This pulls all of the sysctl-focused functions into the sixth labeled section. No functional changes. Cc: Theodore Ts'o Cc: Dominik Brodowski Signed-off-by: Jason A. Donenfeld --- drivers/char/random.c | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) diff --git a/drivers/char/random.c b/drivers/char/random.c index b2af2dc96d20..a32176a46691 100644 --- a/drivers/char/random.c +++ b/drivers/char/random.c @@ -1678,9 +1678,34 @@ const struct file_operations urandom_fops = { .llseek = noop_llseek, }; + /******************************************************************** * - * Sysctl interface + * Sysctl interface. + * + * These are partly unused legacy knobs with dummy values to not break + * userspace and partly still useful things. They are usually accessible + * in /proc/sys/kernel/random/ and are as follows: + * + * - boot_id - a UUID representing the current boot. + * + * - uuid - a random UUID, different each time the file is read. + * + * - poolsize - the number of bits of entropy that the input pool can + * hold, tied to the POOL_BITS constant. + * + * - entropy_avail - the number of bits of entropy currently in the + * input pool. Always <= poolsize. + * + * - write_wakeup_threshold - the amount of entropy in the input pool + * below which write polls to /dev/random will unblock, requesting + * more entropy, tied to the POOL_MIN_BITS constant. It is writable + * to avoid breaking old userspaces, but writing to it does not + * change any behavior of the RNG. + * + * - urandom_min_reseed_secs - fixed to the meaningless value "60". + * It is writable to avoid breaking old userspaces, but writing + * to it does not change any behavior of the RNG. * ********************************************************************/ @@ -1688,8 +1713,8 @@ const struct file_operations urandom_fops = { #include -static int random_min_urandom_seed = 60; -static int random_write_wakeup_bits = POOL_MIN_BITS; +static int sysctl_random_min_urandom_seed = 60; +static int sysctl_random_write_wakeup_bits = POOL_MIN_BITS; static int sysctl_poolsize = POOL_BITS; static char sysctl_bootid[16]; @@ -1746,14 +1771,14 @@ static struct ctl_table random_table[] = { }, { .procname = "write_wakeup_threshold", - .data = &random_write_wakeup_bits, + .data = &sysctl_random_write_wakeup_bits, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, }, { .procname = "urandom_min_reseed_secs", - .data = &random_min_urandom_seed, + .data = &sysctl_random_min_urandom_seed, .maxlen = sizeof(int), .mode = 0644, .proc_handler = proc_dointvec, @@ -1784,4 +1809,4 @@ static int __init random_sysctls_init(void) return 0; } device_initcall(random_sysctls_init); -#endif /* CONFIG_SYSCTL */ +#endif -- 2.35.0