<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/arch/x86/kernel/sev.c, branch linux-5.13.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.13.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2021-07-14T15:06:48Z</updated>
<entry>
<title>x86/sev: Use "SEV: " prefix for messages from sev.c</title>
<updated>2021-07-14T15:06:48Z</updated>
<author>
<name>Joerg Roedel</name>
</author>
<published>2021-06-22T14:48:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0a32c742e877cb61b14aa9bc74ef5b8839c8dde9'/>
<id>urn:sha1:0a32c742e877cb61b14aa9bc74ef5b8839c8dde9</id>
<content type='text'>
[ Upstream commit 8d9d46bbf3b6b7ff8edcac33603ab45c29e0e07f ]

The source file has been renamed froms sev-es.c to sev.c, but the
messages are still prefixed with "SEV-ES: ". Change that to "SEV: " to
make it consistent.

Fixes: e759959fe3b8 ("x86/sev-es: Rename sev-es.{ch} to sev.{ch}")
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Link: https://lkml.kernel.org/r/20210622144825.27588-4-joro@8bytes.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86/sev: Split up runtime #VC handler for correct state tracking</title>
<updated>2021-07-14T15:06:48Z</updated>
<author>
<name>Joerg Roedel</name>
</author>
<published>2021-06-18T11:54:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c6362a74da0c6fbe2c0f0507ccef7c5194994edc'/>
<id>urn:sha1:c6362a74da0c6fbe2c0f0507ccef7c5194994edc</id>
<content type='text'>
[ Upstream commit be1a5408868af341f61f93c191b5e346ee88c82a ]

Split up the #VC handler code into a from-user and a from-kernel part.
This allows clean and correct state tracking, as the #VC handler needs
to enter NMI-state when raised from kernel mode and plain IRQ state when
raised from user-mode.

Fixes: 62441a1fb532 ("x86/sev-es: Correctly track IRQ states in runtime #VC handler")
Suggested-by: Peter Zijlstra &lt;peterz@infradead.org&gt;
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20210618115409.22735-3-joro@8bytes.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86/sev: Make sure IRQs are disabled while GHCB is active</title>
<updated>2021-07-14T15:06:47Z</updated>
<author>
<name>Joerg Roedel</name>
</author>
<published>2021-06-18T11:54:08Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=99e67ee2a1f886f0ebea40c090a7149a1a975735'/>
<id>urn:sha1:99e67ee2a1f886f0ebea40c090a7149a1a975735</id>
<content type='text'>
[ Upstream commit d187f217335dba2b49fc9002aab2004e04acddee ]

The #VC handler only cares about IRQs being disabled while the GHCB is
active, as it must not be interrupted by something which could cause
another #VC while it holds the GHCB (NMI is the exception for which the
backup GHCB exits).

Make sure nothing interrupts the code path while the GHCB is active
by making sure that callers of __sev_{get,put}_ghcb() have disabled
interrupts upfront.

 [ bp: Massage commit message. ]

Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Acked-by: Peter Zijlstra (Intel) &lt;peterz@infradead.org&gt;
Link: https://lkml.kernel.org/r/20210618115409.22735-2-joro@8bytes.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>x86/sev-es: Use __put_user()/__get_user() for data accesses</title>
<updated>2021-05-19T16:45:37Z</updated>
<author>
<name>Joerg Roedel</name>
</author>
<published>2021-05-19T13:52:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4954f5b8ef0baf70fe978d1a99a5f70e4dd5c877'/>
<id>urn:sha1:4954f5b8ef0baf70fe978d1a99a5f70e4dd5c877</id>
<content type='text'>
The put_user() and get_user() functions do checks on the address which is
passed to them. They check whether the address is actually a user-space
address and whether its fine to access it. They also call might_fault()
to indicate that they could fault and possibly sleep.

All of these checks are neither wanted nor needed in the #VC exception
handler, which can be invoked from almost any context and also for MMIO
instructions from kernel space on kernel memory. All the #VC handler
wants to know is whether a fault happened when the access was tried.

This is provided by __put_user()/__get_user(), which just do the access
no matter what. Also add comments explaining why __get_user() and
__put_user() are the best choice here and why it is safe to use them
in this context. Also explain why copy_to/from_user can't be used.

In addition, also revert commit

  7024f60d6552 ("x86/sev-es: Handle string port IO to kernel memory properly")

because using __get_user()/__put_user() fixes the same problem while
the above commit introduced several problems:

  1) It uses access_ok() which is only allowed in task context.

  2) It uses memcpy() which has no fault handling at all and is
     thus unsafe to use here.

  [ bp: Fix up commit ID of the reverted commit above. ]

