[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <a15e03a2-c2da-aa2f-d0b7-c18d23f49ea8@redhat.com>
Date: Tue, 26 Mar 2019 09:27:38 +0800
From: lijiang <lijiang@...hat.com>
To: Borislav Petkov <bp@...en8.de>,
"Singh, Brijesh" <brijesh.singh@....com>,
"Lendacky, Thomas" <Thomas.Lendacky@....com>
Cc: "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"kexec@...ts.infradead.org" <kexec@...ts.infradead.org>,
"tglx@...utronix.de" <tglx@...utronix.de>,
"mingo@...hat.com" <mingo@...hat.com>,
"x86@...nel.org" <x86@...nel.org>, "hpa@...or.com" <hpa@...or.com>,
"akpm@...ux-foundation.org" <akpm@...ux-foundation.org>,
"dyoung@...hat.com" <dyoung@...hat.com>,
"bhe@...hat.com" <bhe@...hat.com>
Subject: Re: [PATCH 1/3] kexec: Do not map the kexec area as decrypted when
SEV is active
在 2019年03月26日 01:32, Borislav Petkov 写道:
> On Mon, Mar 25, 2019 at 05:17:55PM +0000, Singh, Brijesh wrote:
>> By default all the memory regions are mapped encrypted. The
>> set_memory_{encrypt,decrypt}() is a generic function which can be
>> called explicitly to clear/set the encryption mask from the existing
>> memory mapping. The mem_encrypt_active() returns true if either SEV or
>> SME is active. So the __set_memory_enc_dec() uses the
>> memory_encrypt_active() check to ensure that the function is no-op when
>> SME/SEV are not active.
>>
>> Currently, the arch_kexec_post_alloc_pages() unconditionally clear the
>> encryption mask from the kexec area. In case of SEV, we should not clear
>> the encryption mask.
>
> Brijesh, I know all that.
>
> Please read what I said here at the end:
>
> https://lkml.kernel.org/r/20190324150034.GH23289@zn.tnic
>
> With this change, the code looks like this:
>
> + if (sme_active())
> + return set_memory_decrypted((unsigned long)vaddr, pages);
>
> now in __set_memory_enc_dec via set_memory_decrypted():
>
> /* Nothing to do if memory encryption is not active */
> if (!mem_encrypt_active())
> return 0;
>
>
> so you have:
>
> if (sme_active())
>
> ...
>
> if (!mem_encrypt_active())
>
>
> now maybe this is all clear to you and Tom but I betcha others will get
> confused. Probably something like "well, what should be active now, SME,
> SEV or memory encryption in general"?
>
> I hope you're catching my drift.
>
> So if you want to *not* decrypt memory in the SEV case, then doing something
> like this should make it a bit more clear:
>
>
> if (sev_active())
> return;
>
> return set_memory_decrypted((unsigned long)vaddr, pages);
>
> along with a comment *why* we're checking here.
It looks good to me. I will improve them next post.
Thank you, everyone.
Lianbo
>
> But actually, I'd prefer if you had separate wrappers which are called
> for SME and for SEV.
>
> I'll let Tom chime in too.
>
Powered by blists - more mailing lists