Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp742570rdh; Wed, 14 Feb 2024 09:59:07 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXJH/qQ9hRSRUiePVprHU7AnLlpuZfGlQayn5UUhnskstmEWpp1cqJqRbtmaJJluoj7DExvrtY3tEOKn13wyc45FvYuM13BcL9UIkOoIw== X-Google-Smtp-Source: AGHT+IEvd8Yuo+KoxJYERUec7GQfprVa/fXBKVKEuBwTxbp3EHTF5MGw+c28dYWJ8apTz7Uyv04H X-Received: by 2002:a1f:df01:0:b0:4c0:21c4:3a9b with SMTP id w1-20020a1fdf01000000b004c021c43a9bmr3290890vkg.15.1707933547231; Wed, 14 Feb 2024 09:59:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707933547; cv=pass; d=google.com; s=arc-20160816; b=uojfojLvKRXqQMn5jfzJCsoZdKSftQUpFlzI4GMhC9JxQ7f71KF1nnKOy4NVI6kM6t +vGSMk5z2TFxVgfeVDJ2bMKx9ckYkDfjc40x5tEB299FFQZuBKL1RboV6GAYgy4vAahe kBj6cQRnd6AiK15IEzprBhBwNWkl9r5fwxyENl9YHhVw2HDHwkseqIRCwB3VDtTLeY8d JK5FNa3as5867AooKxj3y92UQS/VBy+D0WH4zzr1wJLRq4vh80flXt69Q9B00oaVQlAd tCO2xJhn1M0WqcqP6dhzz7FvreJ4Hr9ttsdLptxUN6Jug/7bzmKohC07DbztEw8WV7ij 1XIg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date:dkim-signature; bh=QeVoRP0IbpurjG7gS4VE/L43GNfNUTlOq+29WpW/Zzo=; fh=kW/JQn/CbHQBBr9ycZif228KZsB7MiqnNsyZ466Y6pg=; b=NLJ2el5IjxxffmKg2F5wLU2mZ4wZtzO1ePPg1HwEtFKg2yQsG2nAxGY9fRfX4CCUik So6jPfqptzryoREKMizuSniEkuXhcyyjoSw+OssIm2zSzM4mcAHf//nBgWqvRAsVMFUr /ZiclopUme3+HUVF6T11S96pFPpCUtUHrf1Cdv270OUOlvBWyQYaGC6igyddxhxBIQL0 ZlYuv3/3pXtkKgvBP/hWZwxgFAFeVBsOTfvENUFSxBEqDiyEckK8AzmmHGBfsPMZ7THp VoR8wFbHGg/7T+FlOmjl894LCeE/rQG7JeWYXVXezCzZnvjhTNcuHWiT0yz/BcHp2ZWf DsPA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R0PzHOM2; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-65737-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com X-Forwarded-Encrypted: i=2; AJvYcCX12UX8k+h7cvvj0+8i9rMkOcP7h25yvRB1ySP/58cxUCmnbZ3ZH2ZrEdicDdKfUR6OB6NP6s6tJ4eRyLJpKxfOJ2HXMqCIeAT8g9rSBA== Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id eq10-20020ad4596a000000b0068ce3d1a3b0si5820964qvb.259.2024.02.14.09.59.07 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 09:59:07 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65737-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=R0PzHOM2; arc=pass (i=1 spf=pass spfdomain=redhat.com dkim=pass dkdomain=redhat.com dmarc=pass fromdomain=redhat.com); spf=pass (google.com: domain of linux-kernel+bounces-65737-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65737-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 885311C2928E for ; Wed, 14 Feb 2024 17:58:05 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 991051292CC; Wed, 14 Feb 2024 17:57:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="R0PzHOM2" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2EBFD128839 for ; Wed, 14 Feb 2024 17:57:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.129.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707933448; cv=none; b=bZzgqch5+1db/7gQvvWUGz9P/X+pb2uEg+sKOYRBC9Ex/eYAs/gU0fMfgx+1SZIXdI7cGa65N8lPlm2P77p06Vz22hBqBWkLjvAjcU3aAH1l9YhGMvsG6pT2y/CzDKRCN4k+Hy5f9p9Drhrn204TnJlh3jRgP7umRMm3rEznRVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707933448; c=relaxed/simple; bh=C/07i7uhraJ/iCdkIrk3+g0sJu4LRkL1MeEwKjt2QEo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=HYjAIk06EGGzErYGIHtscplBVdE9xPmqFTmEwTV+QYgTvqtiZa8GldvX6Tv/NRs3rshvvnCW0jl95GOy6rEIjQKzROAS2AHPxPXSfb54x0fnZmP38GhsBr9zssBIhp1nMTZNavHWzjd5vWZ7FSdDPTKJF3rqZXZsGOHv2aMLqY0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com; spf=pass smtp.mailfrom=redhat.com; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=R0PzHOM2; arc=none smtp.client-ip=170.10.129.124 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1707933446; 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: in-reply-to:in-reply-to:references:references; bh=QeVoRP0IbpurjG7gS4VE/L43GNfNUTlOq+29WpW/Zzo=; b=R0PzHOM2rZNcS4XQYtUAErNaZWbLxknc+fHoDsVWtcoQ/Gxjw4uUwga4tzUDcahGdtE8V9 190nO9EAjUmXiIB9Gww++R39oIHA+d1Ovh75FOV1r/KDUPhGpv25wGI7XZ9O0O+NtdXqLc Wds0UwIDIVKDocDHEG42z+Q0iyotBk0= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-157-_FqYJNzxP3iqxzNw-5dL_w-1; Wed, 14 Feb 2024 12:57:18 -0500 X-MC-Unique: _FqYJNzxP3iqxzNw-5dL_w-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 531DB185A785; Wed, 14 Feb 2024 17:57:17 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.126]) by smtp.corp.redhat.com (Postfix) with SMTP id E186D2166B4F; Wed, 14 Feb 2024 17:57:12 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 14 Feb 2024 18:56:00 +0100 (CET) Date: Wed, 14 Feb 2024 18:55:55 +0100 From: Oleg Nesterov To: Tycho Andersen Cc: coverity-bot , Christian Brauner , Nicholas Piggin , Sebastian Andrzej Siewior , Peng Zhang , Ard Biesheuvel , Luis Chamberlain , Heiko Carstens , Andrew Morton , Suren Baghdasaryan , Thomas Gleixner , Mateusz Guzik , Dmitry Vyukov , Tycho Andersen , Mike Christie , "Paul E. McKenney" , linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-next@vger.kernel.org, linux-hardening@vger.kernel.org Subject: Re: Coverity: __do_sys_pidfd_send_signal(): UNINIT Message-ID: <20240214175555.GC16265@redhat.com> References: <202402131559.B76A34B@keescook> <20240214090332.GA14017@redhat.com> <20240214090640.GB14017@redhat.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 Hi Tycho, let me repeat just in case, I am fine either way, whatever you and Christian prefer. In particular, I agree in advance if you decide to not change the current code, it is correct even if it can fool the tools. That said, On 02/14, Tycho Andersen wrote: > > On Wed, Feb 14, 2024 at 10:06:41AM +0100, Oleg Nesterov wrote: > > > > - /* Ensure that only a single signal scope determining flag is set. */ > > - if (hweight32(flags & PIDFD_SEND_SIGNAL_FLAGS) > 1) > > + switch (flags) { > > + case 0: > > + /* but see the PIDFD_THREAD check below */ > > Why not put that bit inline? Not sure I understand what does "inline" mean... but let me reply anyway. We want to check the "flags" argument at the start, we do not want to delay the "case 0:" check until we have f.file (so that we can check f.file->f_flags). but perhaps this is another case when I misunderstand you. > But I guess the hweight and flags mask > are intended to be future proofness for flags that don't fit into this > switch. Yes I see, but > That said, your patch reads better than the way it is in the > tree and is what I was thinking. this was my point. And if we add more flags, we will need to update the "switch" stmt anyway. But again, I won't insist. This is cosmetic afer all. Oleg.