linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: "Jason A. Donenfeld" <Jason@zx2c4.com>,
	Linus Torvalds <torvalds@linux-foundation.org>
Cc: linux-kernel@vger.kernel.org, linux-crypto@vger.kernel.org,
	x86@kernel.org, Nadia Heninger <nadiah@cs.ucsd.edu>,
	Thomas Ristenpart <ristenpart@cornell.edu>,
	Theodore Ts'o <tytso@mit.edu>,
	Vincenzo Frascino <vincenzo.frascino@arm.com>,
	Adhemerval Zanella Netto <adhemerval.zanella@linaro.org>,
	Florian Weimer <fweimer@redhat.com>
Subject: Re: [PATCH RFC v1] random: implement getrandom() in vDSO
Date: Mon, 01 Aug 2022 21:30:20 +0200	[thread overview]
Message-ID: <87zggnsqwj.ffs@tglx> (raw)
In-Reply-To: <YuXCpyULk6jFgGV5@zx2c4.com>

Jason!

On Sun, Jul 31 2022 at 01:45, Jason A. Donenfeld wrote:
> Thanks a bunch for chiming in. Indeed this whole thing is kind of crazy,
> so your input is particularly useful here.
>
> On Sat, Jul 30, 2022 at 08:48:42AM -0700, Linus Torvalds wrote:
>> It's just too specialized, and the people who care about performance
>> can - and do - do special things anyway.
>
> To be clear, I really would rather not do this. I'm not really looking
> for more stuff to do, and I don't tend to write (public) code "just
> 'cuz". My worry is that by /not/ doing it, footguns will proliferate.
> The glibc thing was what finally motivated me to want to at least sketch
> out a potential action to make this kind of (apparently common) urge of
> writing a userspace RNG safer.

But the user space tinkering will continue no matter what. They might
then just use the vdso to get access to the ready/generation bits. I've
seen "better" VDSO implementations to access time. :)

> So, anyway, if I do muster a v2 of this (perhaps just to see the idea
> through), the API might split in two to something like:
>
>   void *getrandom_allocate_states([inout] size_t *number_of_states, [out] size_t *length_per_state);
>   ssize_t getrandom(void *state, void *buffer, size_t len, unsigned long flags);

I'm not seeing any reason to have those functions at all.

The only thing which would be VDSO worthy here is the access to
random_state->ready and random_state->generation as that's the
information which is otherwise not available to userspace.

So you can just have:

   int random_check_and_update_generation(u64 *generation);

Everything else is library material, really.

Thanks,

        tglx

  parent reply	other threads:[~2022-08-01 19:31 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-29 14:55 [PATCH RFC v1] random: implement getrandom() in vDSO Jason A. Donenfeld
2022-07-29 20:19 ` Florian Weimer
2022-07-29 22:06   ` Jason A. Donenfeld
2022-07-30 15:48 ` Linus Torvalds
2022-07-30 23:45   ` Jason A. Donenfeld
2022-07-31  0:23     ` Jason A. Donenfeld
2022-07-31  1:31       ` [PATCH RFC v2] " Jason A. Donenfeld
2022-08-01  8:48         ` Florian Weimer
2022-08-01 12:49           ` Jason A. Donenfeld
2022-08-01 13:29             ` Jason A. Donenfeld
2022-08-01 13:00         ` Jason A. Donenfeld
2022-08-01 20:48         ` Thomas Gleixner
2022-08-01 23:41           ` Jason A. Donenfeld
2022-08-02  0:12             ` Jason A. Donenfeld
2022-08-01 19:30     ` Thomas Gleixner [this message]
2022-08-01 23:16       ` [PATCH RFC v1] " Jason A. Donenfeld
2022-08-02 13:46         ` Thomas Gleixner
2022-08-02 13:59           ` Jason A. Donenfeld
2022-08-02 15:14             ` Thomas Gleixner
2022-08-02 15:26               ` Jason A. Donenfeld
2022-08-02 22:27                 ` Thomas Gleixner
2022-08-04 15:23                   ` Jason A. Donenfeld
2022-08-04 16:08                     ` Jeffrey Walton
2022-08-04 23:11                     ` Thomas Gleixner
2022-08-17  8:20                   ` Peter Zijlstra
2022-08-05  8:36               ` Florian Weimer

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=87zggnsqwj.ffs@tglx \
    --to=tglx@linutronix.de \
    --cc=Jason@zx2c4.com \
    --cc=adhemerval.zanella@linaro.org \
    --cc=fweimer@redhat.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nadiah@cs.ucsd.edu \
    --cc=ristenpart@cornell.edu \
    --cc=torvalds@linux-foundation.org \
    --cc=tytso@mit.edu \
    --cc=vincenzo.frascino@arm.com \
    --cc=x86@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).