On Wed, 29 Jan 2025 12:03:30 +1100 David Gibson <david(a)gibson.dropbear.id.au> wrote:On Tue, Jan 28, 2025 at 07:48:49AM +0100, Stefano Brivio wrote:Yes, sure. I just mentioned that it's not the intended usage, and rather an error case we need to handle. -- StefanoOn Tue, 28 Jan 2025 11:59:28 +1100 David Gibson <david(a)gibson.dropbear.id.au> wrote: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?On Tue, Jan 28, 2025 at 12:15:30AM +0100, Stefano Brivio wrote:It doesn't happen in our current usage where we close the socket once we're done,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.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.