Received: by 2002:a05:7412:2a91:b0:fc:a2b0:25d7 with SMTP id u17csp536571rdh; Wed, 14 Feb 2024 04:39:23 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWYP/fsmQue1YJbBzvK8bASzHOp2SYIW0M7s3Q35Mwx/EEBWIJmQDV8LrydqP7OB3AdU/ppEzb0gADKLY2/nbc/s5fVH2IL+RP8aKCyWA== X-Google-Smtp-Source: AGHT+IE2fbEGkVbqKTmJKNkc7ITMCIKncploOK6QnGXsft5Bagb+4cwdkSPZvSKngUjFrywWy3Pd X-Received: by 2002:aa7:d055:0:b0:561:c29b:9023 with SMTP id n21-20020aa7d055000000b00561c29b9023mr1691224edo.14.1707914362897; Wed, 14 Feb 2024 04:39:22 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1707914362; cv=pass; d=google.com; s=arc-20160816; b=LEAwN2wuU3997c1j30Y4165tId2B4+pKpAKsayUw8yx9+j6wLafvsmRv2uBNxEGhdh JtDFLbTiCiOEplY4n0wmsGHlzJcqdFxIQCGJFeDHPIU7F33DuRkaXhivFre4ll33NSpG 4E1hOLA3FhwWiKX4LuJy0QRl/hRAJzTvxA6NEWm+ryl3qaK7ns/bH+CNUby2LNm84W1n iMqA3+8+SI2NzZBvYYVGhrGabU5Lg/WhZ6TGKiyl65eoslAY6WIYA6lkCgmp5OxFrtoi Qb8Wp0v7e4KyPYexb3QT6xO8QkTb0KeTLvvbMxT1VcGy7eG3Gimvvj+SBKG6lkVglTNZ QXVg== 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=oO8fV9kKnERG1FqkS8YQ493S/NllBnU42M5+nmWoL50=; fh=Nva0BqI1EID/cuo0mmvpjuN+3JT+zjdWhqV8ER4eUyI=; b=PUoVStV0encUwOvJX7lvO8620OpI0l6bXChKnggN7jFK2YRW0myZeUXk/grxQPtTCd aFTmQEs1ltoKlQfoIZGFAlXrZfAstSOQy3ftPDVUV4ag5BakSsBedqLNrxi7zGYu+6EO ZwJY4Ba5Bn3tEqaje2q0ImuhcsvxO34nkoVcrOpEKR3yWYD5ItVKpvR/a+CKYQMmecst OG+K400LZxHOczRb2qeDj4/qHIdcD4No0cFf0pcPGNXaYAsBt169Sa1HwFewoKOnq5go W4wG5iq+FzYHwoisVFQpoSGIWSKcTmD/wRyU6mqNMZzM/35VrmrgXxsnY7WOq4igSJxg PPqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OUAY5a+7; 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-65203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65203-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; AJvYcCVpbOt4zrJYaxu2mME4G79/LrBXSC06IhnF/oTSr8a8f28xhE+fGFntdTcsKspjgAfr9dOCK3LJMe4mQ9VL6w5AE9fd7Tu9x5hbCytaGQ== Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id x20-20020aa7d394000000b005620a412f9fsi1198286edq.201.2024.02.14.04.39.22 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Feb 2024 04:39:22 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-65203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=OUAY5a+7; 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-65203-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-65203-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 am.mirrors.kernel.org (Postfix) with ESMTPS id A14941F23A1C for ; Wed, 14 Feb 2024 12:39:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2CAA753E00; Wed, 14 Feb 2024 12:38:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="OUAY5a+7" Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.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 83044535D7 for ; Wed, 14 Feb 2024 12:38:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=170.10.133.124 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707914300; cv=none; b=F51pVaCHIaoK+2Ky3nu1j2hpYqXVvw6hOqzWsovF8RkBhwSypG5xu7SorI3hbM5mvHu0YFi9FzEmWoPnfbLJzIQlb5R5hKe7psc1N0rnG8lrdRnWqS9QlDeQZmAl7SYYL1eK/jMttmKj7DCUoOIHU20UPHlPV0hC0TfqyFj/zEg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1707914300; c=relaxed/simple; bh=5L00shtRx0u3K3qY4nS2i8Dv2Y+Jru41wZEr3M9uzfo=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=WgI0zJHjm9N4FoeQ1G8/md9hfSZmDoV1q1fQ2FnDJcmfj4EFjjCz2lS81/861o8Bd/3U740FYdvUavizQzW2+lHSbsdRDh54ptyrzDNvDVlwwSUQ3/OZ+38v+lVzm0g1mVb5fKsnVZnZlYWXqSkhmBtuhK+lJvEc8ZPobNb3onk= 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=OUAY5a+7; arc=none smtp.client-ip=170.10.133.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=1707914297; 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=oO8fV9kKnERG1FqkS8YQ493S/NllBnU42M5+nmWoL50=; b=OUAY5a+7E1dQjSN4x8iWypboyyzga0Jevqnkin1TOD9mXsqHgjL1JDOsTKBQdES1/iMLFX HB8QsnRgusqICMMXoCvIW5Gz7YVd3qh3BufsMbYsUfTfwcvsN5eiLKMJp161IvS1Yf6Ecp Spo5C8ifciPBo2d6yqibsop4XMhPcEg= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-686-DiAhQK0yORKi6rXiTKTaKQ-1; Wed, 14 Feb 2024 07:38:15 -0500 X-MC-Unique: DiAhQK0yORKi6rXiTKTaKQ-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 6D2702812FE5; Wed, 14 Feb 2024 12:38:15 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.126]) by smtp.corp.redhat.com (Postfix) with SMTP id 910572166B36; Wed, 14 Feb 2024 12:38:13 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Wed, 14 Feb 2024 13:36:58 +0100 (CET) Date: Wed, 14 Feb 2024 13:36:56 +0100 From: Oleg Nesterov To: Christian Brauner Cc: Andy Lutomirski , "Eric W. Biederman" , Tycho Andersen , linux-api@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 2/2] pidfd: change pidfd_send_signal() to respect PIDFD_THREAD Message-ID: <20240214123655.GB16265@redhat.com> References: <20240209-stangen-feuerzeug-17c8662854c9@brauner> <20240209154305.GC3282@redhat.com> <20240209-radeln-untrennbar-9d4ae05aa4cc@brauner> <20240209155644.GD3282@redhat.com> <20240210-abfinden-beimessen-2dbfea59b0da@brauner> <20240210123033.GA27557@redhat.com> <20240210-dackel-getan-619c70fefa62@brauner> <20240210131518.GC27557@redhat.com> <20240210-chihuahua-hinzog-3945b6abd44a@brauner> <20240210165133.GD27557@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: <20240210165133.GD27557@redhat.com> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 On 02/10, Oleg Nesterov wrote: > > On 02/10, Christian Brauner wrote: > > > > + if (type == PIDFD_SIGNAL_PROCESS_GROUP) > > + ret = kill_pgrp_info(sig, &kinfo, pid); > > I guess you meant > > if (type == PIDTYPE_PGID) > > other than that, > > Reviewed-by: Oleg Nesterov Yes, but there is another thing I hadn't thought of... sys_pidfd_send_signal() does /* Only allow sending arbitrary signals to yourself. */ ret = -EPERM; if ((task_pid(current) != pid) && (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL)) goto err; and I am not sure that task_pid(current) == pid should allow the "arbitrary signals" if PIDFD_SIGNAL_PROCESS_GROUP. Perhaps /* Only allow sending arbitrary signals to yourself. */ ret = -EPERM; if ((task_pid(current) != pid || type == PIDTYPE_PGID) && (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL) goto err; ? Oleg.