Skip to contentSkip to conversation

tools/xenstored: Stash the correct request in lu_status->in

PATCH In review Julien Grall 3 participants 4 messages Jul 1, 2021 – Jul 6, 2021

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 tools/xenstored: Stash the correct request in lu_status->in

From: Julien Grall <[email protected]>

When Live-Updating with some load, Xenstored may hit the assert req->in == lu_status->in in do_lu_start().

This is happening because the request is stashed when Live-Update begins. This happens in a different request (see call lu_begin() when select the new binary) from the one performing Live-Update.

To avoid the problem, stash the request in lu_start().

Fixes 65f19ed62aa1 ("tools/xenstore: Don't assume conn->in points to the LU request")

----

This was sadly missed because the on my testing the 2 requests were residing at the same place in memory.

This was reproduced by creating domain while Live-Updating. Without the patch, Xenstored will crash.

---
 tools/xenstore/xenstored_control.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tools/xenstore/xenstored_control.c +1 -1
index a1b1bd5a718d..ff9863c17fa4 100644
@@ -103,7 +103,6 @@ static const char *lu_begin(struct connection *conn)
 	if (!lu_status)
 		return "Allocation failure.";
 	lu_status->conn = conn;
-	lu_status->in = conn->in;
 	talloc_set_destructor(lu_status, lu_destroy);
 
 	return NULL;
@@ -757,6 +756,7 @@ static const char *lu_start(const void *ctx, struct connection *conn,
 	lu_status->force = force;
 	lu_status->timeout = to;
 	lu_status->started_at = time(NULL);
+	lu_status->in = conn->in;
 
 	errno = delay_request(conn, conn->in, do_lu_start, conn, false);
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Julien Grall

From: Julien Grall <[email protected]>

When Live-Updating with some load, Xenstored may hit the assert req->in == lu_status->in in do_lu_start().

This is happening because the request is stashed when Live-Update begins. This happens in a different request (see call lu_begin() when select the new binary) from the one performing Live-Update.

Quoted 5 lines

To avoid the problem, stash the request in lu_start().

Fixes 65f19ed62aa1 ("tools/xenstore: Don't assume conn->in points to the LU request")
Reviewed-by [email protected]
Quoted 36 lines

----

This was sadly missed because the on my testing the 2 requests were residing at the same place in memory.

This was reproduced by creating domain while Live-Updating. Without the patch, Xenstored will crash.
---
tools/xenstore/xenstored_control.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
tools/xenstore/xenstored_control.c +1 -1
index a1b1bd5a718d..ff9863c17fa4 100644
@@ -103,7 +103,6 @@ static const char *lu_begin(struct connection *conn)
 	if (!lu_status)
 		return "Allocation failure.";
 	lu_status->conn = conn;
-	lu_status->in = conn->in;
 	talloc_set_destructor(lu_status, lu_destroy);
 
 	return NULL;
@@ -757,6 +756,7 @@ static const char *lu_start(const void *ctx, struct connection *conn,
 	lu_status->force = force;
 	lu_status->timeout = to;
 	lu_status->started_at = time(NULL);
+	lu_status->in = conn->in;
 
 	errno = delay_request(conn, conn->in, do_lu_start, conn, false);
 
Signature · 1 line
2.17.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Julien Grall
Quoted 9 lines · Julien Grall

From: Julien Grall <[email protected]>

When Live-Updating with some load, Xenstored may hit the assert req->in == lu_status->in in do_lu_start().

This is happening because the request is stashed when Live-Update begins. This happens in a different request (see call lu_begin() when select the new binary) from the one performing Live-Update.

Quoted 5 lines

To avoid the problem, stash the request in lu_start().

Fixes 65f19ed62aa1 ("tools/xenstore: Don't assume conn->in points to the LU request")

Juergen

#3 lore raw

Hi Juergen,

Quoted 10 lines · Juergen Gross
Quoted 9 lines · Julien Grall

From: Julien Grall <[email protected]>

When Live-Updating with some load, Xenstored may hit the assert req->in == lu_status->in in do_lu_start().

This is happening because the request is stashed when Live-Update begins. This happens in a different request (see call lu_begin() when select the new binary) from the one performing Live-Update.

Quoted 7 lines
Quoted 5 lines

To avoid the problem, stash the request in lu_start().

Fixes 65f19ed62aa1 ("tools/xenstore: Don't assume conn->in points to the LU request")

Committed. Thanks!

Cheers,

Signature · 1 line
Julien Grall