From patchwork Fri Sep 15 09:16:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1834781 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=S8N2l1X7; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::13d; helo=mail-il1-x13d.google.com; envelope-from=swupdate+bncbcwivbv7sugrbygbscuamgqeudzoi5i@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-il1-x13d.google.com (mail-il1-x13d.google.com [IPv6:2607:f8b0:4864:20::13d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rn7pp3XWkz1ygG for ; Fri, 15 Sep 2023 19:16:18 +1000 (AEST) Received: by mail-il1-x13d.google.com with SMTP id e9e14a558f8ab-34bbbf67e03sf13598395ab.1 for ; Fri, 15 Sep 2023 02:16:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694769376; cv=pass; d=google.com; s=arc-20160816; b=zgDEWaxXZMeC6+AaueS+CRJ2xvR0h5blXeaeI5e5J0r0wGuyytrUHz8vJZHE50Nuqh fGJ293EeUcAAE2wMApRXowDQylee6Xs5yW70oDOsy4s9TzBDTX9tZ1D27lzzSeVErZO0 +5fm9XPkSrZ+PGZst7eLMezMlGBuS54gyqUuUKiE29RCzY0a/hQ/J5hlcBWy0DWAspQj vscX8wrwSxOGxTKlzoxlcR8gIPvvre6XXfxeuoPB9kDwtKYucVsWt5XtBmq+Nm06Gmfq s9lHmRtTiDMFkXX+m4TDWUsL1sjD0Uor3cU2RovD46WivQ2O8fxcGEQEhoPHn6ZgIqMS kpOg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=R3mkrJGyI8ARkgio/eCrZ9wMbafHIyYDosZlZp+ZtQE=; fh=p1uCM7+Dy57llgaJqDV8WVSDsDW3qLgXM2yWsEWRo8U=; b=XX+P6c/JP6P4tevuHF1tv6I9+3+/H5vHiNHRd6A9I2cICaIFtOJnD5eqAAH0ArPx97 WojTAEI8sw+kFD1zdvGC+a3TDlCWFWw3uiTszBZ8/zKdrZNVPAy1OWTH0oIL+tDdgXWY O61ctAxRyB4G5uoOEHcDppOak2PyVcNPzoVL8zC+f8y0ImMEpKYlM7RIHbPN56oD6+0E 3joT4HP8AhMLvbdF0Zn3r0z2SSs2eqagyr/9yNq3uxxjTPa/kaCxGyCM4lQyLdF0Jy7j hGnkxL6WRe0Olqc4r3R57GSG7f6rZxYH5XBZDrR4oqlvDzXI1vyn9D7Oa798aFN7sQU7 lDUQ== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1694769376; x=1695374176; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=R3mkrJGyI8ARkgio/eCrZ9wMbafHIyYDosZlZp+ZtQE=; b=S8N2l1X7RfSKNs65cRjiO2hUHUqhlavS/BEza+NXF3jqfWuaOIZJP+J90E6Z/H3Xyi vMQ2Fr1c6ySEQohZtx/5wwH1UdtJiI+xf6Ljuhel/ogdtR0kxz1xxBPnmPOivT3HrAgG nM/UAQT/J+bvHPugHvu5reGXJGRm6BT1CFp8YgaYdwrOSWDiaDyTp49Q1pZr3O5j5h5m Ru6rT4LfncwLWhvr0we0MZBcVzo8TFpSGbkRmseHJsx/bkcRV/oNeJNOwh6n7WbKtDYf KA3kKE9ZuKdkR52NzWet2GS0RgJiSeaAnLwjgASjXnFr/9I0maIDhTij4kwgd/DgW5I5 PVLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694769376; x=1695374176; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=R3mkrJGyI8ARkgio/eCrZ9wMbafHIyYDosZlZp+ZtQE=; b=goMzmYtIuTcV+qHv4fCMBJMOS+vefEpxHx/kZdjICwfwvR+I6FFAdTyuAHVLZ9G4hQ XIt4k0H6G6ei318BRkGxXO4QVMKShTiU5IhEYVlRzylabBdzaS4xR+giMMqGsNzTXzp1 RgraOyRy5/iuUT1YFeJ10UuBgJhwLL3liMjtoJR1DjzXI9WfvY9W+L/A7z5/XW0fjshy bzWfI6IsKwPxxsHnOAZftBDJ3+MmDpbPWWhd3X37L6bS6Cx4LUGN8MFGv5QRVO0Y8PQI iYbQ0mujTN79ngHL/4MwhvzrGZVQhP7ojIxmo6lwokw0ywitOVW+MFUBrzICsjgl1XUf 6Gig== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0Yz2FNxEfPSG+J/No6D8xfBqA9w0ia5nqp7XJgxzemt3j840xdvB gHu8hFY2LMmDNlDAu/TTlM8= X-Google-Smtp-Source: AGHT+IF7d929ihBYrWwvpUePfuVRO/Mq3l0iN01dSkLdWI+7bvX1HTkBwQWmxJu7WIpcn/vE1DmdvQ== X-Received: by 2002:a05:6e02:1314:b0:34f:4632:4e09 with SMTP id g20-20020a056e02131400b0034f46324e09mr1337578ilr.23.1694769376552; Fri, 15 Sep 2023 02:16:16 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a92:bd11:0:b0:342:2a4b:458e with SMTP id c17-20020a92bd11000000b003422a4b458els185165ile.0.-pod-prod-01-us; Fri, 15 Sep 2023 02:16:15 -0700 (PDT) X-Received: by 2002:a5e:a714:0:b0:780:d031:bc42 with SMTP id b20-20020a5ea714000000b00780d031bc42mr1088780iod.16.1694769375396; Fri, 15 Sep 2023 02:16:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694769375; cv=none; d=google.com; s=arc-20160816; b=iz+7Prhexzkds7OCjv14oGnyclCwoQksDS3mk20Rcinri08VOEoyXudlmz743bg2UZ +/S6XhXeQcmROZjPKa/U/ZRdx4/9fF54nFusSG91ZEV4pCMhuq2rfYE24Q4grzVyeewX cVIwkWk+fyLtwHtQdylyUGgQRLqp2tJn8xf6gy8wcQJ8/bmRgtlBXae6CQp/7ao04W/b 2JTkyYUZLk5ypL+ABAKu7B2vEWRWnzCTn+CnpS3YWf9SfP/8ceF+S4vCpxqhIXyTfF3N aWjj1vp2SNFpn8NaDFBi3bbp1QSRG1zbfKApLL3RIbWnmimPehm5AYbbc1kFBdWWvgml LWuA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=L3n1U6MUDHK1Ue5J42T2y0D458UIh3h+EUZNI/d4meI=; fh=p1uCM7+Dy57llgaJqDV8WVSDsDW3qLgXM2yWsEWRo8U=; b=xWCDr2COdK4fgQaGVQWB3kwmXOAK9aZuNQGAV1wtZRDryO1K58w6zw1mqIY6Zvoqcr mr77J2KFtmIzg3i66/hxSx/EpnXJgRArt0P43pPNnsmBk5Xfp7igdgU+stfu/9Dxc2O6 KM566lNPiaDoIxZ/qDim3/x9A7BogghK+ADgba8pCxcAP/sTMaF+yQ438zY3BBZ6pjc+ nHypagCxSCgDdRSJWl6A7SEUqyFfYiLKQSWTP0TdE5XoRQyaI1lx3e8nM43AW48ejyxt FDDzIZfQIzhxKoLR1US6YsBh1fibXLZSQb1rddvtfD5xEribm1xvKhLOw++i9bv76+is IfRA== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Received: from gw.atmark-techno.com (gw.atmark-techno.com. [13.115.124.170]) by gmr-mx.google.com with ESMTPS id ee20-20020a056602489400b0079186e18eb9si528255iob.3.2023.09.15.02.16.15 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 02:16:15 -0700 (PDT) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) client-ip=13.115.124.170; Received: from gw.atmark-techno.com (localhost [127.0.0.1]) by gw.atmark-techno.com (Postfix) with ESMTP id 2F304600D6 for ; Fri, 15 Sep 2023 18:16:13 +0900 (JST) Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by gw.atmark-techno.com (Postfix) with ESMTPS id DCE7F600D6 for ; Fri, 15 Sep 2023 18:16:12 +0900 (JST) Received: by mail-pj1-f71.google.com with SMTP id 98e67ed59e1d1-26f6ed09f59so1639122a91.1 for ; Fri, 15 Sep 2023 02:16:12 -0700 (PDT) X-Received: by 2002:a17:90a:e285:b0:268:7ec:51ae with SMTP id d5-20020a17090ae28500b0026807ec51aemr843693pjz.41.1694769372016; Fri, 15 Sep 2023 02:16:12 -0700 (PDT) X-Received: by 2002:a17:90a:e285:b0:268:7ec:51ae with SMTP id d5-20020a17090ae28500b0026807ec51aemr843685pjz.41.1694769371749; Fri, 15 Sep 2023 02:16:11 -0700 (PDT) Received: from pc-zest.atmarktech (162.198.187.35.bc.googleusercontent.com. [35.187.198.162]) by smtp.gmail.com with ESMTPSA id bt1-20020a17090af00100b00267b38f5e13sm2431735pjb.2.2023.09.15.02.16.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Sep 2023 02:16:11 -0700 (PDT) Received: from [::1] (helo=pc-zest.atmark.tech) by pc-zest.atmarktech with esmtp (Exim 4.96) (envelope-from ) id 1qh4vq-00DSIA-0h; Fri, 15 Sep 2023 18:16:10 +0900 From: Dominique Martinet To: swupdate@googlegroups.com Cc: Dominique Martinet , Christian Storm Subject: [swupdate] [PATCH 1/2] prepare_ipc: set client fd as CLOEXEC Date: Fri, 15 Sep 2023 18:16:07 +0900 Message-Id: <20230915091608.3207005-1-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , This fd was seen leaking in scripts. Use CLOEXEC to avoid interferences from buggy scripts. Note SOCK_CLOEXEC is not POSIX, but BSDs seem to define it: https://man.openbsd.org/socket.2 https://man.freebsd.org/cgi/man.cgi?query=socket&sektion=2 Signed-off-by: Dominique Martinet Cc: Christian Storm --- Added Christian in Ccs for BSD sanity check, but I think it's OK. If you want to stick to posix, happy to resend this as a patch that does fcntl on the socket after its creation to set CLOEXEC instead. ipc/network_ipc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ipc/network_ipc.c b/ipc/network_ipc.c index 6c8c03ae4617..63552c6df29a 100644 --- a/ipc/network_ipc.c +++ b/ipc/network_ipc.c @@ -43,7 +43,7 @@ static int prepare_ipc(void) { int connfd; struct sockaddr_un servaddr; - connfd = socket(AF_LOCAL, SOCK_STREAM, 0); + connfd = socket(AF_LOCAL, SOCK_STREAM | SOCK_CLOEXEC, 0); if (connfd < 0) return -1; From patchwork Fri Sep 15 09:16:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dominique Martinet X-Patchwork-Id: 1834782 X-Patchwork-Delegate: sbabic@denx.de Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20230601 header.b=SOfJt8BM; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::1038; helo=mail-pj1-x1038.google.com; envelope-from=swupdate+bncbcwivbv7sugrbzobscuamgqegagphua@googlegroups.com; receiver=patchwork.ozlabs.org) Received: from mail-pj1-x1038.google.com (mail-pj1-x1038.google.com [IPv6:2607:f8b0:4864:20::1038]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4Rn7px1LRZz1ygG for ; Fri, 15 Sep 2023 19:16:25 +1000 (AEST) Received: by mail-pj1-x1038.google.com with SMTP id 98e67ed59e1d1-27489394741sf1021609a91.1 for ; Fri, 15 Sep 2023 02:16:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1694769382; cv=pass; d=google.com; s=arc-20160816; b=xpdeuUSarqmbxEkAZH9/sVkDtPQIppPwy24NmvH4771jyqm3xlvDuDn1jXGaN54t1y WSKVnoiq0ALvus0GMcWjLz0g4WtPMREiYV89D5uMIRis/6wMhdqtOE9JpxBmygLl4yDc wIqta+0xrkasZ1OcDXxtaqd6x2w1+mr5HlOQpYtseJFiu+gMNPJvfJrY3AVgyzDb9J2u X6+I6Mzj50PeN34ItkWUn1sUvLGH53/tjZa98ddd0ZNsCxDV5+cl9HGKAg6ZpGlPKUoi DcKv50OJr9zW4j/Rw1miSHr/KZvlrV/ZaeG1GBZp26LtFuUsgM4ijSrHYrllV8J/kgNS QTFQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:sender:dkim-signature; bh=lnlfLPr3cwxtmtVvn1HoQb4y+zp0x+wQZiaTLotrFyk=; fh=2KrNXrrD5DrGMrVrl8wC5A/wjigqRI77pcwL2nJuad4=; b=XnjTWDEdJGi3osBTGN19xXgB5NGLasmHdDCAeQBt5+7I0Ys8h7011N29CFcydwomgb W+f5AQ53s3aUwB5WoUT8MSy77mReWUMnf9GYjNPGZtL/W6o8sfwr+YjcQr8K7Abn95Bd b6n8clnwCY3R1HdpIJFHiOIWkVpL4iUXLun/BATHRAEcQkCGGNMv/Q6eeXn/S8bG/dXY PimRl3k5ue3e+tZuRSICxeUfsjxong8WzZLBctqdd35A+qlfQ3NMWwhGJ2dvCuY5HS65 UoHZMpNlqTLWp+HDpReDymTcKmeJIp4p4brDI/nUppHo0TzyW0IHjj71k8xs18JmB0Sg ua9A== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20230601; t=1694769382; x=1695374182; darn=patchwork.ozlabs.org; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:sender:from:to:cc:subject:date:message-id :reply-to; bh=lnlfLPr3cwxtmtVvn1HoQb4y+zp0x+wQZiaTLotrFyk=; b=SOfJt8BMMoIOQJy8bH9LhvpR5uxaFKpZ17QTXcxcMryq9WSJ2FNHobhtEAzhf1T75p sLrmdnPIeVKfVveXmx54j6+VrklmZpS1Tip60RRe/a5Idn5PeSMWoUsFt1RKSEoru9KR 2BiOW3pv1HnfINI0yKkc3ROFaCNh7Q4ECp/+hFMIG/cxvh+YSLBMathq2y/+cVrvKocb riiHBCy3tQRzAmxAuSZHcHvVpGz989sD+LHMl9R3HC6WSj4/TFp3JeLYXodr52tknTjC 8fzJk0VVqjJKgr36NCDDxvK7IW7FUVd4JUygAAK0mxx4TTl+gPFmJJZNKhHGliO5hsOu 0+XA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694769382; x=1695374182; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:sender:from:to:cc:subject:date :message-id:reply-to; bh=lnlfLPr3cwxtmtVvn1HoQb4y+zp0x+wQZiaTLotrFyk=; b=Jdd7dFs1K7fjaee//q/tz9A6e/Ei8xCXv3h7DLXwl+5RqrreuvSqxecCRF4l2vRqX1 xLpfaT3JFRrKoa9OLIB7876k5NJHS4gO50gpC0pnzMOMEMyyI9WomMi/5tCFKCQaDliV AzqjEASmnxHKmCvSHaPGfnTBv0nnaK5MY4PQdzsTy/wPVJLToa+R3pjsIRykpA1rJHam mjEDDKXIDDYmfD36MsXECOX3H/RROXeaNiidNS+IiX2B1RYQN+HYLLpmhXvq36sXO88P wxqbLnvhVZcNfJDASGdtrdaaqefV4F52LVqce+h1TDJD5YQEf4uW2YQrmy/HK87+dNS3 bdKA== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOJu0YzkjraYivY3mbreChR0hBwqG6jGruY1zOg/hzX9KsjVQ+dLAn51 oFy4zC4lNjZXBai/pWoymtw= X-Google-Smtp-Source: AGHT+IGsdTjQLBGKyERr4Xdcv48SU+59967gvjaDmyNLhguhqrP6bV4Rk8hOxdo0WLKTsDFAVWsocA== X-Received: by 2002:a17:90a:e011:b0:274:9970:9f17 with SMTP id u17-20020a17090ae01100b0027499709f17mr840335pjy.26.1694769382566; Fri, 15 Sep 2023 02:16:22 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a17:90b:238a:b0:262:e296:d183 with SMTP id mr10-20020a17090b238a00b00262e296d183ls941837pjb.1.-pod-prod-09-us; Fri, 15 Sep 2023 02:16:21 -0700 (PDT) X-Received: by 2002:a17:902:d503:b0:1c1:e53a:c2f with SMTP id b3-20020a170902d50300b001c1e53a0c2fmr1238272plg.27.1694769381141; Fri, 15 Sep 2023 02:16:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694769381; cv=none; d=google.com; s=arc-20160816; b=vDzEk2qaIUDUREFEIdDaGUeqzC72OYzsNxXs2ewTx514e3FoyD/wuKoBaMQ6fWKNtw cJjKe9sxgQWBI7Hn3uClu3bze/qRbQQx1SzLLwoiRyrXtqVjwAS/PnwTGZkGW6sZ2HyB h/lsUzkc2FXwKIs1FxXyhT20MHLHgBKLg9ZWpCNDDQEUFMHA9dXEBmWZi/4RvpXp5277 pflnPijAFCr8RxnkK4XhhtQ1cgKDRmPBUGWLoKs37Bpfgw8cQ6qxslJ00AhGDUzE2MJ2 mZB16T02QeU3ieuzX5wuWmNMkEzp1lfqF8Si/vFGSMkLYfmgqnf3iGTSZtwQt+3siS2I F6mg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from; bh=2sp9iXgGH8Qj+XSr3Dww0OffPMHEqqxhxYRtloj2dAE=; fh=2KrNXrrD5DrGMrVrl8wC5A/wjigqRI77pcwL2nJuad4=; b=BYOzupn1SsqagIMyI7qep0nMVfx6MYpLo45dA+rxN/JkyhaJZ42rAqN+OKKQuzsq0E 7sOaiOih5dTAtoN2pAjva7hrkQkhEYU7tABGUwFB9W2KbCVQwTILTq+C9hhnbORT8f4L OJXgIyP6kpKA0RxOksaRmJMbhG/FbAZ7P7KuZoSLMDAbiNuOgAvJqdFJPcO/pCVkcxZ5 WXSnYW4lMcA3CGeUvA/Xsu/kQBLOsi5JFCP8Keho92KQ1/eF0YsrRMf74fD012p6c6q5 Tgl7F2MkRRIkW70gp1tkKjUkkoXra/j3Dt9yk/hHMs6FAOUVhagYDEg1lqHbz4axZsJa QbCw== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Received: from gw.atmark-techno.com (gw.atmark-techno.com. [13.115.124.170]) by gmr-mx.google.com with ESMTPS id kh3-20020a170903064300b001c3fdd40f56si330338plb.3.2023.09.15.02.16.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 02:16:21 -0700 (PDT) Received-SPF: pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) client-ip=13.115.124.170; Received: from gw.atmark-techno.com (localhost [127.0.0.1]) by gw.atmark-techno.com (Postfix) with ESMTP id 78C2E600CB for ; Fri, 15 Sep 2023 18:16:19 +0900 (JST) Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by gw.atmark-techno.com (Postfix) with ESMTPS id 48506600CB for ; Fri, 15 Sep 2023 18:16:19 +0900 (JST) Received: by mail-pl1-f198.google.com with SMTP id d9443c01a7336-1c3f46487fbso18124005ad.0 for ; Fri, 15 Sep 2023 02:16:19 -0700 (PDT) X-Received: by 2002:a17:902:7590:b0:1bc:844:5831 with SMTP id j16-20020a170902759000b001bc08445831mr1029374pll.57.1694769378410; Fri, 15 Sep 2023 02:16:18 -0700 (PDT) X-Received: by 2002:a17:902:7590:b0:1bc:844:5831 with SMTP id j16-20020a170902759000b001bc08445831mr1029364pll.57.1694769378093; Fri, 15 Sep 2023 02:16:18 -0700 (PDT) Received: from pc-zest.atmarktech (145.82.198.104.bc.googleusercontent.com. [104.198.82.145]) by smtp.gmail.com with ESMTPSA id ay6-20020a1709028b8600b001b896d0eb3dsm3002687plb.8.2023.09.15.02.16.17 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Fri, 15 Sep 2023 02:16:17 -0700 (PDT) Received: from [::1] (helo=pc-zest.atmark.tech) by pc-zest.atmarktech with esmtp (Exim 4.96) (envelope-from ) id 1qh4vw-00DSIA-1Y; Fri, 15 Sep 2023 18:16:16 +0900 From: Dominique Martinet To: swupdate@googlegroups.com Cc: Dominique Martinet Subject: [swupdate] [PATCH 2/2] spawn_process: use CLOEXEC for child communication fd Date: Fri, 15 Sep 2023 18:16:08 +0900 Message-Id: <20230915091608.3207005-2-dominique.martinet@atmark-techno.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230915091608.3207005-1-dominique.martinet@atmark-techno.com> References: <20230915091608.3207005-1-dominique.martinet@atmark-techno.com> MIME-Version: 1.0 X-Original-Sender: dominique.martinet@atmark-techno.com X-Original-Authentication-Results: gmr-mx.google.com; spf=pass (google.com: domain of dominique.martinet@atmark-techno.com designates 13.115.124.170 as permitted sender) smtp.mailfrom=dominique.martinet@atmark-techno.com Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: , List-Help: , List-Archive: , List-Unsubscribe: , avoid leaking sw_sockfd to child processes Signed-off-by: Dominique Martinet --- core/pctl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/pctl.c b/core/pctl.c index 2384cd3e4120..1de2903a8aa3 100644 --- a/core/pctl.c +++ b/core/pctl.c @@ -136,7 +136,7 @@ static int spawn_process(struct swupdate_task *task, /* * Create the pipe to exchange data with the child */ - if (socketpair(AF_UNIX, SOCK_STREAM, 0, sockfd) < 0) { + if (socketpair(AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0, sockfd) < 0) { ERROR("socketpair fails : %s", strerror(errno)); return -1; }