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=d6jIIim8; dkim-atps=neutral Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by passt.top (Postfix) with ESMTPS id 325215A061C for ; Tue, 28 Jan 2025 07:48:58 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738046937; 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=9PlXc0v6Kwrj71I1SLCxELHERyyWIZHP9nS88k26sTo=; b=d6jIIim8apbApNrLSyU+YBQCl8VbOiTjmUzzETOUvZTzfIf/OQDTGhjnLzSKR2TOdFguFw Cc65OgUPOCWCynls5A5Z9Dyr5VoJIK5Ypzx7/CA7ejT11HK/Ej+6CQd+MQ5Z8DRK0QHWNK sZ9t8Rg9KtJERpQV6Igee2almtCt/cY= Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com [209.85.128.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-27-BZaTLYWNOSSvdMu_X1wD-Q-1; Tue, 28 Jan 2025 01:48:54 -0500 X-MC-Unique: BZaTLYWNOSSvdMu_X1wD-Q-1 X-Mimecast-MFC-AGG-ID: BZaTLYWNOSSvdMu_X1wD-Q Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-436219070b4so24331975e9.1 for ; Mon, 27 Jan 2025 22:48:54 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738046932; x=1738651732; 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=9PlXc0v6Kwrj71I1SLCxELHERyyWIZHP9nS88k26sTo=; b=G83dRuwcu6FIMguP5RTbpj4GuEVZvzKuqUgunyOY5G4Ck6yyeLlsgDrvZ93XPrRdf5 j3AhKDrC/PutVCdnkV/Iah0ppYPutGx9XCoqtBGGglmziCpICLnPZQq1VqnHtVsTnyP/ /XXAVBb/gv8rhga5Xn8mNMLkAlcnjWDZMf60TjW3Y5CZlM1vYi2R2OglsDRp7/8J/eYJ jX2pqwTcfhdWgZULV6qb4ZIFyQF3bvsrN5lq9EdVXpPIxoODpQ9Y5kNQeqfbT7tCUK7k XHEDz1aybxMBCmMf8xpTbYOjm3/PXSZJk6Tq7Jf0PGLlXxPSea+th/WMQQ/RxFVXIxtQ SH0A== X-Gm-Message-State: AOJu0YxueEo3YhCWW9xzqdXV3cBnZJCLvSgKoiEVwdnxxQToZs7MKbIL VqPnJ4x/gROxmkyT7ZHVLuAGu/L7pFGIxhSUWiBaWaZmABURWQmtzBLfI+iX8E+imen0zLDC6ki OXSIvnkZq/b81SKa0zKA7lclX05eKWEHO06dSNIE/SlZCRf9b2n5zIWD8KA== X-Gm-Gg: ASbGncv0jOb85mNJFIHLqZV1aunCdBadihWMcY6M+mslL2UTM/FPgj1vvg8ycTdqw9w 14nfDzKvydC+GumnAq1Lw2G19Vok7EpRrlzhwjyuNHVMdkoSvv8Z0aMRVxIwzDORO5L1HbEkzOq yVU6lWMAHLihVSW2+7VNDzMP+7dPmj9Qmj+4xDvGLqx2ztsO+aTn61P4T/+gUNiBVQNiVZCJMtR pu0CQ75UjAxT6EmDp3uENzfGnM93N0aGj3TxK3Uczqg0WpG6iT8MWOgTXhJTDQHPSidYj6SlO+F x/J30Vk4Ftg586bV X-Received: by 2002:a05:600c:a03:b0:434:f7e3:bfbd with SMTP id 5b1f17b1804b1-4389142e8b5mr381180605e9.23.1738046932220; Mon, 27 Jan 2025 22:48:52 -0800 (PST) X-Google-Smtp-Source: AGHT+IFcrbIgwny/xylMepM9Bf8T2iTM0lqTFRRhwanGkqVxzwg3TKS7fbrLNP37IF6sY/QR8qwTaw== X-Received: by 2002:a05:600c:a03:b0:434:f7e3:bfbd with SMTP id 5b1f17b1804b1-4389142e8b5mr381180505e9.23.1738046931883; Mon, 27 Jan 2025 22:48:51 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438bd4d34e3sm157902755e9.39.2025.01.27.22.48.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Jan 2025 22:48:51 -0800 (PST) Date: Tue, 28 Jan 2025 07:48:49 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 5/7] util: Add read_remainder() and read_all_buf() Message-ID: <20250128074849.0e83099c@elisabeth> In-Reply-To: References: <20250127231532.672363-1-sbrivio@redhat.com> <20250127231532.672363-6-sbrivio@redhat.com> 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: FbPD7sjZryu1d6-Rx0SITZ1cfawqLlfGONg49OKmdKk_1738046934 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: Y3FEYOGGFUOPZHXDV2MMTRRVYG7S2FNQ X-Message-ID-Hash: Y3FEYOGGFUOPZHXDV2MMTRRVYG7S2FNQ 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 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, 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). -- Stefano