Received: by 2002:a05:7412:1e0b:b0:fc:a2b0:25d7 with SMTP id kr11csp1273697rdb; Fri, 16 Feb 2024 10:13:49 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUBJCwiYxwHARU8iKaZB6ymWZeXVnKLdma/4LciAd5SeC7hf69/PGs66EIMQC8uOnK0qKYYHpxYXaWPy9yFHpc8yRyfR2aYLb/KjFFUxQ== X-Google-Smtp-Source: AGHT+IFzqDqIB/sjUlGClNp9Ky5uU8HV2n2jKub3yx4nixOyjgXTM9VSWGWJpS0FLiMt1clv1s2m X-Received: by 2002:a05:6102:cd1:b0:46d:3976:2112 with SMTP id g17-20020a0561020cd100b0046d39762112mr5928373vst.3.1708107229239; Fri, 16 Feb 2024 10:13:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708107229; cv=pass; d=google.com; s=arc-20160816; b=X9cn1IMiQlpP7q/k4Fdn3HHkEO+Nnv16RojUszjR7MAAtRDu1Q0bLKGdHO3w3IFuWL iV1U2ByFMvA3+AdH9vDewg60dwcXZmt9JtqbMmHF0WtuJx2BgcmT185HRW9PRW2m7dgi ujPkDNI7oLegrvb32gUCZ5o2MbrCoUOTiKY5S0pp+IpUMEPQBRvBm6rzWRECKKHJanEU vIpQ3fawAREeOkRG+Pq33a9LvVEqK7uGnTdRjYiiCEP0pDmL06O0u9nu3I9+UDrSvcCS qspg8X/ueymgdXax3Wz13jyLJUjKnZuDCuDEwtMxNFGc7soUJyPpVK2XX3pnsAZiOEu1 SP+Q== 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=/HgOK0yUuaGMKma7nesHwii4yqa8NnnopVqNm88A5WY=; fh=ne4TmZ9VPQDb+nvf5AqBey5rYR3n7sUi7PA/P/tMPpY=; b=KLiHgtNaUxnq5Z9mtKFMWzXg1G31Bjyq16bf1iH3ExFqePVF00rD5yXidT/P6kVRVp CKwFhDY2qSeqWkK+vG7dVGZV4I37ieadNlrP1DF9U+A0DK4/VKKeh9Jge97HcR5tjEr3 HYWDRhuyVEsOJ1VrzBtp6C8Y39hK0HEoeYVMK/DtUiP5U7r+OKpf0UyDL4dpB+HdnmW1 IyyrLO81VWESj5+pfZg/fjCtAUhOw1W1cMOOcE4IDxhrd3BQN7hACeEYbyC42ukbir3R K+tPsqE2z63pZvN0kCdMF8d6jEw8nm4A57hw9tclL8Uzy3u5zoW8C5xK7iwIAAYC3uGt hlTA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gXqWp+sX; 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-69140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69140-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id t10-20020a67c78a000000b00467335b035csi116523vsk.426.2024.02.16.10.13.49 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Feb 2024 10:13:49 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-69140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=gXqWp+sX; 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-69140-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-69140-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 0035B1C214FC for ; Fri, 16 Feb 2024 18:13:49 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 527BC134CF9; Fri, 16 Feb 2024 18:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="gXqWp+sX" 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 05D34132472 for ; Fri, 16 Feb 2024 18:13:42 +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=1708107225; cv=none; b=ftttNJX+ILKXDQBsUfCX/2PPcIXi3W2EdXIJ++PqbF3mTI9uu+kefPo6ZjSN8eWEU1vXVc+nMiCVzfHTTCRUoPJvdI11hPoaN6QIKu3vZFT0+RmmbG4fqvQubMmRHoieror0FbaHqetmq868E28xkKuup/zIl7Daf7LU/PCoTSI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708107225; c=relaxed/simple; bh=B023sSGDBFQJqmvDlf6apONz6TB5blUVd9P3ksydNeE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=SgOyyX/87lfpGPy5EzDq2jyFJheuNAdnw4C6gMPCWVOjodVwE+knvu0HDS5BInXNJtf9vPkRYMSIUMb721oveSGZNI4u1nCCZLW4NNajfq9xdnXWBe747kiZnraJ7+AmI1C7VG3FSqZRCYXWHtukCHWgEaDDG5fQ0s29sK7wqCA= 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=gXqWp+sX; 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=1708107220; 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=/HgOK0yUuaGMKma7nesHwii4yqa8NnnopVqNm88A5WY=; b=gXqWp+sXPNJpajeyM0SxJH61kK7r73JK4VK0ZRWV/akt7+9wEqI+UuUUW90pJhww6XJBcB 5qBNVPE/DDeXpWHWVTue+Zj/DqOQcM79Lha7VNK9ptX73xILF1AHLI4BgGesZQOH9ZqeOY p3l4OZISN3ZteBqyIZ8TOj+j4dHYb/8= 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-292-85dBkUWwNw-B9aBvz9mtCQ-1; Fri, 16 Feb 2024 13:13:35 -0500 X-MC-Unique: 85dBkUWwNw-B9aBvz9mtCQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.rdu2.redhat.com [10.11.54.3]) (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 05DE41C04333; Fri, 16 Feb 2024 18:13:35 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.226.116]) by smtp.corp.redhat.com (Postfix) with SMTP id 2A0B4112131D; Fri, 16 Feb 2024 18:13:32 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 16 Feb 2024 19:12:17 +0100 (CET) Date: Fri, 16 Feb 2024 19:12:14 +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: <20240216181214.GA10393@redhat.com> References: <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> <20240214123655.GB16265@redhat.com> <20240216-albern-aufwiegen-1de327c7dafd@brauner> <20240216130625.GA8723@redhat.com> <20240216-ohnedies-improvisieren-58edcc102b6a@brauner> 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: <20240216-ohnedies-improvisieren-58edcc102b6a@brauner> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.3 On 02/16, Christian Brauner wrote: > > > SI_USER means that the target can trust the values of si_pid/si_uid > > in siginfo. > > Bah, what an annoying nonsense. I see that this can be used to emulate > stuff like SI_TIMER and SI_ASYNCIO. But I very much doubt the value of > e.g., emulating SI_DETHREAD. Maybe I'm missing something very obvious. I don't understand... SI_USER/SI_TKILL means that the signal comes from the userspace (kill/etc), but siginfo was filled by the kernel so the receiver can trust it. > So wouldn't be better of just writing this as? > > if ((task_pid(current) != pid || type > PIDTYPE_TGID) && > (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL)) > goto err; > > So that we don't have to repeat the same exercise if we extend this to > anything above PIDTYPE_PGID? Heh ;) I swear, this is how I wrote it originally, but then for some reason I thought it would raise the questions, so I changed it to check PIDTYPE_PGID. IOW, sure, I agree. Oleg.