Received: by 2002:a05:7412:3290:b0:fa:6e18:a558 with SMTP id ev16csp650021rdb; Fri, 26 Jan 2024 06:51:39 -0800 (PST) X-Google-Smtp-Source: AGHT+IGOtvZsJeWMDW1NeTV9wsnZgs2TNdkrGUJOC/K8m59CtByHhR+UiFqeXm7npo/xQYpk+KxC X-Received: by 2002:a17:903:985:b0:1d4:20b8:abf9 with SMTP id mb5-20020a170903098500b001d420b8abf9mr1646554plb.54.1706280699545; Fri, 26 Jan 2024 06:51:39 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706280699; cv=pass; d=google.com; s=arc-20160816; b=IGkB0yURBFa16spaUxnNJDximtYd0S0plgHjSoSZ8TqsjkxltwA4kc5JvtBC+gzTQR 8InEzdn9WcexojkaD2EKoBfohwwKdOB5JiJm8f3LhR3s/yMGOgTb65f51Yt/zd7q/GP9 EGtnub8kCPZ60/Bm1oAEO3axKrrhNzySPTqKUkND4e2MxMdLWxYUQ2/omxIJNMVGmzAS fgsxgEHosZnS/rt1Jk+zNaZYri6i+KRtBRSiXMbTjTP+m26Nkk31Ncse2MTwnTS61j99 MQRMr8Y4XIlKWQTLvqFSncLxDRR+zdsXOkYTljuWP/Dbilzjit7JDOG2RU82rEM3jRE4 6CBg== 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=Gu8a9U+kDXaRGvEtVtRt5Sa1+ew9Z1jeQJa10E23ijo=; fh=ttd5M4oh2J/lSvqfHyfhVQGCXE2K4fyBxVoE/QtpyDg=; b=l9LWXxZkBCl+YgIi8utQSuehLJTH0DtIV/ofFPdaQ4+ekBtQoBZz94E5enMUbK24nL 9kAlWqdQzJiXZLBiUbCJPLNS+R8ShqGa4aC6aEEBvE9OeR/OMcqsP5WR0XPCgApSeVBG +sN2U+priR+HmVdbMUb9WKFvnZ6Pnw0d1TBdUWs8CarKDddqGTKatr/kpTvwe35jyF4z tI3fQASyDE4BTAlpCioBXBFpwkyvFoei3CbFEOgyE6hOVT+cOU3meykFVkGdrl+XUaCb QEqG3tNjwNdTyjpOVhIlESCHPnAGXWJGZyDQEwYn9I+kqCspR03oUlw95JSR1ZKMXjof zrVw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cV47q5tS; 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-40190-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40190-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id f2-20020a170902ce8200b001d75d88f9a0si1225022plg.466.2024.01.26.06.51.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 26 Jan 2024 06:51:39 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-40190-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=cV47q5tS; 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-40190-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-40190-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 5BC57B28D56 for ; Fri, 26 Jan 2024 14:35:26 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 91BCF1B801; Fri, 26 Jan 2024 14:35:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b="cV47q5tS" 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 514171CA90 for ; Fri, 26 Jan 2024 14:35:12 +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=1706279713; cv=none; b=i7T9i7auCtGRqzGnpXq2yJ62sZU4rWieuwTYk2+wT3bdyNAaIIkiKGmfDYFpWYg1z97+2CLZE+5cbJdS5ZouOHheReVqnp7XgTTM5covTlCfRke0nzW26cE5ctCprySO8C2joBqaa23wWmF2o16hOwsTVmNYuUAv9ih97pLPiCE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1706279713; c=relaxed/simple; bh=5Mp8HJAIqERvQL0b3/83tZjCcwW56ouo++Tx5D+tlFg=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=haHiaMitB1EZ4UkGg7DZFz83qJHj06PHBQtLoqHRpU3Rf2tkKIttgkrJ/f5ZFnNpvC7vHfZhVhsa6N3GGwkh7HrkK73iQEaTkkvIIIodh1Qz0eLGVZEVTLcVqytXSRnpPXUXC7VYGU3qeyM4pU9MNV+XFxOsF5Rr3MPEJ6nuKcw= 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=cV47q5tS; 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=1706279711; 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=Gu8a9U+kDXaRGvEtVtRt5Sa1+ew9Z1jeQJa10E23ijo=; b=cV47q5tSfrYs4VkXLoISz0/R1SglHOxTbqCeRJMswKKRy8pjm+DJZVslXsCTL2llBhFdSo v+ZSxecptZg4IvcnNUsl+A1gjfY+zisLvEY1oKthKl2Hqo6roZTzgO7HBV+jdY9FxDpE5L NG4eVyiCU8DuBBK5Va0AbpDnzKrw7dU= 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-567-6a8axaRlOeC6WIXbPx2xyQ-1; Fri, 26 Jan 2024 09:35:06 -0500 X-MC-Unique: 6a8axaRlOeC6WIXbPx2xyQ-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.rdu2.redhat.com [10.11.54.4]) (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 EDEB82825BAC; Fri, 26 Jan 2024 14:35:05 +0000 (UTC) Received: from dhcp-27-174.brq.redhat.com (unknown [10.45.224.164]) by smtp.corp.redhat.com (Postfix) with SMTP id 4E0802028CD2; Fri, 26 Jan 2024 14:35:04 +0000 (UTC) Received: by dhcp-27-174.brq.redhat.com (nbSMTP-1.00) for uid 1000 oleg@redhat.com; Fri, 26 Jan 2024 15:33:52 +0100 (CET) Date: Fri, 26 Jan 2024 15:33:50 +0100 From: Oleg Nesterov To: Christian Brauner Cc: Tycho Andersen , linux-kernel@vger.kernel.org, linux-api@vger.kernel.org, Tycho Andersen , "Eric W. Biederman" Subject: Re: [PATCH v3 1/3] pidfd: allow pidfd_open() on non-thread-group leaders Message-ID: <20240126143349.GD7386@redhat.com> References: <20240123153452.170866-1-tycho@tycho.pizza> <20240123153452.170866-2-tycho@tycho.pizza> <20240123195608.GB9978@redhat.com> <20240125140830.GA5513@redhat.com> <20240126-kulinarisch-ausziehen-d2af51882d2f@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: <20240126-kulinarisch-ausziehen-d2af51882d2f@brauner> User-Agent: Mutt/1.5.24 (2015-08-30) X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.4 On 01/26, Christian Brauner wrote: > > > --- a/include/uapi/linux/pidfd.h > > +++ b/include/uapi/linux/pidfd.h > > @@ -7,6 +7,7 @@ > > #include > > > > /* Flags for pidfd_open(). */ > > -#define PIDFD_NONBLOCK O_NONBLOCK > > +#define PIDFD_NONBLOCK O_NONBLOCK > > +#define PIDFD_THREAD O_EXCL // or anything else not used by anon_inode's > > I like it! > > The only request I would have is to not alias O_EXCL and PIDFD_THREAD. > Because it doesn't map as clearly as NONBLOCK did. But it would be nice to have PIDFD_THREAD in file->f_flags. Where else can we keep it? I chose O_EXCL because it can only be used at open time, it can never be used or changed after anon_inode_getfile(), so we can safely do pidfd_file->f_flags |= PIDFD_THREAD; in __pidfd_prepare() and then check in pidfd_poll/pidfd_send_signal. What do you suggest instead? Oleg.