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

[PATCH v1 7/9] tools/ocaml/xenstored: don't store domU's mfn of ring page


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Edwin Török <edvin.torok@xxxxxxxxxx>
  • Date: Thu, 27 Aug 2020 18:35:58 +0100
  • Authentication-results: esa3.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Edwin Török <edvin.torok@xxxxxxxxxx>, "Christian Lindig" <christian.lindig@xxxxxxxxxx>, David Scott <dave@xxxxxxxxxx>, "Ian Jackson" <ian.jackson@xxxxxxxxxxxxx>, Wei Liu <wl@xxxxxxx>, "Signed-off-by : Juergen Gross" <jgross@xxxxxxxx>
  • Delivery-date: Thu, 27 Aug 2020 17:36:38 +0000
  • Ironport-sdr: DXlfC3haA2AR6pJN/KQ4TpOc7Gsgk4d42vnFnC6LVgALQF4cvWIrTOhddyJW7aiZiytaxQdvdZ rl903DhukmgxW6Xtl9d9dnf7jA4iJnFM2evnmJxaIbarvAeP8vDi0+WwKybb8Rc4fJThUt0uFE 2xfs3OUo78NU+ybe89yi82lv928HGkkgN/Sjulscg7wH5K/sCe9i9Ej3wdl1tE6rnmAdrhe6Dj lDO8uWRRsLfFa7zBbdKgylIOj/0aisWBNussW1a176aQriRp6iXpXaVcVf8yLeBgzqQ15bI0gq U3A=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

This is a port of the following C xenstored commit
122b52230aa5b79d65e18b8b77094027faa2f8e2 tools/xenstore: don't store domU's mfn 
of ring page in xenstored

Backwards compat: accept a domain dump both with and without MFN.

CC: Signed-off-by: Juergen Gross <jgross@xxxxxxxx>
Signed-off-by: Edwin Török <edvin.torok@xxxxxxxxxx>
---
 tools/ocaml/xenstored/domain.ml    |  7 ++-----
 tools/ocaml/xenstored/domains.ml   |  6 +++---
 tools/ocaml/xenstored/process.ml   | 16 +++++-----------
 tools/ocaml/xenstored/xenstored.ml |  8 ++++----
 4 files changed, 14 insertions(+), 23 deletions(-)