Fixes: f980f9c31a92 ("x86/sev-es: Compile early handler code into kernel image")
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: stable@vger.kernel.org # v5.10+
Link: https://lkml.kernel.org/r/20210519135251.30093-4-joro@8bytes.org
</content>
</entry>
<entry>
<title>x86/sev-es: Forward page-faults which happen during emulation</title>
<updated>2021-05-19T15:13:04Z</updated>
<author>
<name>Joerg Roedel</name>
</author>
<published>2021-05-19T13:52:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c25bbdb564060adaad5c3a8a10765c13487ba6a3'/>
<id>urn:sha1:c25bbdb564060adaad5c3a8a10765c13487ba6a3</id>
<content type='text'>
When emulating guest instructions for MMIO or IOIO accesses, the #VC
handler might get a page-fault and will not be able to complete. Forward
the page-fault in this case to the correct handler instead of killing
the machine.

Fixes: 0786138c78e7 ("x86/sev-es: Add a Runtime #VC Exception Handler")
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: stable@vger.kernel.org # v5.10+
Link: https://lkml.kernel.org/r/20210519135251.30093-3-joro@8bytes.org
</content>
</entry>
<entry>
<title>x86/sev-es: Don't return NULL from sev_es_get_ghcb()</title>
<updated>2021-05-19T15:05:13Z</updated>
<author>
<name>Joerg Roedel</name>
</author>
<published>2021-05-19T13:52:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b250f2f7792d15bcde98e0456781e2835556d5fa'/>
<id>urn:sha1:b250f2f7792d15bcde98e0456781e2835556d5fa</id>
<content type='text'>
sev_es_get_ghcb() is called from several places but only one of them
checks the return value. The reaction to returning NULL is always the
same: calling panic() and kill the machine.

Instead of adding checks to all call sites, move the panic() into the
function itself so that it will no longer return NULL.

Fixes: 0786138c78e7 ("x86/sev-es: Add a Runtime #VC Exception Handler")
Signed-off-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: stable@vger.kernel.org # v5.10+
Link: https://lkml.kernel.org/r/20210519135251.30093-2-joro@8bytes.org
</content>
</entry>
<entry>
<title>x86/sev-es: Invalidate the GHCB after completing VMGEXIT</title>
<updated>2021-05-18T05:06:29Z</updated>
<author>
<name>Tom Lendacky</name>
</author>
<published>2021-05-17T17:42:33Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=a50c5bebc99c525e7fbc059988c6a5ab8680cb76'/>
<id>urn:sha1:a50c5bebc99c525e7fbc059988c6a5ab8680cb76</id>
<content type='text'>
Since the VMGEXIT instruction can be issued from userspace, invalidate
the GHCB after performing VMGEXIT processing in the kernel.

Invalidation is only required after userspace is available, so call
vc_ghcb_invalidate() from sev_es_put_ghcb(). Update vc_ghcb_invalidate()
to additionally clear the GHCB exit code so that it is always presented
as 0 when VMGEXIT has been issued by anything else besides the kernel.

Fixes: 0786138c78e79 ("x86/sev-es: Add a Runtime #VC Exception Handler")
Signed-off-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/5a8130462e4f0057ee1184509cd056eedd78742b.1621273353.git.thomas.lendacky@amd.com
</content>
</entry>
<entry>
<title>x86/sev-es: Move sev_es_put_ghcb() in prep for follow on patch</title>
<updated>2021-05-18T04:49:37Z</updated>
<author>
<name>Tom Lendacky</name>
</author>
<published>2021-05-17T17:42:32Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=fea63d54f7a3e74f8ab489a8b82413a29849a594'/>
<id>urn:sha1:fea63d54f7a3e74f8ab489a8b82413a29849a594</id>
<content type='text'>
Move the location of sev_es_put_ghcb() in preparation for an update to it
in a follow-on patch. This will better highlight the changes being made
to the function.

No functional change.

Fixes: 0786138c78e79 ("x86/sev-es: Add a Runtime #VC Exception Handler")
Signed-off-by: Tom Lendacky &lt;thomas.lendacky@amd.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Cc: stable@vger.kernel.org
Link: https://lkml.kernel.org/r/8c07662ec17d3d82e5c53841a1d9e766d3bdbab6.1621273353.git.thomas.lendacky@amd.com
</content>
</entry>
<entry>
<title>x86/sev-es: Rename sev-es.{ch} to sev.{ch}</title>
<updated>2021-05-10T05:40:27Z</updated>
<author>
<name>Brijesh Singh</name>
</author>
<published>2021-04-27T11:16:34Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e759959fe3b8313c81d6200be44cb8a644d845ea'/>
<id>urn:sha1:e759959fe3b8313c81d6200be44cb8a644d845ea</id>
<content type='text'>
SEV-SNP builds upon the SEV-ES functionality while adding new hardware
protection. Version 2 of the GHCB specification adds new NAE events that
are SEV-SNP specific. Rename the sev-es.{ch} to sev.{ch} so that all
SEV* functionality can be consolidated in one place.

Signed-off-by: Brijesh Singh &lt;brijesh.singh@amd.com&gt;
Signed-off-by: Borislav Petkov &lt;bp@suse.de&gt;
Acked-by: Joerg Roedel &lt;jroedel@suse.de&gt;
Link: https://lkml.kernel.org/r/20210427111636.1207-2-brijesh.singh@amd.com
</content>
</entry>
</feed>
