From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: passt.top; dmarc=pass (p=quarantine 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=Q02q+nj+; 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 1BB405A0262 for ; Wed, 20 May 2026 02:37:08 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1779237427; 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=SU3bda6CxfMVDMO8tAm9EVhcbYNbwFEDaqQSOdNf7aY=; b=Q02q+nj+LI/svzztbYmKxvRfzb2453fnGU7DLVrRgybIYyBgOdkyTliEKML6ZpmNWWSIAm 3CxH0eHR7dM+NrMOkt+x8R/8G0aaiDK6G3XGsoeWsbK59N2iOzpPQib/BQOPFbqanWBYmE Pz7ZPom/UBeAMIRmjh8PKZ4WlhKWREY= 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-134-rMN-ylm3PPeQoEWMNbNpYQ-1; Tue, 19 May 2026 20:37:05 -0400 X-MC-Unique: rMN-ylm3PPeQoEWMNbNpYQ-1 X-Mimecast-MFC-AGG-ID: rMN-ylm3PPeQoEWMNbNpYQ_1779237424 Received: by mail-wm1-f70.google.com with SMTP id 5b1f17b1804b1-48fd61d252cso32341895e9.1 for ; Tue, 19 May 2026 17:37:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1779237424; x=1779842224; h=date:content-transfer-encoding:mime-version:organization:references :in-reply-to:message-id:subject:cc:to:from:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=SU3bda6CxfMVDMO8tAm9EVhcbYNbwFEDaqQSOdNf7aY=; b=Z1Q6KGpvlvguPTYry+2b8pdcEUY48o4RDS7aG3eXKoAGmD5VihSKMfBHA4FR/JbTjv Th8wwAvNE3KptjPNCOCvecN7RVxxbAvyfR40iwUddt2RP4E1M/EZSP6kafEIKNG++NrX h76GOpg6O/lTwBGwgEH7HJ7+G/16SyVRnt4yg9t3wvYvuDlbOXXCNnRRnPe/6KSHhNaY aROWSCDw7+fGMEUMj+ymSy4Hxm6xsx0yrGUznn1O6YfYxd1ZA4PRTCdrkpPkrktk8CmE iTGLHoqyymbKbpptTcFEjLrhJ6Gqf/FYkG7/ZsBGcJlk/69IcdybfvjPeyB+dzmimISY cndA== X-Gm-Message-State: AOJu0YxLSq3C9X3lRs40BCY/ETgMc+yZrOapdPCrzKNUzXKpacymterK 0Q5Jcz4FS2MW6mdW+dhAwmdFxT0CvRoRMW+knXNTW9E2JcFyxzHdbyV/NgkBq5N3cG3KD9LY1iZ mQytfx28XrvrbVBm7nKxs+E+fjQlSrQko/aQqEHxCm97XM5WyHlhMdw== X-Gm-Gg: Acq92OGcSoqfR3JneE1byChaHxUV7BUNRNH1+Z6odSews7fgopZ7K+KCR7y5c5qz9ED Uzm5bnyHY153GPYvub2SJsSqYwGBNhMP88u9ifpm3KXfOJc6XC8pKylcuaCFAn6jK5UaXWIN0/E 1vMhzySVBfrFh8fliKxY8K+LqmxH7bh26rOU/yZg4pdKlqNwO4VeuM5adSIqWDP0OM/zYnvuN17 wdwb9RQGJljMZlS9nGJ33+S7Wh6OuJOW7z1l15G2Bmijp8Tq3nmayuNxWl2LaY6D736GOs3dyyh LMi9a43UepTv6P/HGkFBd+xoZY9aFRfxG7H1Ef8P4UUx1CdkZtg8g2Tm1Y3Z9eiTSY/PGhAoZH0 8qnkkaHlGH9994pfjfNgjs/tn1LqDoN5z X-Received: by 2002:a05:600c:858d:b0:488:f453:b976 with SMTP id 5b1f17b1804b1-48fe651c8b1mr229028375e9.27.1779237424238; Tue, 19 May 2026 17:37:04 -0700 (PDT) X-Received: by 2002:a05:600c:858d:b0:488:f453:b976 with SMTP id 5b1f17b1804b1-48fe651c8b1mr229028225e9.27.1779237423721; Tue, 19 May 2026 17:37:03 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-45e6a135f0csm30693527f8f.27.2026.05.19.17.37.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 19 May 2026 17:37:02 -0700 (PDT) From: Stefano Brivio To: David Gibson Subject: Re: [PATCH 1/3] treewide: Add SOCK_CLOEXEC to accept() calls that are missing it Message-ID: <20260520023701.42418996@elisabeth> In-Reply-To: References: <20260513041423.2446716-1-david@gibson.dropbear.id.au> <20260513041423.2446716-2-david@gibson.dropbear.id.au> <20260516174610.3ee899b5@elisabeth> Organization: Red Hat X-Mailer: Claws Mail 4.2.0 (GTK 3.24.49; x86_64-pc-linux-gnu) MIME-Version: 1.0 Date: Wed, 20 May 2026 02:37:02 +0200 (CEST) X-Mimecast-Spam-Score: 0 X-Mimecast-MFC-PROC-ID: fX0qie04QiDFegTtujJfGbfgPC2GKEs1xhDgRPummPw_1779237424 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: JWHRY5U73TMZRX3BVP5AFQRBXF5KFEXF X-Message-ID-Hash: JWHRY5U73TMZRX3BVP5AFQRBXF5KFEXF 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 Mon, 18 May 2026 12:28:57 +1000 David Gibson wrote: > On Sat, May 16, 2026 at 05:46:11PM +0200, Stefano Brivio wrote: > > On Wed, 13 May 2026 14:14:21 +1000 > > David Gibson wrote: > > > > > Generally we try to set the O_CLOEXEC flag on every fd we create. This > > > seems to be generally accepted security best practice these days, and we > > > never fork(), so certainly have no need to pass fds to children. > > > > But we do clone() with CLONE_FILES (even though when we clone() to call > > execvp() later, we don't set CLONE_FILES), so, even though I don't see > > a reason to skip O_CLOEXEC for c->fd_tap, this conclusion shouldn't be > > automatic from the fact we don't fork(). > > So, I did think about that when wrote it, but went for the short > version rather than saying clone() with CLONE_FILES doesn't count. > > Now, I realised that we've both fallen for the trap again, forgetting > that this has nothing to do with fork() or clone() and is, as it says > right there in the name, about exec(). No, wait, I didn't fall for it, not this time. :) That's why I was mentioning that when we call clone() and execvp() later (which would be the only path that matters), we don't set CLONE_FILES anyway. -- Stefano