From nobody Mon Feb 9 09:09:32 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=fail; 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 ARC-Seal: i=1; a=rsa-sha256; t=1603992040; cv=none; d=zohomail.com; s=zohoarc; b=UIlBAB1xzoL28qlihWaanEd4cxQN3zpC1YCiyh2HTDYA6HUy8L8rdT+/D5851hgrfk4HIsgpFjmdA5xQS6Fi5+q05KuVwl0AWv0hK6AskvpDITyow0pycIAhvsaZi8kXLVoqHqEMUc/GlZwTCdgv9mUDszgg7qO+HajnfWMN8yE= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1603992040; 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=nOFtdNXlk5HjYyxO1mkGMNqJ+Z1za/MxmXOScJ0HbPg=; b=cQaAGEogHpwV7EA+Zu6pqgzZeYlKguCeUiSA51/XXxFKVBC45ZiGgJULSEAYJ4co7YuW0jdIfk8HB2c5aiVRQG6Uys2s9TF/2a6hnvc44psKY48bmjbgxWLYRYnmLwGWm2/6zEL9qJwzj6U4D52uHHZ/4lFiH1NXZ+r0E70R2Zg= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=fail; 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 Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1603992040745595.3993303956101; Thu, 29 Oct 2020 10:20:40 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.14414.35619 (Exim 4.92) (envelope-from ) id 1kYBb5-0003Qw-Gw; Thu, 29 Oct 2020 17:20:23 +0000 Received: by outflank-mailman (output) from mailman id 14414.35619; Thu, 29 Oct 2020 17:20:23 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kYBb5-0003Qp-DC; Thu, 29 Oct 2020 17:20:23 +0000 Received: by outflank-mailman (input) for mailman id 14414; Thu, 29 Oct 2020 17:20:21 +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 1kYBb3-0003MC-L3 for xen-devel@lists.xenproject.org; Thu, 29 Oct 2020 17:20:21 +0000 Received: from mo4-p01-ob.smtp.rzone.de (unknown [81.169.146.167]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f2ded997-a0ba-499a-9121-66cb54d56275; Thu, 29 Oct 2020 17:20:16 +0000 (UTC) Received: from sender by smtp.strato.de (RZmta 47.3.0 DYNA|AUTH) with ESMTPSA id j0b1afw9THK93f8 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) (Client did not present a certificate); Thu, 29 Oct 2020 18:20:09 +0100 (CET) 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 1kYBb3-0003MC-L3 for xen-devel@lists.xenproject.org; Thu, 29 Oct 2020 17:20:21 +0000 Received: from mo4-p01-ob.smtp.rzone.de (unknown [81.169.146.167]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id f2ded997-a0ba-499a-9121-66cb54d56275; Thu, 29 Oct 2020 17:20:16 +0000 (UTC) Received: from sender by smtp.strato.de (RZmta 47.3.0 DYNA|AUTH) with ESMTPSA id j0b1afw9THK93f8 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256 bits)) (Client did not present a certificate); Thu, 29 Oct 2020 18:20:09 +0100 (CET) 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: f2ded997-a0ba-499a-9121-66cb54d56275 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1603992015; s=strato-dkim-0002; d=aepfle.de; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=nOFtdNXlk5HjYyxO1mkGMNqJ+Z1za/MxmXOScJ0HbPg=; b=K1on7XABhOD58zqU8Not3Jy8NtNKHxa7+wF/7CEvBGy0Xy50gVK77PKerWSLzU+So9 mHzWJMuN/kN5RrPggT/TH/mZQ78+ern0VAvdGZWDY5IV2fvDrTAiXfwrrrdlvJlujlkQ eT8gpkyVPxNJNNRtQ+oMeJ36NHmS8EdXyNfwXvOMgR62w+fQza04ErpoIRIIAk1QJRsl pSXi1Id9jJK4NCWJkSJ6MXk+OpskfrVo8RhyfN0NObP4+mmVnQ1nxapFNmnWLcgw/FM4 ehXSuTwR0ESHiKYrC3itFRjbE8b1pCFsQbUN1vauqXrs5pgQ1LUJTUosAD3b7q/8FUrR fr3A== X-RZG-AUTH: ":P2EQZWCpfu+qG7CngxMFH1J+3q8wa/QXkBR9MXjAuzBW/OdlBZQ4AHSS3G1Jjw==" X-RZG-CLASS-ID: mo00 From: Olaf Hering To: xen-devel@lists.xenproject.org Cc: Olaf Hering , Ian Jackson , Wei Liu , Anthony PERARD Subject: [PATCH v1 03/23] tools: use xc_is_known_page_type Date: Thu, 29 Oct 2020 18:19:43 +0100 Message-Id: <20201029172004.17219-4-olaf@aepfle.de> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20201029172004.17219-1-olaf@aepfle.de> References: <20201029172004.17219-1-olaf@aepfle.de> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: fail (Header signature does not verify) Content-Type: text/plain; charset="utf-8" Verify pfn type on sending side, also verify incoming batch of pfns. Signed-off-by: Olaf Hering --- tools/libs/guest/xg_sr_restore.c | 3 +-- tools/libs/guest/xg_sr_save.c | 6 ++++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/libs/guest/xg_sr_restore.c b/tools/libs/guest/xg_sr_rest= ore.c index b57a787519..f1c3169229 100644 --- a/tools/libs/guest/xg_sr_restore.c +++ b/tools/libs/guest/xg_sr_restore.c @@ -406,8 +406,7 @@ static int handle_page_data(struct xc_sr_context *ctx, = struct xc_sr_record *rec) } =20 type =3D (pages->pfn[i] & PAGE_DATA_TYPE_MASK) >> 32; - if ( ((type >> XEN_DOMCTL_PFINFO_LTAB_SHIFT) >=3D 5) && - ((type >> XEN_DOMCTL_PFINFO_LTAB_SHIFT) <=3D 8) ) + if ( xc_is_known_page_type(type) =3D=3D false ) { ERROR("Invalid type %#"PRIx32" for pfn %#"PRIpfn" (index %u)", type, pfn, i); diff --git a/tools/libs/guest/xg_sr_save.c b/tools/libs/guest/xg_sr_save.c index 2ba7c3200c..044d0ae3aa 100644 --- a/tools/libs/guest/xg_sr_save.c +++ b/tools/libs/guest/xg_sr_save.c @@ -147,6 +147,12 @@ static int write_batch(struct xc_sr_context *ctx) =20 for ( i =3D 0; i < nr_pfns; ++i ) { + if ( xc_is_known_page_type(types[i]) =3D=3D false ) + { + ERROR("Wrong type %#"PRIpfn" for pfn %#"PRIpfn, types[i], mfns= [i]); + goto err; + } + switch ( types[i] ) { case XEN_DOMCTL_PFINFO_BROKEN: