From nobody Mon Feb 9 02:28:14 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=1608050204; cv=none; d=zohomail.com; s=zohoarc; b=RksQs7zUF5Sek4RuWHdixWPGU6lzn8aUAhcdqfypoxpC7iwmDqZ2OunK/FjfLGVdUtDAixiZqW4lLaOprSSw267tTi4U3s4AxVM2BlinJwbtqzcmqb1VbZ7cC85NYaazmgBTLFQVVIxKSOc2zXthauBVi23V5X+uaCcpreQLrI4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1608050204; 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=ObiqKqhNTcFYeiU6ZbVorycCfFl0GdIkW5POb75mHGD5XwHVNDcAJzQg0rpmmpHmve4kn6UbATNh7qlrJuLB47x+Ylv1qsFtViAOHu7SG4fzeJBCEK//MDR8y6rnuFqOfXXqZ985oFyiC01BLpUXu5qeG/OXWng72uyteavkEkI= 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 1608050204472757.8425348305975; Tue, 15 Dec 2020 08:36:44 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.54535.94892 (Exim 4.92) (envelope-from ) id 1kpDJL-0006V0-D8; Tue, 15 Dec 2020 16:36:27 +0000 Received: by outflank-mailman (output) from mailman id 54535.94892; Tue, 15 Dec 2020 16:36:27 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDJL-0006Ug-7Z; Tue, 15 Dec 2020 16:36:27 +0000 Received: by outflank-mailman (input) for mailman id 54535; Tue, 15 Dec 2020 16:36:25 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kpDJJ-000667-GR for xen-devel@lists.xenproject.org; Tue, 15 Dec 2020 16:36:25 +0000 Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id 38bf8d0a-1866-4834-915e-24fcd94ee086; Tue, 15 Dec 2020 16:36:12 +0000 (UTC) Received: from relay2.suse.de (unknown [195.135.221.27]) by mx2.suse.de (Postfix) with ESMTP id 8CB6CB1C4; Tue, 15 Dec 2020 16:36:09 +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: 38bf8d0a-1866-4834-915e-24fcd94ee086 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=1608050169; 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=HxoH/VKPziYS/CvlgodAP7TL52lOF7xAQhediq8DcuBxx6+7J/OmpXAidgqcRGgQr3PhbX IliUzW+PJ1/zyFQV+CPzjxK4aQ8yZGAMMN/1ZCLJqo4pieME0pC+jW7jyQH7Ih8vbDBoDF +JzLHnZnlnWy0M1SlVkYdW2Rx45V1d4= From: Juergen Gross To: xen-devel@lists.xenproject.org Cc: Juergen Gross , Ian Jackson , Wei Liu , Paul Durrant , Julien Grall Subject: [PATCH v10 09/25] tools/xenstore: save new binary for live update Date: Tue, 15 Dec 2020 17:35:47 +0100 Message-Id: <20201215163603.21700-10-jgross@suse.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201215163603.21700-1-jgross@suse.com> References: <20201215163603.21700-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