Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934689AbaGXUan (ORCPT ); Thu, 24 Jul 2014 16:30:43 -0400 Received: from out2-smtp.messagingengine.com ([66.111.4.26]:44385 "EHLO out2-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934503AbaGXUal (ORCPT ); Thu, 24 Jul 2014 16:30:41 -0400 X-Sasl-enc: +fRoTQWBqjns3bNEreAuA98WX7Sxn5+FVsIp9YOGGh1y 1406233830 Date: Thu, 24 Jul 2014 17:30:19 -0300 From: Henrique de Moraes Holschuh To: "Theodore Ts'o" , Andy Lutomirski , Linux Kernel Developers List , Linux API , linux-crypto@vger.kernel.org Subject: Re: [PATCH -v5] random: introduce getrandom(2) system call Message-ID: <20140724203019.GA20737@khazad-dum.debian.net> References: <1406212287-9855-1-git-send-email-tytso@mit.edu> <20140724151814.GE32421@khazad-dum.debian.net> <20140724190206.GL6673@thunk.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20140724190206.GL6673@thunk.org> X-GPG-Fingerprint1: 4096R/39CB4807 C467 A717 507B BAFE D3C1 6092 0BD9 E811 39CB 4807 X-GPG-Fingerprint2: 1024D/1CDB0FE3 5422 5C61 F6B7 06FB 7E04 3738 EE25 DE3F 1CDB 0FE3 User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 24 Jul 2014, Theodore Ts'o wrote: > On Thu, Jul 24, 2014 at 08:21:38AM -0700, Andy Lutomirski wrote: > > > Should we add E to be able to deny access to GRND_RANDOM or some > > > future extension ? > > > > This might actually be needed sooner rather than later. There are > > programs that use containers and intentionally don't pass /dev/random > > through into the container. I know that Sandstorm does this, and I > > wouldn't be surprised if other things (Docker?) do the same thing. > > I wouldn't add the error to the man page until we actually modify the > kernel to add such a restriction. By then, it might be too late. It would be really sad to find ourselves forced to return ENOSYS to getrandom(GRND_RANDOM) when we actually wanted to return EPERM/EACCES. Actually, we might not be able to do even that much: all it takes is for someone to have the bright idea of deploying userspace code that checks for ENOSYS only on a first "probe" getrandom() syscall without GRND_RANDOM, and does something idiotic when it gets ENOSYS later on a getrandom(GRND_RANDOM). meh. We can't even abuse the system ourselves :-) > However, the thought crossed my mind a while back that perhaps the > right answer is a cgroup controller which controls the rate at which a > process is allowed to drain entropy from the /dev/random pool. This > could be set to 0, or it could be set to N bits per unit time T, and > if the process exceeded the value, it would just block or return > EAGAIN. So instead of making it be just a binary "you have access" or That will teach people to not have a SIGALRM on code that calls a blocking syscall, I suppose. Still, there is a risk it could cause so much bad application behaviour to the point of being unusable. > Then I decided that it was overkill, but for people who are trying to Indeed :p -- "One disk to rule them all, One disk to find them. One disk to bring them all and in the darkness grind them. In the Land of Redmond where the shadows lie." -- The Silicon Valley Tarot Henrique Holschuh -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/