From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: passt.top; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=PXG4cBsd; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by passt.top (Postfix) with ESMTPS id 0DB695A0275 for ; Wed, 29 Jan 2025 08:33:53 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738136033; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=gJVV7/GFB8+p1g/4fEzk7enNmQeLwHhBP0dXI4ui8Eo=; b=PXG4cBsd0WFu7ZTOrU3unjPLHGIemT7R+OpQsoXr07PNvlq4+SmQR1eT6OPvz/Udt523vn KGX7czYTDzPKx59vGaOGu/XxRynQWLK0suJ1armLVtEpKbb/EXmBlWnLBLXR5qb57ZhRXg O4Z25wZw1dnl90BCpTfIIITTRIb9Eqk= Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-224-tyxE6A7AN1OliIwi77BwfA-1; Wed, 29 Jan 2025 02:33:51 -0500 X-MC-Unique: tyxE6A7AN1OliIwi77BwfA-1 X-Mimecast-MFC-AGG-ID: tyxE6A7AN1OliIwi77BwfA Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-38a684a0971so2925961f8f.2 for ; Tue, 28 Jan 2025 23:33:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738136030; x=1738740830; h=content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:date:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=gJVV7/GFB8+p1g/4fEzk7enNmQeLwHhBP0dXI4ui8Eo=; b=b+llKdRb/zqeZ/1Hvgbima5piuW/VEZ45CNdByzxaWnJxjV/7/JYxuSEsuCi44AfbQ TjaEEFsgAtajMRNeJZphrc9YFEiVSulY8XqK/MOusrVaY18QVZS11nq3ma+8iJH1KNx5 JVO99j+WWNgs64RrFBexL6j8L8OwA1TbK6jt3yheOZ5crPnezBmQPtFeL4s9lPpUUr65 wPCZ/MVlGEfXJCkN072Up/5fxxd4SHClGye+VpOizlHXvbIbDZCrQKUpz8faatB4EWqR nVTyPOrU6NSQFQ+aVk3EaDwxtkvQ3fV2z3e2wsYtXSMERy3ba1S70eMxKtyFLTQvFc6C zdew== X-Gm-Message-State: AOJu0Yz+BJJrPK7wyqhXPhqIN7Nymppxkx1A6kjZVqyQcqixYlwmYrna z2tbc4j85BvwcZvOVBUmIHWgT9Fz/5tSKOPDmkIAcPqsWxNdKYbE0OcCAp6Ce5zMpGEYmGqfIEZ suG0Iq8MSlBGEEEdyTj9IC1B3ZiStszXqEFZohw5Q4xCn6dxW6g== X-Gm-Gg: ASbGncu+NsUJOTBpTzZwLWFbVxH5Ag8jmVT4Hv5lrGf2hntMGplwO6E0gUwPLu3SoQ2 PWw5fmBGS1a433e28gOwV7vw18xT6mJCl6z6CO7Kq5FD9t9qHbHI4e010LytfIADyfFDJ+VBOKF u7Q2CG+emfBrv9lJWU0/66atYLuWleh+gyb36xSNPMVKoB4c409Jj6SBe7We9TCU+ed1XxTbW1Y KIdhCxNl0YtQFG4kpmw/MhDJCIqccrltdR/JVnFrW6vPbeJwoH7WNI8Oxhuh5BQ3VWC0pILcCzQ 8EcGzwXr/0luhYqy X-Received: by 2002:a5d:5f50:0:b0:38a:4184:151a with SMTP id ffacd0b85a97d-38c520938d4mr1536192f8f.37.1738136029967; Tue, 28 Jan 2025 23:33:49 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaA8UQSYnX44Knwygkqog1xPlkxcN1fDce/+xPIU+0rWRr/r538bbiYOv+1aBnT/Ger/FdKQ== X-Received: by 2002:a5d:5f50:0:b0:38a:4184:151a with SMTP id ffacd0b85a97d-38c520938d4mr1536172f8f.37.1738136029632; Tue, 28 Jan 2025 23:33:49 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c2a18867esm15878871f8f.43.2025.01.28.23.33.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Jan 2025 23:33:48 -0800 (PST) Date: Wed, 29 Jan 2025 08:33:47 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 5/7] util: Add read_remainder() and read_all_buf() Message-ID: <20250129083347.2f6a23af@elisabeth> In-Reply-To: References: <20250127231532.672363-1-sbrivio@redhat.com> <20250127231532.672363-6-sbrivio@redhat.com> <20250128074849.0e83099c@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.41; x86_64-pc-linux-gnu) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: BzzLvLy5VeOOe86I4nPNeR1ZU04Te_GPDTZFmRNXa3E_1738136030 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: 55DWWZIE2S3JOWMZEPUDZX44AGOXZ2RV X-Message-ID-Hash: 55DWWZIE2S3JOWMZEPUDZX44AGOXZ2RV X-MailFrom: sbrivio@redhat.com 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: On Wed, 29 Jan 2025 12:03:30 +1100 David Gibson wrote: > 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: > > > > > 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. > > > > > > 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. > > > > 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? Yes, sure. I just mentioned that it's not the intended usage, and rather an error case we need to handle. -- Stefano