From patchwork Thu Jan 30 20:40:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13954956 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 825C5C0218D for ; Thu, 30 Jan 2025 20:40:52 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A3FC2802AD; Thu, 30 Jan 2025 15:40:52 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 1083E2802AA; Thu, 30 Jan 2025 15:40:52 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id DAFD72802AD; Thu, 30 Jan 2025 15:40:51 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0010.hostedemail.com [216.40.44.10]) by kanga.kvack.org (Postfix) with ESMTP id A69FE2802AA for ; Thu, 30 Jan 2025 15:40:51 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay05.hostedemail.com (Postfix) with ESMTP id 5B1144461F for ; Thu, 30 Jan 2025 20:40:51 +0000 (UTC) X-FDA: 83065287102.01.A8A1C78 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf17.hostedemail.com (Postfix) with ESMTP id 0DB1040011 for ; Thu, 30 Jan 2025 20:40:47 +0000 (UTC) Authentication-Results: imf17.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=cSUjufBz; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CNZOPnrS; spf=pass (imf17.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"); 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=1738269648; 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=Yu0MZDnQfvbXkRCLn1QIAGNaeqNkSXsLqXii1oY4jYw=; b=LHRHiL8hd/gesQahmBQzfaKK61sTg7a81cpQX2tU90e2OJWMr9Cy43ZZTE2pCumYED1Exr 9jyAHbgoSN+NDlQ4IVNIFBi77F7G455zTT5ESu/O+yM7wf/UnHfwvbDwJZ6D1eC8hwhO+o NKPrcrzcvNlijaY00qDg/t4FDAXBWFA= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1738269648; a=rsa-sha256; cv=pass; b=i30Eshg5QOsrqk6N+IbhQ40S46vbopzzZZbzjSrtY4YGBkvnWFD9PzaMAuVHS9QNlVVZsp VsC3Y+vKZYdOIUUjrQ3K7bUGUSfIvsBmNSI2h5Jfj23wULggrnloJbfnCfd7x2+OwDE33V e8Laofcq/EUAJMfq9xLjSxAyTbc33FY= ARC-Authentication-Results: i=2; imf17.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=cSUjufBz; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=CNZOPnrS; spf=pass (imf17.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"); dmarc=pass (policy=reject) header.from=oracle.com 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 50UKRLGI017901; Thu, 30 Jan 2025 20:40:41 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=Yu0MZDnQfvbXkRCLn1QIAGNaeqNkSXsLqXii1oY4jYw=; b= cSUjufBzr/z7im1vcdy51O02ivljRPYGaBZkzjS02BonSF9uQyX3SxWkSgXYflBT OmdIKr38lRrGEsDVQJgMwyZ+3f6epstHszeCZU+uoIZ/ifNK1Zl1NC2ub7liVHVx 7kwtAONSLLolkHkH56eMJkpSzFyIAR8WehK6ajZQ46a9j8ZP43d9ntS64x3lY5Pe OBSAF0hJkdziQn7iPAYucqJmdkzZSAPhkH68vorfcPp7XslTykqEHg41/9AO4TLT lA+LcLwYy5wZguKglHSyxJcGDvvdEGHlMVXqqDsKXh/NOnh1BbHm0KqM05TbCTtL sYF3fn9Jr5U7MyhQ1XUFrg== Received: from iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta02.appoci.oracle.com [147.154.18.20]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44ggfe80sr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:41 +0000 (GMT) Received: from pps.filterd (iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 50UJv1wN009118; Thu, 30 Jan 2025 20:40:40 GMT Received: from nam10-dm6-obe.outbound.protection.outlook.com (mail-dm6nam10lp2048.outbound.protection.outlook.com [104.47.58.48]) by iadpaimrmta02.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 44gg1fhtae-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:40 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=u1O9vNEb//zxZy8ejEYQK3uj+pT4q3pFJGnFAfk+THzSNh6vknWYNd6uWQeySE421/rEWk50+41vD/hUKyKB2jtG0tgAMA/fvHwpLehjFqIRVY/9L2ep+Fiux+tCzqC35GCADAIZsrhrEb19Vfscj5HVPOlyIrSwDhlgduQP1yRS86M2ZP2pxvdgxGNhV7q3kKIuBgchw6Mjy5BHQ8PyTshPvp8zONKlGZ7g7QjS+C6IACjXqKI6QvGmNT+WQnpU+TG7QtlaL1mR6wleuAsPh0p2zDQ/+TQ8sB+DtIitTtXPaAlTvv7YTJLv+InMSsl+UL8p9mU6NzOb2npmNH0kQQ== 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=Yu0MZDnQfvbXkRCLn1QIAGNaeqNkSXsLqXii1oY4jYw=; b=FD3/IjW3Dy86KqgDBRXBKYztoBiahizHCZ8fCP/SSPnOJcsRYL/TJEhdis2A0OhkbkxB/swPasdaBW2aLqL2qfTa2ZE+WKDzpSYTv7rEdDqU+4jWwslY1qxfhpt6N2f8GD8jwsBPjDqq/GkhVSnCbdh9/dXQoQ+VksrazEzyznSGyxJInJQSB7rlfgL1RfShC3ItKMu0SKie5E52x1manwRvd5ODR4DFKAvZ2QkNkLHOmPWJUPuV7xD1TJKQcknrcA4mk+GnumHJlfAcUuBH1AeGHfgGsmrYlkZ6BTNxr04f04LMy1DVWymoNIHCd96DdyN1FrWPSMgSFIUFpAMivg== 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=Yu0MZDnQfvbXkRCLn1QIAGNaeqNkSXsLqXii1oY4jYw=; b=CNZOPnrStNcTqbBDs92H01xB6MOzUTus7ZT2ossy38MNCd3i4mPkSswHpuKAcX1hnGInxwYLumPG2P33NLdbr11EIoHFZAEIEtz60OzVjpYj+Zb5TXg571cz0xdME8rN1AKrjf0YCcjRacOAP5sfR0XJIEGzxdBuUHvq9LBAiZI= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by MW4PR10MB6396.namprd10.prod.outlook.com (2603:10b6:303:1e9::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8398.17; Thu, 30 Jan 2025 20:40:37 +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.8398.018; Thu, 30 Jan 2025 20:40:37 +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 , Tejun Heo , Johannes Weiner , Michal Koutny , Andrew Morton , Shakeel Butt Subject: [PATCH v7 1/6] pidfd: add PIDFD_SELF* sentinels to refer to own thread/process Date: Thu, 30 Jan 2025 20:40:26 +0000 Message-ID: <24315a16a3d01a548dd45c7515f7d51c767e954e.1738268370.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: X-ClientProxiedBy: LO4P123CA0376.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:18e::21) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|MW4PR10MB6396:EE_ X-MS-Office365-Filtering-Correlation-Id: 65dc80c1-6978-4c52-7187-08dd416e5a7d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|7416014|376014|366016; X-Microsoft-Antispam-Message-Info: IuwPZHRCdPvHuearGp9PiYB6obM1LIniOATK6E31y3nkaW7sctZNQScwPxmX2bRXoq+YaOkIzbDCIePJCcLrxLBsF7z3c7ngPik6/HG7fAY8mHot36ZANT8NlenSmgkz/3kM3LTJz1mwjXCrwd7Ci3BPT67GRNhCWK4R1+MBbMtwsVWKGOIYp5yNccVeRGPPdJ+FiF9VhXWD9ZWKmX9/8DKc15QDxi1xoi7HThhH7XCq9RZRN8B0HOLfFUk2rROq+M3MCE8qNXvvedGUlaJU82n3O+76KBr480vzglMtk0ySscrWMxt/jwijYbnJBvdi421lruce108mLY138q8fFCReAA57+6bivKe9/+WoVU6HwKKU81YARnAj5Z2n+pswPrkJ44chO4DoWeKUX+zfTSjfVVxjRu9GdWNFE7kSVA5RRr7dqAA5Jp0hHiKaOUzQkoTB/zfTgH/vF201niOAv7GZ3EvCxV93BUmkZJktl1pvxXxTrE+oMfXOVxsSGRWVmIIym9jtXKINe1JSIis7b1G12bcgBtNEJvkXgj5LvdU37Rd02Wj1F2WC6aQL3HyMSaDM99OAbHLfExUAcjRy3bKjrLLPsr/aIb0VHEvsgUAwcPNiwgDjPPqKEb76llLMdOPy5h+pSrlFqBwUaby/0I26rJqiBDFF8PH7p6X81zJfAAZ0TZ6XwIgOhX90TtTayNBLUjrey4gQLwf74yQRtwOeJBNambpc2wdFLKxg6sqjey1aTSV9jQhSAzWbKMkRY7UuIYLWAvExdtw+kEeGHah3ohYPssVpJZ2DuAzG0Fr2X8NO/Eh/TSkehUkmNJEcHZoAIwpVWtTPzYKENInh1sjFfvNam2UilQADsNQ5/F37k4aOBlY9xxyRB/TtBRzmC2MYzxY1nn5LWXY5sT1yv3QCKNG/Jk7O/QyqAio5yls6ptyQl3TXlNwD1SSpA1Ru3kI8o00Gu/F9UHTeB0s7FFYFISUxWqNeeM09qgwacEH0dsP+MWoZVLjVDTBhe7Vm0LEeYikE1Fj5OIdNW5dN4rwKmfQGVyUA8IkAhUPdriQBk3Oi0jiwdDYxFB4hCO28nAK8eAbtUlILDM6Xw0CYHWLzvN6p/f4nDZo6iVNPQHos6Gosk6OhA/jxMJkvFhlmUHpHv1dKF0pt4i/1HGO//bP57/DKkNljTkparB3L7jmLYE9KOaYGxyhJD2vD5gm+/ODBvsYax0W89KvSdEK3Qit1wYeSBnAU1nIBupSLMpMkITOI9uzVQ86Nx/1AfCybcL/+4804wsZScLjyeDYLvYnG8iQt1M0LyP0vMhh5a7CsvykPjjBnsmGC60NKmpMGPOFpVjbjHkHHFhif81/Vbgi3mgWZcs0F2f5K0MjuNalQJMaNfkDCTI0U98C4CwWY 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)(1800799024)(7416014)(376014)(366016);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: +5crm2XRRqOCFWssgrmTVurfHQm37jSG/jIdvejtC5UzUQ0LXNMovijdxerCpwnX7D65JLKufHbr7Q50Fi7eAeF6WHYxTw1aMNeeV/SgHQz0tepicDG+O/UX6HRsrGOC90J4nZlI9a0bIGLQ0FBi3eogmJjPeIJfAe6oIHgR/yk//XIgiLv5zrGv5HETCyYVKfXawVEF20r3oMmIZaQm5OUhIQCN7HbUxlYm549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6QQI7HQjM0Cc6WY19i358o7eqbvxlakxeWIjClvQkm+r6ATFieiCfevnpScIbvuqODsL6ZUttHjYPJ2TcoTwA8RRbDBZVmr+Hcn22tleTAH0IhVoZr/0yqLfHArMNI84kc/ngZP/cMb32yP9GQd94+51ErOJfSXWZwD8Cew8cYzNYgqFz35yhU8l62xw4YWEAJoyFnetGBOXQWwY3988WvSLxcupvRxLk22MwFVs83M0G0pcGge+5dufPhryBqWKse8+KG+ThzBLGlGxONlWIhC30SCeE5z0XifGrzUR8ehjI/XQ== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 31Bd1alZ2d8S7nZjwWbeHACxmq/bNhrZRMQM///f0wZ6EjyX0+raMAis6Z16ZUt7ma8q1xAJtL5cf2iRPQHvfNtm5AVQK5I/Vf/Awhxortd4oADk8T58DfTZWAtlVtEUsB3lVL9Y7pqB+v/OGr8C2YKooLfdSVqyYyd60gGvbDyqiGIbyKgGxu1AM0Qwa6oQ+Qi/37IpsTU/yJZWglf8Hq1/6XI+99vHGDgjjeabN8VsdolqpdJwwyswCi3d6iF5YLnPIwsbrYde5BS2JACbMro795JkaHyXTexaFuuPyJxoQ8In9w7tzu7BTHpindsIZatcqm0FpAyfVIuce/eCpynLBLvHCI37g7tPvLdTZfkyOEQm1VS6l5yLR1V3UEGEn+y09F+JIS8ey2f3CyWkcgSByOhBXUvTF2QEXSxCJ38w3kdxGN5CTHJa0D3bssHru1Jn9hDoaUCBmHRdf+chO7Xd2hn2axMAekz/91vs1qMi8ot+LKaD2Hz2AGfKzYTF2toO4nmOKeo05kItzMgtnQ5dbh0yhXaMv9HY9+Zq2MRQfIwTveB8R7BBwqZI7YGLBgHf+O3zjt2z3viBh21DD9AQ4nk9Bwj3FKizSCQTVB4= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 65dc80c1-6978-4c52-7187-08dd416e5a7d X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2025 20:40:37.8119 (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: AVG89ec46YLgPsK69Xg1uyQnJUH1BDsBRjl72h8Zp+tpz0BiuLYW3VmPdvMjCCAT48O1k4wNGYfhVZ2Y9w3PoH0v84N0yEIpMSrZySvi7dg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR10MB6396 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-30_09,2025-01-30_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 bulkscore=0 suspectscore=0 adultscore=0 malwarescore=0 phishscore=0 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2501170000 definitions=main-2501300158 X-Proofpoint-GUID: DD5Vine1Yoy130ljATcxiIRFhX_RybCV X-Proofpoint-ORIG-GUID: DD5Vine1Yoy130ljATcxiIRFhX_RybCV X-Stat-Signature: 4r8qg4uz7ktc8s6qtkeb74k7cgxna8hk X-Rspam-User: X-Rspamd-Queue-Id: 0DB1040011 X-Rspamd-Server: rspam03 X-HE-Tag: 1738269647-464878 X-HE-Meta: U2FsdGVkX18oBwNGo/PJjRsBUSaGPrdDxT8YKBi/pzXvh6GCaXS44q9IUW85UPrX5DLm9vHZtXsjECwKmI2/FDHSRWppJLfmmiLyuv5a+q2kpQ/ZzCGFf67tJY60dVGhty5cAS0pzYiMqLdfLhqFdzFzKpLLr3bekDu+Pil0spYfXOT3ptHF8t/llXSx370w0q63MP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6o2JG4E98rRiytZnq8IWophCnJCvjB1hmhyrkrOEzFDeqc1PDoqu7kbbXr0B9axRnr8Kmz7Fyw63hmRr8r3HApMaHIccCxLDbRyPES7QQwgkueul9L3tAyzdnUBDdXhN6/cGLDfJr+JRksQaV3JVANtK7qiogF66fnwWwnCnRKlMND2ACR2bhupv/pQNSiUq5YrzsQzpekdbKplD3ReDVyZSXZ9QMfC0MG593pUPUZnHQo3D4EEj+5lDuyFVIAEqY0PQmCwefItcI0HUIEeG48aOJBufrwtNWUU18ii+2pbivmcg4zdF7YLufV5cBu8tPJkA1I6wAe76tcKpW7ICKF6V0oh6dpgp5dl1vTKBjESl4IuzFoVjsYvCLbNH+3I5xiFW1qOxK9dczuy2M2At2U1gb 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 is useful to be able to utilise the pidfd mechanism to reference the current thread or process (from a userland point of view - thread group leader from the kernel's point of view). Therefore introduce PIDFD_SELF_THREAD to refer to the current thread, and PIDFD_SELF_THREAD_GROUP to refer to the current thread group leader. For convenience and to avoid confusion from userland's perspective we alias these: * PIDFD_SELF is an alias for PIDFD_SELF_THREAD - This is nearly always what the user will want to use, as they would find it surprising if for instance fd's were unshared()'d and they wanted to invoke pidfd_getfd() and that failed. * PIDFD_SELF_PROCESS is an alias for PIDFD_SELF_THREAD_GROUP - Most users have no concept of thread groups or what a thread group leader is, and from userland's perspective and nomenclature this is what userland considers to be a process. We adjust pidfd_get_task() and the pidfd_send_signal() system call with specific handling for this, implementing this functionality for process_madvise(), process_mrelease() (albeit, using it here wouldn't really make sense) and pidfd_send_signal(). Signed-off-by: Lorenzo Stoakes --- include/uapi/linux/pidfd.h | 24 +++++++++ kernel/pid.c | 24 +++++++-- kernel/signal.c | 106 ++++++++++++++++++++++--------------- 3 files changed, 107 insertions(+), 47 deletions(-) -- 2.48.1 diff --git a/include/uapi/linux/pidfd.h b/include/uapi/linux/pidfd.h index 4540f6301b8c..e0abd0b18841 100644 --- a/include/uapi/linux/pidfd.h +++ b/include/uapi/linux/pidfd.h @@ -23,6 +23,30 @@ #define PIDFD_INFO_SIZE_VER0 64 /* sizeof first published struct */ +/* + * The concept of process and threads in userland and the kernel is a confusing + * one - within the kernel every thread is a 'task' with its own individual PID, + * however from userland's point of view threads are grouped by a single PID, + * which is that of the 'thread group leader', typically the first thread + * spawned. + * + * To cut the Gideon knot, for internal kernel usage, we refer to + * PIDFD_SELF_THREAD to refer to the current thread (or task from a kernel + * perspective), and PIDFD_SELF_THREAD_GROUP to refer to the current thread + * group leader... + */ +#define PIDFD_SELF_THREAD -10000 /* Current thread. */ +#define PIDFD_SELF_THREAD_GROUP -20000 /* Current thread group leader. */ + +/* + * ...and for userland we make life simpler - PIDFD_SELF refers to the current + * thread, PIDFD_SELF_PROCESS refers to the process thread group leader. + * + * For nearly all practical uses, a user will want to use PIDFD_SELF. + */ +#define PIDFD_SELF PIDFD_SELF_THREAD +#define PIDFD_SELF_PROCESS PIDFD_SELF_THREAD_GROUP + struct pidfd_info { /* * This mask is similar to the request_mask in statx(2). diff --git a/kernel/pid.c b/kernel/pid.c index 3a10a7b6fcf8..1d2fc59d64fc 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -564,15 +564,29 @@ struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags) */ struct task_struct *pidfd_get_task(int pidfd, unsigned int *flags) { - unsigned int f_flags; + unsigned int f_flags = 0; struct pid *pid; struct task_struct *task; + enum pid_type type; - pid = pidfd_get_pid(pidfd, &f_flags); - if (IS_ERR(pid)) - return ERR_CAST(pid); + switch (pidfd) { + case PIDFD_SELF_THREAD: + type = PIDTYPE_PID; + pid = get_task_pid(current, type); + break; + case PIDFD_SELF_THREAD_GROUP: + type = PIDTYPE_TGID; + pid = get_task_pid(current, type); + break; + default: + pid = pidfd_get_pid(pidfd, &f_flags); + if (IS_ERR(pid)) + return ERR_CAST(pid); + type = PIDTYPE_TGID; + break; + } - task = get_pid_task(pid, PIDTYPE_TGID); + task = get_pid_task(pid, type); put_pid(pid); if (!task) return ERR_PTR(-ESRCH); diff --git a/kernel/signal.c b/kernel/signal.c index a2afd54303f0..1e8f792f88de 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -4009,6 +4009,46 @@ static struct pid *pidfd_to_pid(const struct file *file) (PIDFD_SIGNAL_THREAD | PIDFD_SIGNAL_THREAD_GROUP | \ PIDFD_SIGNAL_PROCESS_GROUP) +static int do_pidfd_send_signal(struct pid *pid, int sig, enum pid_type type, + siginfo_t __user *info, unsigned int flags) +{ + kernel_siginfo_t kinfo; + + switch (flags) { + case PIDFD_SIGNAL_THREAD: + type = PIDTYPE_PID; + break; + case PIDFD_SIGNAL_THREAD_GROUP: + type = PIDTYPE_TGID; + break; + case PIDFD_SIGNAL_PROCESS_GROUP: + type = PIDTYPE_PGID; + break; + } + + if (info) { + int ret = copy_siginfo_from_user_any(&kinfo, info); + + if (unlikely(ret)) + return ret; + + if (unlikely(sig != kinfo.si_signo)) + return -EINVAL; + + /* Only allow sending arbitrary signals to yourself. */ + if ((task_pid(current) != pid || type > PIDTYPE_TGID) && + (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL)) + return -EPERM; + } else { + prepare_kill_siginfo(sig, &kinfo, type); + } + + if (type == PIDTYPE_PGID) + return kill_pgrp_info(sig, &kinfo, pid); + + return kill_pid_info_type(sig, &kinfo, pid, type); +} + /** * sys_pidfd_send_signal - Signal a process through a pidfd * @pidfd: file descriptor of the process @@ -4028,7 +4068,6 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, { int ret; struct pid *pid; - kernel_siginfo_t kinfo; enum pid_type type; /* Enforce flags be set to 0 until we add an extension. */ @@ -4040,54 +4079,37 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, return -EINVAL; CLASS(fd, f)(pidfd); - if (fd_empty(f)) - return -EBADF; - /* Is this a pidfd? */ - pid = pidfd_to_pid(fd_file(f)); - if (IS_ERR(pid)) - return PTR_ERR(pid); + switch (pidfd) { + case PIDFD_SELF_THREAD: + pid = get_task_pid(current, PIDTYPE_PID); + type = PIDTYPE_PID; + break; + case PIDFD_SELF_THREAD_GROUP: + pid = get_task_pid(current, PIDTYPE_TGID); + type = PIDTYPE_TGID; + break; + default: + if (fd_empty(f)) + return -EBADF; - if (!access_pidfd_pidns(pid)) - return -EINVAL; + /* Is this a pidfd? */ + pid = pidfd_to_pid(fd_file(f)); + if (IS_ERR(pid)) + return PTR_ERR(pid); - switch (flags) { - case 0: + if (!access_pidfd_pidns(pid)) + return -EINVAL; /* Infer scope from the type of pidfd. */ if (fd_file(f)->f_flags & PIDFD_THREAD) type = PIDTYPE_PID; else type = PIDTYPE_TGID; break; - case PIDFD_SIGNAL_THREAD: - type = PIDTYPE_PID; - break; - case PIDFD_SIGNAL_THREAD_GROUP: - type = PIDTYPE_TGID; - break; - case PIDFD_SIGNAL_PROCESS_GROUP: - type = PIDTYPE_PGID; - break; - } - - if (info) { - ret = copy_siginfo_from_user_any(&kinfo, info); - if (unlikely(ret)) - return ret; - - if (unlikely(sig != kinfo.si_signo)) - return -EINVAL; - - /* Only allow sending arbitrary signals to yourself. */ - if ((task_pid(current) != pid || type > PIDTYPE_TGID) && - (kinfo.si_code >= 0 || kinfo.si_code == SI_TKILL)) - return -EPERM; - } else { - prepare_kill_siginfo(sig, &kinfo, type); } - if (type == PIDTYPE_PGID) - return kill_pgrp_info(sig, &kinfo, pid); - else - return kill_pid_info_type(sig, &kinfo, pid, type); + ret = do_pidfd_send_signal(pid, sig, type, info, flags); + if (fd_empty(f)) + put_pid(pid); + return ret; } From patchwork Thu Jan 30 20:40:27 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13954957 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 61A6DC0218A for ; Thu, 30 Jan 2025 20:40:55 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8CBD2802AE; Thu, 30 Jan 2025 15:40:54 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id CEE902802AA; Thu, 30 Jan 2025 15:40:54 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id A7BFE2802AE; Thu, 30 Jan 2025 15:40:54 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0014.hostedemail.com [216.40.44.14]) by kanga.kvack.org (Postfix) with ESMTP id 8576A2802AA for ; Thu, 30 Jan 2025 15:40:54 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 0CCEA120155 for ; Thu, 30 Jan 2025 20:40:54 +0000 (UTC) X-FDA: 83065287228.01.2F69D52 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf16.hostedemail.com (Postfix) with ESMTP id C443B180014 for ; Thu, 30 Jan 2025 20:40:50 +0000 (UTC) Authentication-Results: imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=iT4TF+rV; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=bOByOcZS; spf=pass (imf16.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.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=1738269650; 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=dPJtjvvQZ3Lra/UAEbGgucANXzUDJXoWlZKWCd1+jBY=; b=2m5rS89UuIZxeiupoEc2HSjPg6Vdt0RkzNHBkCqdk2vpZ/m4F5843937jgYZHnk0Zszr0u KOW2RjbUjizeQS1sW3qY1EDe7zk3YsYhzZaPHgNdFEKDodlc2o8klUp5GT+Er+Bjg5WC6B CZUtg9k6XhF1n0GhXSor0DTpwv5NcF0= ARC-Authentication-Results: i=2; imf16.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=iT4TF+rV; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=bOByOcZS; spf=pass (imf16.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.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=1738269650; a=rsa-sha256; cv=pass; b=vuF5GoXzSl0sCOo0qSbRmJbfxZgfp5a+1jQmWk1qimbEiL+ZQzuDtq3Y1+a6jhGEJTwpOi ZI2uDE6wTxpC/TYnSQmKUsCFiuCQHwL4x1gXp43qTChepTZHjYHLthCwZ8uX8ZjL68bdiH uF9Wsm7HM/QWYbDsB9fO8yequ+9Jbdc= Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50UKHJ9Z027216; Thu, 30 Jan 2025 20:40:44 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=dPJtjvvQZ3Lra/UAEbGgucANXzUDJXoWlZKWCd1+jBY=; b= iT4TF+rVwlr3tcYdisEPnNJ6InyDIE/rE9LB0Pcdiie5zWxtVctCWYUfYsDc6Z5b JKIe8HZHDVEsC62KANZ8mkU0PLBgoYtge7KFuboDgJB6bAwZMwIdtyA1fI0xM9jZ QNDiggmPxjLy0zG3dYBPc2EmpCEz2Q0TwZDECDuXBQ0vXVFBWb+R/I0AYU1/3CMH FmrOR8ynogNHyXF5oNW4bfxQ3h+Nnmdh/lrVJEMC/0GB1lxsKK6dyNld9iDzb6dB AJap2hyXF7sFHPQD9063cDmghq8xyXJKjduSfNOR9e/y+pCNIsLBM2bhe8s8CiBb isYNExcgL/UFZ0Kch3rceQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44ggaqg1u1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:44 +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 50UJ4pdr032289; Thu, 30 Jan 2025 20:40:43 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2048.outbound.protection.outlook.com [104.47.66.48]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 44gf933y11-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:43 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A5oBPzSZNZj5yuNYiOa802BKR2nkptiO3R3dYqUs0mNVqrSDzocRVV8dQ85G6bhCj/BJ4w9yBbsJWQ+H/bN8ViCyIOA865AhwG62HEopsmzUtCJU1qgOadbNnHie2AbFii9fwFkzinmgvD2ig6ZxQQg386gQt9Kpiag/CS64Gv28/m3ikLtkdYFTVxT1oohOTVCI0GuECsRtiO4GbkseZWXYzmnID8JPkpRRlD3LWgVI9QGS9LlhqvHHfQtg/wnrAOhl42QLVP53Gs4TywzCH+uGv3KPI0/IljmIMfwRz0Y20lmKPRMPU7nXpDPEY81mx7UVrXEDV/8s1nEALSv6Pw== 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=dPJtjvvQZ3Lra/UAEbGgucANXzUDJXoWlZKWCd1+jBY=; b=EDKpqQHTazcRhhRqepXjFj16cHtwWSPLp+RcwVo0eLy9B3ISAZ/jCHuCR81mf5oobc2q5FPLy8oHjtyXDpsJEd+JNhecA4FfUFY3LpYmfma70WhnICwdpT46s9zOuiCS9TWzJ2+Bho2ZLSc+mfHcLvnqXRRMGYTwoxa5Zz0F0j2eC9GrjiuD/7zDuR+5uKDbXoQIkStymC+qGPQmQQG6wRU0rBH3Mp3zxjgopRD7lzvz1nuESWLQc6mJdks2XpXxlHnbbUqVqg9Mx/VGc33E2i7x22xIn6qAaiTKFAd2oNsp3DB+Sdg+wmgSNH/EClACDYsMK4aLP9X/A/1quHmxZg== 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=dPJtjvvQZ3Lra/UAEbGgucANXzUDJXoWlZKWCd1+jBY=; b=bOByOcZSrCXPWEH7yHEcyrjfnTFyMu6YDx55E1OadJ9DzlxAxhRfIYYkI9HnZtgyZoTnuEQRwlC6jHnZGlkfl/QYtrxVnnLzm/gjex+F2oK/vekFP/zcHCS2xA3flwHxktHLge/OG8GQ2tVi79VMGnmdxujh1iQTo+cg2C6RlkM= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SN7PR10MB6547.namprd10.prod.outlook.com (2603:10b6:806:2aa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.23; Thu, 30 Jan 2025 20:40:40 +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.8398.018; Thu, 30 Jan 2025 20:40:40 +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 , Tejun Heo , Johannes Weiner , Michal Koutny , Andrew Morton , Shakeel Butt Subject: [PATCH v7 2/6] selftests/pidfd: add missing system header imcludes to pidfd tests Date: Thu, 30 Jan 2025 20:40:27 +0000 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: X-ClientProxiedBy: LO4P123CA0057.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:153::8) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SN7PR10MB6547:EE_ X-MS-Office365-Filtering-Correlation-Id: 924c1ac0-c788-4100-f4fd-08dd416e5c00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024; X-Microsoft-Antispam-Message-Info: YcxMBomw8EwefaAtqIPxLNVd5EVa7sdtXbJE2xRjQZwmGVjIEW7WHuzOvlDGzyAv8+qem8fJ3+V65di555ecefzBPTDMU9MIb1nocHvZG/dwwrr0R3vBU0DvbfXlrxxsLjZ8TRgpu/46Gx0F2L5QLD4e4AwXzwFqfDa3z35ElBQyGfZ0ZBGhtVCow8N7EAaNdjRWOEjr1Yo8GeJj+4zOl0/JqwZf03/Vp+y5eRet45uYZYqeFOGtm+1ZpwrpsjXSCBlQS5dbVeev/wSp+M6RacQX5V/7nMUiJtwa48UGs/gisENoK6I5EYE4nVqfwo4Pg7XuMEbTclOtHwMGdUyKSSjk7YDiSc3T0UtMoZJJXPiMqufqYvSKzIs6CTLapxfMbJgdyU6dQ4Q2MVmnWD/BIMG+XWmgEELjk02U4c8VUMQPHmnvAhmoE7udmB9gry4Fv1C1fAEijVDoFh9BWkzJVY5I/i7kuNZFpdX3YMzHLfga7JWLPYxd9/vZeHDDHcWdCDW8e+BPSaBiJbrzSGMYF5uSr0YGIo0Alvb42bGJaYXYt0F7xmyf7Q02g/JIAjYqLpx3khOUaW687pxtTPPubWwOGPolZYYA+0waGnf6Lou25XcFmJ9vw4rJL5FJ3rKATl/EXvaOYxeKRu/ojS3xsYRtA3AwnoUT4HBFB8jad1CSAKUtxHy4fRRObPAHK5RW0SIZEM4qwAToVpGso2lG1u2sOa10+eSPVkJTHGYKTwEFzyi2p4FY+U+c6/dhMcIyDl18Pkh9ULbj8AZN0gLx4rkH/h/15cRK0McpFFHxwvOP2kZCdA1Qd107AFwF0DEyutaFTARAcJ9Ssd7lYCXVctsTk5QYoPB0Lec2L9VQSTNS0kMxblI3zW+ZqrC8BXXA7CQJckLLQuckqJmzIQdP/rWxM9R+ZDlvn82EHA4lCDoUdu5pt9I8TSD59r/c77vQH7HITgjzdPLVpxLI8nCcQiW5kfA4gls4mqUFXRmRYdbuVLB8nNPVcV+wwI05xBdQJdwfMn96PyAQqKrdvTntgNC/0UBq/fCR/S1uvaE9xGw0uJtM/z87Yyo/2hZAXRDVHgWjpOWoxyAc7RAN8DA2wqhObKKeoewJXkRDcAIlZx3S0Vim5T6FhCAP+Qx4rYxs+zoD+O5EFDozO8me1irs9j79IUGvQm2U/M+FDLWlI3zjmxvY00X4RNGquKGHXmSRPwa3SQmqjnE8hZxvWmSi6CLApMWaB9T5mD3QFBPFGRpTr0thmnOdxS67dLAqhghpFJbVuY41ItV+tIYBKUU8urXFdESt/4uBTCL5EvXFaVkm+mUobgt2/VhQI9PsAz0hMZ6i6Y+CKPxwmejMyBC74UJg9CebpJetho4VneMkEsUjY7uWeZNxA6yhLkm6OE9P 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)(376014)(7416014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: s8Di3So8K8KjftcTe/GWZ3jlLIWSJIkm/ufLWFqNla5R373pGPzXFwRYvfModDn73OejbRpYlxmCOsZlhebIRWAMAcjsHOKtqvCu2JsT+HTWDnxdh5FqWdevdMaBJAUx/ReKDhnnRwjhaTxBvI6VXuhUHg+Ag8JR+pzoP4z5amM2s6lVyYAEr5HD3ZE9WNx9ZVEC4hm0Oo2NgoFc/KgEKeh8F6l77ULMchiX2qSYmgC+fJ9MxrwVdLvuKmMNRHW/h4oigwX1xFzKPpTyHW28TCBJHvzY2LLTG+oNCmsiCnwfn2y9SwANZzFUPDHbwEBGlVWp4+URidC7GXbSCDgc+OTyVc0zQZN4TMtSz3iaG16a4JolYMViYwEJb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uEcziAfcrgomQ3Unh31r6/08Aqi7nBtz3OW470m31YsctT/7lCeJe9wGZ961b51ydtNnGTl0rYx+7BYT7FNJLByqRyGFtoc6ws30dTbyrB292WD5lGrzq5MfLIkuFhaRACY7tzX6E2yLuFOx+IDTosr1CngDg3uCE5sEw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: EkALtNtOfSUMwLN1GF0WepEc8+X7XZOmXiNXdkM+9sZpkgJzIN3K2Yz8JsCZ2qKy8KjkG+7jAcSFXh5r6x/afZrioEmQhQDapuR7uHFdJwebWsJ20Xy2oeL6Tb3m/bBCof+oVG+DC2jlwtHsLCtC4jazGGlwtlypqRR9de+uQ2uSvfG3eBQmaGbwcyX2wGNhLOo5OFLcIiVVgTN64mExw5lcvp4AgUIwQscNu51Y7YC0YakHgkY/uvTUC36C5KpNhqiYJb1jv4rE2hESAw52XNKWGpcrphxyV8h1jyXe95yYtWAlMrkAhzBvAG1ZROdxcF5JL9IsfOTu0vc2Az3JtvQI2rw8CI493QHQ703DQNFf4HW2OIAPP9RIAmKhQCAVob0ejNh6uiCleJCcB8/QUD3FUfhkancoju+hNVGfbh2kSbT9qMlSxro3CoCRixveakXl5lEHtsGj+h7CGkPH4XNGCYoXvfyqlf461eAldAqC+k/XgGPsABEC5hqJFqSnU3DdedpPl7+uxe021U2/M5lw+okdiy++47j7t8rKy44bXNR7vW3UhI6cGPfAAWfR9DA5pHWMr+XAhzdvFlVQOWOKx5SkTD62jkJ2ahbU5sk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 924c1ac0-c788-4100-f4fd-08dd416e5c00 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2025 20:40:40.3981 (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: BJAKGlXMzQflyVa6TlHSHULgGIpqx0f+cnYIwsZ3P6xWNu+AO8hWGF6QUbapuI/pCYqi9jZ70TSaisPtjoqwLoSlRvaCRH84bWf3b+MnEU8= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6547 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-30_09,2025-01-30_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2501170000 definitions=main-2501300158 X-Proofpoint-ORIG-GUID: UzroupIA3wow-Tie3e_ryVGE_tQOMcma X-Proofpoint-GUID: UzroupIA3wow-Tie3e_ryVGE_tQOMcma X-Rspamd-Server: rspam07 X-Rspamd-Queue-Id: C443B180014 X-Stat-Signature: 5xryks61qt7gknj35tn5h3ndgtc4b1dz X-Rspam-User: X-HE-Tag: 1738269650-986218 X-HE-Meta: U2FsdGVkX18I4aaeWEoMJqjaFW+0id155EOw5EgtFDQatgIS9vKsLhH0QZaHK6gkBzFr9zzMc7Naa8fR814ujT2upNBaE8DhPgmluwKghLkk9WOdUJ5FRJ2Fn/PFHjWXnuwnoZG0uoyge6MSwmpaHBn8i2eZRv9XSlUihrgO5wuqpNTg8JBolR7EWJM4QX/mWgUgBkpoKd1+1765eOcfcFyeM20dD1bEe24r2E6yVL/BH1bIt60EPfQuqYmCN2c04wIlP1GnjYa6LvyDWqqPG1na8WvQlLYsn5ETIfNW7Fi4iV98TWLod/ODiA8doutHTaQ8jagE/sIIsGus542tiJSguXJM3vx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9qXVZ+u6cGPWqbo4dyY4Rlt+/J5vG3F3+CNsaGCqh0YEPSnRvFirbvqDOnmOBSm0wqOznC1Tj5ELjAWvh7RC+K9Z4U7SWdwkFvWFMFMrpfkuYO37/Obe9PI7H19f5i5cZVRozMTbkYf/5lRbGfLtBEqtdfNbC/in3TH+5nXs1bU0uZ+D5jOpVsi5XD7vTmGn0sCx1g6j0fNC06XlnoY7DArjvC74BPrESyWQNBJXa X-Bogosity: Ham, tests=bogofilter, spamicity=0.000011, 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 pidfd_fdinfo_test.c and pidfd_setns_test.c tests appear to be missing fundamental system header imports required to execute correctly. Add these. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd_fdinfo_test.c | 1 + tools/testing/selftests/pidfd/pidfd_setns_test.c | 1 + 2 files changed, 2 insertions(+) diff --git a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c index f062a986e382..f718aac75068 100644 --- a/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c +++ b/tools/testing/selftests/pidfd/pidfd_fdinfo_test.c @@ -13,6 +13,7 @@ #include #include #include +#include #include "pidfd.h" #include "../kselftest.h" diff --git a/tools/testing/selftests/pidfd/pidfd_setns_test.c b/tools/testing/selftests/pidfd/pidfd_setns_test.c index 222f8131283b..a55f6641e0b6 100644 --- a/tools/testing/selftests/pidfd/pidfd_setns_test.c +++ b/tools/testing/selftests/pidfd/pidfd_setns_test.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include From patchwork Thu Jan 30 20:40:28 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13954958 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 3FA5AC0218A for ; Thu, 30 Jan 2025 20:40:58 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id C3503280004; Thu, 30 Jan 2025 15:40:57 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 43D97280058; Thu, 30 Jan 2025 15:40:57 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 224DD280004; Thu, 30 Jan 2025 15:40:57 -0500 (EST) 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 E85CF2802AA for ; Thu, 30 Jan 2025 15:40:56 -0500 (EST) Received: from smtpin01.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay02.hostedemail.com (Postfix) with ESMTP id 953011201F4 for ; Thu, 30 Jan 2025 20:40:56 +0000 (UTC) X-FDA: 83065287312.01.E6FE55A Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf08.hostedemail.com (Postfix) with ESMTP id 4FE98160003 for ; Thu, 30 Jan 2025 20:40:53 +0000 (UTC) Authentication-Results: imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=eJqEgd3R; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="mBsg/z/k"; spf=pass (imf08.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"); 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=1738269653; 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=/HpKRiwOr6F3jDBa6b34ApkfJ3w1KpWcv/2Hw1+4lug=; b=Bf2XX3N/ovCCS1p0uJ3w03cqTyn5r9tzhmSHq/szjE1tGF/4yF5aVDK1ndmaV4a1LxTZDo bBm0hSUawUBuH0v2xOW52Z0jsVNl4d7XGnML8U8FmY23tCwcARcjFUqKmtGedV31yV6Alw WNPrZeSeI3DmQ3u+GvlWeHzAnNFTdKg= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1738269653; a=rsa-sha256; cv=pass; b=w+o2YkBW+2H7mUiC7EmnHNZs9PVm7XC3VADiq9Lnz+7n9tGPpvCKggKoYUKBruNe1jPPsQ T7r55IFWSORN7yZi+BMPfXpe4Ij9ToqEFRyrWfbQsmFcZISaA7xw5MdUsyI6HE3Qh4SXw2 WvBeGouy5kfp5CC/Af3vfXUVw6n2RNU= ARC-Authentication-Results: i=2; imf08.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=eJqEgd3R; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b="mBsg/z/k"; spf=pass (imf08.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"); dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50UJic58009892; Thu, 30 Jan 2025 20:40:46 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=/HpKRiwOr6F3jDBa6b34ApkfJ3w1KpWcv/2Hw1+4lug=; b= eJqEgd3RME4/a1QtCxJjlq65+JBUGPXDLTgofKlerXH4xV6pdQCFSWgPvf/82T7W BYku0yMBei/9wucoVcfL3YtxN27IKiD4oB9YKaMQ40y86wPBEfAlnw8+G8MELGzA GswJyS0L6iDlHVzbbH4UOlvBiWfJFLU0DRYf9M1X6juG7AhUgop+I4Yh2bCLplmy H51FUCApW5a7k66tIc+6HdeQtfdpts7feV35Kt47kqx3C3FjNKDC8XY68Qkulxg9 AJcYLZwM57yiVpsRmqNIjYqfhHz5M6HbrxIINjfJ42ClEj1aJTtjQtK2uIvPkly+ 3SvWvlMcwVzVHwyzGZ9X9Q== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44gf8206yw-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:46 +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 50UKTrLp028353; Thu, 30 Jan 2025 20:40:45 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2041.outbound.protection.outlook.com [104.47.66.41]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 44g0vbm9dp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:45 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=dJL0YJ3bbxqxTnoggcjhkT/j9/Pl4xxFQi6CRnWlI9a1SkgxsglV6SjVXHzTbe6YJ56Ra58iv8aaUjQEy9Nj62jz1ou7lIs1JJBnZ4BpvBveO+yXTGAqO3KtwWHm6tXzB9X9d76U8lEvHzLNSAfl1k2ti2y6mSWxSCjVyYDhREV0lHybvTi8pElaMYiWyxwu2y5Y9hYa1eldDstC+HZ8vfEw4DpTa2/duGLkCzefQSFnXtubn/ssJAp+Iy8Ii9gbAzC19aA+/ScwBPA1XXH7LGAgqKzi/yTBVP5m27MT/wZFUVLZBSlFxjdpaF/xEf3VGOhElEKeBiZ2KQBBhey7tQ== 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=/HpKRiwOr6F3jDBa6b34ApkfJ3w1KpWcv/2Hw1+4lug=; b=J/WQisQa/uTvptlcLs6aEiQe98T26aN5xNPX4o1V4c/qZzopzjv7951GOo/umVxlzOcUXb6k4sltPtxoyaW+VcPd73jJ/yS6jPmXJPZJN7E/xsTqDMhZ5ZmmGQapMy3/xeWMWXJt0x2u47QyFfMWEaQ6GGwgUHX8fWr75AKlveOL/7AH1ND6GaC+fserQRt/I6gD5+6nCdUtrdrxMghS4DdjL2YkMZbpHzTq/NPy6vJWXTTRqX3BPTK1Hnv8gD5iIBGECqEkb44/nbWOdn++m5x8kmKJNOakXe1eb/unGxABg3XmYbLnaFleNrA0jVjZPHNYdF9OBhvDmzEErCeyYg== 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=/HpKRiwOr6F3jDBa6b34ApkfJ3w1KpWcv/2Hw1+4lug=; b=mBsg/z/kzObKa5LWtt8pjMtyaXHauhXx6HTzW1LGRr/hpFaQvdj5q8lltmBtWa7mI3zNaB10tzl7SwXw6XDnLTL7IZhuna+Rqwy6+7OrolsDTvoNAg4oEQi3qijAl6OI0cfYKAa3wZVKw5CSuzBKjmcC3ulUmUtd26FhkdJx8do= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SN7PR10MB6547.namprd10.prod.outlook.com (2603:10b6:806:2aa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.23; Thu, 30 Jan 2025 20:40:43 +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.8398.018; Thu, 30 Jan 2025 20:40:43 +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 , Tejun Heo , Johannes Weiner , Michal Koutny , Andrew Morton , Shakeel Butt Subject: [PATCH v7 3/6] tools: testing: separate out wait_for_pid() into helper header Date: Thu, 30 Jan 2025 20:40:28 +0000 Message-ID: X-Mailer: git-send-email 2.48.1 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0024.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2ae::19) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SN7PR10MB6547:EE_ X-MS-Office365-Filtering-Correlation-Id: f951f2e5-9a5d-4eb3-d2d1-08dd416e5d9f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024; X-Microsoft-Antispam-Message-Info: lAQmadZdNLuJGYvUJJulhdYMYy29JYE8JAL6HUvPLw9gDlAfx5yGsnXnXFDrg8aZHDxOitj0UillktgoPt2XZjlf5fU2rfd9jfuFBOZGh+9VvcSONGktuwD/G0Ud6H8aUQlIY3gaiUyvLD7F194dvW5kO0Y4ODB4Ry52fMs3ZptSGeM0cC3cjpt/OWABwlmviRSQBSgBKpi/DbVDf/4UIK8Q9UQOaOcZFHkQyNahz27FTFUgQnd/7kgSRuVffyVaRYaNoe7WqrolJxTRjY8nAkZGWqNIc+S31RCnZ+833buSD/laMRd+oOOwvV5ev4OkIEicF3mwEDWsLIQrZaEcni6s3ZOaQ5XWAbYYmfQV757GEasKfHf1AEst1m2nx6eKg9zAln7KhNZ1dUS/dBoowz5N6Kyv5oDQWAeKhf6ohXEY1GMahTN9IFmk9AEwE8O/PO34gLzooi0R3WdtUV4oeFaVfVViS1HLOUST44jBo1m0oY3E+UPLpocbAjAG7nseg5cF50WOephL6qGmQq0U9NlvGFVoyfsBEw6gSokaVQE/MTJkQLEE1cBENsqi1HvZ5vZ7B/To24o1TtZOwLUxYqxsgUefkr5NvP5xts3oaukg84AIKi6AZA082GnbjazoSV5KHBTtu+brKUsITGXtnwTPd0hWitT1fOJfpJMJ40GYma60zvtTvIteRvwo7uT19BtMX7Z7ZJGLgBfa/ws/U2RUqbkGyDnjMt3nMVHqFPJBnBHSrZ0vIfxCq6nz3Qs4x44fVt5BKr3OU3VoiP6YPoHTrAjqxicd/FfgFwHbdTK5FrJZjqJBQCMJTdebjG7Rbea2mV2mgMkFr7+IdtCETYBatNcNkAjnSWmPNqBxkA6R7jTdNTRZ5OFMKFONJjimS/M3/0DjcS7Ho7KTLYsNJ9joypZWu4CgyHkeIP7nn42MJPPFJs9ZzTiSOlUylfr+0Fg2WnnXtI3i73STI9yzSp6UKKijMueEtV3SzY673XpPSVJceh3pbbtMqcMeWh7HEI63CWoAC/F2cw+sygE3iYC278vuFRKIwYZSDyJQPLpbrTdNS+fREQW6EZHN2m7BEagQOkAylnxLkEUXGSayiEIdEVe5mEZjuPR69OhYI8fQKZO0/bhmR4hfvnNmFrKoxv8Ch/fbxT86a+ysROTIqbeFNZbG11J+8p61IJodC3wkX520zcsWPzIWwoX030fy+2+25fpR1dfol1zhsxQlys8eG9ZcuXpmd3JWUcxXX8bmDxGlAI06teEkeU7k4Ql3/TS5uCY/UYvQRW093IUcqB0UwC3RLiABy+DmKeSnMoSLm+u+pFhMZvq8e8UwCwsnEGZm/T0BarRq+l4VIG8w4cr7hJky/m5B+1+Dpzq9U7IPwOC5Izbn9R3hcnk4t3X+ 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)(376014)(7416014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OlOROYPqmYAI8dccHHNAFQ+182mSuE9YXtTf1CrRBzk408twzmeRQNV7bzkt7P5DstqV93ORFWg0KBI0pUGz7mgxR1F1hXn1Lzp36rieGAEVx65bE0wUmliL6gHDhtuQ9qOhQ3O8xHMFUy+yRleSceoAGMt9MNl7oMkOHPyjraBbr9/+bOiaCAR+9/fswPn1EGNj32OxKLJiYSPSJm/cpLn3IYSJFq3C0q6EefTJPtvzpuBLPcyB8xcieKmUdLVU64xAdzvTl6HjqpWHxszfCNEt7G9rskdeoh2eAI5Qp7TmfbVGG1vQklQl+Ojh/Z8mrwJN7TqWa13R6AAVCtiw4nRecc7wjDfGDJsjOFbykNWzh/igsT3Hb3KOvZ98Cy3aO4oCIKZ/ww4Bgu378RORRB8cHaI3mlsT5f/5zr+Q2OG86nM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PE/mPTee84434q6jbmwjl+xSeO98AGBzJjUHZZLVi2fk9V8yWIGhmdAQ8HgYBtoODh9gSct3PblSyvIpPaJM5mYXj/mG0+Gfsdhi/Cf7tty5gYaWMdk6qCeLYA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: S/9lJpqikiRLFBdqW4Xb9ICHJnSUND8AJEOtGLrZhBE2rdfB/mhxaQ0xe+nJDK9+p3imYsA4iKjHH1Shvyrmnj7j7vBF6/KDHusmo1Yf6M0/8euip8fm++9TykCT6WyC0rq62WF/jUY+bH/fbl5bsjotYtiKYQWY5dHknxUyEA0ZYPO3bVKtC89NSOcjDajstQKI8ZhgC7F3E7M+gdJLrYLgyEW4attNDl23mq7/yCQui5IfpzjDVj11BHvp1RejVrYTqSVE6Kmfm3KOHbvfLTdPqvIIeUaunvYO9dfr8CYtzA4AuzQm2+8jM2jcxxYrQE2Vxh/bOiqUhpv6zLNQuVyPFu56y2tLZOXwPh2+17eDQcUKh1Bv3AdG0VBayupBl+R0ls+ad8wEy/XZPmAER1XtiR6NqEA6WYPa8+PNMpcUTrvAzNF/I4TS1+g9yKte8hxUqKeNq8Bxmxm0wEtMf+LMNzWVuO2lPJT8RgtItU4/APNKyoT02AezyeGivduX9WFOltmwXwCqF/vDGDEvcPKLI0Xt6kjeRBecs8zb9egw4cl1lc0HRNTIRcAMn2LT9bfDqMIZhZSZHqZCotvjXpNCInuGTwwTwNUfwYr4ArQ= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: f951f2e5-9a5d-4eb3-d2d1-08dd416e5d9f X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2025 20:40:43.0515 (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: Omtx1C0/1FaWP7A9wPycrrb0ezXM3WqHYOgBEF+bfuxFC91AWo5aGVuHC2oSBxf18SkKGJFq+ltr7q3ONkEAuqI2aeyScw241D3y0C6CjXo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6547 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-30_09,2025-01-30_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501300158 X-Proofpoint-GUID: Zr59zrSyWrMhpZ2KUlUZLcjcDYgs0iLg X-Proofpoint-ORIG-GUID: Zr59zrSyWrMhpZ2KUlUZLcjcDYgs0iLg X-Stat-Signature: jdk58pzox1wy4xqxpdttf959dbbtxmd4 X-Rspam-User: X-Rspamd-Queue-Id: 4FE98160003 X-Rspamd-Server: rspam03 X-HE-Tag: 1738269653-194080 X-HE-Meta: U2FsdGVkX18z+bMCO53MR2zqZD9B8omLjMUfPls5rtdgjmHcYterq4QAOdRYJWjVUupk3XfiAdTp8m9a1fOKfxPZgJzuSExcVCnW34A2Mhy2HdjtYQa0A0xwvYwsWoND1hu4qk2BGeKwUG4sYN+5ahgfqFLZ2e+pJC2LRDwknLZUjBg/mY+/CnS9Km+bSZfWy4HqHX6c+VPpwvZiY1ESviDmE8hiQ2R46cwkstzbNV93zLcgrS4sGqC3r+RfjNdf7WderVw2zQdyGv3Gm4GI/EcUsUXMjujfD8TRt4696oNnWSdf2SDb2NA//HecdBrlZ0969itpTSX5PTjXa/YhHj8Q8mYtyXLJZPAAG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yyWFt3i8FN0UxVmL7piw/elXujanF7xMEPzFNzNRtKQywTZuY7QQJ9XiycekwP3nIJYz+Sm0r79rAYcuSu0mU6NoI2zErvAu+ePgkJQJLLOrCiOl4q+rb92Bi2sB0efi7r7j0Wyn5ugwC2uSI2H36iCghyihG0NRpAqRbYw5FUafts/u8zY9PHHHrbZv+Eu86rVzR3BZtQH4X+Nlk+xgkkx6I438eIfxXAkBOaLP9IlkKDXiQbKA+rJzv7hSBfkKiPsCHk6Blxvt/ X-Bogosity: Ham, tests=bogofilter, spamicity=0.000183, 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 0b96ac4b8ce5..d02cfc5ef77b 100644 --- a/tools/testing/selftests/pidfd/pidfd.h +++ b/tools/testing/selftests/pidfd/pidfd.h @@ -17,6 +17,7 @@ #include "../kselftest.h" #include "../clone3/clone3_selftests.h" +#include "pidfd_helpers.h" #ifndef P_PIDFD #define P_PIDFD 3 @@ -73,31 +74,6 @@ static inline int sys_waitid(int which, pid_t pid, siginfo_t *info, int options) return syscall(__NR_waitid, which, pid, info, options, NULL); } -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 Thu Jan 30 20:40:29 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13954960 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 ED3ABC0218D for ; Thu, 30 Jan 2025 20:41:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id D8A7D2802B1; Thu, 30 Jan 2025 15:41:04 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id D3A98280058; Thu, 30 Jan 2025 15:41:04 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id AA24A2802B1; Thu, 30 Jan 2025 15:41:04 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 88A6B280058 for ; Thu, 30 Jan 2025 15:41:04 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay01.hostedemail.com (Postfix) with ESMTP id 7678F1C6A3A for ; Thu, 30 Jan 2025 20:40:59 +0000 (UTC) X-FDA: 83065287438.02.3774DCD Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf15.hostedemail.com (Postfix) with ESMTP id 0B700A0009 for ; Thu, 30 Jan 2025 20:40:55 +0000 (UTC) Authentication-Results: imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="S/91QAB0"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Wp+4QXZ6; spf=pass (imf15.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"); 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=1738269656; 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=KeWPgFb/fq7YdqcyVIZUKRTbdDD+ChS7+ubYputWHNo=; b=UpxJnoV4Ya1ut6FD4Wbs9GqUSgZXvjT5D9qxQQDzmln3Cfg405BuKKKUb8iOIqlpb1bP1b CeAaDybM5q4/RPUs1cCMlkGD+yVx1FFtTUE5G/oJTevq6p5OyL+5EVdNcFpCWzs4y8yaqG 6CBUh3WMayFlz9rrkM/2LNcpkbZYaa4= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1738269656; a=rsa-sha256; cv=pass; b=U4HdPbc4IpSbxeUc2ClK3CosPaWglm5mSQdUzL2GjObB/zbq4KgCHyhE9pfDf9Tv/xKsz+ z2D77QA4M3dwOl7QbA3QmmFsM9bBmheeI9pFhfIIJ3apnTq21D/+LTKNGTovpIhzIaO752 QNNOT6eTtCo4lG0Eqbf7A8+YSYfH5Ec= ARC-Authentication-Results: i=2; imf15.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b="S/91QAB0"; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Wp+4QXZ6; spf=pass (imf15.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"); dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246632.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50UJic59009892; Thu, 30 Jan 2025 20:40:50 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=KeWPgFb/fq7YdqcyVIZUKRTbdDD+ChS7+ubYputWHNo=; b= S/91QAB0qPKpyCF5MoFE1pb3f0VW2Gl5yu5OM06gHbEib2hg9jCYJ57cK3X3U+sb APBUptTuncKbsMqCxZOA/k2o8O6n/YOTJY4gOgCD803K1MhwS7hhhsG3rxdXjXAE yDiFTiBkGfZDYakOJOE3PzYjEVKDjeHNiF0C7Ldx7vRDm2RpbUkRt4OMwVIEsxZe /UX9lXr4J7azkVY+UXQcWwV8Lb6pgAtMkJqZ936kFVuAUL6h7Yg7SwJ1RgEH5QLv /9Hyn54AfA0kkxjqTQYdNnO7gXljKcyQ/d8s3c7YD3ijZeRH7qt06ssghkBzkSd7 mVrPNNaaC+4llmdDCL8gyg== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44gf8206yy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:49 +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 50UKDfVN028297; Thu, 30 Jan 2025 20:40:49 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2044.outbound.protection.outlook.com [104.47.66.44]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 44g0vbm9gb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lfOHk74WTHBJWDLXTEgkK2rwBJEE74pR0byktm/4xwEthMJCx6Isy86dO4/4R7nkWahIxVOrkKs3Q10AULylUwZMghXWJBvJuIanmJqq3u9Zw6R9/5g1FATR+xc5ypF+EF1+6vYs8ovdOuKbeDQsZZox9ZWaPdgyOn+IKc+96y+xyH5oKuj7uheV3NpT8IbXVRaN+B66Q6Vtk/T/pWD9d+qe0t87MqGv/Xh0hD9Dh0OExCMHlre8tpO+iS2Uu2rnr04aNixGWZBWaqPDmeEWVhLl1HCcB64VlXZrwIzBrPbyxARwqrYT2II+bmBte8mTxIzZ7ceVUgG62V+8KcjI/w== 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=KeWPgFb/fq7YdqcyVIZUKRTbdDD+ChS7+ubYputWHNo=; b=ZSYrOypdxb4zWjtsCXm435FN19/BrMyRp1K7kV0CD4awwEtl+t+BSGHTNIbbg3/SHBU//kASklh5CO7qXzol44+sLU3l+l/jGTWexadcvcbcjTgZgYq+mFCmCtOKr9Y8CwmTifpPrpquY5h8vSmZ6tgQOEvSdw0HbQ2k9m3Qul+cOfhcZOO/MGqXRVkPlwVHQj5+/gdbc8OEXDhjtVUEML/PywzfvsvAffFBYgxRnq2Oe6db/QGhD6N5qnp1o93Wf25GzWcWX0A3pVC4Nbs1HN/uzr+sNDMGKu4LVokmX8Yo/mw/wQt1/YShkPfoJdPQtJjU7SJMGea9T9UfDYlLog== 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=KeWPgFb/fq7YdqcyVIZUKRTbdDD+ChS7+ubYputWHNo=; b=Wp+4QXZ623Z00JVmstXJepllzqWLfF1/N/jJo7pz4MIhcxqvqATTzncwx0f1bNCRb6Rj7qziBWy58e4GLBXVSRZnuvxRjHdEjoLWPf3kqeqvoDaSEpSesroTStQ57Cen3Ivb235zKwO5hxLj1wFNURYt6ByRej1cIQFRKjSbIVQ= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SN7PR10MB6547.namprd10.prod.outlook.com (2603:10b6:806:2aa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.23; Thu, 30 Jan 2025 20:40:46 +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.8398.018; Thu, 30 Jan 2025 20:40:46 +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 , Tejun Heo , Johannes Weiner , Michal Koutny , Andrew Morton , Shakeel Butt Subject: [PATCH v7 4/6] selftests: pidfd: add pidfd.h UAPI wrapper Date: Thu, 30 Jan 2025 20:40:29 +0000 Message-ID: <751907a39349d0a1526f6f63f4270e4a5700e244.1738268370.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: X-ClientProxiedBy: LNXP265CA0044.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:5c::32) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SN7PR10MB6547:EE_ X-MS-Office365-Filtering-Correlation-Id: d6c91255-2f9b-453b-44a5-08dd416e5f88 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024; X-Microsoft-Antispam-Message-Info: YUcABkNnYa32CWSmZj9YcqZ+vKqJ51yqFvg52gzh1/56dmhLRgEaonvm6OCZCwL5hjPIkmvDwURGeFxlYF8URPz9mUyOBSym/4Tt41Bd/dmfr54SQg6s2IItESsbVNaEuNONLbzF/OY1TtSZCmTtBJXDT68BSELK5msYCsodAjIUR8wJXzJcZW6USiBJtHTQOEaZ5QtNUq6IKPXs8Z+ntus7Uye+i3LI8+x3qt47iqQ5O/ATLIarMjIR+gk/yJEVm5QQJHigXw8PJqNzxF3Rnzxy/6w//BzH5VVoyx2a6fEOdWIAuB45tsLt8h4ajzL5hAMvcqw+FLalPtYIj0rrVuCO2lrQtxD2WkR42C30xg/3gPy5dc+DS3G2rH6JbujSmPO9yOw6y9KaB49qYp4V3pSxY1yRlIL5BJlP6CcPpK1sVo9OpQiGqNIxJ6V3XWdvc608gHpILIzsURoH30Zc4Ia0jSAhuUUTO2ZFjJHH0OKed6poNcQjoBOMVczWaeD5IMRTFjCaUMGurYtT0SL/hgv7BP9/8PZ978PN+qP4ptkognFkXqjI0WATTXBCNR/fVPbSdy3FSZmJFqry+Uz1LS6ZNTrD4wW4lbiFk+4TlrnneK8D97MhUw96G/sLCC5bTyeoh2L4RWKNLd2nYj/1sK1XteB85yXO1RtjcvjPJqCk7kO6bsuloFIjZvK5Fym4HTpa+I2t3OVBN8s/dW/2Wv9vF0jloSxWMgvGueQ41NW8MUHMcK4SBiHlZWAKdA3tzIDB8tRErD7Jyr3GwQZv48TtQadW16ZbVhzAQ1vLSEHAkiuE0MzTLoDp/+P20zCPGwWzX6QssQjN0pGZWbuXODP+ooU9fxJpin+geBNlrJL7+6hk0T3h+YOxMMIQei0kgUZMhgNgnruy815QLoSfSdAFO1UpOPshglkHXde00KQ/sVK6wwxv1prfimKmTRjNlRmwjxTeP5LUjYGat5hUPlWp5ZNxtZ1PD+Cx8iK9y72nuB/Rq2ZlHypOZqydk8qSMKD54T0E6PoetyUIBF2Xdy/bbJO7JisqPCTbkJutsFT5gGYX7VCVrYDqNEtqZXfpeEZmkrBGc905ITKwAKyCqlpuYdJg6Ys4XLzw7MQw4QFHtABZOdgiIw0X989dRexjAG2W3XgGCY4IgePuunnEDDKarhJkwMufBlg9q6rD0H+yjpHURIBAMCKpQAAkloc3FGTRSlOPUpgNLqUJsy2dzF2gOTPzRLpueutxJeT60zkGFlJonPM6Vp0pynSUhVu74WqQtOT7oHbEgFKqfqiOrVHgkTEvp40Gk4kGUvwejlK3XXYmbFpC5cb4Bii1ZRq49riPLECcNLw63m2L80RHKhRF7oAvLyybMzdHy5X4Db05sN1GExhvOq419UQw97nZ 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)(376014)(7416014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: XHoPLt+xamfoSL6Ro6XFl4OUfXsjVl+j2fSdYa7Hlt1cTUWJoMZgTFStqM0GdNLjtTPxYdRPQ9PyEgaSo0i/xtsUD2cguJ1zzAKiN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9t9Yxi9+Wz5KWGymveAHpYorfGWj4zh8715psB9lWetYEYKaFgnxE09obr6E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d6c91255-2f9b-453b-44a5-08dd416e5f88 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2025 20:40:46.2427 (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: nIdLRajGtTtP8InUuKVE11YRW6PJ+xCRKtBElqu7fJ/qRR+T4mBrlUW+1EPmMINQuINB6N5+U/HyZym6ArMqmSrjZUY4Qk/TeB+MsZkLj1g= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6547 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-30_09,2025-01-30_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 mlxlogscore=999 spamscore=0 phishscore=0 bulkscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2411120000 definitions=main-2501300158 X-Proofpoint-GUID: XfV_9gjByChqX8bkpM8-xht-m0EjaK7R X-Proofpoint-ORIG-GUID: XfV_9gjByChqX8bkpM8-xht-m0EjaK7R X-Stat-Signature: tyamrxptd1ayk634ducmdzaptwm7eurb X-Rspam-User: X-Rspamd-Queue-Id: 0B700A0009 X-Rspamd-Server: rspam03 X-HE-Tag: 1738269655-396932 X-HE-Meta: U2FsdGVkX18IIlVHpdvvwZ9F36i/wg4MM7oOAxvfnvL0cqa8/aaxVu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ThMjSDIGbaSa9mc7HGVBLWgoYn8O5QjONwoqZBedx+emlXC/knPcPflG21qoe2r8DDVwiER8akZvYSlt7GYa5VL//59JeJr7FaCa0a5yh09VqQBY3MZ4aYezz+B5WQD0bS8smWvh3ggA3XzyhNu0EkkQwA0nLVlQUJzRIkZxWNP5m9usjDN0x0Q8iaVPb0BKROM2LuJ66vrKUMunc6I+InTsdVYTctisBVq6HSGbNLF6beijGeKuXbipyLEtJjqtgChP/f6pi8X0KnWtX1y80cE1LYU5juGepxIXZaKgEXaUsZcZhBwqUPTZC15/riGKSvtho3ts+cPzYtaOphS9WH4Nos8PjH+Z/d0LkfAkSrzyKQKGTJF7JdwcRBbl/b7dtoY7VacV1NiNHRDcyBVok0hr3SyLNy1CEsMzPpjwtdbaGguFWdZuho5gTa/xRv/NmfMNx3QjGstHxnjtjNWO8jV/Jboz+YPNxW86BfB12GbkAxLkJ3qsxKNSrvEm0drB8FaqsfAGKhtBWhxJpsBfJpf1Spt/xyJ1hcqQmWggQxWljqvPLTGHpy/U= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000573, 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 301343a11b62..5363d5ab27a4 100644 --- a/tools/testing/selftests/pidfd/Makefile +++ b/tools/testing/selftests/pidfd/Makefile @@ -1,9 +1,8 @@ # 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 \ pidfd_file_handle_test pidfd_bind_mount include ../lib.mk - From patchwork Thu Jan 30 20:40:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13954959 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 1468EC0218A for ; Thu, 30 Jan 2025 20:41:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 994162802B0; Thu, 30 Jan 2025 15:41:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 91BAF280058; Thu, 30 Jan 2025 15:41:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 746B52802B0; Thu, 30 Jan 2025 15:41:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 51B78280058 for ; Thu, 30 Jan 2025 15:41:03 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BECCE1601D8 for ; Thu, 30 Jan 2025 20:41:02 +0000 (UTC) X-FDA: 83065287564.02.EAC4A5B Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf23.hostedemail.com (Postfix) with ESMTP id 6F9F6140017 for ; Thu, 30 Jan 2025 20:40:59 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Ft7g8fPr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hS3yGOQJ; spf=pass (imf23.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"); 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=1738269659; 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=Bk4iEJmNOs0gKjCIyK6jOaRhyYYz7iRVbjW4yL2p6M4=; b=IHvFMaqmiCqFj8KzLqj/ZYSHFkaVrVx+qEzhaDuahrlOada16msaguhvGpKMhnmL66DGxo yL0lJlQ2fZMwS0lQcnLKz1ctdcwA2DWLDovSojJhgiSbSEX/l6G/LZwNckYjsgyvUznUBB ZdnoLHEsyOpGDD8nlwfVtTFyfBN8PDc= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1738269659; a=rsa-sha256; cv=pass; b=N68oi9z4bmUWbKq3eegcYl0J3SjzHSlpZE/9pA9rfafDBFjT+Z3yGfnDjRsjdDgMP+ENA2 vXkIy+ZwL4OE9gdOiQFvPfRPWVsB0TwYYsTzgVcxMo5mSBxxqbJkGqQ9EMVZNVO5+1Lihl LSv4dmuCcMbIhc5/SW7RuOAI/tKncPQ= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Ft7g8fPr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hS3yGOQJ; spf=pass (imf23.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"); dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50UKH0et026817; Thu, 30 Jan 2025 20:40:52 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=Bk4iEJmNOs0gKjCIyK6jOaRhyYYz7iRVbjW4yL2p6M4=; b= Ft7g8fPr0hn07dsuEe9MphtGbWYQsT77SEDgmFoXA4pRYxWdybufzqdJZBPQ/Lj0 O5mE+QifF3YWv3YAcHKWO9aK2Ouu48rveN0Ov4O6e6XM5E3QrpQPp/vTXR/23NTr b79SXAXLRgLQlT3vhbow+IjSIMVuntbc3OdonmxDbPbj9d+uU9Rf1haqwVFEBrIB 4q3EEHYd4kgMB6+h5KBv5P+2GmSCQXn93UXp1bnj2b8/DQh/KVJhEAm56Jv6D8OL ++d6Ta1d7X1ujHY1K3NZ+lD/Q4DPCowvo1cjJhh8eIvfd8Qgh1Gdy44sFxZ++btq O9LAsSE9RryB6pyKr2Sn7A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44ggaqg1u5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:52 +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 50UJNXhp006240; Thu, 30 Jan 2025 20:40:51 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 44gfhtk6tc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=piHxRbML8qMkjDXY/3cFu/kMLrVXnSRk9bPO94SoqBJjCVEY9aFaVqSNPbSj9X5BBI0atUWP/RyPJUhoYfVzp6LUikHxoYp1gny7xFC9OIa27yULyKJEKWh4jhQDoAZasqM+Ryp3M7Lo8DBpPW/hzzkEd6H2LCFPz8PbkBzxOxfesmO1AIh2HaDeNCWoJngYEswq8gEXGMImaIxQYUi/8N5HkBqzBblNiBNpu3HEj/2Nithz7quVOEX1MkDw9ZVru4dTey7mYOTWYK3Trh6iVNQ0H9tJqhM1dSncAbL0JzC+eyYKhXEuxbSVQDTMRSdAxYm/5TjC+cmZBneFLdLeCw== 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=Bk4iEJmNOs0gKjCIyK6jOaRhyYYz7iRVbjW4yL2p6M4=; b=zJeX/fgL59OnUTOPwFNZPA+REpZavGL/XP/rbVsc9DH0PKvp0XyAv0MA52FCAf4k7UXAFgma8m/+ThcTsRclqnVExkwyy2jWZ4gCN/MoI+b6DbbDr+hwfoLxUKB0VCSySUK3cjDUcShvz8MXszQEuWnBP33fChyLkoOmvXqOWY6drJKEuM4+CY5l2oCpG012NIviB55KNhTx2uaIMxQxQgDSbXWICdviatwlYTVR5IhFEo2JEMCeIsCZ9WVtgXa5uTlYDADxx3/OyPdlIiJ0BH8D9+0GhIZyjUcg1RPuezmZMm9lzA4gMQFbEF81UT9pOuP4Tkw8dzfdSxxMNZOsOg== 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=Bk4iEJmNOs0gKjCIyK6jOaRhyYYz7iRVbjW4yL2p6M4=; b=hS3yGOQJ5k56H2UXrCj/p74sktNsUgJvZBbnlr80xyhdlXi47gz4Aar+a+gqURqZPfobnYJmKsoK6h/ewb1n6GzRjvkCWlRnDZKpsoBXTIGL0oVqTzGKLtVwhOs8+VbSqFT+AMyqf3M3GGf5XpDzmBXKKylfiYPVh5cNs4EjOWY= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SN7PR10MB6547.namprd10.prod.outlook.com (2603:10b6:806:2aa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.23; Thu, 30 Jan 2025 20:40:49 +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.8398.018; Thu, 30 Jan 2025 20:40:49 +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 , Tejun Heo , Johannes Weiner , Michal Koutny , Andrew Morton , Shakeel Butt Subject: [PATCH v7 5/6] selftests: pidfd: add tests for PIDFD_SELF_* Date: Thu, 30 Jan 2025 20:40:30 +0000 Message-ID: <7ab0e48b26ba53abf7b703df2dd11a2e99b8efb2.1738268370.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0072.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2af::21) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SN7PR10MB6547:EE_ X-MS-Office365-Filtering-Correlation-Id: 3634b2da-05bf-40d8-d37b-08dd416e6129 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024; X-Microsoft-Antispam-Message-Info: eJgoeI35AdpeIo9siq0kV42bzU9vaEM0IRlu6XcaVrI0p+SjU5zmRG/B4UJl0GNxfE2KOFiMlmJmqc+obdhFkI16v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YZK81r43AzZnb8l1NJDN6/+MHURV7H/HXur1//lAXDCcfROoCcUXjhrco62dqH0ZIOyTljIMGKj8vEBbVeeYwEhIlasyrSksIF1Q3vQ6R8QXas+Fpwpho+4+qDvtFEwRkewVL7pnITUchrIVz+sscKa50din4q9eBHKWdzrfkj/eU+D1xRfLXGSNxe8m8HJHlKXzi/j5U+FfjBf5dNOcMY84EEzFkjbyeGB13FXkB4knTr 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)(376014)(7416014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wfABsDEwsqh9BaLFFQ3I1ELdWJ8cbdCESevd1/yHV5QSKN8TpXLpB8SxDgyXbkdTVIfrymz+QzVZRBqPA82bq35Hp+aK2rpQLxk5kRQNODZbVg9pCmZRTJp0xilaxa8ksQwON9hZPn/T/yC1FooKFhTvtbXTBFl9VCN1fWcBmWQU1yBIRhKi1WgSSttMMVB6QAVpY/21RDTm2jYy/vE0zL4EaMe9nLFY+KNotyrvH6IMdg33xgQNvd3W3c+dYLpjCth3FmxKJl3KLpFpeejZ05aM/zo4ceuK1IFxIFo5R/91fb44TyG86Uq6rSTk+wNLP90tF1mHK767mwRCIGvcJHityaIwGdDoXQ0LnM4T70la3zLXCOzmrDXP932Kxr3AbfWlUWJVgSK4fpz9vrCKyN/C+xlzPGtJ5nzvdhatc4Ty0klVpYq7pPCHRJQzztbXiHdS2JdjbyvzWGdEeeeLktN3umU8EWkJrbdqQDJuKn/IHXhJ4FcMN9NJ2svKorRQpuZlTTsiyWOo7PB40TxuSfZCH6TjTSHEhopKoHffxpoinS2c7+NYcT5nJVzvJmgZTF3gbeC3BrspHXb/j9tyqqHS6hMoEctDmgZ0vfpVb/P2BRyvwN2iJ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40KeZJHSLUoIhNyD8woiEHdNHrTaT+COoaX1XX9wYaZrv98C9xzS2JrN65RT2yU2LCQ58RNDvGoS7+zUXd9oNM4mQYxkpxj12xDpRiaQ4A/8AoPCW/cy0xpl6UWzoklXs/gOBScoblwO0jFQEwO/nxia5N+Im4ISgBeZWd/mSpJkC5TQNpXvv9mJWz3LyGwz+aiLG5APX+ZEY1yVfK9lNbVa0z9cEHK3v3J+KknliGfjzVX/zs0ZfhCU43W8aNV6vfvOjseg02tnCjWfF3J+QinOdyhbVKAU/WiryP7I4cFJ/+IprxSAIeIrFrTEe5CA41rLnqzVljn+ce70t0cClVfo4DC9q2O1+qlAlEbFEe6iGH21p0q9NpVeUVc4ymJtS6VbDo/J1+dVU967dmnI9dZTxIHceHcGwuXIUKXTrKgJC9hFyonQFYtW+R45unHtmZNAueEh3WACOoBPdecqZ6iieKFyGOEr6tyyMl+c7baFExxGZd85hPE7H5p5/tOZkXB5u/9pgr4nCKE+K6o/RukFte2GNnegDtrw3ncYl4gjDJsDvD2kuqHe3h3ijK6huCNkfxQ+k/6o6ZtsdOLqgoS7jpQjjvGbRruNKh34BCA= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 3634b2da-05bf-40d8-d37b-08dd416e6129 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2025 20:40:48.9776 (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: 99vuMzWRjg0R4X33wE3RdCyXTK0VwXBp655ufj129knETZL7+unesUVW7QHYTebZHqQhMQ8vyKQCXF7mtcoNyikfMQ5Ag5ML0UOmocFS130= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6547 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-30_09,2025-01-30_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2501170000 definitions=main-2501300158 X-Proofpoint-ORIG-GUID: 6jpQdmPgzVkG9Pnyrlra1A1ppx64t9wS X-Proofpoint-GUID: 6jpQdmPgzVkG9Pnyrlra1A1ppx64t9wS X-Rspamd-Queue-Id: 6F9F6140017 X-Stat-Signature: prjog5gwhdgcrn9khrs3wuwjhg85qh7k X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1738269659-329319 X-HE-Meta: U2FsdGVkX1/1WwkB85/LClgOIxyhOXcBdDHDT2hDqrDAiq9aH8hOg9FUrN+5v+tdjnaPQFrNN+8RLZSEZBfM1JMZ1x2J3pkVeiBkQTzcixIQbB0wvkAOvoPxQ/xx71whUhVha/W4IjY34qhAdCdBWB6fhsSmfUTTgR58XQ7n56Z1Vge+19fydr775G2a2S83dTeMf7TvPukXof7WcaDLTADplhV10h31AhJLoxGcYx/fWh2PPVJ1vb/49epaEoBkdC0H33x5yV4RVO/iS9nvhvLZsQ9KWSPZj/lQ2bKmyi/X5g2FYf3MMJYKk1uVxY29/l4hlufBla1VKZnNg0duCo/CMXB11wXdsu0lmx9XhiOtKEtl40Zoktg7bic/Kgv6K9icfQmmOIvjo/RT0t08bJHZDn6/2NGTzDOJXQQyh8jtgjnswc8/1RAvQiXAFBW//wLR1oVDp64n5WWE4lxBXQEs9NeisAiNB0hQ7SV/MHJWe0kCe40lVifBqClqUDrnQrqUujRSoOrYNuaOQjzM4CWj9wEbDu+A/VhaMMbKE6yP5Qqcjt9szF+lwUg3DIE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sDa6GNTtTn5Z1viaNXzuymZvg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000025, 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. We explicitly test pidfd_send_signal(), however 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). We also correct the pidfd_open_test.c fields which refer to .request_mask whereas the UAPI header refers to .mask, which otherwise break the import of the UAPI header. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 2 + .../testing/selftests/pidfd/pidfd_open_test.c | 6 +- tools/testing/selftests/pidfd/pidfd_test.c | 76 ++++++++++++++++--- 3 files changed, 69 insertions(+), 15 deletions(-) diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h index d02cfc5ef77b..cc684d872253 100644 --- a/tools/testing/selftests/pidfd/pidfd.h +++ b/tools/testing/selftests/pidfd/pidfd.h @@ -15,6 +15,8 @@ #include #include +#include + #include "../kselftest.h" #include "../clone3/clone3_selftests.h" #include "pidfd_helpers.h" diff --git a/tools/testing/selftests/pidfd/pidfd_open_test.c b/tools/testing/selftests/pidfd/pidfd_open_test.c index ce413a221bac..9a40ccb1ff6d 100644 --- a/tools/testing/selftests/pidfd/pidfd_open_test.c +++ b/tools/testing/selftests/pidfd/pidfd_open_test.c @@ -31,7 +31,7 @@ #define PIDFD_INFO_CGROUPID (1UL << 0) struct pidfd_info { - __u64 request_mask; + __u64 mask; __u64 cgroupid; __u32 pid; __u32 tgid; @@ -148,7 +148,7 @@ static pid_t get_pid_from_fdinfo_file(int pidfd, const char *key, size_t keylen) int main(int argc, char **argv) { struct pidfd_info info = { - .request_mask = PIDFD_INFO_CGROUPID, + .mask = PIDFD_INFO_CGROUPID, }; int pidfd = -1, ret = 1; pid_t pid; @@ -227,7 +227,7 @@ int main(int argc, char **argv) getegid(), info.sgid); goto on_error; } - if ((info.request_mask & PIDFD_INFO_CGROUPID) && info.cgroupid == 0) { + if ((info.mask & PIDFD_INFO_CGROUPID) && info.cgroupid == 0) { ksft_print_msg("cgroupid should not be 0 when PIDFD_INFO_CGROUPID is set\n"); goto on_error; } diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c index e9728e86b4f2..fcd85cad9f18 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; } From patchwork Thu Jan 30 20:40:31 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13954961 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 B629DC0218A for ; Thu, 30 Jan 2025 20:41:08 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 1A4DB2802B2; Thu, 30 Jan 2025 15:41:06 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 12DC1280058; Thu, 30 Jan 2025 15:41:06 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id D893C2802B2; Thu, 30 Jan 2025 15:41:05 -0500 (EST) 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 A09DB280058 for ; Thu, 30 Jan 2025 15:41:05 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay08.hostedemail.com (Postfix) with ESMTP id 62944140116 for ; Thu, 30 Jan 2025 20:41:05 +0000 (UTC) X-FDA: 83065287690.02.6E18140 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf27.hostedemail.com (Postfix) with ESMTP id BD0C940004 for ; Thu, 30 Jan 2025 20:41:01 +0000 (UTC) Authentication-Results: imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=XPvV2A+3; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cd+lPFsl; spf=pass (imf27.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=1738269662; 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=hskeFoXwHdhQ92h/U+r/jHo6BZpLt2aINstNSYk42Cc=; b=oj9Q0jOu6fH+HitUFU8IpylkjQkJ8ZA1sBGSW3uDevP2+GyFHVqNS2VdjRkQcb8t1lGbaJ 3ml5y3jfZfwesyjS3fI1K/xh7f46RQ4zXb+HoC3AdmOpCgsERdYwAYVYLDELOhuW7zK60i /pKOEjYIDsEf1/U+c9hge9+mbF8Wr1s= ARC-Authentication-Results: i=2; imf27.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=XPvV2A+3; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=Cd+lPFsl; spf=pass (imf27.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=1738269662; a=rsa-sha256; cv=pass; b=ry4KFmuOzZypYNIS7y/3W/JMs32FA2eNl2UYtpFVBM9zAA7emobxbN/JouJO8GX4cxHRXH GpXBTMq5Svjidv/I6ZgHC5/i4OvW/Lq3fMBiUE0VC9yx3SIzyIKn7QNO6HEMF0n7pE58Y4 eI0YAGs2arYhNT8CU3UPB259iY0/Wjs= Received: from pps.filterd (m0246617.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50UJig0N010291; Thu, 30 Jan 2025 20:40:55 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=hskeFoXwHdhQ92h/U+r/jHo6BZpLt2aINstNSYk42Cc=; b= XPvV2A+3ZDZ1hPZMFgb2+Tw3z//P9aLbx301LUO3PIDtLxzM4YLAA88pi4a66yVY enk2br3hTOFmfh16yshT5KqvGZG5hwKrzdquCHnP4w3tWj8UNy/dI6PSqJvFQl1Q VW/Ax7Jh69xDlcRiAMMswgt7Jeh7N/yDPifmUn4gwUKPROCXVELtC5lfaZA3yeU5 EVkixSJKCQNgIm6YANY9hHyKsJzm5Tz7/piUDsGJXtI5SS4YCB2ITBUBFJk98HjA dCFD3+0xZe79cS3aoyfoY5ROE90l72h0287lfqtJ63xTMeS+cnz2l8i3AVkpqjl5 Jl9b5tKNKA3hO30mK+h/mg== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44gf7kg6ty-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:54 +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 50UKene6032289; Thu, 30 Jan 2025 20:40:54 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2040.outbound.protection.outlook.com [104.47.66.40]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 44gf933ye1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:54 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=A/6M4rcKBj+GZ6JvBnBoGQGuJOCpKt31HXSt3J4mIu7oAieUrtE0ZTW9h/9rk6wY2n4e3VqRDorYe7JAoqMzUIJoFUyZ8jsOqUMSlA91Lx7NkniDxpfkV5+Eg79+9R0pq060vEsBM1xI5ccZwqEZinnWL2OG70roFe/RcDzPrOOSGI2/v46UqItml5VPO62w3+Am0WpUQSxIIEHtxIlkipsIMqi+CwPlZXLhebognzvEYzuWcdoS3eF0vKekNiyEZfUUlStd5u6OcxaUTstPha0LLktCx1lpcvFCQcVApZGr6Bg5/KFoVZtHMl29jWBPjB1C3dO4jr7P/jSANpp65Q== 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=hskeFoXwHdhQ92h/U+r/jHo6BZpLt2aINstNSYk42Cc=; b=e1+0Y8pic0B2hdyunhjWC7OSEE0pe0y6A4z+zx15M1v4oqXdqEPt2x6yjcg72nSUtuoe8CvCc14Kcyb3xWJg7IzVWb6N5QuaBzG84A0mYWQSvogKcIm4djokiLkL2EgKVvrtWdvGJNAORpvIjetocMG8iU0J59ZmUk+u+goQD8gnooR48/Q156VxCo71+MXKozSH9cY0AMQy4/QyAK3Hvm3D0YqLuXnO7jaOISOiph9ASCmxtka0aDyCLYjG6y0C/4MjJihEyYrVi5eM72w/DY2nVwu/7jlzx0FPL0+kQt8n8spfyDBaYHU+g2HIJWT+SJU/Tw6xeUnfV42O18mszg== 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=hskeFoXwHdhQ92h/U+r/jHo6BZpLt2aINstNSYk42Cc=; b=Cd+lPFslo+Bfv/lbZzwH6UARWjnVCaFkugYJqSlMONXUqyp3F7NXs3L3cMMdqRGQ3xEXoDONxLJZ6wECZzuFY1TMNYZNhMQjrkz7/V0zxJt/Oorv6sCkL3c8klzneVHx90haQo/PUZvOaeV6SK60vEkT2UxN6ock5M29womhAsY= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SN7PR10MB6547.namprd10.prod.outlook.com (2603:10b6:806:2aa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.23; Thu, 30 Jan 2025 20:40:51 +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.8398.018; Thu, 30 Jan 2025 20:40:51 +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 , Tejun Heo , Johannes Weiner , Michal Koutny , Andrew Morton , Shakeel Butt Subject: [PATCH v7 6/6] selftests/mm: use PIDFD_SELF in guard pages test Date: Thu, 30 Jan 2025 20:40:31 +0000 Message-ID: <69fbbe088d3424de9983e145228459cb05a8f13d.1738268370.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0208.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:33a::6) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SN7PR10MB6547:EE_ X-MS-Office365-Filtering-Correlation-Id: 19ddfab8-81f5-4ff3-f324-08dd416e62cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024; X-Microsoft-Antispam-Message-Info: kKmaK60y+D5hTsPEbtUctQNxmGQT/jv+P95cLtdY5w1D9fqRs2S28h08XEHyB/OPsfPQ79Ud3Bbio+00S9GFuXQaGXYfulgkitiHXd9R+3lsJrgwj1UtPTneMECVR/G3R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0c3GhSCczWzWtn/0yxtGtxJN9scbDjlOZCzNJqywUQlsmjQG5jK9kMXs16n/Jv9GDsbG23av1jrBeO0GFmZoB/ZY5OZfmx2iDzdMMgkZGIMhuoM1JtlO85+3M0/L0XpFzw9cXICO+QsNiaH+z7cdWhjkhk3nusSpySeRZb4T73B/RwDJsUdtvY 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)(376014)(7416014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 3FZ6B40OoZyyVohdkQylI8gOzszcp2grOl7GGlcilIMiz2NNpzZb4kAU4s03Jypt2SW80ct5VkiRSZ9aJ+t+o/DH0IYW4PxqsciHpKrITOSq4cz7t+rMOPKi/igy97gg/H7a9WEDN+CUVrmw6moKRd83f9ic45/ZxGFgwtMC4dPONIDKrChOcFC2TEnot1zI9ljRhoTyf/DdlaQM1F067SIPVaQx4bAMRCc8aR3wTHDaFVTxVkDtai/fNdhC/0o/gcJNNxPf+vrZ9zISF1Fxjx53Gvpb3n5SkZCEL3TKnyatMtmylLHgjiir+y+9fv33DXU4fSx7x2Y7BgjeKrd88FKI5HiMCPT9+zYZTJ3e5S6pFjH63LeR7wK1kjd1GyAYu9KVYisW4Wjpoac4fvngSAM5oHTlbRMXMNCj8ymzN8f5fJZ4dO1V+n6Qt418N/PvhEm9XfdScSlzgsFNzEZrOsF/OUojEnhjULw2vZkx05RILx91qjATk6MbkVBlClRrXKO+h0eVRhJevdn4CKMidGGLBsHgz3uXQbJtxDoPJ5m3wyzXtEgo0xwTnRvGVk5XTZC+++u+CdTbEF39AAdXQ7ooeU6QLucfdu/AvRA3c7ghoJi+0zgHjN3aAFWhMrfrqQBixsk+s+vR6cFxPA0HwidFNA1PU+yDatg4rrB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yCHPIbhXo6sOrXerGkV1td86TJCThdPIPqjKcVK8M987uPImS4qYV7VqrokR23jRmyOQPOdxoNaRsyVvBRZGQjkZpypMU6hFJTg0oGWkyFyQLW/E/7yswypkUkL90djgRmU1Qy19k3nF+1VxxcLX5LMELbSZsG9FB63LxNflih0wb3atQw8fRadzai9cmCmkbLeO1ap6I9XSFjlMOhDvHY3WaVxWm3DdXAptLvEbLXprEvwHR5QYFM5O2kjvmrzRYzzrNW09dhErwUrqV19uhBiMh6PHbD5/53vJnN3jaODH9ceBni+9yqQ9mpqg0AaK2i5fD061axgEEMwaPienyDVxziTVB8ioamPuTi9rAlhGz1UGrrflwjl86+H1DqUTdEM9R359tRRlnP97YSaYt4A3EBqcfHm8Q735NytRi6cINU9SiAEJhMAfqFhS1z3gAN6O3BzayNmeTF128n1jpIu9ZuwdCTlYSejKnaoxaWzGl73CfBc4/dGDuulQcefN9ocw6UH22BduteFGLD8uHyNKlo0e7DHWicXa8o= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 19ddfab8-81f5-4ff3-f324-08dd416e62cf X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2025 20:40:51.7686 (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: S0bpBzxpbTKkZO9Ckcz2H351KVjds8fqB3+RkVvL5VJURRI6MxUtiNG92XyDs1Qlltl3ERfrPmUtH/Ogr1H/8XZTItC/qfVMIigZ7MuJ4rw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6547 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-30_09,2025-01-30_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 adultscore=0 mlxscore=0 suspectscore=0 spamscore=0 phishscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2501170000 definitions=main-2501300158 X-Proofpoint-GUID: PEzxQ-nTMSLNURM0U0S_mNH0cLTeOgIm X-Proofpoint-ORIG-GUID: PEzxQ-nTMSLNURM0U0S_mNH0cLTeOgIm X-Rspamd-Queue-Id: BD0C940004 X-Rspam-User: X-Rspamd-Server: rspam11 X-Stat-Signature: y9gpr9b8hmz61iregzjst9gj7omzmds8 X-HE-Tag: 1738269661-346607 X-HE-Meta: U2FsdGVkX19mJFoYvN4aT1niTcbECqWFkG372Uj+paRrg9bjmZD6DI6AdmbzdOJCd7HWUA1iDaMhQFu7vZ8QDLmDPzDAk5gfflISr58m4juR1WGrlBqV2XG0COZfSmCL4GRQatv0GjdC7QF4M7lTw16zFTOG7uF3fzUbbZGNOP78/PQG2ll+NGm6GpEQOhGCivt23um82o6DENnt7jDpchRmL3yW1rxdqzgDpmVn4qW+eknAnZeIiHyd4t/XoQ4siepjHm4QbXNdr52e2lpF4FEkJ5l/deNSQHE5wcHFjxeBy4RD0Kd/CLFMB96TmWrUhq25hY0G7JJUINer1AA4oUhDiS2/ew5D+4tLmf3NM6SI9GqfdTDd5nmWg1Uo9jGVgbO5su3IM5IL2IcfWjqEwyh7PI2O81w5tOh9OcyiSAHP14JVOivPgXrCgqjnZvYE86HSarBBxKXOHPy9VwZPEAQnvsX84sWd+BS+z1oFmI14xOfAK1tUo3PAv+R+X7Y0X61qiwTlQ5yNlRjZYi/MZoXkDtjx+auS1r3sbMN7D771/dX8M+rDsZdP1V3LHX8ytsXTeTwqCjcIU5w5eLrN/K/kOiPskjk5ETOh8OKVItlc+gRBx07OKqHOieddMXEIbtkdHe0uHDSFKvGGmFTeypw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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: Now we have PIDFD_SELF available for process_madvise(), make use of it in the guard pages test. This is both more convenient and asserts that PIDFD_SELF works as expected. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/mm/Makefile | 4 ++++ tools/testing/selftests/mm/guard-pages.c | 15 +++------------ 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/mm/Makefile b/tools/testing/selftests/mm/Makefile index 63ce39d024bb..ecc4252fa3fe 100644 --- a/tools/testing/selftests/mm/Makefile +++ b/tools/testing/selftests/mm/Makefile @@ -225,6 +225,10 @@ $(OUTPUT)/ksm_tests: LDLIBS += -lnuma $(OUTPUT)/migration: LDLIBS += -lnuma +# We need uapi/pdifd.h but need to work around broken linux/fcntl.h, so +# explicitly import +$(OUTPUT)/guard-pages: CFLAGS += -I $(top_srcdir)/tools/include + local_config.mk local_config.h: check_config.sh /bin/sh ./check_config.sh $(CC) diff --git a/tools/testing/selftests/mm/guard-pages.c b/tools/testing/selftests/mm/guard-pages.c index ece37212a8a2..549653724661 100644 --- a/tools/testing/selftests/mm/guard-pages.c +++ b/tools/testing/selftests/mm/guard-pages.c @@ -18,6 +18,7 @@ #include #include #include +#include /* * Ignore the checkpatch warning, as per the C99 standard, section 7.14.1.1: @@ -50,11 +51,6 @@ static void handle_fatal(int c) siglongjmp(signal_jmp_buf, c); } -static int pidfd_open(pid_t pid, unsigned int flags) -{ - return syscall(SYS_pidfd_open, pid, flags); -} - static ssize_t sys_process_madvise(int pidfd, const struct iovec *iovec, size_t n, int advice, unsigned int flags) { @@ -370,14 +366,10 @@ TEST_F(guard_pages, multi_vma) TEST_F(guard_pages, process_madvise) { const unsigned long page_size = self->page_size; - pid_t pid = getpid(); - int pidfd = pidfd_open(pid, 0); char *ptr_region, *ptr1, *ptr2, *ptr3; ssize_t count; struct iovec vec[6]; - ASSERT_NE(pidfd, -1); - /* Reserve region to map over. */ ptr_region = mmap(NULL, 100 * page_size, PROT_NONE, MAP_ANON | MAP_PRIVATE, -1, 0); @@ -425,7 +417,7 @@ TEST_F(guard_pages, process_madvise) ASSERT_EQ(munmap(&ptr_region[99 * page_size], page_size), 0); /* Now guard in one step. */ - count = sys_process_madvise(pidfd, vec, 6, MADV_GUARD_INSTALL, 0); + count = sys_process_madvise(PIDFD_SELF, vec, 6, MADV_GUARD_INSTALL, 0); /* OK we don't have permission to do this, skip. */ if (count == -1 && errno == EPERM) @@ -446,7 +438,7 @@ TEST_F(guard_pages, process_madvise) ASSERT_FALSE(try_read_write_buf(&ptr3[19 * page_size])); /* Now do the same with unguard... */ - count = sys_process_madvise(pidfd, vec, 6, MADV_GUARD_REMOVE, 0); + count = sys_process_madvise(PIDFD_SELF, vec, 6, MADV_GUARD_REMOVE, 0); /* ...and everything should now succeed. */ @@ -463,7 +455,6 @@ TEST_F(guard_pages, process_madvise) ASSERT_EQ(munmap(ptr1, 10 * page_size), 0); ASSERT_EQ(munmap(ptr2, 5 * page_size), 0); ASSERT_EQ(munmap(ptr3, 20 * page_size), 0); - close(pidfd); } /* Assert that unmapping ranges does not leave guard markers behind. */