From nobody Mon Feb 9 21:12:10 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=1; a=rsa-sha256; t=1610638731; cv=none; d=zohomail.com; s=zohoarc; b=engfckpl0iETS4P2MaTNfg507KMw6sc4dAFv2s5VECAHWkRgh3zTB+LmxcXqdRP9bIpRrGSaDj/L+wl0fxXzoo8q6a8McEcoMaL9SOw+SUrT+eKPPYegWYk/VPMcrMSoFqAuRBWt0rxDHmyG0po2+tBdVtBnIrKwUTxwOZj+Txw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1610638731; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=aNFJAE4KqQnX5IjGOaMkCIzNeyfe1g2GU9xo9W5ZYdw=; b=La0o3lHnRzR4qqs+0UPMjBpRAYPWJdPfk7+wLjC42ZZxSVyCsfFpYuS7EF1U7CJ8SOnArOVVyH+xlyYtCeF90/Pm5jl6c6s1UF1kNIqsiH5X8JRcAHG7OqEReVwYhfK5owKSVa4c9W5/95SQDbRpCuymsqSU5oBttq0vpP47utY= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=quarantine dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1610638731649223.29872289312357; Thu, 14 Jan 2021 07:38:51 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.67213.119829 (Exim 4.92) (envelope-from ) id 1l04ho-00039q-8I; Thu, 14 Jan 2021 15:38:36 +0000 Received: by outflank-mailman (output) from mailman id 67213.119829; Thu, 14 Jan 2021 15:38:36 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l04ho-00039a-1M; Thu, 14 Jan 2021 15:38:36 +0000 Received: by outflank-mailman (input) for mailman id 67213; Thu, 14 Jan 2021 15:38:34 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1l04hm-0002Sh-J5 for xen-devel@lists.xenproject.org; Thu, 14 Jan 2021 15:38:34 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id c7470f7c-5ab8-4424-9acb-cad56fbe2503; Thu, 14 Jan 2021 15:38:10 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id D5826AF0F; Thu, 14 Jan 2021 15:38:08 +0000 (UTC) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c7470f7c-5ab8-4424-9acb-cad56fbe2503 X-Virus-Scanned: by amavisd-new at test-mx.suse.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=susede1; t=1610638689; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=aNFJAE4KqQnX5IjGOaMkCIzNeyfe1g2GU9xo9W5ZYdw=; b=sF7PjYmydkar5XuezprwYewHZOzUUcLx1IM7Ddvf3I1rDFTkvIskj2umfWZZqDK+BZRFz/ aBHrMzMfvzg18X9a8OQhM7rPy0lhX5UQL98+wflcGf7SR4frhhMhxOsy2Yr+K6VzAJbwwy uZojxkSk6q2SZlh2zv8kkr/rtsJ9V1U= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu , Paul Durrant , Julien Grall Subject: [PATCH v11 10/27] tools/xenstore: save new binary for live update Date: Thu, 14 Jan 2021 16:37:46 +0100 Message-Id: <20210114153803.2591-11-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210114153803.2591-1-jgross@suse.com> References: <20210114153803.2591-1-jgross@suse.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @suse.com) Content-Type: text/plain; charset="utf-8" Save the new binary name for the daemon case and the new kernel for stubdom in order to support live update of Xenstore.. Signed-off-by: Juergen Gross Reviewed-by: Paul Durrant Reviewed-by: Julien Grall --- tools/xenstore/xenstored_control.c | 41 +++++++++++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) diff --git a/tools/xenstore/xenstored_control.c b/tools/xenstore/xenstored_= control.c index 7854b7f46f..95ac1a1648 100644 --- a/tools/xenstore/xenstored_control.c +++ b/tools/xenstore/xenstored_control.c @@ -1,5 +1,5 @@ /* - Interactive commands for Xen Store Daemon. +Interactive commands for Xen Store Daemon. Copyright (C) 2017 Juergen Gross, SUSE Linux GmbH =20 This program is free software; you can redistribute it and/or modify @@ -22,6 +22,9 @@ #include #include #include +#include +#include +#include =20 #include "utils.h" #include "talloc.h" @@ -31,6 +34,14 @@ struct live_update { /* For verification the correct connection is acting. */ struct connection *conn; + +#ifdef __MINIOS__ + void *kernel; + unsigned int kernel_size; + unsigned int kernel_off; +#else + char *filename; +#endif }; =20 static struct live_update *lu_status; @@ -215,6 +226,13 @@ static const char *lu_binary_alloc(const void *ctx, st= ruct connection *conn, if (ret) return ret; =20 + lu_status->kernel =3D talloc_size(lu_status, size); + if (!lu_status->kernel) + return "Allocation failure."; + + lu_status->kernel_size =3D size; + lu_status->kernel_off =3D 0; + return NULL; } =20 @@ -224,6 +242,12 @@ static const char *lu_binary_save(const void *ctx, str= uct connection *conn, if (!lu_status || lu_status->conn !=3D conn) return "Not in live-update session."; =20 + if (lu_status->kernel_off + size > lu_status->kernel_size) + return "Too much kernel data."; + + memcpy(lu_status->kernel + lu_status->kernel_off, data, size); + lu_status->kernel_off +=3D size; + return NULL; } =20 @@ -243,13 +267,23 @@ static const char *lu_binary(const void *ctx, struct = connection *conn, const char *filename) { const char *ret; + struct stat statbuf; =20 syslog(LOG_INFO, "live-update: binary %s\n", filename); =20 + if (stat(filename, &statbuf)) + return "File not accessible."; + if (!(statbuf.st_mode & (S_IXOTH | S_IXGRP | S_IXUSR))) + return "File not executable."; + ret =3D lu_begin(conn); if (ret) return ret; =20 + lu_status->filename =3D talloc_strdup(lu_status, filename); + if (!lu_status->filename) + return "Allocation failure."; + return NULL; } =20 @@ -272,6 +306,11 @@ static const char *lu_start(const void *ctx, struct co= nnection *conn, if (!lu_status || lu_status->conn !=3D conn) return "Not in live-update session."; =20 +#ifdef __MINIOS__ + if (lu_status->kernel_size !=3D lu_status->kernel_off) + return "Kernel not complete."; +#endif + /* Will be replaced by real live-update later. */ talloc_free(lu_status); =20 --=20 2.26.2