]> xenbits.xensource.com Git - xen.git/commitdiff
tools/oxenstored: Make evaluation order explicit
authorChristian Lindig <christian.lindig@citrix.com>
Mon, 13 Aug 2018 16:26:56 +0000 (17:26 +0100)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 14 Aug 2018 15:56:46 +0000 (16:56 +0100)
In Store.path_write(), Path.apply_modify() updates the node_created
reference and both the value of apply_modify() and node_created are
returned by path_write().

At least with OCaml 4.06.1 this leads to the value of node_created being
returned *before* it is updated by apply_modify().  This in turn leads
to the quota for a domain not being updated in Store.write().  Hence, a
guest can create an unlimited number of entries in xenstore.

The fix is to make evaluation order explicit.

This is XSA-272.

Signed-off-by: Christian Lindig <christian.lindig@citrix.com>
Reviewed-by: Rob Hoes <rob.hoes@citrix.com>
tools/ocaml/xenstored/store.ml

index 13cf3b5bf459531cb8ec47385a6c9473835b1018..5a8c377603467395f5c1a998bb9eebbb4b9ac806 100644 (file)
@@ -262,7 +262,8 @@ let path_write store perm path value =
                Node.check_perm store.root perm Perms.WRITE;
                Node.set_value store.root value, false
        ) else
-               Path.apply_modify store.root path do_write, !node_created
+               let root = Path.apply_modify store.root path do_write in
+               root, !node_created
 
 let path_rm store perm path =
        let do_rm node name =