[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220302101602-mutt-send-email-mst@kernel.org>
Date: Wed, 2 Mar 2022 10:20:25 -0500
From: "Michael S. Tsirkin" <mst@...hat.com>
To: "Jason A. Donenfeld" <Jason@...c4.com>
Cc: Laszlo Ersek <lersek@...hat.com>,
LKML <linux-kernel@...r.kernel.org>,
KVM list <kvm@...r.kernel.org>,
QEMU Developers <qemu-devel@...gnu.org>,
linux-hyperv@...r.kernel.org,
Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
Alexander Graf <graf@...zon.com>,
"Michael Kelley (LINUX)" <mikelley@...rosoft.com>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
adrian@...ity.io,
Daniel P. Berrangé <berrange@...hat.com>,
Dominik Brodowski <linux@...inikbrodowski.net>,
Jann Horn <jannh@...gle.com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
"Brown, Len" <len.brown@...el.com>, Pavel Machek <pavel@....cz>,
Linux PM <linux-pm@...r.kernel.org>,
Colm MacCarthaigh <colmmacc@...zon.com>,
Theodore Ts'o <tytso@....edu>, Arnd Bergmann <arnd@...db.de>
Subject: Re: propagating vmgenid outward and upward
On Wed, Mar 02, 2022 at 04:14:56PM +0100, Jason A. Donenfeld wrote:
> Hi Michael,
>
> On Wed, Mar 2, 2022 at 3:46 PM Michael S. Tsirkin <mst@...hat.com> wrote:
> > I just don't see how "value changed while it was read" is so different
> > from "value changed one clock after it was read". Since we don't detect
> > the latter I don't see why we should worry about the former.
>
> The "barrier" is at the point where the plaintext has been chosen AND
> the nonce for a given keypair has been selected. So, if you have
> plaintext in a buffer, and a key in a buffer, and the nonce for that
> encryption in a buffer, and then after those are all selected, you
> check to see if the vmgenid has changed since the birth of that key,
> then you're all set. If it changes _after_ that point of check (your
> "one clock after"), it doesn't matter: you'll just be
> double-transmitting the same ciphertext, which is something that flaky
> wifi sometimes does _anyway_ (and attackers can do intentionally), so
> network protocols already are resilient to replay. This is the same
> case you asked about earlier, and then answered yourself, when you
> were wondering about reaching down into qdiscs.
>
> Jason
So writing some code:
1:
put plaintext in a buffer
put a key in a buffer
put the nonce for that encryption in a buffer
if vm gen id != stored vm gen id
stored vm gen id = vm gen id
goto 1
I think this is race free, but I don't see why does it matter whether we
read gen id atomically or not.
--
MST
Powered by blists - more mailing lists