mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@ucw.cz>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>
Cc: Theodore Ts'o <tytso@mit.edu>,
	linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	Linus Torvalds <torvalds@linux-foundation.org>,
	Guenter Roeck <linux@roeck-us.net>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	Jann Horn <jannh@google.com>
Subject: Re: [PATCH] random: allow writes to /dev/urandom to influence fast init
Date: Mon, 23 May 2022 19:59:28 +0200	[thread overview]
Message-ID: <20220523175928.GA30223@duo.ucw.cz> (raw)
In-Reply-To: <YjqbcQbYHCOpgqGg@zx2c4.com>

[-- Attachment #1: Type: text/plain, Size: 1836 bytes --]

Hi!

> > One of the big issues with /dev/urandom writes is that *anyone*,
> > including malicious user space, can force specific bytes to be mixed
> > in.  That's the source of the reluctance to immediate use inputs from
> > writes into /dev/[u]random until there is a chance for it to be mixed
> > in with other entropy which is hopefully not under the control of
> > malicious userspace.
> 
> Right, sort of. Since we now always use a cryptographic hash function,
> we can haphazardly mix whatever any user wants, without too much
> concern. The issue is whether we _credit_ those bits. Were we to credit
> those bits, a malicious unpriv'd user could credit 248 bits of known
> input, and then bruteforce 8 bits of unknown input, and repeat, and in
> that way destroy the security of the thing. So, yea, the current
> reluctance does make sense.
> 
> > Now, I recognize that things are a bit special in early boot, and if
> > we have a malicious script running in a systemd unit script, we might
> > as well go home.  But something to consider is whether we want to do
> > soemthing special if the process writing to /dev/[u]random has
> > CAP_SYS_ADMIN, or some such.
> 
> Exactly. So one way of approaching this would be to simply credit writes
> to /dev/urandom if it's CAP_SYS_ADMIN and maybe if also !crng_ready(),
> and just skip the crng_pre_init_inject() part that this current patch
> adds. I'll attach a sample patch of what this might look like at the end
> of this email.

CAP_* should not really work like that. They should control if process
can do the operation, but should not really silently change what
syscall does based on the CAP_*...

(And yes, I'm a bit late).

Best regards,
								Pavel
								

-- 
People of Russia, stop Putin before his war on Ukraine escalates.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]

  parent reply	other threads:[~2022-05-23 18:28 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-22 19:14 Jason A. Donenfeld
2022-03-22 20:42 ` Linus Torvalds
2022-03-22 23:54   ` Jason A. Donenfeld
2022-03-23  2:15 ` David Laight
2022-03-23  2:50   ` Jason A. Donenfeld
2022-03-23  8:43     ` Rasmus Villemoes
2022-03-24 14:12       ` Jason A. Donenfeld
2022-03-23 11:45     ` David Laight
2022-03-23  3:35 ` Theodore Ts'o
2022-03-23  4:00   ` Jason A. Donenfeld
2022-03-23 12:31     ` Theodore Ts'o
2022-05-23 17:59     ` Pavel Machek [this message]
2022-03-23  4:30 ` Alex Xu (Hello71)
2022-03-23  4:47   ` Jason A. Donenfeld
2022-03-23 14:01     ` David Laight
2022-03-23 19:53       ` Jason A. Donenfeld
2022-03-24 18:01         ` Eric Biggers
2022-03-24  3:18     ` Jason A. Donenfeld
2022-03-24 16:28       ` Alex Xu (Hello71)
2022-03-24 17:20         ` Jason A. Donenfeld
2022-03-24 19:03           ` Alex Xu (Hello71)
2022-03-24 18:26       ` Eric Biggers
2022-03-24 18:31         ` Jason A. Donenfeld
2022-06-19 16:44       ` Pavel Machek
2022-03-24 19:53 ` Eric Biggers
2022-03-24 20:25   ` Jason A. Donenfeld
2022-06-19 16:56     ` Pavel Machek

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220523175928.GA30223@duo.ucw.cz \
    --to=pavel@ucw.cz \
    --cc=Jason@zx2c4.com \
    --cc=jannh@google.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=linux@roeck-us.net \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®