[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH v8 19/25] HYPERCALL_version_op: Add VERSION_build_id to retrieve build-id.



The VERSION hypercall provides the flexibility to expose
the size of the build-id (so the callers can allocate the
proper size before trying to retrieve it). It also allows
in one nice swoop to retrieve the hypervisor build-id in the
provided buffer.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
Acked-by: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Acked-by: Jan Beulich <jbeulich@xxxxxxxx>
Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>

---
Cc: Daniel De Graaf <dgdegra@xxxxxxxxxxxxx>
Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Cc: Stefano Stabellini <stefano.stabellini@xxxxxxxxxxxxx>
Cc: Wei Liu <wei.liu2@xxxxxxxxxx>

v4: New patch.
v5: Rebase - s/VERSION_OP/VERSION/
v6: Add Jan's Ack [provided the version_ops replacement does not need to
    be reverted].
---
---
 tools/flask/policy/policy/modules/xen/xen.te | 1 +
 xen/common/kernel.c                          | 4 ++++
 xen/include/public/version.h                 | 3 +++
 xen/xsm/flask/hooks.c                        | 3 +++
 xen/xsm/flask/policy/access_vectors          | 2 ++
 5 files changed, 13 insertions(+)

diff --git a/tools/flask/policy/policy/modules/xen/xen.te 
b/tools/flask/policy/policy/modules/xen/xen.te
index 34fcfb9..28da3bc 100644
--- a/tools/flask/policy/policy/modules/xen/xen.te
+++ b/tools/flask/policy/policy/modules/xen/xen.te
@@ -83,6 +83,7 @@ allow dom0_t xen_t:version {
     xen_extraversion xen_compile_info xen_capabilities
     xen_changeset xen_pagesize xen_guest_handle xen_commandline
     extraversion capabilities changeset pagesize guest_handle commandline
+    build_id
 };
 
 allow dom0_t xen_t:mmu memorymap;
diff --git a/xen/common/kernel.c b/xen/common/kernel.c
index af2674d..14e14ad 100644
--- a/xen/common/kernel.c
+++ b/xen/common/kernel.c
@@ -474,6 +474,10 @@ DO(version_op)(unsigned int cmd, 
XEN_GUEST_HANDLE_PARAM(void) arg,
         ptr = saved_cmdline;
         break;
 
+    case XEN_VERSION_build_id:
+        rc = xen_build_id(&ptr, &sz);
+        break;
+
     default:
         rc = -ENOSYS;
     }
diff --git a/xen/include/public/version.h b/xen/include/public/version.h
index 78961c9..3f3238f 100644
--- a/xen/include/public/version.h
+++ b/xen/include/public/version.h
@@ -157,6 +157,9 @@ DEFINE_XEN_GUEST_HANDLE(xen_version_op_val_t);
 /* arg = char[]. Contains NUL terminated utf-8 string. */
 #define XEN_VERSION_commandline         9
 
+/* arg = void. Contains binary value of hypervisor build-id. */
+#define XEN_VERSION_build_id            10
+
 #endif /* __XEN_PUBLIC_VERSION_H__ */
 
 /*
diff --git a/xen/xsm/flask/hooks.c b/xen/xsm/flask/hooks.c
index 14ca163..e199d57 100644
--- a/xen/xsm/flask/hooks.c
+++ b/xen/xsm/flask/hooks.c
@@ -1697,6 +1697,9 @@ static int flask_version_op (uint32_t op)
     case XEN_VERSION_commandline:
         return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
                             VERSION__COMMANDLINE, NULL);
+    case XEN_VERSION_build_id:
+        return avc_has_perm(dsid, SECINITSID_XEN, SECCLASS_VERSION,
+                            VERSION__BUILD_ID, NULL);
     default:
         return -EPERM;
     }
diff --git a/xen/xsm/flask/policy/access_vectors 
b/xen/xsm/flask/policy/access_vectors
index 6c0ce7c..a1e40e6 100644
--- a/xen/xsm/flask/policy/access_vectors
+++ b/xen/xsm/flask/policy/access_vectors
@@ -540,4 +540,6 @@ class version
     guest_handle
 # Xen command line.
     commandline
+# Build id of the hypervisor
+    build_id
 }
-- 
2.5.0


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.