linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Jason A. Donenfeld" <Jason@zx2c4.com>
To: Greg KH <gregkh@linuxfoundation.org>
Cc: LKML <linux-kernel@vger.kernel.org>,
	Linux Crypto Mailing List <linux-crypto@vger.kernel.org>,
	Netdev <netdev@vger.kernel.org>, Alexander Graf <graf@amazon.com>,
	Jann Horn <jannh@google.com>,
	Dominik Brodowski <linux@dominikbrodowski.net>,
	"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [PATCH 2/3] random: provide notifier for VM fork
Date: Wed, 2 Mar 2022 12:41:46 +0100	[thread overview]
Message-ID: <CAHmME9r4P+5pdrRxaUZs96nshp7rN4GP2xoV9h=umqMOAgs8iA@mail.gmail.com> (raw)
In-Reply-To: <Yh8wjrf7HVf56Anw@kroah.com>

Hi Greg,

On Wed, Mar 2, 2022 at 9:53 AM Greg KH <gregkh@linuxfoundation.org> wrote:
> It seems crazy that the "we just were spawned as a new vm" notifier is
> based in the random driver, but sure, put it here for now!  :)

I was thinking you might say this. I see it both ways, but I think I'm
more inclined to doing it this way, at least for now. Here's how it
breaks down:

VM forking is usually an okay thing to do because computers are
deterministic. Usually. Where is there non-determinism in a place that
it matters? The RNG is supposed to be "the" place of non-determinism.
If anything is going to happen in response to a VM fork, it's going to
necessarily be _after_ the RNG becomes sufficiently non-deterministic
again, and so it's the RNG who announces, "hey I'm safe to use again,
and please read from me again if you're doing non-misuse resistant
crypto." It's the proper place to announce that.

On the other hand, I think you could argue that really this should
come from vmgenid itself, with the caveat that the notifier is called
after add_vmfork_randomness is called. For now that would exist in
vmgenid.o itself, and then if we ever have multiple drivers notifying,
some shared infrastructure could be made. Except vmgenid.o might be
vmgenid.ko, and then the whole problem gets kind of annoying and maybe
we actually want that shared infrastructure _now_ instead. And now we
find ourselves complicating everything with additional Kbuild symbols
and header files and stubs. It just seems like the road of more pain.

Anyway, even if we go with the first solution -- keeping it in
random.o -- now, I wouldn't be opposed to revisiting that decision
later if the landscape becomes more complex. Luckily this is just the
kernel side of things and not userspace, so we can easily change
things down the road.

Jason

  reply	other threads:[~2022-03-02 11:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-01 23:10 [PATCH 0/3] random: wire up in-kernel virtual machine fork notifications Jason A. Donenfeld
2022-03-01 23:10 ` [PATCH 1/3] random: replace custom notifier chain with standard one Jason A. Donenfeld
2022-03-02  5:33   ` Dominik Brodowski
2022-03-02 11:42     ` Jason A. Donenfeld
2022-03-02 14:53       ` Dominik Brodowski
2022-03-01 23:10 ` [PATCH 2/3] random: provide notifier for VM fork Jason A. Donenfeld
2022-03-02  8:53   ` Greg KH
2022-03-02 11:41     ` Jason A. Donenfeld [this message]
2022-03-01 23:10 ` [PATCH 3/3] wireguard: device: clear keys on " Jason A. Donenfeld
2022-03-01 23:25   ` Jakub Kicinski
2022-03-02  8:36   ` Michael S. Tsirkin
2022-03-02 11:44     ` Jason A. Donenfeld
2022-03-02 13:06       ` Michael S. Tsirkin
2022-03-13  1:07   ` [PATCH v2] " Jason A. Donenfeld

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='CAHmME9r4P+5pdrRxaUZs96nshp7rN4GP2xoV9h=umqMOAgs8iA@mail.gmail.com' \
    --to=jason@zx2c4.com \
    --cc=graf@amazon.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jannh@google.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@dominikbrodowski.net \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).