[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: propagating vmgenid outward and upward
From: |
Michael S. Tsirkin |
Subject: |
Re: propagating vmgenid outward and upward |
Date: |
Wed, 2 Mar 2022 11:22:46 -0500 |
On Wed, Mar 02, 2022 at 04:36:49PM +0100, Jason A. Donenfeld wrote:
> Hi Michael,
>
> On Wed, Mar 02, 2022 at 10:20:25AM -0500, Michael S. Tsirkin wrote:
> > 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.
>
> Because that 16 byte read of vmgenid is not atomic. Let's say you read
> the first 8 bytes, and then the VM is forked.
But at this point when VM was forked plaintext key and nonce are all in
buffer, and you previously indicated a fork at this point is harmless.
You wrote "If it changes _after_ that point of check ... it doesn't
matter:"
> In the forked VM, the next
> 8 bytes are the same as last time, but the first 8 bytes, which you
> already read, have changed. In that case, your != becomes a ==, and the
> test fails.
Yes I'm aware what an atomic read is. If the read is not atomic
a part of value can change ;)
--
MST
- Re: propagating vmgenid outward and upward, (continued)
- Re: propagating vmgenid outward and upward, Michael S. Tsirkin, 2022/03/02
- Re: propagating vmgenid outward and upward, Jason A. Donenfeld, 2022/03/02
- Re: propagating vmgenid outward and upward, Michael S. Tsirkin, 2022/03/02
- Re: propagating vmgenid outward and upward, Jason A. Donenfeld, 2022/03/02
- Re: propagating vmgenid outward and upward, Michael S. Tsirkin, 2022/03/02
- Re: propagating vmgenid outward and upward, Jason A. Donenfeld, 2022/03/02
- Re: propagating vmgenid outward and upward, Michael S. Tsirkin, 2022/03/02
- Re: propagating vmgenid outward and upward, Jason A. Donenfeld, 2022/03/02
- Re: propagating vmgenid outward and upward,
Michael S. Tsirkin <=
- Re: propagating vmgenid outward and upward, Jason A. Donenfeld, 2022/03/02
- Re: propagating vmgenid outward and upward, Michael S. Tsirkin, 2022/03/02
- Re: propagating vmgenid outward and upward, Michael S. Tsirkin, 2022/03/03
- Re: propagating vmgenid outward and upward, Michael S. Tsirkin, 2022/03/02
Re: propagating vmgenid outward and upward, Michael S. Tsirkin, 2022/03/01
Re: propagating vmgenid outward and upward, Greg KH, 2022/03/01