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

[xen stable-4.17] oxenstored: Factor out Process.do_reconnect()



commit 7499d14f6e7fda900d8ad00f6224b2efe226ac20
Author:     Andrii Sultanov <andriy.sultanov@xxxxxxxxxx>
AuthorDate: Thu Aug 20 16:00:02 2026 +0100
Commit:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
CommitDate: Wed Aug 26 17:51:38 2026 +0100

    oxenstored: Factor out Process.do_reconnect()
    
    The logic flow here is complicated.  In preparation to fix a bug, factor out
    reconnecting a xenbus connection, and fold History.reconnect into it's 
single
    caller.
    
    No functional change.
    
    This is part of XSA-512 / CVE-2026-79604.
    
    Signed-off-by: Andrii Sultanov <andriy.sultanov@xxxxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Andrii Sultanov <andriy.sultanov@xxxxxxxxxx>
    (cherry picked from commit 9c5a46b12066da7311a8d43202abd78956ab0bfb)
---
 tools/ocaml/xenstored/history.ml |  4 ----
 tools/ocaml/xenstored/process.ml | 17 ++++++++++-------
 2 files changed, 10 insertions(+), 11 deletions(-)

diff --git a/tools/ocaml/xenstored/history.ml b/tools/ocaml/xenstored/history.ml
index ba5c9cb571..029802bd15 100644
--- a/tools/ocaml/xenstored/history.ml
+++ b/tools/ocaml/xenstored/history.ml
@@ -39,10 +39,6 @@ let end_transaction txn con tid commit =
        trim ~txn ();
        success
 
-let reconnect con =
-       trim ();
-       Connection.do_reconnect con
-
 let push (x: history_record) =
        let dom = x.con.Connection.dom in
        match dom with
diff --git a/tools/ocaml/xenstored/process.ml b/tools/ocaml/xenstored/process.ml
index 02bd0f7d80..33161da5eb 100644
--- a/tools/ocaml/xenstored/process.ml
+++ b/tools/ocaml/xenstored/process.ml
@@ -333,6 +333,13 @@ let do_reset_watches con _t _domains cons _data =
   Connections.del_watches cons con;
   Connection.del_transactions con
 
+let do_reconnect cons con =
+  let domstr = Connection.get_domstr con in
+  info "%s requests a reconnect" domstr;
+  History.trim ();
+  Connection.do_reconnect con;
+  info "%s reconnection complete" domstr
+
 (* only in >= xen3.3                                                           
                         *)
 let do_set_target con _t _domains cons data =
        if not (Connection.is_dom0 con)
@@ -718,9 +725,7 @@ let do_input store cons doms con =
                        if Connection.can_input con then Connection.do_input con
                        else None
                with Xenbus.Xb.Reconnect ->
-                       info "%s requests a reconnect" (Connection.get_domstr 
con);
-                       History.reconnect con;
-                       info "%s reconnection complete" (Connection.get_domstr 
con);
+                       do_reconnect cons con;
                        None
                | Invalid_argument exp | Failure exp ->
                        error "caught exception %s" exp;
@@ -743,7 +748,7 @@ let do_input store cons doms con =
                write_access_log ~ty ~tid ~con:(Connection.get_domstr con) 
~data;
                Connection.incr_ops con
 
-let do_output _store _cons _doms con =
+let do_output _store cons _doms con =
        Connection.source_flush_watchevents con;
        if Connection.has_output con then (
                if Connection.has_new_output con then (
@@ -758,8 +763,6 @@ let do_output _store _cons _doms con =
                try
                        ignore (Connection.do_output con)
                with Xenbus.Xb.Reconnect ->
-                       info "%s requests a reconnect" (Connection.get_domstr 
con);
-                       History.reconnect con;
-                       info "%s reconnection complete" (Connection.get_domstr 
con)
+                       do_reconnect cons con;
        )
 
--
generated by git-patchbot for /home/xen/git/xen.git#stable-4.17



 


Rackspace

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