* [PATCH] target/i386/sev: Fix a segfault in sev_kvm_init
@ 2024-01-04 10:48 Srikanth Aithal
2024-01-04 13:48 ` Philippe Mathieu-Daudé
2024-01-04 16:27 ` Zhao Liu
0 siblings, 2 replies; 3+ messages in thread
From: Srikanth Aithal @ 2024-01-04 10:48 UTC (permalink / raw)
To: qemu-devel, pbonzini, mtosatti; +Cc: nikunj, Srikanth Aithal
Propogate error code using errp in sev_kvm_init.
Before fix:
qemu-system-x86_64: sev_kvm_init: guest policy requires SEV-ES,
but host SEV-ES support unavailable
27747 Segmentation fault (core dumped)
After fix:
qemu-system-x86_64: sev_kvm_init: guest policy requires SEV-ES,
but host SEV-ES support unavailable
qemu-system-x86_64: failed to initialize kvm: Operation not permitted
While at it, also fix two more locations.
Reviewed-by: Nikunj A Dadhania <nikunj@amd.com>
Signed-off-by: Srikanth Aithal <srikanth.aithal@amd.com>
---
target/i386/sev.c | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/target/i386/sev.c b/target/i386/sev.c
index 9a71246682..c0a4d5e535 100644
--- a/target/i386/sev.c
+++ b/target/i386/sev.c
@@ -922,7 +922,8 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
ret = ram_block_discard_disable(true);
if (ret) {
- error_report("%s: cannot disable RAM discard", __func__);
+ error_setg(errp, "%s: cannot disable "
+ "RAM discard", __func__);
return -1;
}
@@ -979,13 +980,13 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
if (sev_es_enabled()) {
if (!kvm_kernel_irqchip_allowed()) {
- error_report("%s: SEV-ES guests require in-kernel irqchip support",
- __func__);
+ error_setg(errp, "%s: SEV-ES guests require in-kernel "
+ "irqchip support", __func__);
goto err;
}
if (!(status.flags & SEV_STATUS_FLAGS_CONFIG_ES)) {
- error_report("%s: guest policy requires SEV-ES, but "
+ error_setg(errp, "%s: guest policy requires SEV-ES, but "
"host SEV-ES support unavailable",
__func__);
goto err;
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] target/i386/sev: Fix a segfault in sev_kvm_init
2024-01-04 10:48 [PATCH] target/i386/sev: Fix a segfault in sev_kvm_init Srikanth Aithal
@ 2024-01-04 13:48 ` Philippe Mathieu-Daudé
2024-01-04 16:27 ` Zhao Liu
1 sibling, 0 replies; 3+ messages in thread
From: Philippe Mathieu-Daudé @ 2024-01-04 13:48 UTC (permalink / raw)
To: Srikanth Aithal, qemu-devel, pbonzini, mtosatti; +Cc: nikunj
On 4/1/24 11:48, Srikanth Aithal wrote:
> Propogate error code using errp in sev_kvm_init.
>
> Before fix:
> qemu-system-x86_64: sev_kvm_init: guest policy requires SEV-ES,
> but host SEV-ES support unavailable
> 27747 Segmentation fault (core dumped)
>
> After fix:
> qemu-system-x86_64: sev_kvm_init: guest policy requires SEV-ES,
> but host SEV-ES support unavailable
> qemu-system-x86_64: failed to initialize kvm: Operation not permitted
>
> While at it, also fix two more locations.
>
> Reviewed-by: Nikunj A Dadhania <nikunj@amd.com>
> Signed-off-by: Srikanth Aithal <srikanth.aithal@amd.com>
> ---
> target/i386/sev.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] target/i386/sev: Fix a segfault in sev_kvm_init
2024-01-04 10:48 [PATCH] target/i386/sev: Fix a segfault in sev_kvm_init Srikanth Aithal
2024-01-04 13:48 ` Philippe Mathieu-Daudé
@ 2024-01-04 16:27 ` Zhao Liu
1 sibling, 0 replies; 3+ messages in thread
From: Zhao Liu @ 2024-01-04 16:27 UTC (permalink / raw)
To: Srikanth Aithal; +Cc: qemu-devel, pbonzini, mtosatti, nikunj
On Thu, Jan 04, 2024 at 04:18:20PM +0530, Srikanth Aithal wrote:
> Date: Thu, 4 Jan 2024 16:18:20 +0530
> From: Srikanth Aithal <srikanth.aithal@amd.com>
> Subject: [PATCH] target/i386/sev: Fix a segfault in sev_kvm_init
> X-Mailer: git-send-email 2.34.1
>
> Propogate error code using errp in sev_kvm_init.
>
> Before fix:
> qemu-system-x86_64: sev_kvm_init: guest policy requires SEV-ES,
> but host SEV-ES support unavailable
> 27747 Segmentation fault (core dumped)
>
> After fix:
> qemu-system-x86_64: sev_kvm_init: guest policy requires SEV-ES,
> but host SEV-ES support unavailable
> qemu-system-x86_64: failed to initialize kvm: Operation not permitted
>
> While at it, also fix two more locations.
>
> Reviewed-by: Nikunj A Dadhania <nikunj@amd.com>
> Signed-off-by: Srikanth Aithal <srikanth.aithal@amd.com>
> ---
> target/i386/sev.c | 9 +++++----
> 1 file changed, 5 insertions(+), 4 deletions(-)
Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
>
> diff --git a/target/i386/sev.c b/target/i386/sev.c
> index 9a71246682..c0a4d5e535 100644
> --- a/target/i386/sev.c
> +++ b/target/i386/sev.c
> @@ -922,7 +922,8 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
>
> ret = ram_block_discard_disable(true);
> if (ret) {
> - error_report("%s: cannot disable RAM discard", __func__);
> + error_setg(errp, "%s: cannot disable "
> + "RAM discard", __func__);
> return -1;
> }
>
> @@ -979,13 +980,13 @@ int sev_kvm_init(ConfidentialGuestSupport *cgs, Error **errp)
>
> if (sev_es_enabled()) {
> if (!kvm_kernel_irqchip_allowed()) {
> - error_report("%s: SEV-ES guests require in-kernel irqchip support",
> - __func__);
> + error_setg(errp, "%s: SEV-ES guests require in-kernel "
> + "irqchip support", __func__);
> goto err;
> }
>
> if (!(status.flags & SEV_STATUS_FLAGS_CONFIG_ES)) {
> - error_report("%s: guest policy requires SEV-ES, but "
> + error_setg(errp, "%s: guest policy requires SEV-ES, but "
> "host SEV-ES support unavailable",
> __func__);
> goto err;
> --
> 2.34.1
>
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-01-04 16:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-04 10:48 [PATCH] target/i386/sev: Fix a segfault in sev_kvm_init Srikanth Aithal
2024-01-04 13:48 ` Philippe Mathieu-Daudé
2024-01-04 16:27 ` Zhao Liu
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).