From: Brijesh Singh <brijesh.singh@amd.com>
To: Paolo Bonzini <pbonzini@redhat.com>,
Sean Christopherson <sean.j.christopherson@intel.com>
Cc: brijesh.singh@amd.com, Borislav Petkov <bp@suse.de>,
"x86@kernel.org" <x86@kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"kvm@vger.kernel.org" <kvm@vger.kernel.org>,
"Lendacky, Thomas" <Thomas.Lendacky@amd.com>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: SEV guest regression in 4.18
Date: Fri, 24 Aug 2018 13:47:10 -0500 [thread overview]
Message-ID: <47b8f9dc-fb55-f14d-cb88-343810ad5763@amd.com> (raw)
In-Reply-To: <25d2cf1f-11ee-ecba-73a9-15a9553a3d96@redhat.com>
On 08/24/2018 10:50 AM, Paolo Bonzini wrote:
> On 24/08/2018 17:41, Brijesh Singh wrote:
>>>>
>>>> Wouldn't that result in exposing/leaking whatever code/data happened
>>>> to reside on the same 2M page (or corrupting it if the entire page
>>>> isn't decrypted)? Or are you suggesting that we'd also leave the
>>>> encrypted mapping intact?
>>>
>>> Yes, exactly the latter, because...
>>
>>
>> Hardware does not enforce coherency between the encrypted and
>> unencrypted mapping for the same physical page. So, creating a
>> two mapping of same physical address will lead a possible data
>> corruption.
>>
>> Note, SME creates two mapping of the same physical address to perform
>> in-place encryption of kernel and initrd images; this is a special case
>> and APM documents steps on how to do this.
>
> Ah, so that's what I was thinking about. But a single cache line would
> never be used both encrypted and unencrypted, would it?
>
No.
If we create two mapping of same physical address and ensure that
accesses are cache line aligned and size then I think we will safe from
cache point of view.
I have not tried early remap from kvmclock_init() yet and not sure if it
will work so early. The downside of this approach is, we will put
too many constraints on caller; it will need to ensure that variables
are cache line aligned and sized, never accessed with C=1, and must
create a new mapping before accessing it.
I am more inclined towards creating a new section with PMD aligned and
sized. This section will contains the decrypted data. In early
boot code we will update the mapping with C=0. If caller wants to create
a shared variable then it can do so with:
static int foo __decrypted;
I will submit patch fir review.
thanks
next prev parent reply other threads:[~2018-08-24 18:47 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-08-20 22:11 SEV guest regression in 4.18 Brijesh Singh
2018-08-21 8:39 ` Borislav Petkov
2018-08-21 14:37 ` Brijesh Singh
2018-08-21 15:19 ` Borislav Petkov
2018-08-21 16:07 ` Brijesh Singh
2018-08-22 8:14 ` Borislav Petkov
2018-08-22 15:00 ` Sean Christopherson
2018-08-22 20:11 ` Brijesh Singh
2018-08-23 11:26 ` Paolo Bonzini
2018-08-23 15:29 ` Sean Christopherson
2018-08-23 16:16 ` Paolo Bonzini
2018-08-24 15:41 ` Brijesh Singh
2018-08-24 15:50 ` Paolo Bonzini
2018-08-24 18:47 ` Brijesh Singh [this message]
2018-08-25 4:47 ` Borislav Petkov
2018-08-24 16:24 ` Sean Christopherson
2018-08-24 18:48 ` Brijesh Singh
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=47b8f9dc-fb55-f14d-cb88-343810ad5763@amd.com \
--to=brijesh.singh@amd.com \
--cc=Thomas.Lendacky@amd.com \
--cc=bp@suse.de \
--cc=kvm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pbonzini@redhat.com \
--cc=sean.j.christopherson@intel.com \
--cc=tglx@linutronix.de \
--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).