From patchwork Thu Oct 17 21:05:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13840817 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 08702D3C534 for ; Thu, 17 Oct 2024 21:06:27 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 7D11F6B007B; Thu, 17 Oct 2024 17:06:27 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 759D16B0082; Thu, 17 Oct 2024 17:06:27 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 585D06B0083; Thu, 17 Oct 2024 17:06:27 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 356816B007B for ; Thu, 17 Oct 2024 17:06:27 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 4CEEA121417 for ; Thu, 17 Oct 2024 21:06:16 +0000 (UTC) X-FDA: 82684327278.23.A2E64D0 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf16.hostedemail.com (Postfix) with ESMTP id 03DA0180009 for ; Thu, 17 Oct 2024 21:06:12 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=CG9C5cH6; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fFm3Oy3h; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf16.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729199064; a=rsa-sha256; cv=pass; b=inxdNU2568Sp5CkFJH3OYP28Jq4XoDfYrmUroV63FetJv2o+tKC8QpvNjYXdWDJfBrKocS xZ9WSrRgmZ7J4+d2zRmp6Ee4a4hkkKRkghXhXs23cVzYxRE0e0o+lvgND54RBptGwajUSZ mHzdB1B4zimG7tqtkMR+GkbVYwp0z44= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=CG9C5cH6; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=fFm3Oy3h; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf16.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729199064; h=from:from:sender: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: references:dkim-signature; bh=NgH20b0nzGzn+JEP6Wmh3EBcM6LRnAosz15/3YSNlfw=; b=Js2MaW1F5BFHzASEEWuUoVZvELNpfvA4zy/jqVj4jVjVONFWlrsB43UTDSAbf+2Ey0aTdU NfDpX7zveEnuVwCzNjid6a/Leqy6O8vBZF5EjD7SyOnv2XZ/+HZCEeF/wEhZquxpoNW4+J IRjfFjKMEoR7uAZr4XUj/6QsUueL8us= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49HKtmEI006176; Thu, 17 Oct 2024 21:06:15 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=corp-2023-11-20; bh=NgH20b0nzGzn+JEP 6Wmh3EBcM6LRnAosz15/3YSNlfw=; b=CG9C5cH6SGu30VE8tiGDEIh44b2BFbMG ylVc38ddogvWXRBo4LEcqqfUx+NNmbMcapQIvOWSuDfhrToRp0jo+l+1iC7uJc79 a9VKCkZ3W7s23jUkvMnt8Zjb/H+ycQLQs9HvY2Dz0CHqPfSei6ROthtO7c/mVQML X0gnilW0ixsVmQrdKI4+mM5rScHBGfahipKNhUfh6AmJSGMuUN0kDLL2MXLkiuhl X0le115DoyOYiS2gu8FjfrhlHdJEQ+xO8sYNHHgLY5pZqZeJAgN/5gFiW6qVMalV s1G96cmVy6D0Ju11OFLDDEYo/EyFC2P9a3HBOfdhv3TsNFN0GDQXXQ== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 427g1aq7jh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 21:06:15 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49HKbB3S019898; Thu, 17 Oct 2024 21:06:14 GMT Received: from nam11-bn8-obe.outbound.protection.outlook.com (mail-bn8nam11lp2168.outbound.protection.outlook.com [104.47.58.168]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 427fjasrb2-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 17 Oct 2024 21:06:14 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=nnfDGu/M7aRlwI+XOJy2TUP1syFRzN5RG0WqNQW9iiaJSJapA0BpN8lyAUhQNUkZ4Xbo74/sPgUHicqv8pVhUCIuBkKH05MWoIDwqKmt12bPRaewjPZfFyXKQm6cN/aV9clukWJLJEnp76oMNG+AMChpE26X0FnMvjMu/5mzAXoxCJvkB4LvuemobWk5T5suBRtBA76JlEi982qPX5ZA6csluejo5OaHllNmOiGXSTuC0zkhxojSksHZQwyiKlNl8ko3W33bu1rhkYX7w0EvTupdssPDa8RapJVW9vQpzZSWRsJruObUHK62qJo8sith+tT2+ocJq7TDFmEJ4oPwyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=NgH20b0nzGzn+JEP6Wmh3EBcM6LRnAosz15/3YSNlfw=; b=szY0dbRrioy8ssA/FfbMOCn4jx7d4yD5j6btCGhRqQNmOto1z8/PlNV+lo8bWIp5HAMDxHddblqyOhTA3ey9T4pwUn23rC/LErcIZBm+fBg8VeNDnHrZMnWSQMx7+fBnDvOVhz+fnXHpRhUZus38L0OI5X2Cwj3f+zyZwlzbFu3BR7cdRNdKyhrwUfTglVaxYvq8Rs61TOPEVatDweKQphT8Tyd0ApUPnsLB2FyUMqcTnyNYAxhzXCKvuz1yNsZFrRhRaIpyn5yeGeC1WNhO+Js77SqcXL5z2Ud0dbnGmFHpV+dQxwngXqY6v0CkfHr3CJoO1WfvxeK8xyyYjH5kLw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=NgH20b0nzGzn+JEP6Wmh3EBcM6LRnAosz15/3YSNlfw=; b=fFm3Oy3hf8LWdZY+hzY1W54S+la9tHPAbBQdokw1VnmpkELrblFcZp4UV9DhQHGa1bddeKaiLcRsR63J6Is9ItWJbCiG/HFXcoEk/lp/bGtXKrBDqLMaIDjdQbWPs1/llYzOzQVRvV4V70I3lzCgSdztaKNVz5OARuOJ5imSPuQ= Received: from SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) by MN0PR10MB5981.namprd10.prod.outlook.com (2603:10b6:208:3cb::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.27; Thu, 17 Oct 2024 21:06:11 +0000 Received: from SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e]) by SJ0PR10MB5613.namprd10.prod.outlook.com ([fe80::4239:cf6f:9caa:940e%5]) with mapi id 15.20.8069.016; Thu, 17 Oct 2024 21:06:11 +0000 From: Lorenzo Stoakes To: Christian Brauner Cc: Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , John Hubbard Subject: [PATCH v4 0/4] introduce PIDFD_SELF* sentinels Date: Thu, 17 Oct 2024 22:05:48 +0100 Message-ID: X-Mailer: git-send-email 2.46.2 X-ClientProxiedBy: LNXP265CA0046.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::34) To SJ0PR10MB5613.namprd10.prod.outlook.com (2603:10b6:a03:3d0::5) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: SJ0PR10MB5613:EE_|MN0PR10MB5981:EE_ X-MS-Office365-Filtering-Correlation-Id: 1e84d1cb-ec06-46d1-f196-08dceeef8726 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|366016|376014|7416014; X-Microsoft-Antispam-Message-Info: xCjOQocPxaOsqhsLt7a7oSlpPOcqJ/ie6MQqDzm6K6zH/A2iSLBtKW8M6RGiztQyWuHGV8fX65CRDxSxdK4FHxqEM0lTnjjDfYLuFR6e0udj9R6UbmKd+g2vW4KIL4TYFvxKH8b5LtXPKHOPlvHOt2lsWx11SVM8WCslwDU6Of3CWNJ4u4HxgbqJkf/9K2mPERBg/6aeYvha6dB81fbCF9JQmdcUWh1Sgt9vC4RFP89mqeYaTZfNDxEDNJfdMT3sbtySJhVF5moatot0Yas7BsLIrL1q2e0vQbbbR8vOAYTtooRcgUXWG1yEyX1fmlvJSLF9q51C959NWcVWgLyGuoOxDyp3IpkbLW7EDuwOVkH+PUcLezzstBh4DSJarcA5W6JTGKG07FpnVKcZ6xU5ofo8IaCt7RyORaex/gqgNGmYVyO0VX4KkTVxd0f9s1iSHeU2xrwTwYBAznNnvo0zKd0giIO9FPfPra2UxXkK5bWez5cb4ySL5Kr0/njUfev1xeUlCy8Mb1XKN3E/2dRlXv32O+epdaHTHmpONVO3qw+kjy5U1nJAXvxksEQwYSwk+Drq/0ZxeAHzrIWDmsFci02a0saKUTzkz86EFyHFp+fFzXtn6Hn9p3v59l7cdcZbU1sq7fnmgib8WCk+38iATPu5+XqivAbkEyIo/OkTYcvZnL5OqNuseLkRwHx0ZgPXhdHM9kCsySXdmu6XP1MJGp+laTWJkR/uU46/6VTy8J9ZICnCmKtN2ntgR8PE0RjFlMgVbbNfX4UzeOjWFmvkp5Ae/3qwRQJ46wZQKO7y/BZ6NcyLmdfytBLGtbUdGINQ7dqbzpHq48r6fZXOTyTcAf9DPaeNQ80a5QrOmXC0lnJsuAfkJzXPGLK4GD0KaoOSK3pwiWidFiF36YRNvtv8BV6BUl3iACnU8R6RmXjhdZHEujye6QgVppShM/R1f/RgUs9+0WQmlAkK6RDb2PL/0gKa12snU816AuZYtJteI4/pzxOyEvnDCiJgkReaL97W9UBidJqNx2JjHLUd94xhs5R6d8tUCTOmsU5oGw9zjAhEJAOm94ok6Zw+xzSQzol8PqoLl8F2lCMU6918Obq2JLlA39/8LVR/2prLbFuLh2rQuSOp3JTAi+dL8+NlXi4+Wbut/QIHfYidAhH5ShB9jOONLRvVvKj6E+Fv1TZbqfdZqeKMjHRVuI/GrhUf1UOQPznXeXNZ4kD0pvwXgjmo6sVf2AaccHbE4L0cbLSk1ZjJFE1TNkgrplSE5Lk2Xw8DFlC3sbBR3aFgu2LTrL7XVzhajQ/3zI5JtU/hqOtQlGSpldexDZ9INSxb9LD1liat X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:SJ0PR10MB5613.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(366016)(376014)(7416014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: W8A8CK9N4AUR9o6p+cHHAIw7LowHO2dMVgJNP7osdCUDeCzy8v3jHhT5MoqL+PDkZu4OP3/u1jca+DxluT86Sqxy6g2OZR18lI5HDMQNwCsChcGbGZPJMkkE0EW+X/GYDp8mow0XY0b1TyTPCX302GOeCPN8Y6AzWFpZsXZvzPO0EIAHzzFPqQwWW0WtNP5q1Qa03MfstYMVGp0phgBZA9OS7dCvewQTlpppSLTwU35XxGXiTUpBb/BNGKPPkaqUZ9DIODwJqPdiBPXSQm4tQZrbsT2jiGdMoCT90/Vrwd9/21ENEjqagdV9yrb/B6r+q8kPaF49chjvryBw9V/3jvfR5WTaU58i5D2B4Q1mbakAwHBL9N7T/jeHPhDP/666nGNLmJwEdxqXUubdxty2P2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AHnaq5m1g5nqXeVprd0nJfeYuI9jWLZ7v+ux3WJ8CxbKVlOwJd4ptIllM2pxh1yOVKj3Ge/aAiJetpre1V7HPsYdgJV1YBRHa4aWAT16BvM1YpYBGf0zEz67qjCsyV3RYk0QQ+cY2mTag== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: Jwh7dWLWmVjbLAcR0ZJX9AxvwgIZQOYk01VPvTiiIoqBdKuS7oC45MEBxpYIW6VBPsGJdeYfHh6CbsXWaG8UVc51zN1pxusJ7gAu03x/1R4/0SfG0mWt1svgnZN9lyAlYIvRNXCsTLQS5u0QV0P5MucIltzNrhSmUqXIqtdBzMZCTr59idqPccwvHeSLhF8jUP7qG9d6WdQSZwVV9QmSDShCc3GIL/WAO2Kge70mhuxH8CrT/xmIVt101ss4z1voiuuG//VAe2hrIxyNNatf/j8xkkwUFbzsDsi7BQjAn1BHOn217LkXKwsQOD6tiBamGTax0G224BTQ8Z796OwyNMgNRjMrkwVAAoY4Wo+HW+/l4YulkT6M3gS0Mwm1y15j5I8eOJR9x+bmiM1IDl04k5LlX2kEsZnlXT2kc88vuKiyIi+7UgI0e9Z6fjKJtAFlhjQw99sxx1dx/KKPDO9lJXTsoQb/M7jEY5w9LoXqmQiVVayXeBj4BOYP3CGA8wWy6RlMyHeHXbrqZMGeXeCoHJHtmjw+DljQxpOoiC/ZybMg6iHzoKtWzb6oi0QKWQibw0oEgW42oHgJfxyF8Guj5M6+qXpnSmbkMIGgvzplfeg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1e84d1cb-ec06-46d1-f196-08dceeef8726 X-MS-Exchange-CrossTenant-AuthSource: SJ0PR10MB5613.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2024 21:06:11.3319 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: xUmKw9iHm/VvkmCgevnDTgww+xRBez3rEwX8+HCFirxrKvYlzNzwIPMGTlWvQHQUzIDkQVBVyCF44uh4mBl+VirwgWn2S5hSLZoFMdwM3Zk= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN0PR10MB5981 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-17_23,2024-10-17_01,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 bulkscore=0 suspectscore=0 spamscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410170142 X-Proofpoint-GUID: PpRnyT8ZRqQyg-BX4vFD2OMSXVNFUhCz X-Proofpoint-ORIG-GUID: PpRnyT8ZRqQyg-BX4vFD2OMSXVNFUhCz X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 03DA0180009 X-Stat-Signature: uidudtab84ki5ykjnjb6d856rfxicsyc X-Rspam-User: X-HE-Tag: 1729199172-663967 X-HE-Meta: U2FsdGVkX1+p1e6jeHPf2DaXJs1pepdqFXrX/WOPIvzzA9EqEjJ9k9NJC1Yju80o02YQ+d312nWT8PpLj9E4OXSua5Sbh3G6Oog3GQ6NeHKsI8XBB8cJ8peGgL3oHwABs7XuTc2/3ZKFQmhm/42CBxDtjINbxjHIM6a2BrXx8AisRTHMCvC3ViWkxpD8EViJxtuHiByHTC6fUfy0O6f/pATsAQAsALols+zn3EedxxtO+YuiGeCSD4jG5tCGn/mSrdYdptmAgxMSwh1UasCEAp1MUnGlxnPxGfnwjVcTzCfRfipNRKQ0RZCnsg8WUEWaQLRoKM1RXGPBqNb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DzyIY7NhIsfwJLOx2BISAJ1P8x6tg4TkU8GW3uFjpssOykijD2I1qw89fLiE4lHLh3Gh4mtSs7nAX8GcSEiIOYUoKXRrCw6ixnojHuzbs7z4NTmrQG28+dowDRwL5vR6l4a0Pc+kAHs503y7hCOcZMymM2ZBSnQcydsC7RSkXWQs0Ks969XooaC10S9znDiy/m1/SpgTtdF5NUxLmRnkB4kzVc+3Mb2Joj4wgYiLHYo5at0CvmYrnA== X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: If you wish to utilise a pidfd interface to refer to the current process or thread it is rather cumbersome, requiring something like: int pidfd = pidfd_open(getpid(), 0 or PIDFD_THREAD); ... close(pidfd); Or the equivalent call opening /proc/self. It is more convenient to use a sentinel value to indicate to an interface that accepts a pidfd that we simply wish to refer to the current process thread. This series introduces sentinels for this purposes which can be passed as the pidfd in this instance rather than having to establish a dummy fd for this purpose. It is useful to refer to both the current thread from the userland's perspective for which we use PIDFD_SELF, and the current process from the userland's perspective, for which we use PIDFD_SELF_PROCESS. There is unfortunately some confusion between the kernel and userland as to what constitutes a process - a thread from the userland perspective is a process in userland, and a userland process is a thread group (more specifically the thread group leader from the kernel perspective). We therefore alias things thusly: * PIDFD_SELF_THREAD aliased by PIDFD_SELF - use PIDTYPE_PID. * PIDFD_SELF_THREAD_GROUP alised by PIDFD_SELF_PROCESS - use PIDTYPE_TGID. In all of the kernel code we refer to PIDFD_SELF_THREAD and PIDFD_SELF_THREAD_GROUP. However we expect users to use PIDFD_SELF and PIDFD_SELF_PROCESS. This matters for cases where, for instance, a user unshare()'s FDs or does thread-specific signal handling and where the user would be hugely confused if the FDs referenced or signal processed referred to the thread group leader rather than the individual thread. We ensure that pidfd_send_signal() and pidfd_getfd() work correctly, and assert as much in selftests. All other interfaces except setns() will work implicitly with this new interface, however it doesn't make sense to test waitid(P_PIDFD, ...) as waiting on ourselves is a blocking operation. In the case of setns() we explicitly disallow use of PIDFD_SELF* as it doesn't make sense to obtain the namespaces of our own process, and it would require work to implement this functionality there that would be of no use. We also do not provide the ability to utilise PIDFD_SELF* in ordinary fd operations such as open() or poll(), as this would require extensive work and be of no real use. v4: * Avoid returning an fd in the __pidfd_get_pid() function as pointed out by Christian, instead simply always pin the pid and maintain fd scope in the helper alone. * Add wrapper header file in tools/include/linux to allow for import of UAPI pidfd.h header without encountering the collision between system fcntl.h and linux/fcntl.h as discussed with Shuah and John. * Fixup tests to import the UAPI pidfd.h header working around conflicts between system fcntl.h and linux/fcntl.h which the UAPI pidfd.h imports, as reported by Shuah. * Use an int for pidfd_is_self_sentinel() to avoid any dependency on stdbool.h in userland. v3: * Do not fput() an invalid fd as reported by kernel test bot. * Fix unintended churn from moving variable declaration. https://lore.kernel.org/linux-mm/cover.1729073310.git.lorenzo.stoakes@oracle.com/ v2: * Fix tests as reported by Shuah. * Correct RFC version lore link. https://lore.kernel.org/linux-mm/cover.1728643714.git.lorenzo.stoakes@oracle.com/ Non-RFC v1: * Removed RFC tag - there seems to be general consensus that this change is a good idea, but perhaps some debate to be had on implementation. It seems sensible then to move forward with the RFC flag removed. * Introduced PIDFD_SELF_THREAD, PIDFD_SELF_THREAD_GROUP and their aliases PIDFD_SELF and PIDFD_SELF_PROCESS respectively. * Updated testing accordingly. https://lore.kernel.org/linux-mm/cover.1728578231.git.lorenzo.stoakes@oracle.com/ RFC version: https://lore.kernel.org/linux-mm/cover.1727644404.git.lorenzo.stoakes@oracle.com/ Lorenzo Stoakes (4): pidfd: extend pidfd_get_pid() and de-duplicate pid lookup pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process selftests: pidfd: add pidfd.h UAPI wrapper selftests: pidfd: add tests for PIDFD_SELF_* include/linux/pid.h | 34 ++++- include/uapi/linux/pidfd.h | 15 ++ kernel/exit.c | 3 +- kernel/nsproxy.c | 1 + kernel/pid.c | 65 +++++--- kernel/signal.c | 29 +--- tools/include/linux/pidfd.h | 14 ++ tools/testing/selftests/pidfd/Makefile | 3 +- tools/testing/selftests/pidfd/pidfd.h | 2 + .../selftests/pidfd/pidfd_getfd_test.c | 141 ++++++++++++++++++ .../selftests/pidfd/pidfd_setns_test.c | 11 ++ tools/testing/selftests/pidfd/pidfd_test.c | 76 ++++++++-- 12 files changed, 333 insertions(+), 61 deletions(-) create mode 100644 tools/include/linux/pidfd.h