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

[xen master] tools/ocaml/xenstored: only Dom0 can change node owner

commit 2a3f8d12f00ea87c8ac84b8a2f84d1afe42230f3
Author:     Edwin Török <edvin.torok@xxxxxxxxxx>
AuthorDate: Tue Dec 15 13:37:33 2020 +0100
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Tue Dec 15 13:37:33 2020 +0100

    tools/ocaml/xenstored: only Dom0 can change node owner
    Otherwise we can give quota away to another domain, either causing it to run
    out of quota, or in case of Dom0 use unbounded amounts of memory and bypass
    the quota system entirely.
    This was fixed in the C version of xenstored in 2006 (c/s db34d2aaa5f5,
    predating the XSA process by 5 years).
    It was also fixed in the mirage version of xenstore in 2012, with a unit 
    demonstrating the vulnerability:
    but possibly without realising that the vulnerability still affected the
    in-tree oxenstored (added c/s f44af660412 in 2010).
    This is XSA-352.
    Signed-off-by: Edwin Török <edvin.torok@xxxxxxxxxx>
    Acked-by: Christian Lindig <christian.lindig@xxxxxxxxxx>
    Reviewed-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
 tools/ocaml/xenstored/store.ml | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/ocaml/xenstored/store.ml b/tools/ocaml/xenstored/store.ml
index 22d4ac159f..e20767372f 100644
--- a/tools/ocaml/xenstored/store.ml
+++ b/tools/ocaml/xenstored/store.ml
@@ -437,7 +437,8 @@ let setperms store perm path nperms =
        | Some node ->
                let old_owner = Node.get_owner node in
                let new_owner = Perms.Node.get_owner nperms in
-               if not ((old_owner = new_owner) || (Perms.Connection.is_dom0 
perm)) then Quota.check store.quota new_owner 0;
+               if not ((old_owner = new_owner) || (Perms.Connection.is_dom0 
perm)) then
+                       raise Define.Permission_denied;
                store.root <- path_setperms store perm path nperms;
                Quota.del_entry store.quota old_owner;
                Quota.add_entry store.quota new_owner
generated by git-patchbot for /home/xen/git/xen.git#master



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