Received: by 2002:a05:6500:2018:b0:1fb:9675:f89d with SMTP id t24csp661242lqh; Fri, 31 May 2024 12:17:37 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWYI0jQrrET+VUGne87L7xQokhM0cpZduUkMDJ5+h5rSsl7XV6gemgMLNb7ogqVk8efCeV8RCcoxAj3iU9Wg0j/yQI0srIpCAD+9yPUpQ== X-Google-Smtp-Source: AGHT+IGkWm0jGHJgH39DUy0IWSNOybuGfzJdFNRdZtbvi8eULYpbUm/bzkVh0x0wgYILPdEU9Zcb X-Received: by 2002:ac2:53a8:0:b0:512:e02f:9fa7 with SMTP id 2adb3069b0e04-52b895217a8mr2277575e87.1.1717183057562; Fri, 31 May 2024 12:17:37 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1717183057; cv=pass; d=google.com; s=arc-20160816; b=CENWhsP/jsyum+Sn0SQWzfkxMXLJwQvpKiyOESY+XMk7bANWfJOmFaqKvN+Pnn6kZD IwjN9UDDxfrEU0cZNUr8U5r7qwucIqCCDbOr6W+CV5Dztj8h6hyT/rTb7U1NU5JJ42M+ AVzi4JvVAaqPSuyezFpIyYJJ3YxDGh64shYSo4q38cs12RuhS4AAFGRLkEFACYQemgY5 DiB4a7dDj1B3z8kxU5jHWlfcrrVJw3+T/lS4wXRqgXKD3CF2TaGHi6pIYYnyo/JiIub0 EX/fPLFyPAHZnaB3pNE9fm/yTBO6qwIZz8k20RNLumipFuFjX01a0d6wfqYL9SzU0z9L OouQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=u/g1j5mYG7Zir9s2o+HTGAW2a6hjFEiH6+1szjteCnM=; fh=dhbLWZ5YHgDiQsiBvVl0QIJQiGAlg+8xB6C7iWLPPTo=; b=hkm8WERFkT06m43ukNAeUA6JdnXAV+r9A+SI54KD3OktU/JcBf2pSWBNW7xWX6m5x/ GEXO462yP4WPXpeaKIA8aNH8SDwszGZBtaJ7xa5tlTiqjfEzy9XtoFicZ03tbRBOZa6o ZW+0CTrN0cZ1Img8zK1hmh9pYvmL9aODAIs90CSshnTfSIILFtWo3imaFXd9cwZ894rI TxdizXsHWADQ26tGSFbRrJ3CH0Kg9ifYYL2DjDoEo/DVF78m80qzSgl5IX2d99xk/b6J dPggYfHlT2bU4RiQNmLZ28qFf7+lxG9N+wHHWgef6avffihGnC36lg64PV04DLMmFmNO 95Lg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=REdAg7gc; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-197348-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197348-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id a640c23a62f3a-a688598e9bcsi81583066b.984.2024.05.31.12.17.37 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 12:17:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-197348-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=bombadil.20210309 header.b=REdAg7gc; arc=pass (i=1 dkim=pass dkdomain=infradead.org); spf=pass (google.com: domain of linux-kernel+bounces-197348-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-197348-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 46FB41F29D81 for ; Fri, 31 May 2024 19:17:37 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9E27D17D379; Fri, 31 May 2024 19:15:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b="REdAg7gc" Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 567C98063C; Fri, 31 May 2024 19:15:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.137.202.133 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717182918; cv=none; b=Ft6Nm2WkI21vZGjOhgL3h+GI2s6uE2FjFdr44HddbUGrfuG8YuRGgfCFbIYWXceKiDqFcGjncytRxQX4KPAn56/CZE4+VZT0P7dixOepdFl/T7lS3VowFjOXu3DvQQuBGBaZMTGdR/yL+m38KVnm+H+jhn9YWcOBkhow6gsRoJ8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1717182918; c=relaxed/simple; bh=DUlJAMG6VtwvoyO4lKU2qtv4Guzyd5yLV54zhkBQpLU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=Brg5A8Bjg7BTqw2wKVYD3AjVM84P6/1X4Y3grG9/jjmaJLW30v6lJ5KhBMt3rUygJuH60D3zPfJh8FSsUoXwIppNZXHddGfmudf3Mu8uWsiKC8vDy1nTZsahSJt+OA4OJk9j0WzvNqI0FDs3lBR/RfsNPFWAsR+6RXUCTZbDOz4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org; spf=none smtp.mailfrom=infradead.org; dkim=pass (2048-bit key) header.d=infradead.org header.i=@infradead.org header.b=REdAg7gc; arc=none smtp.client-ip=198.137.202.133 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=infradead.org Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:From:References:Cc:To:Subject:MIME-Version:Date: Message-ID:Sender:Reply-To:Content-ID:Content-Description; bh=u/g1j5mYG7Zir9s2o+HTGAW2a6hjFEiH6+1szjteCnM=; b=REdAg7gcqz7o0aDLXsHBfdUAKm dMQye5x6Cg/sTyaN2LgZPWLcQCXBi5N1sMfl1vBsqep8+qae8DmlDu/Knj9Pjl0aytbFbzYKOZkYG 3mx8cJrHSqb+Kef+HbwTaV3AvRis9iBPCxIcpTYprbif9Q5LORgiDtPxnDU5656xX0XUqVbXnGNqG J70a80uI9zh2UOLhiyCxZuH/JusIiLqTOlfzcG1vQxaMPBl78ggV9Emr/340N1mmS3lbzZKnRlzhF 3WX06z4JAVIxEtsksR/gEQMvQp6m7J+x3/V9KtA/27wZVB75paUBrx7NRfwrWSOImhHM76FR1hn4d vrs7hs4g==; Received: from [50.53.4.147] (helo=[192.168.254.15]) by bombadil.infradead.org with esmtpsa (Exim 4.97.1 #2 (Red Hat Linux)) id 1sD7ie-0000000BDZx-3TST; Fri, 31 May 2024 19:15:16 +0000 Message-ID: Date: Fri, 31 May 2024 12:15:16 -0700 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v16 4/5] random: introduce generic vDSO getrandom() implementation To: "Jason A. Donenfeld" , linux-kernel@vger.kernel.org, patches@lists.linux.dev, tglx@linutronix.de Cc: linux-crypto@vger.kernel.org, linux-api@vger.kernel.org, x86@kernel.org, Greg Kroah-Hartman , Adhemerval Zanella Netto , Carlos O'Donell , Florian Weimer , Arnd Bergmann , Jann Horn , Christian Brauner , David Hildenbrand References: <20240528122352.2485958-1-Jason@zx2c4.com> <20240528122352.2485958-5-Jason@zx2c4.com> Content-Language: en-US From: Randy Dunlap In-Reply-To: <20240528122352.2485958-5-Jason@zx2c4.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit On 5/28/24 5:19 AM, Jason A. Donenfeld wrote: > +/** > + * __cvdso_getrandom_data - Generic vDSO implementation of getrandom() syscall. > + * @rng_info: Describes state of kernel RNG, memory shared with kernel. > + * @buffer: Destination buffer to fill with random bytes. > + * @len: Size of @buffer in bytes. > + * @flags: Zero or more GRND_* flags. > + * @opaque_state: Pointer to an opaque state area. > + * > + * This implements a "fast key erasure" RNG using ChaCha20, in the same way that the kernel's > + * getrandom() syscall does. It periodically reseeds its key from the kernel's RNG, at the same > + * schedule that the kernel's RNG is reseeded. If the kernel's RNG is not ready, then this always > + * calls into the syscall. > + * > + * @opaque_state *must* be allocated using the vgetrandom_alloc() syscall. Unless external locking > + * is used, one state must be allocated per thread, as it is not safe to call this function > + * concurrently with the same @opaque_state. However, it is safe to call this using the same > + * @opaque_state that is shared between main code and signal handling code, within the same thread. > + * > + * Returns the number of random bytes written to @buffer, or a negative value indicating an error. * Returns: > + */ -- #Randy https://people.kernel.org/tglx/notes-about-netiquette https://subspace.kernel.org/etiquette.html