diff --git a/tools/ocaml/xenstored/domain.ml b/tools/ocaml/xenstored/domain.ml
index 2d9c1f5d09..b11a2f39f5 100644
--- a/tools/ocaml/xenstored/domain.ml
+++ b/tools/ocaml/xenstored/domain.ml
@@ -22,7 +22,6 @@ let warn  fmt = Logging.warn  "domain" fmt
 type t =
 {
        id: Xenctrl.domid;
-       mfn: nativeint;
        interface: Xenmmap.t;
        eventchn: Event.t;
        mutable remote_port: int;
@@ -41,7 +40,6 @@ let is_dom0 d = d.id = 0
 let get_path dom = "/local/domain/" ^ (sprintf "%u" dom.id)
 let get_id domain = domain.id
 let get_interface d = d.interface
-let get_mfn d = d.mfn
 let get_remote_port d = d.remote_port
 let get_port d = d.port
 
@@ -62,7 +60,7 @@ let string_of_port = function
 | Some x -> string_of_int (Xeneventchn.to_int x)
 
 let dump d chan =
-       fprintf chan "dom,%d,%nd,%d\n" d.id d.mfn d.remote_port
+       fprintf chan "dom,%d,%d\n" d.id d.remote_port
 
 let notify dom = match dom.port with
 | None ->
@@ -88,9 +86,8 @@ let close dom =
        Xenmmap.unmap dom.interface;
        ()
 
-let make id mfn remote_port interface eventchn = {
+let make id remote_port interface eventchn = {
        id = id;
-       mfn = mfn;
        remote_port = remote_port;
        interface = interface;
        eventchn = eventchn;
diff --git a/tools/ocaml/xenstored/domains.ml b/tools/ocaml/xenstored/domains.ml
index d9cb693751..0dfeed193a 100644
--- a/tools/ocaml/xenstored/domains.ml
+++ b/tools/ocaml/xenstored/domains.ml
@@ -124,10 +124,10 @@ let cleanup doms =
 let resume _doms _domid =
        ()
 
-let create doms domid mfn port =
+let create doms domid port =
        let mapping = Gnt.(Gnttab.map_exn doms.gnttab { domid; ref = xenstore} 
true) in
        let interface = Gnt.Gnttab.Local_mapping.to_pages doms.gnttab mapping in
-       let dom = Domain.make domid mfn port interface doms.eventchn in
+       let dom = Domain.make domid port interface doms.eventchn in
        Hashtbl.add doms.table domid dom;
        Domain.bind_interdomain dom;
        dom
@@ -147,7 +147,7 @@ let create0 doms =
                        port, interface
                )
                in
-       let dom = Domain.make 0 Nativeint.zero port interface doms.eventchn in
+       let dom = Domain.make 0 port interface doms.eventchn in
        Hashtbl.add doms.table 0 dom;
        Domain.bind_interdomain dom;
        Domain.notify dom;
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index ff5c9484fc..73d7411e59 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -97,10 +97,6 @@ let do_debug con t _domains cons data =
        | "watches" :: _ ->
                let watches = Connections.debug cons in
                Some (watches ^ "\000")
-       | "mfn" :: domid :: _ ->
-               let domid = int_of_string domid in
-               let con = Connections.find_domain cons domid in
-               may (fun dom -> Printf.sprintf "%nd\000" (Domain.get_mfn dom)) 
(Connection.get_domain con)
        | _ -> None
        with _ -> None
 
@@ -409,20 +405,18 @@ let do_introduce con _t domains cons data =
        let dom =
                if Domains.exist domains domid then
                        let edom = Domains.find domains domid in
-                       if (Domain.get_mfn edom) = mfn && 
(Connections.find_domain cons domid) != con then begin
-                               (* Use XS_INTRODUCE for recreating the xenbus 
event-channel. *)
-                               edom.remote_port <- port;
-                               Domain.bind_interdomain edom;
-                       end;
+                       (* Use XS_INTRODUCE for recreating the xenbus 
event-channel. *)
+                       edom.remote_port <- port;
+                       Domain.bind_interdomain edom;
                        edom
                else try
-                       let ndom = Domains.create domains domid mfn port in
+                       let ndom = Domains.create domains domid port in
                        Connections.add_domain cons ndom;
                        Connections.fire_spec_watches cons "@introduceDomain";
                        ndom
                with _ -> raise Invalid_Cmd_Args
        in
-       if (Domain.get_remote_port dom) <> port || (Domain.get_mfn dom) <> mfn 
then
+       if (Domain.get_remote_port dom) <> port then
                raise Domain_not_match
 
 let do_release con _t domains cons data =
diff --git a/tools/ocaml/xenstored/xenstored.ml 
b/tools/ocaml/xenstored/xenstored.ml
index a232e4c616..0e23bec69d 100644
--- a/tools/ocaml/xenstored/xenstored.ml
+++ b/tools/ocaml/xenstored/xenstored.ml
@@ -152,9 +152,9 @@ let from_channel_f chan domain_f watch_f store_f =
                        let l = String.split ',' line in
                        try
                                match l with
-                               | "dom" :: domid :: mfn :: port :: []->
+                               | "dom" :: domid :: _ :: port :: []
+                               | "dom" :: domid :: port :: [] ->
                                        domain_f (int_of_string domid)
-                                                (Nativeint.of_string mfn)
                                                 (int_of_string port)
                                | "watch" :: domid :: path :: token :: [] ->
                                        watch_f (int_of_string domid)
@@ -178,10 +178,10 @@ let from_channel store cons doms chan =
        (* don't let the permission get on our way, full perm ! *)
        let op = Store.get_ops store Perms.Connection.full_rights in
 
-       let domain_f domid mfn port =
+       let domain_f domid port =
                let ndom =
                        if domid > 0 then
-                               Domains.create doms domid mfn port
+                               Domains.create doms domid port
                        else
                                Domains.create0 doms
                        in
-- 
2.25.1




 


Rackspace

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