From patchwork Sat Oct 26 07:24:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13852101 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 87FABD10BE5 for ; Sat, 26 Oct 2024 07:25:25 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 0C00C6B007B; Sat, 26 Oct 2024 03:25:25 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 048AE6B0082; Sat, 26 Oct 2024 03:25:24 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D8E786B0083; Sat, 26 Oct 2024 03:25:24 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0011.hostedemail.com [216.40.44.11]) by kanga.kvack.org (Postfix) with ESMTP id B1ACC6B007B for ; Sat, 26 Oct 2024 03:25:24 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay03.hostedemail.com (Postfix) with ESMTP id 2F8D3A147D for ; Sat, 26 Oct 2024 07:24:47 +0000 (UTC) X-FDA: 82714916340.17.3AF4610 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf25.hostedemail.com (Postfix) with ESMTP id 277F8A000A for ; Sat, 26 Oct 2024 07:25:05 +0000 (UTC) Authentication-Results: imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=GAGewO8t; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ziQTk4gS; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf25.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729927468; a=rsa-sha256; cv=pass; b=f0vE3QRKoMz5pCRfmhPQzpb0TifzegvlHwzzwRfIszfq9J1e47uXnQyoIeUW1U8oL2lWft NXVYKWivCTvEi2OTUwSbYtNxoOfXW5UkxkeafJkNe7wVbR1CklTAj2lxKaSk1obJLADkQZ Y8FRvMDNdZMNcDJ+Ajhw4/wfAx91yOo= ARC-Authentication-Results: i=2; imf25.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=GAGewO8t; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=ziQTk4gS; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf25.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729927468; 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:in-reply-to:references:references:dkim-signature; bh=ysaPi8DTdXVgT7KKevj+tCObGLJIis9xvmd4QhwzTz8=; b=zuTyT2wbKQvY5Lm5ceschTLPvzmWoQ62iiW26voD4LbOMMneMBSZ0ziXPND5jvwzAzcbnG Yf4gwicK06BqJ02rdl60JEmyjQI7MqM63wJpuZF+k95Vxy5WjkVIfJnISloFoaoV5E7nrS 214u9umh/DQzc0cB1/o1oaNpuHqXOko= Received: from pps.filterd (m0246630.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49Q3JgJP012970; Sat, 26 Oct 2024 07:25:13 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=ysaPi8DTdXVgT7KKevj+tCObGLJIis9xvmd4QhwzTz8=; b= GAGewO8tTWzaTK//HW+fhgGnno7PPrGkRb/kIAtH3lM3prIfv+LYUFTwZmcilNVf iI8fhCkgWeEQ4nmakKDBzdHK7QZ2A44/Zur4jVTXKGCPaTUkkklVkeARvLxbuOxf v0xjBONKp4B1MDc6bJt8TliUTu1Am+JbxDPpkOFHdvPgklHXzFLAeC4IvYDxoEOA jnzfcgycvgJA5mhtY1WZwOr5Kb5NO+/oFv7VaES8Fu4rPekFwuHsjACUD6SeWcRW YLK8cVuyED+vv97WVZjUagDTFWxtTuglgSbcq1aUXHmFkByx1bfkpB0CWcs2371P IPAl3Ln3mU9nZ6YyeLhMrg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grdq84m5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Oct 2024 07:25:13 +0000 (GMT) Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49Q3DnSq004393; Sat, 26 Oct 2024 07:25:12 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2045.outbound.protection.outlook.com [104.47.70.45]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42gpvaddaf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Oct 2024 07:25:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sIZIYXgoEWDtreLmcjhbLHDJeWYiDxCiTiVWwQgRdDF3IgML6fW65byngz1Pu7lejA+3wkG1WuYTEb1RZ+QHldbAZ7kvQ3He51Jjaml3ATWAmUylOFS0RHTBrWX3DN+STQOVr1HSRFEOCmknJO2TC07f7DR2tGnj9qQeb7WoTGZBO1TCTGlYYY+xYSNY9kBP0WB8BJIOYnL9djipoWS72DrFe/ZAZj3JLmNiOmHeJnF1MzQCJQDH3MusdAw6i4k7n/CThPATMktUvCweloZB1agaCrwIPnkNg5Q7+Wi7/yjSmsNEBXeOEpu3xTIM918D/eZsN8PH0vfPA7VOoyR+ZA== 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=ysaPi8DTdXVgT7KKevj+tCObGLJIis9xvmd4QhwzTz8=; b=Rj4ttO5m1couZ0t757d4YIKH1inbhju5RBz0Ljszk5cUF+kXh0Oj8amOruaHWx7D6DpRCjo31FUxmIyh801Ft0fJUYPkCXe+E5RSzp+9DhtLivA7Ribn+6oNe6FPKwEvKpxIVmdSH3pragbHuW9Mom7GTka1N8zaV/jUT7NHlSucBEVNx127aWrWQeu2DrnQL9KO8mhTtKLJN3U6ZuxL4HVcTlR2n7KoL8tAt4UF/z2Wp/9unx465NwCajYLED83P62rqjrcd3rghKvVUtbWeADmkexYqxXjJu2kuVSkH9B7fiN/kcdefcVLEkrb6cjLJJXJTUpqnGOzGftauZxItw== 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=ysaPi8DTdXVgT7KKevj+tCObGLJIis9xvmd4QhwzTz8=; b=ziQTk4gSeO9xtNFwiRkSJjuP7Yo7O25I9Nq6vkRCkqOgM/fVG6V06MbCKCFHWSTXcp3yFHMRWQVc5ms5kHcA0rnhGGGNHb7YNz8WbpaUt+VeaVxLCbxpmFzxAVvz+N+K5WKJKZ5ZYe0q05TUmC5gna7h8sQEzriA4JtT+IviTRA= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SJ0PR10MB4543.namprd10.prod.outlook.com (2603:10b6:a03:2d9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Sat, 26 Oct 2024 07:25:10 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.014; Sat, 26 Oct 2024 07:25:10 +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 v6 1/5] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup Date: Sat, 26 Oct 2024 08:24:57 +0100 Message-ID: X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LNXP265CA0015.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5e::27) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SJ0PR10MB4543:EE_ X-MS-Office365-Filtering-Correlation-Id: c05217eb-4440-417a-ad7f-08dcf58f5329 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: oZ3SFKdHgje5eXDvuQbRKET7S3nY+TkEX3a560LEjgiy/SD6zib8F4JvjHK7bOF+m6B+zVIfulr6TFwE/WrrU5cR0yIqBzuuJOnKfMt0CX/wRV6HD53S5Im8+bvXsiLT1t4O8PswYxpT21cjtp3RFo9U8RqkV7werDouagJpucA+bFVIXK467ae3DoSG33Fffqsx1/eSK1jMtg7EmI69zLOepFlV8dVEUlEFSRU3gAfk9rOS9m9igetjknQM8MTzfHnw8t0nZnUaDTk2ELK6fQNvFq6Ph1Tw30mR6WuGWQU1Rdh4dk9j1xosPDzADScgVXj6e4f53r2G4W5pukjC57YjJAomlCdX3d0Yp3dlhFtdkp0fP+4DlbyS6OD4GIx00ShUTd0XueZWjfHZBz5XJFvcJgijp+FspWlFhp8ZJskeJpuKHXj/YpvNLNSNwBWl3yfDn+klKhIXZcDA7734zKd71P/8WeD+qjqRFElJq60/V6ewjlAxZR8xyiCFLhLfipGpTSBuK2c7oBZB+3LMwiXdDbpfzLTfac0qlyzodjmwReqFj4S/pV3EZfTes1qLn0Z48Us+IHqUrDgpvuqA+ApT3byBu7oyzVWqspCig5ddyS38RLcyOCNEG98sSou1c6pdI0LI7PVRN5m+cKobAOzLm6TmK76WR7r//cuEVlzJ2dmtet9UDJn9v0e5k8XZHY18er/zYdx8RVGc96Je3uyxwka+sjM5vj1HsOICLyYPTduJLzEzwypHuQClX2H1ouyfxL8GV6cbTfdaRIcm3ilMptOaBj2ycNzFzxGcfqhn+Y7JdKrqhBtqEFdumVducDEUK2Y7dI8xk7yfUCI9JNhqcY2GHuSYHyl0ERDSBCX2V8b1DR2hX67gAfuBLdzE2yXrfA0oHa9HEkovw/ZWFJE9nwR7D/KtBRLLDPZQHCTkxcLIhQFHMkj2+Ao0KZyogKpgTtRWjA6H2GDOHxt70YodajD1cs7FzCGcDM9ELWUIMNa04UYUhd44vFsH6awbyf6Nyie831XZjKnx5yD3tzNbDi58vO6+ce+q79p2BE/DWwvHXCT6YeUlZgFuOQmCC/f04/HLz3iJgGcgXm+t7dJKWP3qU7JCGH2LfvrEAlvTQDW7vNJiehyxExKIQqYSFYH7iavuMexs1JNlZEjJWq8Rn+TUxI2Qjy4exBrzUL2Ae+WoRwO1NP3+IUrmnomE+aQqdGhicNjADg4fbt2TMIhJ37OHoJv4ELJGW+MJyZG6fGc42KmyJK0OfSFm7ra6OriuLq5Rwss39f+gZIkR4PUi+Ese4F0dFGKgBkHaKxhuAKVDEik0qhvr2nmxguyB X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: P/3Zavcpy2gEwkMgPP3lUr+J9oCG8jXJ08G0xT8SZyF1OcaGg7AFLxmNBTcx/z537CbRcYffdVio3fIKGR2oCUGeLD85kp2kYYR4kBLLSisPQZ59mDIYW5a5N2bBF7HprH7/bnDrVYrlFLvauv9G0zM7coTCTLZXYdJDcA/PyCTaoWMqKUuZgozQ/7zAnZAKi1fTR3fOlTU2Me+nroofcjUiO8xXOcEiIqq2whjcVNXRf8uDhNTj2Yly+wchbH6YMT+1AFPqRL3q8ReyrLBLtQAE4rIkH4UycC6CQLQBZsPUefBSsvSjAcfu522TgN8Ei5+Cl5fZRc9JVZmERGMEFpNc/vAN3O/QyTetSimEbCKjbNFkxOXiSZUC1JS87wmVLVGvTR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SyofBC08MPm8jAGAD93jxql5I/1wXZQJIpcwTdPjTFKlJgDODEZ3H8NE5JQuzDxKDghiiQg7Mu+6w7OTocBCJr/oG2vLYfmR5JuD0lZ+keRmzTROtM3MTvUfKSpXBcMEOSXgvL/JJHUC8uxaiZDGuR3cnZc1nw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: wVarTsIb5VcyVYIrDGFHSBKOf+w8qKLwHtY8eP3Q7QpCvDefcTULPwnsn3vSZysO88iiQ8YwojWu3qM+Ph+jxjT6wVG/gmrlIgcHIYol6n3Fs3GP5Lsijgw3R1nZTZcQCYu9AzLcm+wulgLybGCuok7y4rbw1J84L90H3m+Hhtp5VVYZ3P5P7usSKgdsljkxyI4WSBKcUpAP4O3tyF3BnfnngkIWDjyxBQes9dcN0txTxRfaKNwtaTANVZtsDzODESbjKHLcBTrIKICqaQ3RvIWlTX6OSquQm8L2Ko43mqw4qf9BMdthfgj3iYi1vmNj6HYLvZWcpTqATiXeIleJVMCtve3NfR0fE34AiERzQt3Lfdkkl56744eQYELu2ortV6w3q9IV4dVOIbPdmlYuzs+031I2Dapb8DS082CJKrr0Qk8CQFDEFnLV2eiqvIN+tLFuCkHssI7IVTn0iK8BtyIem91yA7Dj7ahKZmxspER25qxM+Axh942MGcAnTuGON0S+Nzk5kIouZQhdKSgnWhgXYjnesKu7RW9jPKXM+WThuF0lo5SEJVs66xBzGFEXbStETtyz+Ho+XZGvB/nPtT+6TILgZpdyDD4E/nvGhOo= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c05217eb-4440-417a-ad7f-08dcf58f5329 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2024 07:25:10.6290 (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: b2JItDQRoB4Nw1G0Xl+VIjGtGBb53CxFCxNaxlBqd/sZpd8W1lEz1wURzlp/FnuMFU4m5/vOG0atlW8m4iaNLTu8dqPxxBTQKDj0FCNvZxs= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4543 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-25_14,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 suspectscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 malwarescore=0 phishscore=0 adultscore=0 spamscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410260060 X-Proofpoint-GUID: 4VBHUktliZglGhPqbtwc-fvR6CZ04yP4 X-Proofpoint-ORIG-GUID: 4VBHUktliZglGhPqbtwc-fvR6CZ04yP4 X-Rspam-User: X-Rspamd-Queue-Id: 277F8A000A X-Rspamd-Server: rspam01 X-Stat-Signature: bjtrbjq55wr66z6kfpcrhkq9i7xgunrh X-HE-Tag: 1729927505-940063 X-HE-Meta: U2FsdGVkX1/qh1WnLYjLdtszzKQ+9DXrOiIjw0sVY1Qe0vNwpABuKWbw4sxuIobIdca+D8a8X+H41uy6q8lb4VsIUVVZN7Lr/1m/fVE1QvcgcKEyrr7LmPMsQtfwg8IE2VlNQDCLC7WQZ0zGTXpeJJwQ3bj+oOtVAKB0sR6yY7JTV1P2XNSI326ysYOY8WvuMRFiS2p2fyqM4i7Gd8Nc1cJV9lsijA84Itko1CzFfZcIfoVRD3jAdRr6wwd4otFMIHMWWHxQtmfUOXpipjqBzemrcSv7pJ2xl0YLpEZF0vF9NWYJOrxoA9Ccqb/PJ3wPEkJ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LlfYQY+sc3s4iXbauBvoD+4D+Bm6UJJDCzrMTg7wzZ4x0krK9lFTyLuQeY/HDa/PFuEBzxmwant64TqNNn4MKpS5HqXVm8bAfypBzWjvS1HzqoggfNNS7mrjTeo9mwRborN1LtvxJXNTIPlqaHbeQB4SJULbfC5Y2p30SE/09s8YT4pr/7fsbplnsDPpNx4g/Kp1y0/pGUjoZT5tnuqfLoIKtbUZG2gSZMFzttBb8aI1IQrIV1pBre/2MDQ= 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: The means by which a pid is determined from a pidfd is duplicated, with some callers holding a reference to the (pid)fd, and others explicitly pinning the pid. Introduce __pidfd_get_pid() which narrows this to one approach of pinning the pid, with an optional output parameters for file->f_flags to avoid the need to hold onto a file to retrieve this. Additionally, allow the ability to open a pidfd by opening a /proc/ directory, utilised by the pidfd_send_signal() system call, providing a pidfd_get_pid_proc() helper function to do so. Doing this allows us to eliminate open-coded pidfd pid lookup and to consistently handle this in one place. This lays the groundwork for a subsequent patch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Reviewed-by: Shakeel Butt Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h | 30 +++++++++++++++++++++++++++++- kernel/pid.c | 42 ++++++++++++++++++++++++------------------ kernel/signal.c | 29 ++++++----------------------- 3 files changed, 59 insertions(+), 42 deletions(-) diff --git a/include/linux/pid.h b/include/linux/pid.h index a3aad9b4074c..d466890e1b35 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -2,6 +2,7 @@ #ifndef _LINUX_PID_H #define _LINUX_PID_H +#include #include #include #include @@ -72,8 +73,35 @@ extern struct pid init_struct_pid; struct file; + +/** + * __pidfd_get_pid() - Retrieve a pid associated with the specified pidfd. + * + * @pidfd: The pidfd whose pid we want, or the fd of a /proc/ file if + * @alloc_proc is also set. + * @allow_proc: If set, then an fd of a /proc/ file can be passed instead + * of a pidfd, and this will be used to determine the pid. + * @flags: Output variable, if non-NULL, then the file->f_flags of the + * pidfd will be set here. + * + * Returns: If successful, the pid associated with the pidfd, otherwise an + * error. + */ +struct pid *__pidfd_get_pid(unsigned int pidfd, bool allow_proc, + unsigned int *flags); + +static inline struct pid *pidfd_get_pid(unsigned int pidfd, unsigned int *flags) +{ + return __pidfd_get_pid(pidfd, /* allow_proc = */ false, flags); +} + +static inline struct pid *pidfd_get_pid_proc(unsigned int pidfd, + unsigned int *flags) +{ + return __pidfd_get_pid(pidfd, /* allow_proc = */ true, flags); +} + struct pid *pidfd_pid(const struct file *file); -struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags); struct task_struct *pidfd_get_task(int pidfd, unsigned int *flags); int pidfd_prepare(struct pid *pid, unsigned int flags, struct file **ret); void do_notify_pidfd(struct task_struct *task); diff --git a/kernel/pid.c b/kernel/pid.c index 2715afb77eab..94c97559e5c5 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -534,22 +535,32 @@ struct pid *find_ge_pid(int nr, struct pid_namespace *ns) } EXPORT_SYMBOL_GPL(find_ge_pid); -struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags) +struct pid *__pidfd_get_pid(unsigned int pidfd, bool allow_proc, + unsigned int *flags) { - struct fd f; struct pid *pid; + struct fd f = fdget(pidfd); + struct file *file = fd_file(f); - f = fdget(fd); - if (!fd_file(f)) + if (!file) return ERR_PTR(-EBADF); - pid = pidfd_pid(fd_file(f)); - if (!IS_ERR(pid)) { - get_pid(pid); - *flags = fd_file(f)->f_flags; + pid = pidfd_pid(file); + /* If we allow opening a pidfd via /proc/, do so. */ + if (IS_ERR(pid) && allow_proc) + pid = tgid_pidfd_to_pid(file); + + if (IS_ERR(pid)) { + fdput(f); + return pid; } + /* Pin pid before we release fd. */ + get_pid(pid); + if (flags) + *flags = file->f_flags; fdput(f); + return pid; } @@ -747,23 +758,18 @@ SYSCALL_DEFINE3(pidfd_getfd, int, pidfd, int, fd, unsigned int, flags) { struct pid *pid; - struct fd f; int ret; /* flags is currently unused - make sure it's unset */ if (flags) return -EINVAL; - f = fdget(pidfd); - if (!fd_file(f)) - return -EBADF; - - pid = pidfd_pid(fd_file(f)); + pid = pidfd_get_pid(pidfd, NULL); if (IS_ERR(pid)) - ret = PTR_ERR(pid); - else - ret = pidfd_getfd(pid, fd); + return PTR_ERR(pid); - fdput(f); + ret = pidfd_getfd(pid, fd); + + put_pid(pid); return ret; } diff --git a/kernel/signal.c b/kernel/signal.c index 4344860ffcac..9a35b1cf40ad 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3875,17 +3875,6 @@ static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, return copy_siginfo_from_user(kinfo, info); } -static struct pid *pidfd_to_pid(const struct file *file) -{ - struct pid *pid; - - pid = pidfd_pid(file); - if (!IS_ERR(pid)) - return pid; - - return tgid_pidfd_to_pid(file); -} - #define PIDFD_SEND_SIGNAL_FLAGS \ (PIDFD_SIGNAL_THREAD | PIDFD_SIGNAL_THREAD_GROUP | \ PIDFD_SIGNAL_PROCESS_GROUP) @@ -3908,10 +3897,10 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, siginfo_t __user *, info, unsigned int, flags) { int ret; - struct fd f; struct pid *pid; kernel_siginfo_t kinfo; enum pid_type type; + unsigned int f_flags; /* Enforce flags be set to 0 until we add an extension. */ if (flags & ~PIDFD_SEND_SIGNAL_FLAGS) @@ -3921,16 +3910,10 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, if (hweight32(flags & PIDFD_SEND_SIGNAL_FLAGS) > 1) return -EINVAL; - f = fdget(pidfd); - if (!fd_file(f)) - return -EBADF; - /* Is this a pidfd? */ - pid = pidfd_to_pid(fd_file(f)); - if (IS_ERR(pid)) { - ret = PTR_ERR(pid); - goto err; - } + pid = pidfd_get_pid_proc(pidfd, &f_flags); + if (IS_ERR(pid)) + return PTR_ERR(pid); ret = -EINVAL; if (!access_pidfd_pidns(pid)) @@ -3939,7 +3922,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, switch (flags) { case 0: /* Infer scope from the type of pidfd. */ - if (fd_file(f)->f_flags & PIDFD_THREAD) + if (f_flags & PIDFD_THREAD) type = PIDTYPE_PID; else type = PIDTYPE_TGID; @@ -3978,7 +3961,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, else ret = kill_pid_info_type(sig, &kinfo, pid, type); err: - fdput(f); + put_pid(pid); return ret; } From patchwork Sat Oct 26 07:24:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13852103 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 D4B31D10BE8 for ; Sat, 26 Oct 2024 07:25:34 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 57AA16B0088; Sat, 26 Oct 2024 03:25:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 504386B0089; Sat, 26 Oct 2024 03:25:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 2BAEF6B008A; Sat, 26 Oct 2024 03:25:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id F26DB6B0088 for ; Sat, 26 Oct 2024 03:25:33 -0400 (EDT) Received: from smtpin17.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id CBF09C037B for ; Sat, 26 Oct 2024 07:25:11 +0000 (UTC) X-FDA: 82714916760.17.E206A88 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf11.hostedemail.com (Postfix) with ESMTP id 422074001A for ; Sat, 26 Oct 2024 07:25:05 +0000 (UTC) Authentication-Results: imf11.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="PWuAKu/5"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MNcY7ilh; spf=pass (imf11.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729927452; 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:in-reply-to:references:references:dkim-signature; bh=SLlbDZlZ3nLzA+OMshfpAja8xZBB1l8GJOD6tbMQ7pA=; b=VI86/RnPYnRa1IzdX0S4cm4xGZlg2Ne/ZDMi/TxDXdhesl+/VlAXItfyYbptHJ4aDlcdFa O7B6fHnAsfrugTGR+I4J8LHdPqzBYtZbLXJRBxQkisL1LvIdnUTJ9kMsD0kCosblRrv1pL PeSYFYriPbVRxdEWDqKc7LvpXWowgE0= ARC-Authentication-Results: i=2; imf11.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="PWuAKu/5"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=MNcY7ilh; spf=pass (imf11.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; dmarc=pass (policy=reject) header.from=oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729927452; a=rsa-sha256; cv=pass; b=57+ocxQlhx9k9iCBcm/E6TvwadBKskD58Qo9zfNDsBZmijpceFf46PhJwlQERsrOu0f/xz 8CqAArzDf4H8V9Bz2f181vGwReib5ACrZi+WbEnR4swCqIEQMvtf/HUwmztABR+7Mh4yRI 4ZCjXkz5ly2J/dFzONFb2+5vfaF+2tw= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49Q3G69V024667; Sat, 26 Oct 2024 07:25:20 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=SLlbDZlZ3nLzA+OMshfpAja8xZBB1l8GJOD6tbMQ7pA=; b= PWuAKu/5Lk8XFEOjSH8gp0D/U+y2LRPkZ8K2PDwW6OkApIxNxqq3Q9aQYh6nb+bM 5k70SiOh/qSq9M24x3ERBUaR0HZEjul3qKOQCQ7eZY9PEP8ICc3MKUzKfth3ma9u lcs/o9BHtuMy5tTDpSZB6WQHqsAi5Ul3e4h6kWyLaAkdNn1cDTYBq9BmtDC4zttl Yg3pUbkjAhM4PHx9QpIKlislD/t6YSnvTvVTGog+7DcRUcq/yB3EH5ZJq7LVfRfg TTtKGZue8eGV0yz8majGCRe3r+B1JEPCszO+qOW288/Cch34GMAZiAwVKPBkJU4m aJDalVgOSezW4OfKHtCdFA== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grc8r4qv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Oct 2024 07:25:20 +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 49Q3Duxv031966; Sat, 26 Oct 2024 07:25:19 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2044.outbound.protection.outlook.com [104.47.70.44]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42gpv44tug-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Oct 2024 07:25:19 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cY+WVuFezljjN0sms6nRYNy7HGp+P6eP6yMT5Hkr6V8A2gDddSyXBIiASTDVzz0U0OUtwZEDJEdSYLF8T4W80pJXWaGynl7PoiKY0DWx7ZlrcrpnxZYr3Q3eo3M3Pt37hD4o08cqDpSFW81UtYHjhR1WzZzfObk3/FBohxBx21faM6UhaKcnX79KGGmspUpBeHO4821PZg+Zk5eJj62NDqLr4Hida1dMW+ZviODMhB9jSpsKqeMODxkIL43OUXBN5vjVZ8fdjmkPCPevjOurWDaAbW2qCHEOQSx6Xr+lLY/mnmJe61kBGu1L1r778D6N1R/eVxxU1oVq7SPwp3lY5g== 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=SLlbDZlZ3nLzA+OMshfpAja8xZBB1l8GJOD6tbMQ7pA=; b=U9RtpMbmm9ps1nmKQwWlWQMjlKW5C0qTinMzSSzvMwYC6UOogSq/ujhBFkC+abEkIuWpviwzNC9bJLBBUJxdBxZLtKwq1USBXoSM5WYhUDJ1OwDGeCXfsiW6nIyCytLG4R56aIBkobbiVIICoKf5rOp0/0jjkgJyXFVifcu9dUA/zAHCceQm1EAGuVXhTepXxIV5PRBiXdHxIJ/kj5W1ZP5tg8MuOG+VfVeiPOn2pUZj+CTOHl8kQiNIedUhRsR4bKeHgKDnZvNbufyQnCO8e/ZWjNHY11MZcQ2f7mVjr9+dv4t7Q2qp1cDImhvBqblZDoyvUf4jmhE2mymXERBIiQ== 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=SLlbDZlZ3nLzA+OMshfpAja8xZBB1l8GJOD6tbMQ7pA=; b=MNcY7ilhVVvwPC0YoKlr+IW6RQETezAZ08TCkRA6IyYSbAQLFqVg8RrM51eUaA6cWo6ZTQ+e2I5vk77KXCH7XZhkGDBRv9ekbVktYNgyMqD7GQzCiCtjC/zzmp0hE3KOCVYaSTiHJ4uEnj6x6wJ7pwEUKRzyqYyXqMdyYrKNLpU= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SJ0PR10MB4543.namprd10.prod.outlook.com (2603:10b6:a03:2d9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Sat, 26 Oct 2024 07:25:17 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.014; Sat, 26 Oct 2024 07:25:17 +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 v6 3/5] tools: testing: separate out wait_for_pid() into helper header Date: Sat, 26 Oct 2024 08:24:59 +0100 Message-ID: <334ba78c4a6f4e58c60634709df26debf4b4de29.1729926229.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0389.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:f::17) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SJ0PR10MB4543:EE_ X-MS-Office365-Filtering-Correlation-Id: 0f2d9740-534d-4abd-70f6-08dcf58f56fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: eY20M5syZkPI+27aKfC1RLMwz6h6tBaY6PEIU1ANwk4Afwhkb8VUxiJhCBI0mN/1Kj4uw7tMMqC9dvaHUYWvp8tZacxlCvrhMoh7qGh7Rxk4zLpIhgAhoA+9QUenE/b6wt9FIGfLDISQ3zIz6DOKBoGUef6gmCuTM3xpGNT4coqk1n0lKxWFZP4CnwmbhP+9nEngX4Umm9sPD15A3HATM4H9iKLlKpnBp8mhKWoA66X8CRPkZhd+gY/Ne7PWF8plmXrFGgkDa2F2i6jdpys9UXOqVN6Df+xrW/w425qbRiEBGePS1kOsQ7jM+Iac7h3gfabvT0uNGZRCpR26bDqj7XnIr0cpVGHXoT6wVKXkERrN924t4n7C28vZn8wXFVHcFuDs/wxte5lMPMx2QuBZ7eUpBGWD9FnIYuywSs/dQbQ3SrG8N0x8RNLIo+GxbdWd0m4nxRrO8RYh7yBvcR2MGHmAXyHOlojo40Rou/W+rXDy/IK/OMoUxc+6nv7Y+VivD1kqYcejcgdxNlUzl5KEMPrz3og4mqUh0urVeMj5vqa9epld/begNms9sETIvdPiRWabS+9xM2H7LdPk7Q+ZC1QeOifNrjCOuqYMnlEG91g4krxBURyXUK+5FBjzrDwjoFuF/bsVvAxLW0/NRPDtDlZhSgLJ2h6QgQ/st+fHRjqLThHf0BHVIImHUCAQRSHrucu91oIePNJJ6ekjNi9cgnvpdNH2arjkrvoUo/za7SU1rlYzJivBZBegDDhrDJqoSf9+zb1FhAJNDk7hbNNE7UmJT1xxtqwfycP/ZNC5ypwAN30Gr82uvkeLcbrdWx6krLOdq6aWaRRQIOqbxf/GyO8bj3wX82rLdWBmDOV2PbBQimKRnUSeTyKFEwyp5DeIS1YxUXqdiPfqvumN8IS2Q1w7AIFfVZbmAPp7hAYrl3NoS3ygbJtaAH22voU4lDJOfh1my9IVhT8i5m4Euva7JDnoyQtp+5LVEGf9NPzoE9O9oF6UCEuHzBZazswHtlJjPs8Sx7Jg6JJQ2BZcKXTqsuP1De7HQrEpnRekSh64v/RXG6bRZ0I44YeZqa6swYv4d+lAxWddOrTYEU3tSPx6Sl7TduCvuztWMnUa/7vkqiW53skSz9dvhatSrkFcgoWnUKNsXLd5QbW+nJDdOgE08y6o9zV/ahCdG8XOM0kc2Xw20KyWP5M2L39QMD0MQkAdHSVQ1AzJ6JTrd6cRTKps/W/d6+pNuTQ8bVxTayL64yd8vs1cQgAprpw22oySJuJ6a4N0tJ5rKKVWZjrms0e3I1jVigAyUcXoIb84BXYvyYTtLUpSNyQ/1vop4xJ8tps0 X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SF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k6vn7e5VkQ/u3ogV84X0JvkJbVXWvGYsUJ58gWOv2zDp/xxQozXGHx97Bmj/8UAwrymIL10oTOW5E3wNUj2Jez7BtJfjxnpfQZHi+jIJlShD0MFQQzRaSTy0bvzvDpGMXmxDeTXodbwsaoUV1puCfFA8E6nnAEb+ZkcNnN/QZYyX8rp2XDc+DDMXFmWf3o4fxeLaCGwC4rArDQLjL8tp4zftlTQqzyGUFsYAYfoZBb8= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0f2d9740-534d-4abd-70f6-08dcf58f56fb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2024 07:25:17.0290 (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: LsARB6aulFmDebW5ZA/IqmfWfJF0kX0UP7psNSmXlqREAGoMv22sQVjOue3r66Yghtwf8JA5tDl9cV8+FuahN8MKUJXTpqxooysZb/wRrzg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4543 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-25_14,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 spamscore=0 mlxlogscore=999 mlxscore=0 suspectscore=0 adultscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410260060 X-Proofpoint-GUID: 0jM3AnRQHFUG9kVm2YZz7Pi2VNggFJyV X-Proofpoint-ORIG-GUID: 0jM3AnRQHFUG9kVm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OFPYyzi8ODYK62TWqSoaWwq+2+Kybo JlsFGfCK 3S0JBse5jQaGTChg9pQFzrQzhyJC43A1ODvasOx5QL/f0kzhDH4Qj0CKAzNHnwRNYCiwX9zwGEp4En7qOap2oOVqatyv0nZubY2Ki3n73zG/wRMZ19itByuaJ2Glqq3krwMiZ343cqgsPTVBTbj2EP1LmKthqtXC08IpJ88Z6a8pcVLIkfXmc7lKLlQS/DpY+cwzbg32U3jZo+A1hYi0P7oiJTMh0fNN3em3pUQNCdtYrRLyV7CGx8TlzW5DPWTGxdQ9bQfYzK7GwmAAXH+U4+KIfWs+d7X3d9SXCvetQgYQH+LhvEYUoE4NE85HV7Sz1Di6GgJlMxm+3/6gYZDSkn1Ocql6eTqDzYw6veDoaJef+89V4D6KNI0F/42gKyLAJv7JsG28QYFfix+gyQxb7aK6B1ot12jM8WUnH/32uv9f2sLwbCzUCzMcI7yygzmJgSH8pqnb4xPt3pRmtTolKG9oEfghcSGm6m9+KfbAipXUCAKsdsCmQrEqIeqvyN4IV2+EVeMLT/sP9VowY+diJ8qK3RRmZln0FnNkw+bQfbR+Eh1Jvpyv9j/V2KNd0TchC+D8Sj4ForUt1xUH38/RMqXQp54MuUrVYXnUzpx16D4o2234vWhsNoBri99eRPuDvOqRn8GIsPVGR2kRZbnp7L6tEBd+tsgrMYOseviD6iIDLWk4= 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: It seems tests other than the pidfd tests use the wait_for_pid() function declared in pidfd.h. Since we will shortly be modifying pidfd.h in a way that might clash with other tests, separate this out and update tests accordingly. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/cgroup/test_kill.c | 2 +- .../pid_namespace/regression_enomem.c | 2 +- tools/testing/selftests/pidfd/pidfd.h | 26 +------------ tools/testing/selftests/pidfd/pidfd_helpers.h | 39 +++++++++++++++++++ 4 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 tools/testing/selftests/pidfd/pidfd_helpers.h diff --git a/tools/testing/selftests/cgroup/test_kill.c b/tools/testing/selftests/cgroup/test_kill.c index 0e5bb6c7307a..2367f645fe89 100644 --- a/tools/testing/selftests/cgroup/test_kill.c +++ b/tools/testing/selftests/cgroup/test_kill.c @@ -10,7 +10,7 @@ #include #include "../kselftest.h" -#include "../pidfd/pidfd.h" +#include "../pidfd/pidfd_helpers.h" #include "cgroup_util.h" /* diff --git a/tools/testing/selftests/pid_namespace/regression_enomem.c b/tools/testing/selftests/pid_namespace/regression_enomem.c index 7d84097ad45c..f3e6989c8069 100644 --- a/tools/testing/selftests/pid_namespace/regression_enomem.c +++ b/tools/testing/selftests/pid_namespace/regression_enomem.c @@ -12,7 +12,7 @@ #include #include "../kselftest_harness.h" -#include "../pidfd/pidfd.h" +#include "../pidfd/pidfd_helpers.h" /* * Regression test for: diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h index 88d6830ee004..0f3fc51cec73 100644 --- a/tools/testing/selftests/pidfd/pidfd.h +++ b/tools/testing/selftests/pidfd/pidfd.h @@ -17,6 +17,7 @@ #include #include "../kselftest.h" +#include "pidfd_helpers.h" #ifndef P_PIDFD #define P_PIDFD 3 @@ -68,31 +69,6 @@ #define PIDFD_SKIP 3 #define PIDFD_XFAIL 4 -static inline int wait_for_pid(pid_t pid) -{ - int status, ret; - -again: - ret = waitpid(pid, &status, 0); - if (ret == -1) { - if (errno == EINTR) - goto again; - - ksft_print_msg("waitpid returned -1, errno=%d\n", errno); - return -1; - } - - if (!WIFEXITED(status)) { - ksft_print_msg( - "waitpid !WIFEXITED, WIFSIGNALED=%d, WTERMSIG=%d\n", - WIFSIGNALED(status), WTERMSIG(status)); - return -1; - } - - ret = WEXITSTATUS(status); - return ret; -} - static inline int sys_pidfd_open(pid_t pid, unsigned int flags) { return syscall(__NR_pidfd_open, pid, flags); diff --git a/tools/testing/selftests/pidfd/pidfd_helpers.h b/tools/testing/selftests/pidfd/pidfd_helpers.h new file mode 100644 index 000000000000..5637bfe888de --- /dev/null +++ b/tools/testing/selftests/pidfd/pidfd_helpers.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __PIDFD_HELPERS_H +#define __PIDFD_HELPERS_H + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include "../kselftest.h" + +static inline int wait_for_pid(pid_t pid) +{ + int status, ret; + +again: + ret = waitpid(pid, &status, 0); + if (ret == -1) { + if (errno == EINTR) + goto again; + + ksft_print_msg("waitpid returned -1, errno=%d\n", errno); + return -1; + } + + if (!WIFEXITED(status)) { + ksft_print_msg( + "waitpid !WIFEXITED, WIFSIGNALED=%d, WTERMSIG=%d\n", + WIFSIGNALED(status), WTERMSIG(status)); + return -1; + } + + ret = WEXITSTATUS(status); + return ret; +} + +#endif /* __PIDFD_HELPERS_H */ From patchwork Sat Oct 26 07:25:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13852104 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 884A0D10BE5 for ; Sat, 26 Oct 2024 07:25:36 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D43886B0089; Sat, 26 Oct 2024 03:25:34 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id CCBCD6B008A; Sat, 26 Oct 2024 03:25:34 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A34456B008C; Sat, 26 Oct 2024 03:25:34 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8019C6B0089 for ; Sat, 26 Oct 2024 03:25:34 -0400 (EDT) Received: from smtpin30.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id DE0A11C7336 for ; Sat, 26 Oct 2024 07:25:10 +0000 (UTC) X-FDA: 82714917558.30.9B92B93 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf22.hostedemail.com (Postfix) with ESMTP id 95E7BC000F for ; Sat, 26 Oct 2024 07:25:05 +0000 (UTC) Authentication-Results: imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=FKjxNgI0; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rb3ZBBtg; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf22.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=1729927404; a=rsa-sha256; cv=pass; b=j1p84xgZ7WPLnhqO8WVTMrduMfbuAcSmLk6KMSPo2dQR6phm1JdQ+b98txqmsrMiyHfI54 IUigkL7sYhuz+AiPZRQ1foNYbGnFKFi7OMDCxfdRtfLdB6I0AF5nMnXUFRQFgClZgMxCAf qxxrSbyqiILXBqtLhhDDVK2AxcCBFCU= ARC-Authentication-Results: i=2; imf22.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=FKjxNgI0; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=rb3ZBBtg; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf22.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=1729927404; 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:in-reply-to:references:references:dkim-signature; bh=//aIKsfakC4UDo1gdtqhmI6TrmfLl1HZuQqSyReu2Fg=; b=eVbKOv8iAcJRWkk5HUkz+Ghq9T6sOEZekaH6Um762vkA6gZTM4mCzgn4Dt+xhOIOXmOrkE wnCtqIccYCm9kCd8Gc9y5GZfWbLVO1Eu1teRAyM6HEGO5lyWQu0H5bHxVUAOIzdFWUQALn sDx83UvfHgLTj9padp/TdguvwLVcI60= Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49Q4CPtA019896; Sat, 26 Oct 2024 07:25:23 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=//aIKsfakC4UDo1gdtqhmI6TrmfLl1HZuQqSyReu2Fg=; b= FKjxNgI0jpufHS7K0sdlNOuPC+tXa37xtdLgGhxvYQD6elrrSrq0iXrFNn7fUpES S/FvXQSfrgOsr7kEUYxnv1I+B1sfuqCfZoc1hrNP7Rcq9I6pHz0yCMwkRkvrr3u6 C3rJTv8FmtnBRAj5ppS7e7kXv2ttLTUklXUgEeJdDFisdzdtx2suC37KqkVqCnsu sc5fBjUqUc4EcJVSHI25zEJOQ+b4XcyHwPlmrsitDVqqRl2juAbys/WPF9uTr62T ApYPZ7MG7p0nMcAO5s+gKNr+ZQ70th/yF1dEV0dgJ+8avBHEZLxhVeRnaz6/YwxE caDK6lgRX6LirL4QYJBHHg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grgw84md-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Oct 2024 07:25:23 +0000 (GMT) Received: from pps.filterd (phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49Q71Gbd016456; Sat, 26 Oct 2024 07:25:22 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2049.outbound.protection.outlook.com [104.47.70.49]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42gpv44vtq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Oct 2024 07:25:22 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sHEECgoInfWP09Qa6wRPpev3IO2Q+D9VAB4nPnFaKM9QL5Lcd4QQIArVQvnCpYhy25ohSDRMyyW6e4bMUtp59MlXaet7TR8oo0R5SosWfvKlUwDo6zLHiZjfzFovqXpLUk5Q2lteKcEpJUqAwg/TpDjtS24D2WX8+dAchLEXawnQQeY93qrdsmiUSqTP2orCByFj3q8X84KqS8j/o9cvhYrFs5BIvx1GKK3d7gF/Sg2I1Pc7pW3Vda9GyNzwvoA9lPv1vyZyxFUd82fwgR9DP1nTtIndCmRCYL7l3ymc/4A4D6RKF9H8yToJzkksP6NIqeJyxruwtYwAdYV7j7gK5Q== 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=//aIKsfakC4UDo1gdtqhmI6TrmfLl1HZuQqSyReu2Fg=; b=X8c0MolUxsGy0+tNJXh5DBLzi0QIeNkqDABZ7GxOHPtKOgHnsvHllchqg/yVAOI9sYxdI+Zs8TyxLpPAjWyQh/OALgXEydbB2SFGoVsdnvkvtJ5mNHYfS/R2hOcQ7hZkQz9DVnOg/i5qLeKnH6gjgTV0RUsgAaMGaAUfyGDWHgZbMKjcoKOLQq6+rb11VksxfnMLPLLoP7fC6hzO9NBUXFQZf0qeK/3YOa4q4jftnmri8C6JBQEIxjnIqPLrT4PyB9//b4QtOKIiCiL865lzmyyqvC44BFvUDfbHWi8jPTjlEt1J+M5J4NCp3DKkcO/zJZmYqRUj6VJAGkoSibXBBw== 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=//aIKsfakC4UDo1gdtqhmI6TrmfLl1HZuQqSyReu2Fg=; b=rb3ZBBtgd6llz+TWLplmkYOYmrzqoU6zaVu1VV1t32phWPVPHbACeqen8+IZlf3L3F0jPv/pL8n7pJbGMkwZD3otu+lQ4nkO3eYTuEYVpN8gqjmy3Mc7LRdB8zbU4HTqekkQmRglpsrXhT7ylEgjQSt31UWJrgd4nLU8psSEbWk= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SJ0PR10MB4543.namprd10.prod.outlook.com (2603:10b6:a03:2d9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Sat, 26 Oct 2024 07:25:19 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.014; Sat, 26 Oct 2024 07:25:19 +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 v6 4/5] selftests: pidfd: add pidfd.h UAPI wrapper Date: Sat, 26 Oct 2024 08:25:00 +0100 Message-ID: <185b546439c29e9c36272462768af014a262985a.1729926229.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0109.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2c3::13) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SJ0PR10MB4543:EE_ X-MS-Office365-Filtering-Correlation-Id: 28d26bbb-28f9-4e84-126c-08dcf58f58b9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: Am2cCXO6PfuZ7ExJlpXoaxYpeAtgIA5DfV2Cn8Fmy/ia53WY/82hMq1nWrsupqwSqVnGWPRjHLeaHQgXrpi6y/PEAwjV/zOzoh+SgeOiejuAgT10hrTBNfC5pk5rewGCn/JFaAV3hni4jTOiozLIA2isTU+9dNCLkmPv7YqGC+CZWxdSyOf7dLzS0ic+twJgLhvzUYhxMQa9/F+sHZwSye/zToFxw9bbO+2Lk4n/WqHRGVGRFhihlv+IEbbX+Zs7AehKerQ7RD66hn40XE5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Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: Aw8tl1A8/mOq/6H8o1T9AdRHiuZxU0fBPIR+98nBHKQUrIts6UZPuy6M/t/lu8LbVB290I6rTABLVuLmbPIQyISjk5Ux9J61lneZofTdlYIy63VJb8eVIUEP9necLtrKYZwkWf55k56sG6q10LIMifIo836Tw99JCtUjmAPYydU3m/q+r8tQSaAqSmLP3HIaQi94TAoZdA0R44huLMBVBuvmOUYsLpO3RErzCmXFgGCE5rC2sqGeUCfxT8G7AC2GtCGjuTVmE+gaxquk9UMuTqnyH2yJO9Dr4jnemUmUEqTwnzZPaXS86v218CTYrESbObzOmp4+TtwO876IZyM3YT0kqnrRSnk2zEebpXRw+eFhjV5kVTLm+5UlMfRZXa5dSRODtvdsncnSd3TGoC2W8DBIdEpAcYqwVxmZaZuK66oOMZc+0lkWHtNDjEJwOf6YCDcmJa5QHVgDRjQMIRlcO6pvVeA6ZUOXgkXI7I1/kVyfikbJpTIEC+1uxB50Fy6ehO1AxnEyJXgWHK3jM8Wm73bpcGAzOuDbuMamJAtEjzGnpBQPHDkFkh6cPbnT6RsowccR3vdwXNTtBV3EFfCbtO9i0lQ4TGOVDWgX8K3yMzwYzkraGOHgv1Yw0uiM8sLq3cY6j+XzU2z04GOo8zh8tSKvguWFoU1WAfWYvi0kxGvVZYK6NCqPjU6kepp+Dn8nt/uLo+c6a1dX2BqLDKSk0TRXMof6jbdmRhx7TVjtfHbKLYjguCec9W/xcVIg0N1CTrTnaYTy890gW4J0L9E6qaqI9J0GXSTiv39CZm/eaFtptVme2a31tKXLHRkE6KYaS1c+mkcDt7ToZqwCo1N8Fbdtbpejv0xwpac+/BOeg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R2wqPfj4E8lABt8+ClNXsbsO7emaIWvkP1lHKH010xTdMxNtW+qkxFVVo3ENnJ+A7pzmbUsq+aRsS1cSJ9CoNd1B7/dJcGLOFwLD9wXRSLqMpANtrQSqC4Fyq2vM482b/1qWY+kcU5g+av3ZmTCJQnusF2Ko5jPUWW9KeZB9M8TXXNQP+LM7N1KyIIgxmbZtVrqbTbxUnv+JnlE8iq1a8nOshdFRXkSrUVkqj6qvBT2d72ZU8FJZWMxi8/SxX7gn/TiESHjffR5oY0qmpd1DJXJ5wrV8UkQER9n1upsh1KvAulI6OUQ82N0GKGZQ7648qZg0G/Y0n+K/8QsiboIbIM5EpenkcU66oxKTEydbCB4y6/QdfD3a4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 28d26bbb-28f9-4e84-126c-08dcf58f58b9 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2024 07:25:19.8133 (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: p3ruLJlrA+9xs1Vrn7L6iGYzhcHuDMqJmhkxwiwQVzJKD49dMrZT3g4Vp/mPTMIa8zYFBQYD8/5HeCOfrcNVdT9QzEjBUcJGpuzz9LISliw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4543 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-25_14,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 phishscore=0 adultscore=0 bulkscore=0 suspectscore=0 mlxscore=0 spamscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410260060 X-Proofpoint-ORIG-GUID: Gaq-OBWvUkuEf77HGwlNH2BC56nN9RUp X-Proofpoint-GUID: Gaq-OBWvUkuEf77HGwlNH2BC56nN9RUp X-Rspamd-Server: rspam12 X-Rspamd-Queue-Id: 95E7BC000F X-Stat-Signature: gc4x5jcrt1oro19fqu3qhiqy4w65fr54 X-Rspam-User: X-HE-Tag: 1729927505-848001 X-HE-Meta: U2FsdGVkX19ugjiiLfFI8mpp1MyshOAIc0Y/Urec7yDab0oG6Nfne3qA7m+s+9AYkkCQlcms6CLj5LN9EmjEMAY2nDeZQRsGDDhJlTI0/sjSCSDVT/wYgCLksLBClS2PP8+cRsPJWYSk0BJ46bVlmZFgrjtfuXuVEHlMOoAgPFwGRl0DMtY0hp4hi9oC2lPCWQ5HFc5C5jA7pdBqtFXmMh96ALhny+N35U1IBRpVywFtXU9fiBimscAtKVBBgnS1WZfDNCdbEBJWUHJ0b25xSftxkAoHuWJftqHm3ep0758tu77wbrYmsBnhiADwcMEBRSIXcFkQ7dqCl2t5yO8B7xV+H7ZWpDL8toVp/fKshSem7s2uGpQL9DQl+Bi6VeCieEnGag1QHRYOXOhSWTqvEU65vz5dnIRxI8+treHBgK1B6SZNCfNgoiRQlpM1gfPYGW5Yy2ktwMXSUYZkz/JzAgAyWyRg/EWE4Is/D1zrS4mAePv72eBjeN4dXrl5UftgB7W8S1+RBrsmt27DfAraxnhnigYbzP5Sp0qWlgJZAg1iZMR3PuBqwfG9RP6uucyp9wOijlOMiwXsgptbXhcTCxqG4PAvwd59CeTRl4j6HmfhiJs5GbnweoyEZkqB8ej7nmOT1cxYErP7B4Kpjac+mkBOZw/ZVG0D3maguKkSwFq1EMMlhbF94XR0L9rQLEAIU/Nf+ZQgUrMfVYw7LYIwpKtkHgmdQIEMjIClx/Fr6R30N1RYej7ue37odwIKcDpq70kbm45XW29NyRRg0zgaRfk1CGDpX368Sxuk8BYIu15y1gIj44masJ9NOV82L8Ae2rYOJGKjqATArwMndQVLTzPOroAtXBuk7lF8mF1vu7ywJMV32L+ij1WtXGFThf/9QCDqkdwOE8ZlyYL6SHDeTpPYx0bh8JD+kyI6X5ed59omuglMabBjmOTMA/EBGws4sctaG+xlPi3QLq1Q8iN iMgmKI2a I3zOiFEkZfS1VHx6nTwUJk0QfAZeu/dzMIsX1Qqe3Q1Tz9KcIedW1jTAyAvv/6aSykNCzGRLJsiXEU2jSuQW1G5Fnnqs9Zc+3F+a9/MzU20+GIgndWiM3bChZpP7iZ+y8ho0ChCPbkWbPQvAvuc6TofVnVW90cPAHiFTTAdUxyx90aNjWLT7/KfpJEqsIwFbMhF3KeivzhufDfM0CyHcDF1AJiZ90mVpuGbMNWo3tsZQHztgYphTiNd4Jnb/ZPDT6jHMrCCMF2kzySfPV0FCE0Xl4oSWZkyMvmnYvo1Ii9rKDaVrqaYVR73FVcAL+HxXCSkL0luo9iot1gP4ssNeqOCbq98XxRK44Zi2rkBj6aybJJVF0kKJh7WBlPAWh2aXsK1TAfZQzmAtK42LEcxROPFEySMxRVP7U5/f3m77l5VcqjuEwAGZW4P1nH/0i9KLHEGevcMzILqrLq3UAvM7AeyskxdiJmihI38pySPv1FoGmOo11W4RqKyXD9j2xrMmcuv6HmXlh1hFUlz0RM2h+yXUqOJt1hQ6Nfmb3JJb5U08eO3Rlrp8L3CUjfwDwWrnKGUhK0UCl4j0hjoHBPvl6yhKDAR1rubsZBMbLxC5dQkcaVOonYPWDhwb2vfarIRfuTIyXohQ51w/wxX+wZAjpobIX2TXac8EGABiP+5OwXelOuOmlt1qROL9HlXYs/VE9sc5CL0rHZOop+3QrR4WJjKRbUH4Nh5Poxno+ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000015, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Conflicts can arise between system fcntl.h and linux/fcntl.h, imported by the linux/pidfd.h UAPI header. Work around this by adding a wrapper for linux/pidfd.h to tools/include/ which sets the linux/fcntl.h header guard ahead of importing the pidfd.h header file. Adjust the pidfd selftests Makefile to reference this include directory and put it at a higher precidence than any make header installed headers to ensure the wrapper is preferred. This way we can directly import the UAPI header file without issue, use the latest system header file without having to duplicate anything. Reviewed-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/include/linux/pidfd.h | 14 ++++++++++++++ tools/testing/selftests/pidfd/Makefile | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tools/include/linux/pidfd.h diff --git a/tools/include/linux/pidfd.h b/tools/include/linux/pidfd.h new file mode 100644 index 000000000000..113c8023072d --- /dev/null +++ b/tools/include/linux/pidfd.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _TOOLS_LINUX_PIDFD_H +#define _TOOLS_LINUX_PIDFD_H + +/* + * Some systems have issues with the linux/fcntl.h import in linux/pidfd.h, so + * work around this by setting the header guard. + */ +#define _LINUX_FCNTL_H +#include "../../../include/uapi/linux/pidfd.h" +#undef _LINUX_FCNTL_H + +#endif /* _TOOLS_LINUX_PIDFD_H */ diff --git a/tools/testing/selftests/pidfd/Makefile b/tools/testing/selftests/pidfd/Makefile index d731e3e76d5b..f5038c9dae14 100644 --- a/tools/testing/selftests/pidfd/Makefile +++ b/tools/testing/selftests/pidfd/Makefile @@ -1,8 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only -CFLAGS += -g $(KHDR_INCLUDES) -pthread -Wall +CFLAGS += -g -isystem $(top_srcdir)/tools/include $(KHDR_INCLUDES) -pthread -Wall TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \ pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test include ../lib.mk - From patchwork Sat Oct 26 07:25:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13852105 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 29BA2D10BE8 for ; Sat, 26 Oct 2024 07:25:39 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 8D8CF6B008A; Sat, 26 Oct 2024 03:25:37 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 813CB6B008C; Sat, 26 Oct 2024 03:25:37 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 503CB6B0092; Sat, 26 Oct 2024 03:25:37 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0015.hostedemail.com [216.40.44.15]) by kanga.kvack.org (Postfix) with ESMTP id 21A816B008A for ; Sat, 26 Oct 2024 03:25:37 -0400 (EDT) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 1344CC037B for ; Sat, 26 Oct 2024 07:25:15 +0000 (UTC) X-FDA: 82714917264.01.3DCEFD4 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf16.hostedemail.com (Postfix) with ESMTP id 26F4E180003 for ; Sat, 26 Oct 2024 07:25:12 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="Q/KnNi3u"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=UVBJ97sw; arc=pass ("microsoft.com:s=arcselector10001:i=1"); 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; dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729927378; 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:in-reply-to:references:references:dkim-signature; bh=wY6kdgChMItf6mowLK+7M+e6qDkjxAzv9eXffTxVzSk=; b=GUzOvJRFXe0bk8HWXU4QnNSkGqrqnmPeIqecDNhpFU2kDZNvPgcWw626fG44aLHX1/hX/i QiET5e9+UHL2vrru1eqgTFtLj8i0IH9hjQhhbWFEuJF9T5tCwBEkGKf5upC9yu7IsQmKlT oFji9SRvfAzjWD88X3sT1fior6cMDxQ= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729927378; a=rsa-sha256; cv=pass; b=wgmoofQq/c62MZ6YzB4iJbBxSeZ0jGnzD9OGa9Vsv16Ciui23Yb9fceAtv1tWYPPILfrbB +9njQ2BBlTH58mONVycxtadAgxFO9qclP5VpiyFaxzw8tQBI3igLnnCugsqTS9/1mNptU4 VI5ZGhKzZIGIFYahnU6RS1dcmI97NiY= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="Q/KnNi3u"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=UVBJ97sw; arc=pass ("microsoft.com:s=arcselector10001:i=1"); 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; dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49Q5qHOd017637; Sat, 26 Oct 2024 07:25:26 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=wY6kdgChMItf6mowLK+7M+e6qDkjxAzv9eXffTxVzSk=; b= Q/KnNi3uK/iBAMboyb+Hdnx30+MrM4tA0kc6D75M0UZLJ/dLx4HY7jEZYSjJ912u aL9wUWSsgDzc7g6WM4cNXHc8b8xNHaGvNk2DOceGHp8Po62iOxaDMmw0e9DfFYfU AXd9OIY36ovBQ0nQ7AM/l4XbV85zWTiQOWpOc4Qer+5XahLRN6M1lzYGOVPlbMLe FN/lnky9q25BmdQuLHPsjCMYwn0qfybbZJRbrOmfTiOrmg0kPtScf8gtG4rfMTa0 AebA905pN/QMWBg3hwMQQmF17PcLHFSYbFvlSL78+Y6P4oSLIbsx6/XN9ZVeNch3 cMh/HEI2puoTZHds71KZ9g== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42grc8r4r5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Oct 2024 07:25:25 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49Q3E028031353; Sat, 26 Oct 2024 07:25:24 GMT Received: from nam10-bn7-obe.outbound.protection.outlook.com (mail-bn7nam10lp2047.outbound.protection.outlook.com [104.47.70.47]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42gpvacxv8-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 26 Oct 2024 07:25:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=jQjCs2PRcNSO33s5Z6P/BuCU3/wHAV6tiwnu9paaRdKS1lXMV6HJTmbNzz8KXOD/724DA3Qstz78AkdxUEpQDX3I4N79kXWdS26H4s0MJPW0k44Wo7wVxvgW4rzIKhRwao9WH+BqMY5cXn/JP7bpRfwrHbkWvzsJuzPDMf9Ae9eSGU1v5CTMX1C3oraHralA0xBFC0FqBYFlsbDByOzFYlBwZuMa6lAzCkV8qoqph2bjKeX87wTKNQAbRgCkP+rP8nUWoIFw+E9rBRNKViI+rCoFIPD6S4auy6YbqEH1sZE6yIvmQ/obU6rRXRNOiVB3MtRttJezaT4OstRuZ+SzbA== 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=wY6kdgChMItf6mowLK+7M+e6qDkjxAzv9eXffTxVzSk=; b=kw6B4el9+XyugaUKQ0y2MLJFwcMLBF9tsaqsfArMyAtdBeORNJSe/a0b3LtkSsiEnvVB2MUM1/5nlA0d3FixpmBzpXzB1yu7IqwkFjZktOjIWID3R308yjR9FUMh1DUSCDMqTEZ6PKDIBWL0KDQpH63VMbMbE276N8h1rGJd7ZtlekgAUMai5e5EcmrSUl9jMhov3CY66zaPuEJFC5K5uCs4XcR0eLNLSJsGIKxUQOPi+b7foHD3ku2FJuddqsgiFxkC/ZXFVJp2Qxxli38DrvY9PXW4TbCkSjRCJtZ9m/6arB87V37E62N7RdEAZY/p5Y9eLnTPRZMfeeMg49+HQw== 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=wY6kdgChMItf6mowLK+7M+e6qDkjxAzv9eXffTxVzSk=; b=UVBJ97sw4vcw9F43zbZ1OkghdQtdoHiFBwATXBy6ehabfGpwgXW2bjhHQPy9OslIBGPMp56RLtFPWYawLl7Ud1YNkceX5ErHU8OXxAPvImCR9aD8j/zEFCUg7EBlb+Brg0ckvYEWiLWZAlSnkRL3LQwW9n9dgptOBBlZdIAuhLY= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SJ0PR10MB4543.namprd10.prod.outlook.com (2603:10b6:a03:2d9::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.23; Sat, 26 Oct 2024 07:25:22 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.014; Sat, 26 Oct 2024 07:25:22 +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 v6 5/5] selftests: pidfd: add tests for PIDFD_SELF_* Date: Sat, 26 Oct 2024 08:25:01 +0100 Message-ID: <57394004d602b648818d4a2809e599ea967997f6.1729926229.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0203.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:318::17) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SJ0PR10MB4543:EE_ X-MS-Office365-Filtering-Correlation-Id: f1708817-4a43-43eb-0790-08dcf58f5a53 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: l/XJLk2IX2wKblQwaSTS7Vgyr8Njbov/dziH8lxhCeSow/H8JdR/+q21hIAdiUGtBuPhQHceB+JPZMduax5q51fq/WxMfb1undEQJEUaTnKsg/vs48zrZ8xkZlGerxhQIALN56LEZlrCgLZgNqKpY2FR7cjGoj+x74ee0EAnHRyD/grEETNuFQIq/6L72l5qfDLleDw6pgE+Rgy4o4QOMxqZDf7phdDHKEP6rWWcn4U06mmsiY5iYWywd06Nbkfxk1ERRVPUOlf7pMNObeGTyEr3c0Gvc2znIdr+AXnYOhDWgWc1c0TiGyAmWBrC3AIME4Qx2lQ4zu6Y9ER2bqrNvYkRp0PN7poebR78G0pOloNjcCZq/xtX3utRx2R6G2eGzH1WoTWX9DKzqFsTQJVeGjuyBscwVWuzJYvvqof8gcD5Y491h2xYxpNTDfwLR6SzFU9cLX8Y1DA5S3l3/PEogSY2/YLysrugRZsGcJ14W17RZoNyltWD0XR3kSkSofnavixXz42T5eO9UFwnhI9ajVmb5ywwUJpS+akaSVqqiEcoF5DkHSfg4qXja4fCyPf1cCUDN4ySfGWl6WfX8gJt4XtwMRFgbem1ev3/IMBV7FQhc+YCjaX5Oad3G7OnUefcnm1ZndL1Lb+EfSLP6lQ8sKEk9eL7j4sK+HQZG+7uvwfFRJ2byvqHsbmGJgP79uTeFiAkdL9kvoA1BpNtzxa7BbwdLG+z2cjoULvNWTpmeVtqCdEt7b5gMT2SiF+JzaE/g6TX6Yzm+PdErR6lvJZf7spDt1aJC/kKUSsYDCu83p7Ya6oKlUzBhJoBSCM2jD89od8jM/mbRgX9yH/Ozzsq93yOVYvhvyg81lfEyg7G6cILLVXvAPXN26USvE+PwWQvCL3kW2+4XjBqJq4/JE9/q9vVOBgrzHr1s5RSPk+/v+7RZFFOVbZyK9unEIjy8DgHloljSxLVf72j6IG/Z4PJ2fL7zavFsjO383nM7+HtLU+nLpIhvFO05FIyg+yEAKq6nPjxaFoo/u+Y/EmF8Tqij13n+cw3O3Qgt6S6wPaKf04M2eBTEVtO/yI5szscqQy76VOT+XZZ558Zz+Fez8jOnIFE114oU4GH0X8gk1sT8tkvK8hwlEEfrJUB7aDKjXcpl1fg/okT+2/lvwzJnEAODG+RDza2x/2Z2wAgAdW+9JdSSS6jdzesyNloKriM/tfQ7osK3mdbv+LCl3TgmlGIxLQuIrja8FFy6sl1TD5KzFalv4/hY+U22C//xKmBv156+xTSZlB3rs6qHF9ncPnXznCj7IEnArL7REmTrwTp3ok= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: JpThJQrw0XMmvxso6xuL06a2e7Ss6EB8iUf1jdMjsDmkKvPe7URNPBfW6Fat126p0jnPQ9TqrEcAGDiYV2fY4TqvXrIZqu5oBbHp68dwmANJMTj2flvnfee8MhIwnx/+sC8OkWda25/TMAzz/MsRwDFOvFJeLl+fxrNDQ06LE6HRW2fV0s7GOxZp5jU5LWDIQRX/XQSsb9aSyHTCn2CSSzjN6Q/bXjPuwfgrrf3yHkUzw3TScm0s3u/bFXdn+RkoygO8QEtVk7BDWneXSuwe1nd4UggbP/r/vxEsOv02tqkhhzD0a7n4DkKLbD4+yDW5OM//FdnzwTuHJOoUG8tVUsb4VdZ1GKjgy8rKm1ReGqWD6Bdmp41mYBwrxkWZ6CgAV2LSA01Y8hWKGWVtGWfuyy2tpG4c/7OlJnqndMDkBWxL7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eFyNMtsHKufpwh5PMJ1+5yk04Zhoiu09vgTXsmn4yEQoMgs6i9n09I7TJtgGTFouNHmd71lXZAUo4LuPe5Z2TrkTwGBjxz8oxgeuoKNcmM6WaxJNDYMZDmRK8hWehoorP0iA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: QYS0daoIaemHEcJsk8wOl253G4/4mWD6RihMpWDmsRrf41UOvQeAO9omN1MT0wZnoc4bpyritK3vIHCoq92vfjHM5JjSgpg2IRZGGF0cxX6zeHyiENq+DK4O4sQKlFwlRYL6oCO5yxtfhuTd3J7uzQcmm5gd0pv2jlPTKqWdQI1ltCDlY4XCdddVkdsYnbTxbKgQC/fYAdL1MlxVRHiMm08ZYOopRY1SnsAWXvzO7AdTGPVF46eMidqDJ6GAGEk7ugMFrZREbkeu30Bv13Ox8ZYo3TOyfuiooa6Fxo+fOXJH9naqR14RwWjoCMKEdg5vQKdTSvw+u1K1Mgp54/UUfxriFPKQbDQOYA0Iw9aWhHVhB2c2noHOQkiaJW9rJWMtLE7flGMvwStiONN4Q2M6sjW7QYgj7hCE+DK9TnrXVXQ5ewKzRK/b3yfJrbxR2HLZM322c0zVndLyGgR7GUwotwlIS63BN7Sxa+8Lb7fzcYe61EcXD80nZPi5ytDWF7kKkA/8rT0iuwzMKEVwigR5lPtrE5pNvUFot/ZI9JUHhYNYP//mhji9+be/HcsTaGptPCB0Pd2DvyTh42oW8RjGKnXDn47iDZybj3HbSE8V4bs= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f1708817-4a43-43eb-0790-08dcf58f5a53 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Oct 2024 07:25:22.5168 (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: TTml4uQPcxgERo+OD7jzQ8uwCP6lw63T+s1S9mdXdUhLwcaSXAKairROPcO9twQeAvyV3gebj2C6Did3f7cwjeaGfu7WLyJqm09LVkvAMWo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ0PR10MB4543 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-25_14,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 mlxscore=0 bulkscore=0 suspectscore=0 spamscore=0 mlxlogscore=999 phishscore=0 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410260060 X-Proofpoint-GUID: Imd0_rXcSwhwayZgf4R56LFD8soy3VqW X-Proofpoint-ORIG-GUID: Imd0_rXcSwhwayZgf4R56LFD8soy3VqW X-Rspam-User: X-Rspamd-Server: rspam04 X-Rspamd-Queue-Id: 26F4E180003 X-Stat-Signature: iwdf3m6f5stqgsdztwoh73qfq5eehjxa X-HE-Tag: 1729927512-87541 X-HE-Meta: U2FsdGVkX18MHsb9hIRaWIhzttBify6vMNv3D0ZP9+pwBGieu7D3PaNtSVXMngyInVsFP50xO60p/xSWR9t1yaYEupQpOpheBcLgtRYsSp0SCAhtnlQFgBVWi5yuuPj5uad72XnowaZBDQbFaCFA9R3wlPJcWGpcerB1ntlKrNiIvzCDnNJDpiRtRg5ZqCnyWGJnO5HIw/wm8xH4Tka3XByTlQqbLhwI6Xc0LpGNWfAz8HUDVom/oa1qp+Tm5HIzGSIWucpuylbFZfefhqn1oL9YfavDOU/fx1aM9dv4l83tadus/FEFdbcgRj1grNFBApdY1sizSTtMIGpAcRk4bOrMbB5cNksp0K+EFOhSEVtwEUEpf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XGZZdQFUJDiQhhLOZ07v1fgId+30wEL0sCFjnPRHanR3M5GOAjyBirU5HYdV9mAiHijMaoFPGIyB0P+yVYYsQ7MaW/gA6jhIgOjkVrYawN3ko5WyJDlMYMj5XA1N1s91andZApSj8cY61X5Vz0Sawp0WjNz3FF8DSKiVHNHA80L+3IfFBV3YUBTtRzG5bfbXEOgvh3nEo0qAK02+hgaIcWKVZp42JngKF+5XSNm3C6Axm0Cs8qDKkBrdqHScqZYlejXz66jXmxYK5LKPworXTTZUrh4eHN70IGl/2Tg3+YZ9M7coXN2PtfaUUiH/+MhS60H+8tgKaGBqxxMYw== 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: Add tests to assert that PIDFD_SELF_* correctly refers to the current thread and process. This is only practically meaningful to pidfd_send_signal() and pidfd_getfd(), but also explicitly test that we disallow this feature for setns() where it would make no sense. We cannot reasonably wait on ourself using waitid(P_PIDFD, ...) so while in theory PIDFD_SELF_* would work here, we'd be left blocked if we tried it. We defer testing of mm-specific functionality which uses pidfd, namely process_madvise() and process_mrelease() to mm testing (though note the latter can not be sensibly tested as it would require the testing process to be dying). Reviewed-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- 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 ++++++++-- 4 files changed, 218 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h index 0f3fc51cec73..1dbe48c1cf46 100644 --- a/tools/testing/selftests/pidfd/pidfd.h +++ b/tools/testing/selftests/pidfd/pidfd.h @@ -16,6 +16,8 @@ #include #include +#include + #include "../kselftest.h" #include "pidfd_helpers.h" diff --git a/tools/testing/selftests/pidfd/pidfd_getfd_test.c b/tools/testing/selftests/pidfd/pidfd_getfd_test.c index cd51d547b751..48d224b13c01 100644 --- a/tools/testing/selftests/pidfd/pidfd_getfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_getfd_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #include @@ -114,6 +116,94 @@ static int child(int sk) return ret; } +static int __pidfd_self_thread_worker(unsigned long page_size) +{ + int memfd; + int newfd; + char *ptr; + int err = 0; + + /* + * Unshare our FDs so we have our own set. This means + * PIDFD_SELF_THREAD_GROUP will fal. + */ + if (unshare(CLONE_FILES) < 0) { + err = -errno; + goto exit; + } + + /* Truncate, map in and write to our memfd. */ + memfd = sys_memfd_create("test_self_child", 0); + if (memfd < 0) { + err = -errno; + goto exit; + } + + if (ftruncate(memfd, page_size)) { + err = -errno; + goto exit_close_memfd; + } + + ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED, memfd, 0); + if (ptr == MAP_FAILED) { + err = -errno; + goto exit_close_memfd; + } + ptr[0] = 'y'; + if (munmap(ptr, page_size)) { + err = -errno; + goto exit_close_memfd; + } + + /* Get a thread-local duplicate of our memfd. */ + newfd = sys_pidfd_getfd(PIDFD_SELF_THREAD, memfd, 0); + if (newfd < 0) { + err = -errno; + goto exit_close_memfd; + } + + if (memfd == newfd) { + err = -EINVAL; + goto exit_close_fds; + } + + /* Map in new fd and make sure that the data is as expected. */ + ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED, newfd, 0); + if (ptr == MAP_FAILED) { + err = -errno; + goto exit_close_fds; + } + + if (ptr[0] != 'y') { + err = -EINVAL; + goto exit_close_fds; + } + + if (munmap(ptr, page_size)) { + err = -errno; + goto exit_close_fds; + } + +exit_close_fds: + close(newfd); +exit_close_memfd: + close(memfd); +exit: + return err; +} + +static void *pidfd_self_thread_worker(void *arg) +{ + unsigned long page_size = (unsigned long)arg; + int ret; + + /* We forward any errors for the caller to handle. */ + ret = __pidfd_self_thread_worker(page_size); + return (void *)(intptr_t)ret; +} + FIXTURE(child) { /* @@ -264,6 +354,57 @@ TEST_F(child, no_strange_EBADF) EXPECT_EQ(errno, ESRCH); } +TEST(pidfd_self) +{ + int memfd = sys_memfd_create("test_self", 0); + unsigned long page_size = sysconf(_SC_PAGESIZE); + int newfd; + char *ptr; + pthread_t thread; + void *res; + int err; + + ASSERT_GE(memfd, 0); + ASSERT_EQ(ftruncate(memfd, page_size), 0); + + /* + * Map so we can assert that the duplicated fd references the same + * memory. + */ + ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED, memfd, 0); + ASSERT_NE(ptr, MAP_FAILED); + ptr[0] = 'x'; + ASSERT_EQ(munmap(ptr, page_size), 0); + + /* Now get a duplicate of our memfd. */ + newfd = sys_pidfd_getfd(PIDFD_SELF_THREAD_GROUP, memfd, 0); + ASSERT_GE(newfd, 0); + ASSERT_NE(memfd, newfd); + + /* Now map duplicate fd and make sure it references the same memory. */ + ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED, newfd, 0); + ASSERT_NE(ptr, MAP_FAILED); + ASSERT_EQ(ptr[0], 'x'); + ASSERT_EQ(munmap(ptr, page_size), 0); + + /* Cleanup. */ + close(memfd); + close(newfd); + + /* + * Fire up the thread and assert that we can lookup the thread-specific + * PIDFD_SELF_THREAD (also aliased by PIDFD_SELF). + */ + ASSERT_EQ(pthread_create(&thread, NULL, pidfd_self_thread_worker, + (void *)page_size), 0); + ASSERT_EQ(pthread_join(thread, &res), 0); + err = (int)(intptr_t)res; + + ASSERT_EQ(err, 0); +} + #if __NR_pidfd_getfd == -1 int main(void) { diff --git a/tools/testing/selftests/pidfd/pidfd_setns_test.c b/tools/testing/selftests/pidfd/pidfd_setns_test.c index 7c2a4349170a..bbd39dc5ceb7 100644 --- a/tools/testing/selftests/pidfd/pidfd_setns_test.c +++ b/tools/testing/selftests/pidfd/pidfd_setns_test.c @@ -752,4 +752,15 @@ TEST(setns_einval) close(fd); } +TEST(setns_pidfd_self_disallowed) +{ + ASSERT_EQ(setns(PIDFD_SELF_THREAD, 0), -1); + EXPECT_EQ(errno, EBADF); + + errno = 0; + + ASSERT_EQ(setns(PIDFD_SELF_THREAD_GROUP, 0), -1); + EXPECT_EQ(errno, EBADF); +} + TEST_HARNESS_MAIN diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c index 9faa686f90e4..440447cf89ba 100644 --- a/tools/testing/selftests/pidfd/pidfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_test.c @@ -42,12 +42,41 @@ static pid_t pidfd_clone(int flags, int *pidfd, int (*fn)(void *)) #endif } -static int signal_received; +static pthread_t signal_received; static void set_signal_received_on_sigusr1(int sig) { if (sig == SIGUSR1) - signal_received = 1; + signal_received = pthread_self(); +} + +static int send_signal(int pidfd) +{ + int ret = 0; + + if (sys_pidfd_send_signal(pidfd, SIGUSR1, NULL, 0) < 0) { + ret = -EINVAL; + goto exit; + } + + if (signal_received != pthread_self()) { + ret = -EINVAL; + goto exit; + } + +exit: + signal_received = 0; + return ret; +} + +static void *send_signal_worker(void *arg) +{ + int pidfd = (int)(intptr_t)arg; + int ret; + + /* We forward any errors for the caller to handle. */ + ret = send_signal(pidfd); + return (void *)(intptr_t)ret; } /* @@ -56,8 +85,11 @@ static void set_signal_received_on_sigusr1(int sig) */ static int test_pidfd_send_signal_simple_success(void) { - int pidfd, ret; + int pidfd; const char *test_name = "pidfd_send_signal send SIGUSR1"; + pthread_t thread; + void *thread_res; + int err; if (!have_pidfd_send_signal) { ksft_test_result_skip( @@ -66,25 +98,45 @@ static int test_pidfd_send_signal_simple_success(void) return 0; } + signal(SIGUSR1, set_signal_received_on_sigusr1); + + /* Try sending a signal to ourselves via /proc/self. */ pidfd = open("/proc/self", O_DIRECTORY | O_CLOEXEC); if (pidfd < 0) ksft_exit_fail_msg( "%s test: Failed to open process file descriptor\n", test_name); + err = send_signal(pidfd); + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on sending pidfd signal\n", + test_name, err); + close(pidfd); - signal(SIGUSR1, set_signal_received_on_sigusr1); + /* Now try the same thing only using PIDFD_SELF_THREAD_GROUP. */ + err = send_signal(PIDFD_SELF_THREAD_GROUP); + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on PIDFD_SELF_THREAD_GROUP signal\n", + test_name, err); - ret = sys_pidfd_send_signal(pidfd, SIGUSR1, NULL, 0); - close(pidfd); - if (ret < 0) - ksft_exit_fail_msg("%s test: Failed to send signal\n", + /* + * Now try the same thing in a thread and assert thread ID is equal to + * worker thread ID. + */ + if (pthread_create(&thread, NULL, send_signal_worker, + (void *)(intptr_t)PIDFD_SELF_THREAD)) + ksft_exit_fail_msg("%s test: Failed to create thread\n", test_name); - - if (signal_received != 1) - ksft_exit_fail_msg("%s test: Failed to receive signal\n", + if (pthread_join(thread, &thread_res)) + ksft_exit_fail_msg("%s test: Failed to join thread\n", test_name); + err = (int)(intptr_t)thread_res; + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on PIDFD_SELF_THREAD signal\n", + test_name, err); - signal_received = 0; ksft_test_result_pass("%s test: Sent signal\n", test_name); return 0; }