From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 37040C07E99 for ; Mon, 5 Jul 2021 19:50:25 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id D91D56196A for ; Mon, 5 Jul 2021 19:50:24 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D91D56196A Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=invisiblethingslab.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from list by lists.xenproject.org with outflank-mailman.150666.278548 (Exim 4.92) (envelope-from ) id 1m0UbQ-0000R3-F1; Mon, 05 Jul 2021 19:50:00 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 150666.278548; Mon, 05 Jul 2021 19:50:00 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m0UbQ-0000Qw-B1; Mon, 05 Jul 2021 19:50:00 +0000 Received: by outflank-mailman (input) for mailman id 150666; Mon, 05 Jul 2021 19:49:59 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1m0UbP-0000Qq-E4 for xen-devel@lists.xenproject.org; Mon, 05 Jul 2021 19:49:59 +0000 Received: from out5-smtp.messagingengine.com (unknown [66.111.4.29]) by us1-rack-iad1.inumbo.com (Halon) with ESMTPS id e61e831b-fc03-4178-b258-a45428858db9; Mon, 05 Jul 2021 19:49:58 +0000 (UTC) Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 597665C00F0; Mon, 5 Jul 2021 15:49:58 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute6.internal (MEProxy); Mon, 05 Jul 2021 15:49:58 -0400 Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 5 Jul 2021 15:49:56 -0400 (EDT) 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: e61e831b-fc03-4178-b258-a45428858db9 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=G7DY70 Grx+0a8Dm8h5ZrFNCmadOBGwqFg2YnRI1MFUw=; b=ao4EuSMK7v8/ssNxhSzg/w wSePPC5SC+vLWDnrKYk8oKHVEhSumR9AQCat4wxtM+bpXYl6EshsRYjlk6IEuOth VpTkxFSROEdwY9Kc4pryBzz00J0Pz1OYBTgBFiXzjTAwFAsSW7ITMrZm+5RUT4Nt atWzbqftTnyki6LHnpkisKEGATGB7B8F4M3iSUZ/+w/19bIL9AO29mu7SQ725XVv grjgRlUjDNZo0iNy4Haz91HQOMjUWL+aQ8N3OoLdFYZ6EcC4IJrg68ZhA+qh1UAR e7O7Q6wSunlEQbM/cNZJURziIIEefQD3ZmdBAXX/fMjgOsgAzG9a7rqsb6epdSJw == X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeejgedgudegtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpqfgfvfdpuffrtefokffrpgfnqfgh necuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmd enucfjughrpeffhffvuffkfhggtggujgesghdtreertddtjeenucfhrhhomhepofgrrhgv khcuofgrrhgtiiihkhhofihskhhiqdfikphrvggtkhhiuceomhgrrhhmrghrvghksehinh hvihhsihgslhgvthhhihhnghhslhgrsgdrtghomheqnecuggftrfgrthhtvghrnhepteev ffeigffhkefhgfegfeffhfegveeikeettdfhheevieehieeitddugeefteffnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepmhgrrhhmrghrvghk sehinhhvihhsihgslhgvthhhihhnghhslhgrsgdrtghomh X-ME-Proxy: Date: Mon, 5 Jul 2021 21:49:52 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Andrew Cooper Cc: Xen-devel , Olaf Hering , Juergen Gross , Ian Jackson , Wei Liu Subject: Re: [PATCH 1/5] tools/python: handle libxl__physmap_info.name properly in convert-legacy-stream Message-ID: References: <20210705191027.15107-1-andrew.cooper3@citrix.com> <20210705191027.15107-2-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="fsnkhmf9WWev5GLc" Content-Disposition: inline In-Reply-To: <20210705191027.15107-2-andrew.cooper3@citrix.com> --fsnkhmf9WWev5GLc Content-Type: text/plain; protected-headers=v1; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Date: Mon, 5 Jul 2021 21:49:52 +0200 From: Marek =?utf-8?Q?Marczykowski-G=C3=B3recki?= To: Andrew Cooper Cc: Xen-devel , Olaf Hering , Juergen Gross , Ian Jackson , Wei Liu Subject: Re: [PATCH 1/5] tools/python: handle libxl__physmap_info.name properly in convert-legacy-stream On Mon, Jul 05, 2021 at 08:10:23PM +0100, Andrew Cooper wrote: > From: Olaf Hering >=20 > The trailing member name[] in libxl__physmap_info is written as a > cstring into the stream. The current code does a sanity check if the > last byte is zero. This attempt fails with python3 because name[-1] > returns a type int. As a result the comparison with byte(\00) fails: >=20 > File "/usr/lib/xen/bin/convert-legacy-stream", line 347, in read_libxl_= toolstack > raise StreamError("physmap name not NUL terminated") > StreamError: physmap name not NUL terminated >=20 > To handle both python variants, cast to bytearray(). >=20 > Signed-off-by: Olaf Hering > Reviewed-by: Andrew Cooper Acked-by: Marek Marczykowski-G=C3=B3recki > --- > tools/python/scripts/convert-legacy-stream | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) >=20 > diff --git a/tools/python/scripts/convert-legacy-stream b/tools/python/sc= ripts/convert-legacy-stream > index 66ee3d2f5d29..227e1b5c3fd3 100755 > --- a/tools/python/scripts/convert-legacy-stream > +++ b/tools/python/scripts/convert-legacy-stream > @@ -343,7 +343,7 @@ def read_libxl_toolstack(vm, data): > if twidth =3D=3D 64: > name =3D name[:-4] > =20 > - if name[-1] !=3D b'\x00': > + if bytearray(name)[-1] !=3D 0: > raise StreamError("physmap name not NUL terminated") > =20 > root =3D b"physmap/%x" % (phys, ) > --=20 > 2.11.0 >=20 --=20 Best Regards, Marek Marczykowski-G=C3=B3recki Invisible Things Lab --fsnkhmf9WWev5GLc Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEhrpukzGPukRmQqkK24/THMrX1ywFAmDjYmAACgkQ24/THMrX 1yyYqAf/QTmKsert72icwDsQSxGNQMOTfTSY4078x9/EW21JzXXKvf+UCfeTeanM 1kqvhM63SatAutj1zGxhXLaMUgVnnPKCUY4ujncsIRwIyhTuUO9/7rCC+cuavS/y daXg+REYhovvxXFHzAocscyh8OmseHHUnIKJggV64J17b8Zn0Quq/UvZ/R9E/jRj fmi2k1uqt/IFVIgvYjJQycX6V8g8ybDFBe7tN1gf7OC/sWd/tCcWuUhJqaJ083sr 1N/XD1HJ8mLPntP7DYq5JQf7tMPt8rkR5w86P7xHYLuHQybHsERyuzuwbO6/Wvhg JLENqN9o3l+sC08skJuCdZzC9j2JdA== =ORhh -----END PGP SIGNATURE----- --fsnkhmf9WWev5GLc--