Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp2339121ybc; Wed, 20 Nov 2019 12:34:38 -0800 (PST) X-Google-Smtp-Source: APXvYqxQxR1AxiQCzMrsfWhBpmR5SYUqeDsjNHvUVC81a/GF9mWDxifpWI0lFEYYWQpCRSJKAvJK X-Received: by 2002:a17:907:212a:: with SMTP id qo10mr7890581ejb.197.1574282078521; Wed, 20 Nov 2019 12:34:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574282078; cv=none; d=google.com; s=arc-20160816; b=Me/EPd38i307SPSzv+vz+NKFaEGsGxFILc22hrsKyysSuKI/1PAfp/8SSmaR3zY+Gq PdJ3Ym/a35NsVjaOKQDccTMrRwR4zYG/EWc3yNCimUEPe+Ixj7ujRiNI0bWh/Rl6Enis 0aTIOeEdyMamFBx1eyfzRucGGv3DGLUZ7tM9qDu1h2xlKDfxA85a/Fe1UwXAwvlYOabR XlYaa5zTV5KE57aRu6Npfn1SwMJwHtL0sMZ8tHvSrlzMyLUYatIs9oSn6/EazZJ31rL2 E+LK8sLy32jg4aWrGzkcL7CJjbl3Fwz4EHoxGw3afvtv7+cy+TXA+RuCnrTL78/MhvHq xCOQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=dOgR36156YtVCJlCPHfw3bIwt/7J0RHomyUKGPcaKlI=; b=CrkvjbNHKqWL2P8gaQcoxi8COTVS7BFlOUit8hhgWcuC1/CVSTHInSOhLbfq7OHgi9 OfzIeg7DLU83yPe273hHRgIZdjfq3D4Q3RANbGCl7GYUjag8HOl4h0RuZfVwdPJ71Fj+ VrFkt+a2F+4FvSL2SD/FF1FpJ43WzZkEtHeJbfZsXP6MSSTJI9548jkNjAe/kJPWJBqr +z9QcPLIKJ/gb4Cz8IcLXqE/3EtWBW9WA7MGOW7QwTtbFpeIQyAEyZ9U5fcnBjZklUXT JxEM5jfM2t10Mov5PsLRPMm31571kF9sy0gfypaT/8fjksZEqcSyxGB2gsdOT0Z32ppe NNEg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YxytrLSu; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j44si499936eda.345.2019.11.20.12.34.09; Wed, 20 Nov 2019 12:34:38 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=YxytrLSu; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726351AbfKTUcg (ORCPT + 99 others); Wed, 20 Nov 2019 15:32:36 -0500 Received: from mail.kernel.org ([198.145.29.99]:53430 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726038AbfKTUcg (ORCPT ); Wed, 20 Nov 2019 15:32:36 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (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 E33AC20872; Wed, 20 Nov 2019 20:32:34 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574281955; bh=rgz7tSc56R6AlFhUwHCm3gukAfl1sHXelnLXuoyn9n8=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=YxytrLSujkMi+YhB60vQ4R5qA6bi7jIjXFJCPx0aj6ZCR2dKlKjWHI649X9tToNSd 5u+a+9w4YBtS9AcvywmrIMwG5XV6XwGzKwtDkp4YuWzFG2LES9dsOJYsGMthUe/NhI a2QS8rjcGaeNUNn8GJwOHx5qfXXsS8WeLJrXdWKE= Date: Wed, 20 Nov 2019 21:32:32 +0100 From: Greg Kroah-Hartman To: Stephan =?iso-8859-1?Q?M=FCller?= Cc: Andy Lutomirski , Arnd Bergmann , Linux Crypto Mailing List , LKML , Linux API , "Eric W. Biederman" , "Alexander E. Patrakov" , "Ahmed S. Darwish" , "Theodore Y. Ts'o" , Willy Tarreau , Matthew Garrett , Vito Caputo , Andreas Dilger , Jan Kara , Ray Strode , William Jon McCann , zhangjs , Florian Weimer , Lennart Poettering , Nicolai Stange , "Peter, Matthias" , Marcelo Henrique Cerri , Roman Drahtmueller , Neil Horman Subject: Re: [PATCH v25 10/12] LRNG - add TRNG support Message-ID: <20191120203232.GB3109949@kroah.com> References: <5390778.VeFRgus4bQ@positron.chronox.de> <19681012.svDddlc5pN@positron.chronox.de> <20191120132918.GA2892197@kroah.com> <1695782.oZ5Vf4nH9s@positron.chronox.de> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <1695782.oZ5Vf4nH9s@positron.chronox.de> User-Agent: Mutt/1.12.2 (2019-09-21) Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Wed, Nov 20, 2019 at 08:51:11PM +0100, Stephan M?ller wrote: > Am Mittwoch, 20. November 2019, 14:29:18 CET schrieb Greg Kroah-Hartman: > > Hi Greg, > > > On Wed, Nov 20, 2019 at 09:58:35AM +0100, Stephan M?ller wrote: > > > Am Dienstag, 19. November 2019, 13:41:50 CET schrieb Greg Kroah-Hartman: > > > > > > Hi Greg, > > > > > > > On Tue, Nov 19, 2019 at 02:07:40AM -0800, Andy Lutomirski wrote: > > > > > > As this would introduce a new device file now, is there a special > > > > > > process that I need to follow or do I need to copy? Which > > > > > > major/minor > > > > > > number should I use? > > > > > > > > > > > > Looking into static const struct memdev devlist[] I see > > > > > > > > > > > > [8] = { "random", 0666, &random_fops, 0 }, > > > > > > [9] = { "urandom", 0666, &urandom_fops, 0 }, > > > > > > > > > > > > Shall a true_random be added here with [10]? > > > > > > > > > > I am not at all an expert on chardevs, but this sounds generally > > > > > reasonable. gregkh is probably the real authority here. > > > > > > > > [10] is the aio char device node, so you better not try to overlap it or > > > > bad things will happen :( > > > > > > Thanks for your insights. > > > > > > Which device minor number could we use? > > > > Get your own dynamic one by using a misc device if you _REALLY_ want to > > add yet-another-char-node-for-random-data. > > > > But I would have thought that we all realize that this is not the way to > > do things. Let's not have "random", "urandom", and "true_random" be > > something we want to totally confuse userspace with, that way is insane. > > > > Please just make the existing userspace api "just work", don't add to > > the mess. > > Thank you, I think we should follow that advise. > > With that and considering Alexander's rightful remark we have a challenge. So, > changing the syscall may not be the right way unless we find a way to restrict > the permissions somehow (capability? LSM? None of that seems to be a good > fit). > > What about providing a /sys file? I.e. adding a file that: > > a) has permissions 440 per default and maybe the ownership of root:root > > b) allow user space to perform a chown/chgrp > > c) only supports reading of data from user space > > But then, how could we provide a common interface for the existing random.c > and the LRNG? > > Or should we use a proc file for that? If yes, I guess it should not be a > sysctl, but a "regular" proc file that should allow a chown(2) operation. On > the other hand, is proc the right place to provide a user space interface for > exporting data to user? No, do not abuse sysfs or procfs for something like this. Use a real syscall please if you really need it. greg k-h