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=WX8TWEQz; 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 ESMTP id 946F45A004E for ; Mon, 28 Oct 2024 10:04:40 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1730106279; 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=75glvsGzavw7rzyxRLmiOo8GEo+/KuLMbpUk+2mmWwM=; b=WX8TWEQzipCZHQduTuWRxkW0ZKYMVmjRk0OLMGLD7/VlOPuHbWkr7VDBKVndM2nWBP6eDs 7urR4htbNbk65EzrF+2DQqaIvripK6U5hy9h/DJnMrMd2BuQHXD1YjR/vrXiye+XO1p+UW xTU0+VM6scG3fVN3ks2br6DJUrYqhcY= Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-592-w_1EVEVDO4SRIpGGcNohbA-1; Mon, 28 Oct 2024 05:04:37 -0400 X-MC-Unique: w_1EVEVDO4SRIpGGcNohbA-1 Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-4314c6ca114so30522745e9.1 for ; Mon, 28 Oct 2024 02:04:37 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730106276; x=1730711076; 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=75glvsGzavw7rzyxRLmiOo8GEo+/KuLMbpUk+2mmWwM=; b=j2vklMoGDvsqGT+SKFKIGHR25XH2I5rE3sZ2ewQCscXdbCOEdW44QinU8x5ub43eQN EM7osorHmfBTaVAnBQafHUcQydj3wQ8cDoayCJGM7cr2FYXXRD4zM1aJ0SDIm5IcVfKm 7LAxiqx8m8J1qZBzVwEyE3iOc17IrsVHgR/hVfUmvp5iV6moKAhbQq936TCf+RzJvnuP dYD3sH3pTsRAsyFb7KyVLcO09sRkyCZdY5ngPJWujZPRTo9uWnWn7sLow4LksDzJLglP kPE9O8K7kwCbAI8+YKNzk/FBRg3MVSWuMsptRprqij5Gu+3Uo7AzAH0Ubm+e+Sq7/k8q M/gA== X-Gm-Message-State: AOJu0YzGlgY3i5QBLbT0DRF2PPhxwttdbKpbg/oW2XJEPw79V0fUXn4i v6PER4NjrXuJ427dS2jAzaNCl/sD7E/wIHZDcyAeZ2euLb+0p67jANvN4kU+Ls67+xXN10yRW2O YQ/eS6bLSBKt2BmTaTVFQ5iiT7flguypj/IxpMi2f7LOS9l2Kul7IY6bpwQ== X-Received: by 2002:a05:600c:46c8:b0:431:4f5e:1f61 with SMTP id 5b1f17b1804b1-4319acb01ccmr68277735e9.14.1730106275733; Mon, 28 Oct 2024 02:04:35 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEybOnLNPeBCzydvUeA+v8+fW4IIZZCkUi0TXFSyP9vX6v8+A6aREOodcNVaXVST+4fAKQdEA== X-Received: by 2002:a05:600c:46c8:b0:431:4f5e:1f61 with SMTP id 5b1f17b1804b1-4319acb01ccmr68277515e9.14.1730106275289; Mon, 28 Oct 2024 02:04:35 -0700 (PDT) Received: from maya.myfinge.rs (ifcgrfdd.trafficplex.cloud. [2a10:fc81:a806:d6a9::1]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4318b579968sm133156265e9.39.2024.10.28.02.04.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 02:04:34 -0700 (PDT) Date: Mon, 28 Oct 2024 10:04:32 +0100 From: Stefano Brivio To: David Gibson Subject: Re: [PATCH v2 5/8] treewide: Suppress clang-tidy warning if we already use O_CLOEXEC or if we can't Message-ID: <20241028100432.3647aed3@elisabeth> In-Reply-To: References: <20241025120814.3449347-1-sbrivio@redhat.com> <20241025120814.3449347-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-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Message-ID-Hash: FWIOGBLZNX2PRVR5YATBZIFC4DHZITW2 X-Message-ID-Hash: FWIOGBLZNX2PRVR5YATBZIFC4DHZITW2 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, 28 Oct 2024 12:00:53 +1100 David Gibson wrote: > On Fri, Oct 25, 2024 at 02:08:11PM +0200, Stefano Brivio wrote: > > In pcap_init(), we open the packet capture file with O_CLOEXEC only > > when possible. > > > > In logfile_init() and pidfile_open(), the fact that we pass a third > > 'mode' argument to open() seems to confuse the android-cloexec-open > > checker in LLVM versions from 16 to 19 (at least). > > > > The checker is suggesting to add O_CLOEXEC to 'mode', and not in > > 'flags', where we already have it. > > > > Signed-off-by: Stefano Brivio > > --- > > log.c | 4 ++++ > > pcap.c | 1 + > > util.c | 4 ++++ > > 3 files changed, 9 insertions(+) > > > > diff --git a/log.c b/log.c > > index 6932885..154466f 100644 > > --- a/log.c > > +++ b/log.c > > @@ -416,7 +416,11 @@ void logfile_init(const char *name, const char *path, size_t size) > > if (readlink("/proc/self/exe", exe, PATH_MAX - 1) < 0) > > die_perror("Failed to read own /proc/self/exe link"); > > > > + /* We use O_CLOEXEC here, but clang-tidy as of LLVM 16 to 19 looks for > > + * it in the 'mode' argument if we have one, so... > > + */ > > log_file = open(path, O_CREAT | O_TRUNC | O_APPEND | O_RDWR | O_CLOEXEC, > > + /* NOLINTNEXTLINE(android-cloexec-open) */ > > S_IRUSR | S_IWUSR); > > if (log_file == -1) > > die_perror("Couldn't open log file %s", path); > > diff --git a/pcap.c b/pcap.c > > index 6ee6cdf..6753cfb 100644 > > --- a/pcap.c > > +++ b/pcap.c > > @@ -167,6 +167,7 @@ void pcap_init(struct ctx *c) > > return; > > > > flags |= c->foreground ? O_CLOEXEC : 0; > > + /* NOLINTNEXTLINE(android-cloexec-open): ...only where possible */ > > Hmm... why do we need the conditional on c->foreground? It's > close-on-exec(), not close-on-fork() or close-on-daemonize(). Oops, see also 20220823063151.854034-4-david@gibson.dropbear.id.au, I never learn. Fixing. -- Stefano