On Tue, Jan 28, 2025 at 07:48:49AM +0100, Stefano Brivio wrote:On 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.but sure, if we use it for something else, boom. Let me add a rc == 0 case (which gets EIO or EINVAL, I'm not sure yet). Or feel free to re-post this if you have clearer ideas how to fix this up (but only if tested).-- 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