public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] x86/sev: Make SEV_STATUS available via SYSFS
@ 2025-03-05 10:52 Joerg Roedel
  2025-03-05 11:11 ` [tip: x86/sev] " tip-bot2 for Joerg Roedel
                   ` (2 more replies)
  0 siblings, 3 replies; 62+ messages in thread
From: Joerg Roedel @ 2025-03-05 10:52 UTC (permalink / raw)
  To: x86
  Cc: hpa, Tom Lendacky, Nikunj A Dadhania, linux-kernel, Larry.Dewey,
	Joerg Roedel

From: Joerg Roedel <jroedel@suse.de>

Current user-space tooling which needs access to the SEV_STATUS MSR is
using the MSR module. The use of this module poses a security risk in
any trusted execution environment and is generally discouraged.

Instead, provide an file in SYSFS in the already existing
/sys/devices/system/cpu/sev/ directory to provide the value of the
SEV_STATUS MSR to user-space.

Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 arch/x86/coco/sev/core.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/x86/coco/sev/core.c b/arch/x86/coco/sev/core.c
index 82492efc5d94..7b23fb803610 100644
--- a/arch/x86/coco/sev/core.c
+++ b/arch/x86/coco/sev/core.c
@@ -2678,10 +2678,19 @@ static ssize_t vmpl_show(struct kobject *kobj,
 	return sysfs_emit(buf, "%d\n", snp_vmpl);
 }
 
+static ssize_t sev_status_show(struct kobject *kobj,
+			       struct kobj_attribute *attr, char *buf)
+{
+	return sysfs_emit(buf, "%llx\n", sev_status);
+}
+
 static struct kobj_attribute vmpl_attr = __ATTR_RO(vmpl);
+static struct kobj_attribute sev_status_attr = __ATTR_RO(sev_status);
+
 
 static struct attribute *vmpl_attrs[] = {
 	&vmpl_attr.attr,
+	&sev_status_attr.attr,
 	NULL
 };
 
-- 
2.48.1


^ permalink raw reply related	[flat|nested] 62+ messages in thread

end of thread, other threads:[~2025-03-12 11:44 UTC | newest]

Thread overview: 62+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-05 10:52 [PATCH] x86/sev: Make SEV_STATUS available via SYSFS Joerg Roedel
2025-03-05 11:11 ` [tip: x86/sev] " tip-bot2 for Joerg Roedel
2025-03-05 11:12 ` [PATCH] " Borislav Petkov
2025-03-05 11:26   ` Ingo Molnar
2025-03-05 11:31     ` Borislav Petkov
2025-03-05 11:35       ` Juergen Gross
2025-03-05 11:41         ` Borislav Petkov
2025-03-05 11:48           ` Jürgen Groß
2025-03-05 11:53             ` Borislav Petkov
2025-03-05 11:42       ` Ingo Molnar
2025-03-05 11:50         ` Borislav Petkov
2025-03-05 13:56           ` Joerg Roedel
2025-03-05 15:37             ` Borislav Petkov
2025-03-05 16:37               ` Dave Hansen
2025-03-05 16:40               ` Dave Hansen
2025-03-05 16:55                 ` Borislav Petkov
2025-03-05 17:09                   ` Dave Hansen
2025-03-05 17:51                     ` Joerg Roedel
2025-03-05 20:07                     ` Borislav Petkov
2025-03-06  8:01                 ` Kirill A. Shutemov
2025-03-06  8:38                   ` Joerg Roedel
2025-03-06 10:31                     ` Borislav Petkov
2025-03-06 13:36                       ` Kirill A. Shutemov
2025-03-06 13:56                         ` Borislav Petkov
2025-03-06 10:37                     ` Alexey Gladkov (Intel)
2025-03-10 10:28                       ` Joerg Roedel
2025-03-10 11:02                         ` Borislav Petkov
2025-03-10 12:46                           ` Joerg Roedel
2025-03-10 13:36                             ` Borislav Petkov
2025-03-10 11:24                         ` Alexey Gladkov
2025-03-10 12:28                           ` Juergen Gross
2025-03-10 12:35                             ` Joerg Roedel
2025-03-10 12:49                               ` Juergen Gross
2025-03-10 13:38                                 ` Borislav Petkov
2025-03-10 14:39                                   ` Tom Lendacky
2025-03-10 14:50                                   ` Alexey Gladkov
2025-03-10 15:11                                     ` Borislav Petkov
2025-03-10 15:33                                       ` Jürgen Groß
2025-03-10 15:41                                         ` Borislav Petkov
2025-03-10 15:50                                           ` Alexey Gladkov
2025-03-10 15:43                                         ` Alexey Gladkov
2025-03-10 15:52                                           ` Juergen Gross
2025-03-10 15:55                                             ` Borislav Petkov
2025-03-10 16:00                                               ` Juergen Gross
2025-03-10 16:06                                                 ` Borislav Petkov
2025-03-10 16:23                                                   ` Jürgen Groß
2025-03-10 16:05                                             ` Alexey Gladkov
2025-03-11  9:43                                           ` Joerg Roedel
2025-03-11 10:22                                             ` Jürgen Groß
2025-03-11 11:07                                               ` Borislav Petkov
2025-03-11 11:14                                                 ` Juergen Gross
2025-03-11 18:24                                                 ` Alexey Gladkov
2025-03-11 18:40                                                   ` Joerg Roedel
2025-03-11 20:37                                                     ` Alexey Gladkov
2025-03-12  7:19                                                     ` Kirill A. Shutemov
2025-03-12  8:23                                                       ` Joerg Roedel
2025-03-12  8:48                                                         ` Kirill A. Shutemov
2025-03-12  9:07                                                           ` Joerg Roedel
2025-03-12 10:59                                                             ` Kirill A. Shutemov
2025-03-12 11:44                                                               ` Joerg Roedel
2025-03-11 18:13                                             ` Alexey Gladkov
2025-03-05 13:50 ` Joerg Roedel

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox