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=GD2UdbXu; 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 30D355A0275 for ; Fri, 07 Feb 2025 10:42:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1738921368; 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=ccIIvBw6ry4vM0WEoz7ta1REPtdK2PCVwokFxOy+qzw=; b=GD2UdbXuIzx9CacEkAdBqGw7QLt/OhzKy+xR9KgIjdGCmOwVMd7sNbWGGBdJRmd+DkwQ2j tO77h5rQxQMv23FzhTJWWLrdy+eegZEMZwZOCC7s5l+lRjdw0a9yR427ojzlRqdVjt4bS2 lXlf+Ztl3VWm8/QZJCrCtAJxx1Bdm+E= 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-306-za6CTb3vMMO9VLzjyKU91w-1; Fri, 07 Feb 2025 04:42:47 -0500 X-MC-Unique: za6CTb3vMMO9VLzjyKU91w-1 X-Mimecast-MFC-AGG-ID: za6CTb3vMMO9VLzjyKU91w Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-438e180821aso11088105e9.1 for ; Fri, 07 Feb 2025 01:42:46 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738921365; x=1739526165; 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=ccIIvBw6ry4vM0WEoz7ta1REPtdK2PCVwokFxOy+qzw=; b=gz8uprk+DYmET9xfp+QrmSnHJWhzasZ8/86SDlYE0AVmeioBBdv10Q6UG+DWxDbJey 4nzzCv8wEdlL8m9QXyNsUvznbPo3DKq6T3e6xv7qjgTCdrip3aBYNsSl2S9/CmMlXXiN Vef1cwomTYFJaPc3gf5u6peEg1XDVM/FkdyeDPtg10K4k99+9H+rT17xHM9tlLiOcUpQ SNVvP1+bR6Hz3Tw94qjo3JqTtEI4NNgUimyjr7vBy40e6/5ptqf9l54ropjGPCrDdx5l 2Qu6WHIrOGZ/P7Xac3Sp/LpWm2rylMoDymugeEonpEzMa9QFjwIEc8I8a3XEP3DD/FKm kksA== X-Gm-Message-State: AOJu0YxENfVlhyjw7FOWz7NmmKK3CvVmDtK+YSDDuwWi2X61pIAMb5b3 K2EvIXJvDo/N9UikeGJ6pMsVqzHpzoSpaugGF/gRU4a47IbxR+aLAgqHyP+2SBTQ7gm0AiQyOQH vezbVPX6hNacSQ8lIZ135qpB4Fvf9qoh6IX25d4mSMerzyDRjAMaBVJmt/w== X-Gm-Gg: ASbGncuM3l1e0vuwFrC8KGjSClXGrKkJDY6LnCZl5If760og1v9v9LrZ5bY6vjlNASu EQgrY4e+M6PRgc6diruCJt9ivOY/zt65Sm2C5npIQ3niDULgNyLnNB5ELchcAQlzhRhu5mByVcV edp7nniyCz1zPeGkzRfBPfYo50t9yjm6YxRK6SPw6bdeGc3ohs2SCz1tb/Hqw1HMR3eNnlrUCYe g3ouf9RO1kivUgw6kyH8vs+cRMeXivH9wnAzLF3kcJqx1WjH7rYSvk4mIk3Q44OM+FvQCgEd+DX TtKm1GNuULmGPHSA X-Received: by 2002:a05:600c:4f91:b0:434:feb1:adae with SMTP id 5b1f17b1804b1-4392497feafmr21798075e9.3.1738921365057; Fri, 07 Feb 2025 01:42:45 -0800 (PST) X-Google-Smtp-Source: AGHT+IHN3VzJRrwgeCj3o5Mf8ntNi7LIxv6P8hIUDxE9R4CQSn6ywRLr2MSpWT+H8j+ah0qVroElyw== X-Received: by 2002:a05:600c:4f91:b0:434:feb1:adae with SMTP id 5b1f17b1804b1-4392497feafmr21797885e9.3.1738921364521; Fri, 07 Feb 2025 01:42:44 -0800 (PST) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38dc17e278bsm3288401f8f.48.2025.02.07.01.42.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 07 Feb 2025 01:42:43 -0800 (PST) Date: Fri, 7 Feb 2025 10:42:38 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH] passt-repair: Don't use perror(), accept ECONNRESET as termination Message-ID: <20250207104238.2e8db279@elisabeth> In-Reply-To: References: <20250207005439.3117473-1-sbrivio@redhat.com> <20250207022923.74b29ed5@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: M7wNVziK5l-Rr_2f2O5Xd2sbqd6RmErfktmmPTre4p4_1738921366 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: ZO73A7T22NDAMG5PJ32E5AWGOAHUWBXG X-Message-ID-Hash: ZO73A7T22NDAMG5PJ32E5AWGOAHUWBXG 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 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 Fri, 7 Feb 2025 13:38:10 +1100 David Gibson wrote: > On Fri, Feb 07, 2025 at 02:29:23AM +0100, Stefano Brivio wrote: > > On Fri, 7 Feb 2025 12:15:35 +1100 > > David Gibson wrote: > > > > > On Fri, Feb 07, 2025 at 01:54:39AM +0100, Stefano Brivio wrote: > > > > If we use glibc's perror(), we need to allow dup() and fcntl() in our > > > > seccomp profiles, which are a bit too much for this simple helper. On > > > > top of that, we would probably need a wrapper to avoid allocation for > > > > translated messages. > > > > > > > > While at it: ECONNRESET is just a close() from passt, treat it like > > > > EOF. > > > > > > > > Signed-off-by: Stefano Brivio > > > > > > Reviewed-by: David Gibson > > > > > > > --- > > > > passt-repair.c | 10 +++++++--- > > > > 1 file changed, 7 insertions(+), 3 deletions(-) > > > > > > > > diff --git a/passt-repair.c b/passt-repair.c > > > > index 3c3247b..d137a18 100644 > > > > --- a/passt-repair.c > > > > +++ b/passt-repair.c > > > > @@ -95,7 +95,7 @@ int main(int argc, char **argv) > > > > } > > > > > > > > if ((s = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { > > > > - perror("Failed to create AF_UNIX socket"); > > > > + fprintf(stderr, "Failed to create AF_UNIX socket: > > > > %i\n", errno); > > > > > > We could use strerror_() here, couldn't we? > > > > We would need to link that, which is quite some code (the whole > > strerrordesc_np())... I mean, this runs privileged. > > Hrm, is the non-locale one really that much code though? Shouldn't it > be about 5 lines of code and a table of strings? But then.. glibc is > really good at making things complicated. Right, and the "table of strings" is probably not great to have here. But the lines of code I was referring to are the weak aliasing trick (musl doesn't have strerrordesc_np(), which is not POSIX). I could include util.h, but that means including even more code... Really, I think numbers fit error messages printed by a privileged component pretty well. -- Stefano