From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=none (p=none dis=none) header.from=gibson.dropbear.id.au Authentication-Results: passt.top; dkim=pass (2048-bit key; secure) header.d=gibson.dropbear.id.au header.i=@gibson.dropbear.id.au header.a=rsa-sha256 header.s=202412 header.b=mjiCvUrE; dkim-atps=neutral Received: from mail.ozlabs.org (mail.ozlabs.org [IPv6:2404:9400:2221:ea00::3]) by passt.top (Postfix) with ESMTPS id 9CD735A026F for ; Wed, 29 Jan 2025 02:29:43 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gibson.dropbear.id.au; s=202412; t=1738114167; bh=Ud0DP2VhSIYjpUfhkUD2Lg4/yvqsjJoTWMgtYwjNGeA=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=mjiCvUrErV2J2WUfDa476Eanv8VaBXSH9PP/THnkJHNPuhXxVbUphsnC1X0z+kRIp DpWBt3ObxNjIUpMS5inrq7cap8prRVgBaPXtlbfoEvrkubsYrGcg/92LUTveQ7k40Y QM9N0btRbn76bahEjGU0M83oel7AUPj50J21T6d++FVRRhJisG8TGrUtWBr96tsEnW 0zbKM5xKz+1aTYh93mKGlZ0HyEfFL+C+whb+6Bn/EqYHTchI08JYHaXQr+l1WITBwt LKB9Zyq4SSAHQ369oR3yWK7YvuzBcG4H3sE+dILsdQb/dSVUTAjt5tMqVxpq5CrwMk I3SxHpDAl/X+Q== Received: by gandalf.ozlabs.org (Postfix, from userid 1007) id 4YjPhR17pJz4x3J; Wed, 29 Jan 2025 12:29:27 +1100 (AEDT) Date: Wed, 29 Jan 2025 12:03:30 +1100 From: David Gibson To: Stefano Brivio Subject: Re: [PATCH 5/7] util: Add read_remainder() and read_all_buf() Message-ID: References: <20250127231532.672363-1-sbrivio@redhat.com> <20250127231532.672363-6-sbrivio@redhat.com> <20250128074849.0e83099c@elisabeth> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="0FsXC1wSQw0Ge+Ry" Content-Disposition: inline In-Reply-To: <20250128074849.0e83099c@elisabeth> Message-ID-Hash: 62O234CTV4U4YY6JWVDCMKYLBGOKZASO X-Message-ID-Hash: 62O234CTV4U4YY6JWVDCMKYLBGOKZASO X-MailFrom: dgibson@gandalf.ozlabs.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: passt-dev@passt.top, Laurent Vivier X-Mailman-Version: 3.3.8 Precedence: list List-Id: Development discussion and patches for passt Archived-At: Archived-At: List-Archive: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: --0FsXC1wSQw0Ge+Ry Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Tue, Jan 28, 2025 at 07:48:49AM +0100, Stefano Brivio wrote: > On Tue, 28 Jan 2025 11:59:28 +1100 > David Gibson wrote: >=20 > > On Tue, Jan 28, 2025 at 12:15:30AM +0100, Stefano Brivio wrote: > > > These are symmetric to write_remainder() and write_all_buf() and > > > almost a copy and paste of them, with the most notable differences > > > being reversed reads/writes and a couple of better-safe-than-sorry > > > asserts to keep Coverity happy. =20 > >=20 > > So, there's one thing that needs to be not quite symmetric for the > > read() version: we need to handle EOF. At present, I believe these > > will enter an infinite loop on EOF, which is not a graceful failure > > mode. >=20 > It doesn't happen in our current usage where we close the socket once > we're done, I don't see how what we do with the socket is relevant. Couldn't we hit this case if qemu unexpectedly closed the socket or died? > but sure, if we use it for something else, boom. Let me add > a rc =3D=3D 0 case (which gets EIO or EINVAL, I'm not sure yet). >=20 > Or feel free to re-post this if you have clearer ideas how to fix this > up (but only if tested). >=20 --=20 David Gibson (he or they) | I'll have my music baroque, and my code david AT gibson.dropbear.id.au | minimalist, thank you, not the other way | around. http://www.ozlabs.org/~dgibson --0FsXC1wSQw0Ge+Ry Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEO+dNsU4E3yXUXRK2zQJF27ox2GcFAmeZfmEACgkQzQJF27ox 2GckCRAAjX+InxPGb6ViAyLhHGgFWrrD1iV00NTw3G29p1pWsuWLP7Jk+CM923D9 hgEKTllReoJFanfyz2Kx76n28CJ11zF4KjNFvfO+NzxehCConcVFSwtiQU+z/fBS l7n4/iHv8G98lvi8VayLQCVV0jHbATv4W/1HUTjA22PuVTeCzAYwKK9XGmaEY3An Lg/z7mo6Noyctujws3xkRsAgACwbv8xH9KNMGtPPJAHTyKxfamslQxra0q/j8HkM qSvQ6MDO+7+wJClb1YKmPd7VeG0l3ybf6Q0OYeQn4YlYP/bN8CLjXaAuIiyCRcwY x6HSZjg4nPSn64wWpkrnzdmKsghguOYFH3xxTyguT/S9y+SvkRQI4h8FlNgoURv8 P54oYRtGRnL9ENfk/kUhHQztYUsgApuqLOwBd+/n1dAOkTTHV1NIbSFK57XfHlrP NK6gdfppzMahHhXaQFkICgr9uqUQUnDFUnEAbO7m0Iw6I1NneZ7r0fEx4IBk139T sL8yKJK3TmvwA1mMH30vp0KpDjsRvZhLqY/lhgLX7JOt3T6kKJ9FhQS3HRlCRusp u+QYuijTeeVgHgW9080b2rYdBqj8rX8SD8gRoQwVQY5q3aIQZOrL8cMraqaiZ0Kt GpEGqj4fvS+rMEaLx9jAwAMV2PP5K7UrZpzpp+P52bDwBw4eg/4= =WwEk -----END PGP SIGNATURE----- --0FsXC1wSQw0Ge+Ry--