[PATCH] hvf: Report HV_DENIED error

Antonio Caggiano posted 1 patch 10 months, 3 weeks ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/qemu tags/patchew/20230601142704.68768-1-quic._5Facaggian@quicinc.com
Maintainers: Cameron Esfahani <dirty@apple.com>, Roman Bolshakov <r.bolshakov@yadro.com>
There is a newer version of this series
accel/hvf/hvf-all.c | 3 +++
1 file changed, 3 insertions(+)
[PATCH] hvf: Report HV_DENIED error
Posted by Antonio Caggiano 10 months, 3 weeks ago
In case the resulting binary is not signed with the proper entitlement,
handle and report the HV_DENIED error.

Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
---
 accel/hvf/hvf-all.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
index 0043f4d308..679907a147 100644
--- a/accel/hvf/hvf-all.c
+++ b/accel/hvf/hvf-all.c
@@ -38,6 +38,9 @@ void assert_hvf_ok(hv_return_t ret)
     case HV_UNSUPPORTED:
         error_report("Error: HV_UNSUPPORTED");
         break;
+    case HV_DENIED:
+        error_report("Error: HV_DENIED");
+        break;
     default:
         error_report("Unknown Error");
     }
-- 
2.40.0
Re: [PATCH] hvf: Report HV_DENIED error
Posted by Peter Maydell 10 months, 3 weeks ago
On Thu, 1 Jun 2023 at 15:27, Antonio Caggiano <quic_acaggian@quicinc.com> wrote:
>
> In case the resulting binary is not signed with the proper entitlement,
> handle and report the HV_DENIED error.
>
> Signed-off-by: Antonio Caggiano <quic_acaggian@quicinc.com>
> ---
>  accel/hvf/hvf-all.c | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/accel/hvf/hvf-all.c b/accel/hvf/hvf-all.c
> index 0043f4d308..679907a147 100644
> --- a/accel/hvf/hvf-all.c
> +++ b/accel/hvf/hvf-all.c
> @@ -38,6 +38,9 @@ void assert_hvf_ok(hv_return_t ret)
>      case HV_UNSUPPORTED:
>          error_report("Error: HV_UNSUPPORTED");
>          break;
> +    case HV_DENIED:
> +        error_report("Error: HV_DENIED");
> +        break;
>      default:
>          error_report("Unknown Error");
>      }

HV_DENIED only appeared in macos 11, so this will break
the build on Catalina (10.15). Catalina isn't in our official
list of supported versions any more (too old) so we don't
strictly have to support it, but is it easy to add some
kind of ifdef so we don't break it just yet ?

thanks
-- PMM