Skip to contentSkip to conversation

hvf: Report HV_DENIED error

PATCH Applied Antonio Caggiano 2 participants 2 messages Jun 8, 2023 – Jun 13, 2023

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 hvf: Report HV_DENIED error

On MacOS 11 and subsequent versions, in case the resulting binary is not signed with the proper entitlement, handle and report the HV_DENIED error.

---
v2: Use architecture specific defines from AvailabilityMacros.h to enable the
HV_DENIED case only on MacOS 11 and subsequent versions.
v3: Fix ifdef guard.

 accel/hvf/hvf-all.c | 6 ++++++
 1 file changed, 6 insertions(+)
accel/hvf/hvf-all.c +6 -0
index 754707dbfb..4920787af6 100644
@@ -38,6 +38,12 @@ void assert_hvf_ok(hv_return_t ret)
     case HV_UNSUPPORTED:
         error_report("Error: HV_UNSUPPORTED");
         break;
+#if defined(MAC_OS_VERSION_11_0) && \
+    MAC_OS_X_VERSION_MIN_REQUIRED >= MAC_OS_VERSION_11_0
+    case HV_DENIED:
+        error_report("Error: HV_DENIED");
+        break;
+#endif
     default:
         error_report("Unknown Error");
     }
Signature · 1 line
2.40.0
#1 lore raw
Quoted 4 lines · Antonio Caggiano

On MacOS 11 and subsequent versions, in case the resulting binary is not signed with the proper entitlement, handle and report the HV_DENIED error.

Quoted 8 lines

---
v2: Use architecture specific defines from AvailabilityMacros.h to enable the
HV_DENIED case only on MacOS 11 and subsequent versions.
v3: Fix ifdef guard.

  accel/hvf/hvf-all.c | 6 ++++++
  1 file changed, 6 insertions(+)

Queued, thanks!