From patchwork Fri Oct 25 09:41:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13850348 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 CAA6CD0C5F4 for ; Fri, 25 Oct 2024 09:41:59 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 556F96B009F; Fri, 25 Oct 2024 05:41:59 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 5048A6B00A1; Fri, 25 Oct 2024 05:41:59 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 308176B00A0; Fri, 25 Oct 2024 05:41:59 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 0896B6B009E for ; Fri, 25 Oct 2024 05:41:59 -0400 (EDT) Received: from smtpin13.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay09.hostedemail.com (Postfix) with ESMTP id 085C480748 for ; Fri, 25 Oct 2024 09:41:42 +0000 (UTC) X-FDA: 82711632192.13.64A40FF Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf09.hostedemail.com (Postfix) with ESMTP id B4DFB140009 for ; Fri, 25 Oct 2024 09:41:41 +0000 (UTC) Authentication-Results: imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Tq3GGf2b; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=J4ph4TGT; spf=pass (imf09.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=1729849237; a=rsa-sha256; cv=pass; b=h+SrlIjFjxrNfhRleajm+tU+Fg8ESHSSrj7ekoHHvr1BdDTb+/UodEARU/9zfp5sPRCzAm MSexwpFRHBsKGRftM+3jQQ25rEtdgPDwaX0Wr2HJktiz0yVYO1Ain650UR5ULGSLzYAQaW WcuMFTdsN9Wdo7NShDyjOKoe+GWG9as= ARC-Authentication-Results: i=2; imf09.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Tq3GGf2b; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=J4ph4TGT; spf=pass (imf09.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=1729849237; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=ysaPi8DTdXVgT7KKevj+tCObGLJIis9xvmd4QhwzTz8=; b=gOxSfVoOPNRIN55F5A3TtCEOOROhSqsvp1MPX4JyVv8NRbtKrQsIO4iv/eyifUjQvYHx9L X/nk/6wSS587rejqq2AgUBo4DCm3l6pFGsWcu7wH6CzLXu1vSCSt6kK6PZrA1qz9q2wRTf 6slFxJfAlWalglupKWN5wGVh2JhN9WI= Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49P8Bavr014269; Fri, 25 Oct 2024 09:41:48 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=ysaPi8DTdXVgT7KKevj+tCObGLJIis9xvmd4QhwzTz8=; b= Tq3GGf2blwKua78D5b7tXt+1Xp3ZmjdcFm4xc2xy9aMhvGdjaFh95s++PISFfXYQ +6+X0liyhm+T3AepNFZzcqK/kqyuj7ff366YDkoM7puw6oPhtfVsv8t9kb6EdRWy UfpA21s+dGdQhGYbRcc0Wr02L0p5l4jrXjngWiy8bCMj1Zcagwk5IuzQFwqhnade T1Ke7Sx8lPlk6vhJiMOX/ZIRn4LoqfT0IB2cgnBfGhPzLrzCsRU8LhYp4MlDLzpY L3BgaFDjQrvMsPsRSoAqykZoakGPmJhrRtG0CZ+yfFuMrKz+wVcYlzQXR/cN8/kP 2ehv3nlkTmKdofo1nWQHTA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42c55emffp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:47 +0000 (GMT) Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49P9e10I039385; Fri, 25 Oct 2024 09:41:46 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2170.outbound.protection.outlook.com [104.47.57.170]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 42emhdnd53-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:46 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vXYmR3rk79OjqiibuYJBWrYLTjQv0/5boxrJPvQKoYkwu1vjUyF93AfhqOBJFeQaxbcwroPG1psnb8uVhrmCcHgQvEF9neSJZac+PP9mUwF35kCSrPIfMPZUlLO+bPJky8K0IKOfFbHZDnfyJrVL7wkOlg7hSX0/3lBKe6aGH2g2X/3vP5I+QIs9YyaJbVDGoZYBkSWxl+GC//GhtEC+ZbS/C/1wxJ5swSzwp+gtQ3iTsWH7iSt7e64RgXRTab2nU5WYL9VC993Phx9Msv9VzWPnlGHXwNMLN8UotAFFeslcTkWEXt9Gttbar3L012Lu34KBObZNiaQIlRDnnkZkiQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=ysaPi8DTdXVgT7KKevj+tCObGLJIis9xvmd4QhwzTz8=; b=EF8oeItZYjT4suTbnO3me1syQ3p2tDrM+ZIbJdOSy9hV7hhyCJNBLmdm/8O3Ay8DNc1uH3Yo8VgvdGX4B057nocYKNQZpvBVENa7OSQlNDuzHnujTHKW927WsO9OTEYv9HUMD7JxxDlLamTOf3RuPcm6sl9VIvPxmovmxD0Lm15JH//lSlrEXP2UHpP9PcABywIpsb4uuQ+LUPNw0EOW3GrnUzm7dtduseLm/GJLbaygcDOppWsJHbf+G5tvliJAHncVX7NLcXi/zGtrxB/Ctm/3tcN0U3cm720CoMbxpD2T06TpPRzpzOa+NHYjmXYrNfeGOK3K61zxbps3hXYc5w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=ysaPi8DTdXVgT7KKevj+tCObGLJIis9xvmd4QhwzTz8=; b=J4ph4TGTPwGzxtT0xyHOl2QRQrYlZiwhvrbtkaQebPWiblSpAHeP9oKuqfdn3vYLo+j52fxJS9TQWlWuu1dkabmI3GzQ+lO/84JkKvFRrXjOCzBzvC7Q1Xip057mnPA89f+dcFcgZIHGgFfWHb/JrOPQ2kRGjeAeFer46yHgd38= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by IA1PR10MB6121.namprd10.prod.outlook.com (2603:10b6:208:3ab::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Fri, 25 Oct 2024 09:41: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.8093.014; Fri, 25 Oct 2024 09:41: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 Subject: [PATCH v5 1/5] pidfd: extend pidfd_get_pid() and de-duplicate pid lookup Date: Fri, 25 Oct 2024 10:41:30 +0100 Message-ID: <20ff34d7de698a0537adbf4ef67b509eb250961e.1729848252.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0463.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a2::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_|IA1PR10MB6121:EE_ X-MS-Office365-Filtering-Correlation-Id: c39148ee-579f-4e9e-88e9-08dcf4d93c2b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: b1yl3XzSsq6Ib4Z0QMQ4HWbAyhgz6ilGWA5LSd+N9VGOCM2806Mj04Q3Kx3J/jZQBofEUO/CLIq+hbBAUPbIOxow7PVOkcqIEOGW+ck4+zr9snFeJnPkp1H8Zx3YhHhAs4aHcQpZ5yOqgswgZfgOwfdVMdnC1vCYau5qd+y34ysLf/4H1/tuZECltjJBYi4wSW5qdkOu8w8rb8clj808WDZmY/KcxAjd2QNA7ebh0HXrGxmMqO7qJCDkhe5ePIb302AxoSGvw+9aRKjfOhWOS7ZLNU1cE51hu0lYEBNgIrvqeAGFMGZFF0l3gHalPE4jMWFqJtjAaWpk42xflxh5VS0335Kivq4L49L4qAMaeGiBf92RzB6/JgGJs1DH8vF1ec2rJwcuaJf2SZXhqzbB8cs/QUiZC01pydSdz0elGr8U1fRK5sGcET3Xr8XipgDfZZYs1X5CP3sSfRxJZr6vDLBnxuUMq3kqu7qiEuUvg/yO8kV5lXDdiGQHYX46klOGwyA34UJ/NXT2jzCOCTPDDQYWxz53DQV/T9GpJdnENi58zUHPM+L32i1xOIwQYkff7LIMp1Gras5lfccE6ye5VXdhYh+dtAhVob6ocoAqSwd2BDCQPQ/3aCVRvGwKmhNo5N7XICVDBaOnOzAoIgJjpu0Q1znMWk/3dH9csL+wdSmzxxsjL8Ulu0uruvzNRcJVKpiTlRGmSHfq9y/D9pgGpmTbY6oRDvjaEtG3z/M1km08r1td6P1dN3rmiGkPdVD1IqkjbWD8d4aXBLxuL1z4dgcnHgk8nO3SKrYe2HXLyu1Y8BpFIhOeOW6OeK1xEgpCZQoMXFq0/wOHl87nEZS35pDpY2UUm9igQLZSSx92Wow/dDIFbjOM8HBJsUdX9vFHNUgmG94sC9LWuVZpi6PHz5ViGqT/RPKlNZ6NX+Tlqhmd0A5In77n9z71sOcefqC7L3uVeXrJb1xE7ECxzp/Ejzjd5LGWZWcKpI3pIUwCsxMKElh0Y72xIHiWPY5vCEPbVqhBDKkUD62NxGtzEI/azqJWcIzLWWXpjnuBfGSKpevf0831hrFCAoWFN6ycuHbVvaYdFjdQUu9o/5puiGDOTs05eAsViXgSy0wuiFACDojCwh3oegBkTb4gD1wanNVWP8c5NZLYeovZxuSujZQqs4UhOJJMN5gm6VZVqvhu8naGyIA+I7RE0ghikx4hSaIMRGxWK3uor4GgvgWOX0VUrt+epfCQuwuIwLEpiTckaqMYNfBGRUENa8o3ZvnoDcYpWC3nhZJiWM/KygdLhoKYahymz+yhka/ekx4b6hmM03FiVRq04zywE3vSSHQoWntu 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)(10070799003)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: pgQpL6LYelysw/Qqgow0WztzqNt6BHY0YSKUc4w0LI67AmIs+djLpns8FMdXKyps1mzepEnJg2vPShO/YRmxdGd9y+c+TUXbLwAN5L5bYi2VdRCKCbYBoaW1jUNFchYNf7w763NNaZ1LNZHOSiBuXSJTJaV3kEFf1IIeRDJ1Hg2o/P5F6v1eX5b8PlGxYrZCblaSnVmS0TOOeDJldAEoH2C47gsaBLxpEc1gUKtn/A1BZVXIzpMclQGnt5zS7u1m5RDadPhSs4ZdXAo8csYu6O5hmRDOazWYawUpIvk3XsKfc4LSbrV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LcNGJL7bCucBpopewMDwWH7sNaFUJi3x1IiMt8jFzGJwdD//DfUjvp86vdlYuPrlfo5dpGK3LD/7kYoM8hYxvYKyR8GeIJcFAXp8kr458nonoVGcTr6MaacyBbRL5Bh14gVAX1BmjyRDQOJ8fnF5W+FN+xpWAJNWxs31JUXhslN5bvp3izNN+5NYKm+xYAZ1oAMb8n5ea3BrMtcMJqLL8gucjZwO73WBIG1S2xSF9EoIFoKFmcygAbBGqeQBGEtl3aNKZUJUNaABYONZDXXzKZ4arlhtzRz4ZICAQTx6bkne0utXI2E3bsdf5NQWAw== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: d+XuP+tBEOzGq3zhUKuZQ5rlVHkHoRJIlyvs5Xoa93mwS36QVyu4rmFIl9JG4Ba2uxXQOWEcIs+xqnH8CQZv9vVzEQ/NasVBLfOykuLyOkbq6QYth3Vve/laZXPM1vDfRBOdbOV0MtgVkoDgmJMppUHoCiBqmznRmJvCdRHXGMZDEhHVM9lQ+OD9uyWxWRTUw2hiAz69bHKdsxb6ZBX20hcg53M6mBbIsocuddDlh2WUzreHHMNV3aFogt50StNd9TmzfzWRDVHVVuAqkrA88jzKmGP0T49NxZNcWJ2OzoQC0gfghksojrDg6sjBNk1rB4vE9ebn1A5ygdPCLNDGNl0i/joL6R5Y19Hlg8i/+sxzg8x941X18pcaw55tkShl2DHvnm+Q9rbiiMHiNQW4hyuEhUYtZK0X95HqKKcpShs3IJankRniro8k67KrWK7YGE/LYbw3PLQWJtq9FnBGGapmwvc4VMt/uMPqVU/WK+r96oFhha7pw9MmAa8iQ5kR7hSD4L/BSfq8lORHtJsGD+9EGqCr5q5KNYodAYpdUEBv0i7ElNANx0Ug3RGkBA45kEOPjFvJLP51Pga0gBkahM3XyexAJyJmPcH3Xcc8Z6E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: c39148ee-579f-4e9e-88e9-08dcf4d93c2b X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 09:41:43.6783 (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: JoCHD4W+gMVz56U5GGhpWxsrkgCSNuFa4SKhVbniEjMXe9zrUoaQJw5MnhFiH8zpX/Klj8luYlRWC+XcVgvvOUicBZrvT/pU3MyHedXx61U= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6121 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-25_06,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 phishscore=0 suspectscore=0 bulkscore=0 adultscore=0 malwarescore=0 mlxlogscore=999 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410250073 X-Proofpoint-ORIG-GUID: BHQhgcVjkEWSlBaWRb6ZeNRN7bmxM0SG X-Proofpoint-GUID: BHQhgcVjkEWSlBaWRb6ZeNRN7bmxM0SG X-Stat-Signature: em3w4z35d5kdg8zg57or5paezjs1b9q4 X-Rspamd-Queue-Id: B4DFB140009 X-Rspam-User: X-Rspamd-Server: rspam10 X-HE-Tag: 1729849301-970343 X-HE-Meta: U2FsdGVkX1/esaihSHfwwqMIDChK7nqUW7srT1yX/TtmWusNGsyp3/Vu5MXHjg8F5WVlxttUEGka5S+ODDBYDvRw78uCZjO7biNTDLKe3NItZkHWI12cXngefUs3lMcM07D876nOasX0qLkmyBWI4BeRa7nA58FMjgsdbuz3YtiurP2gjKWH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G39pnJ7K9/E1zYO6Elx01ivWCoSo2tFeb91zz9pcIfJMHmB0fdVCZvbS69mJ1Bdhn3Em0uQF8JJv1r8bU/ZLl1m2kx3Zh2RbdmkQsFYluRTg0Y6AFfWPvNBEGGzSdcBmLc3EI2cJBRfGbb8vkgNRkSuNK3HRPKQyCuWbVRGoconbSaCnJhScMdQfULYve1hc5bAOjfg6TYWZq66L1y8mmMLp71eq3lLPS9n3L3FoOawaeeMaZVg/FBkzdb4UvcROTl92IBgCNdhIhWDzDHj4qp/II1WYUCSg6yV86qQqDHMeFzX57EytOUsNW3srRAnVSw0VrOodPNcZ6GhSSVnqKUfOHbGf2Jjn9tgRPsnodd1Qorm8ZmDdn7kAk= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: The means by which a pid is determined from a pidfd is duplicated, with some callers holding a reference to the (pid)fd, and others explicitly pinning the pid. Introduce __pidfd_get_pid() which narrows this to one approach of pinning the pid, with an optional output parameters for file->f_flags to avoid the need to hold onto a file to retrieve this. Additionally, allow the ability to open a pidfd by opening a /proc/ directory, utilised by the pidfd_send_signal() system call, providing a pidfd_get_pid_proc() helper function to do so. Doing this allows us to eliminate open-coded pidfd pid lookup and to consistently handle this in one place. This lays the groundwork for a subsequent patch which adds a new sentinel pidfd to explicitly reference the current process (i.e. thread group leader) without the need for a pidfd. Reviewed-by: Shakeel Butt Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h | 30 +++++++++++++++++++++++++++++- kernel/pid.c | 42 ++++++++++++++++++++++++------------------ kernel/signal.c | 29 ++++++----------------------- 3 files changed, 59 insertions(+), 42 deletions(-) diff --git a/include/linux/pid.h b/include/linux/pid.h index a3aad9b4074c..d466890e1b35 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -2,6 +2,7 @@ #ifndef _LINUX_PID_H #define _LINUX_PID_H +#include #include #include #include @@ -72,8 +73,35 @@ extern struct pid init_struct_pid; struct file; + +/** + * __pidfd_get_pid() - Retrieve a pid associated with the specified pidfd. + * + * @pidfd: The pidfd whose pid we want, or the fd of a /proc/ file if + * @alloc_proc is also set. + * @allow_proc: If set, then an fd of a /proc/ file can be passed instead + * of a pidfd, and this will be used to determine the pid. + * @flags: Output variable, if non-NULL, then the file->f_flags of the + * pidfd will be set here. + * + * Returns: If successful, the pid associated with the pidfd, otherwise an + * error. + */ +struct pid *__pidfd_get_pid(unsigned int pidfd, bool allow_proc, + unsigned int *flags); + +static inline struct pid *pidfd_get_pid(unsigned int pidfd, unsigned int *flags) +{ + return __pidfd_get_pid(pidfd, /* allow_proc = */ false, flags); +} + +static inline struct pid *pidfd_get_pid_proc(unsigned int pidfd, + unsigned int *flags) +{ + return __pidfd_get_pid(pidfd, /* allow_proc = */ true, flags); +} + struct pid *pidfd_pid(const struct file *file); -struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags); struct task_struct *pidfd_get_task(int pidfd, unsigned int *flags); int pidfd_prepare(struct pid *pid, unsigned int flags, struct file **ret); void do_notify_pidfd(struct task_struct *task); diff --git a/kernel/pid.c b/kernel/pid.c index 2715afb77eab..94c97559e5c5 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -36,6 +36,7 @@ #include #include #include +#include #include #include #include @@ -534,22 +535,32 @@ struct pid *find_ge_pid(int nr, struct pid_namespace *ns) } EXPORT_SYMBOL_GPL(find_ge_pid); -struct pid *pidfd_get_pid(unsigned int fd, unsigned int *flags) +struct pid *__pidfd_get_pid(unsigned int pidfd, bool allow_proc, + unsigned int *flags) { - struct fd f; struct pid *pid; + struct fd f = fdget(pidfd); + struct file *file = fd_file(f); - f = fdget(fd); - if (!fd_file(f)) + if (!file) return ERR_PTR(-EBADF); - pid = pidfd_pid(fd_file(f)); - if (!IS_ERR(pid)) { - get_pid(pid); - *flags = fd_file(f)->f_flags; + pid = pidfd_pid(file); + /* If we allow opening a pidfd via /proc/, do so. */ + if (IS_ERR(pid) && allow_proc) + pid = tgid_pidfd_to_pid(file); + + if (IS_ERR(pid)) { + fdput(f); + return pid; } + /* Pin pid before we release fd. */ + get_pid(pid); + if (flags) + *flags = file->f_flags; fdput(f); + return pid; } @@ -747,23 +758,18 @@ SYSCALL_DEFINE3(pidfd_getfd, int, pidfd, int, fd, unsigned int, flags) { struct pid *pid; - struct fd f; int ret; /* flags is currently unused - make sure it's unset */ if (flags) return -EINVAL; - f = fdget(pidfd); - if (!fd_file(f)) - return -EBADF; - - pid = pidfd_pid(fd_file(f)); + pid = pidfd_get_pid(pidfd, NULL); if (IS_ERR(pid)) - ret = PTR_ERR(pid); - else - ret = pidfd_getfd(pid, fd); + return PTR_ERR(pid); - fdput(f); + ret = pidfd_getfd(pid, fd); + + put_pid(pid); return ret; } diff --git a/kernel/signal.c b/kernel/signal.c index 4344860ffcac..9a35b1cf40ad 100644 --- a/kernel/signal.c +++ b/kernel/signal.c @@ -3875,17 +3875,6 @@ static int copy_siginfo_from_user_any(kernel_siginfo_t *kinfo, return copy_siginfo_from_user(kinfo, info); } -static struct pid *pidfd_to_pid(const struct file *file) -{ - struct pid *pid; - - pid = pidfd_pid(file); - if (!IS_ERR(pid)) - return pid; - - return tgid_pidfd_to_pid(file); -} - #define PIDFD_SEND_SIGNAL_FLAGS \ (PIDFD_SIGNAL_THREAD | PIDFD_SIGNAL_THREAD_GROUP | \ PIDFD_SIGNAL_PROCESS_GROUP) @@ -3908,10 +3897,10 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, siginfo_t __user *, info, unsigned int, flags) { int ret; - struct fd f; struct pid *pid; kernel_siginfo_t kinfo; enum pid_type type; + unsigned int f_flags; /* Enforce flags be set to 0 until we add an extension. */ if (flags & ~PIDFD_SEND_SIGNAL_FLAGS) @@ -3921,16 +3910,10 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, if (hweight32(flags & PIDFD_SEND_SIGNAL_FLAGS) > 1) return -EINVAL; - f = fdget(pidfd); - if (!fd_file(f)) - return -EBADF; - /* Is this a pidfd? */ - pid = pidfd_to_pid(fd_file(f)); - if (IS_ERR(pid)) { - ret = PTR_ERR(pid); - goto err; - } + pid = pidfd_get_pid_proc(pidfd, &f_flags); + if (IS_ERR(pid)) + return PTR_ERR(pid); ret = -EINVAL; if (!access_pidfd_pidns(pid)) @@ -3939,7 +3922,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, switch (flags) { case 0: /* Infer scope from the type of pidfd. */ - if (fd_file(f)->f_flags & PIDFD_THREAD) + if (f_flags & PIDFD_THREAD) type = PIDTYPE_PID; else type = PIDTYPE_TGID; @@ -3978,7 +3961,7 @@ SYSCALL_DEFINE4(pidfd_send_signal, int, pidfd, int, sig, else ret = kill_pid_info_type(sig, &kinfo, pid, type); err: - fdput(f); + put_pid(pid); return ret; } From patchwork Fri Oct 25 09:41:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13850349 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 B58E2D0C5F8 for ; Fri, 25 Oct 2024 09:42:02 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 4B8056B00A0; Fri, 25 Oct 2024 05:42:02 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 4408B6B00A1; Fri, 25 Oct 2024 05:42:02 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 21E8F6B00A2; Fri, 25 Oct 2024 05:42:02 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0012.hostedemail.com [216.40.44.12]) by kanga.kvack.org (Postfix) with ESMTP id 005046B00A0 for ; Fri, 25 Oct 2024 05:42:01 -0400 (EDT) Received: from smtpin24.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id BD7231A0758 for ; Fri, 25 Oct 2024 09:41:26 +0000 (UTC) X-FDA: 82711632696.24.B123A9E Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf21.hostedemail.com (Postfix) with ESMTP id D3AD61C000F for ; Fri, 25 Oct 2024 09:41:20 +0000 (UTC) Authentication-Results: imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=gYIQWtve; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xcT4YrOO; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf21.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729849266; a=rsa-sha256; cv=pass; b=Fawf2zE8EPVQuqPPOS4QaTkmoyS8YByVceMn1g43X2RCLNebLy4M6Z4kAwzA1x/tfemiZh BD0Ul6EHn6JLwwjJ8eR5M9rRZiEv5Upss0xT6eV4nXgEWzjiDdd3ucBjjeaXmqVEk5vrar hTieRf49fj+Ox0WMjT938pqIl5+ofuQ= ARC-Authentication-Results: i=2; imf21.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=gYIQWtve; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=xcT4YrOO; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf21.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729849266; 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=d+w1NL58a0s/TvcpDRjcjRaE1BTZDAu5TSa+cfzMlM0=; b=g+3HGZSiS7kSQqeXjFse5OiGy4UuDRZacXljlkZnWo7Xm4U5cEU6WjDhyVnk1eqhzpD5wD ddHQZ28pOCWMkAkFvR9ynI4g8w/PZp6jbXEmREx/Zeb7BTumtvoMh31kz/ZOhf0OWNlCb2 QwEDMF9lSu2EZ/QzSwQXEEAQtY708L8= 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 49P8BYo0014697; Fri, 25 Oct 2024 09:41: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=d+w1NL58a0s/TvcpDRjcjRaE1BTZDAu5TSa+cfzMlM0=; b= gYIQWtveTwswJC5LOSgH9ML5sWeC/lu6hm3/MmkOQtLF/2c30wA0eV094VjnVdEx ZaSL+VFGO7ctgZBuC3XiQPZrHmiJtlskTHn5SsLaAi1UwRpe42ZlOuJ9qiJAPl37 OvlKucXkD3WaUI/DPaLLXOJU7Iu21Jwiorl/6+MAm/BFareBRr+0utKIK9XRtAeL 20J/eZm9M23/nmsNv/cSKg4qcAoUFvqOQoxxrWz3dn6ySGhuXONfg/doPk4eDWrG ozbHmzVg06JUHjm9Z9gCpwkU3lwrxllV6nv+/mkRSY8/rrgDzNWlxTU5Imt4Tf8O nVWRfVE1MMXC94muw9dRuQ== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42c5asmm29-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:50 +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 49P91wFN035766; Fri, 25 Oct 2024 09:41:49 GMT Received: from nam04-dm6-obe.outbound.protection.outlook.com (mail-dm6nam04lp2043.outbound.protection.outlook.com [104.47.73.43]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42emh53wh4-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:49 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=itYyxZUieXopytDE0V+mFtth7XKP5bY+J6S0WOrFeKa5CQ9ZjhuQy/AcFzJTr58IgKx1m/0tAGjA6JDwZXBT5znxs9qt8QBuF1C1rYvDgptPX1DTMXlmqzB2QsTx0ZwwdLkhBm8e9NsXUOVs9aYmwiugzB+kkni/5aiGpDVTdVXMglkrUTpgrx8rTZ2gWqXmd3ciFjHmEZmDgpYhaEdOEtsIzcnPFc9H6ZTSFcUyPgf9zgovD1Ff5zYWjwknKc3zZnZOG2Y4rBX2yA8GcCFPbRM25HFCI8Vl7B+SvI/gBPSknK5NqPQXdlGtBktVDagMnsd8jpLZQw6dndrcSolC7w== 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=d+w1NL58a0s/TvcpDRjcjRaE1BTZDAu5TSa+cfzMlM0=; b=Ezt4KyUMaZfY4Q9dgmZ8ObbzEA40dJiAylBXJg6jCSiCA2XM9TA/eFIh57xpPUzZvYqbDczfjLMj1QjcB1WHc36EH9k+oBklbwcy1h6tOb6MsJbSL/47USGUyUB8ZEji30iUy2iGXMIZmOeV1QDRB8RmcRHOxus9/miHcxOvYJdX/qqNLct2FuyqDT2Qjv4e7+4x7o6UDUzsr2lBHlADi/M+iHgW490XC8Fx589upR/u1b9zrf93+pF0PBw6UaOHdeBB/7FCubvj0Yhe1iCZ0o4CWL/440WfTWP43Uf9Kko/mSqF9rI9U11WY8Xe8c62YrH76pVPUtR4p91cmxVl1A== 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=d+w1NL58a0s/TvcpDRjcjRaE1BTZDAu5TSa+cfzMlM0=; b=xcT4YrOOlVeiTN/GPnHirh6U0uy2G8AWwP5xbY1XNDrBDR9tXj+qvWpxawUKQlfMi+yeWCoTboAmU8J3EtNIrann3S5DoWP7v9nWx/lfXzcUZdlhG4wgviDOrtbqYYh7ldtu9HLvf8sK7O9Tc7766bOgCpwaiXmvP6wGFVrYXE4= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by IA1PR10MB6121.namprd10.prod.outlook.com (2603:10b6:208:3ab::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Fri, 25 Oct 2024 09:41:47 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.014; Fri, 25 Oct 2024 09:41:47 +0000 From: Lorenzo Stoakes To: Christian Brauner Cc: Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , John Hubbard Subject: [PATCH v5 2/5] pidfd: add PIDFD_SELF_* sentinels to refer to own thread/process Date: Fri, 25 Oct 2024 10:41:31 +0100 Message-ID: <788fdfcc9ef602b408951d68097918d6ae379395.1729848252.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0289.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a5::13) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|IA1PR10MB6121:EE_ X-MS-Office365-Filtering-Correlation-Id: 1d549080-c03a-4610-35b4-08dcf4d93e25 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: 0asKowcRPCF9i/rU9emtBThCF7yTp0tVbVugzxD89Or/Ws1vigBDnI1aN66rC5hvKrhR5IsfYqx7uL5rvPZfEZdJiuyFHmAZ5KBmVpUz80NAbgwYQN8oO3qin5Q0FOPzSVzynWCXGw3+oosiJkfdfv8/kcmHUgi6C2TkJuvMYE9KZQl/PxheDN7u1bcugaKbcxusURI7PPyw9OTUbnUU41tbluDmXLgHk+L3D5vtUhKvZvbqHObnVQUiTrlEbRO5c29OzdW7ga3EmGTCcZUl4+g9wVrUcLDC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: 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)(10070799003)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wEYUGvaECOaEy+I1/lH2CQETbIVarL+h/AvW2GTdzSLfxthHFvvfM2rW4Tmdrg58Flys8lkbO2ECRSflxU9ZKJHJa5HI1hHi0cVEnhmurXYlwFagRDgRBsnYEyl1D9nCYVjLRl52c3aIj1seBQJO9dhDl8fv405LiQFSYOrCYUEHrNvINgFvZ+fNpIqSwewp0mtj468i6K8CMsqRdl2GYaqPlZeGJq3oADGEXDCQBKbRpp48RCPXKWGzlFgUBClnME3TWYBMnX5rNMGhW/YEtTz1Z8zgHn+61WHlUQ2h/pNEw/m3c+zyKIz49ARt4AK+LXiEqq+xndgXIYMk4g4jY0f2/ElVHewlRSl003qOgQOmayAs1N0Wor82bGygIRQPKnG4DgJisExT3F185nUvtxd4uFSNd7JSHg7xZ9cPzcjgxwS1AfCGbIOXzsVG6ZjSGUu8dhPIwTUuu9hi64Bgjrf+HTDejPsM1a4mvbuBf1V9ta/YiA0YzLfQu6FkH1mVTe1Xh4dkxnCip5U0Fv9yiraDYHAzHq7/4MwZR/BzOc9N8Y/8NglSA21E2jEGovZISXpaCyGC8XV8JbMKUSMe1quzIGxavxcwa9K3A+FP5Y2Bn4TgpuQnAHuU+ZctY0YzbcBVmyF0aLveqNvNL52i0yqJom9s4sJ2tv+KX7BJX3fJlwbKVdhAY4vOV0eDyA4he+/dwIGdbcNzG68IJtg2gAsTtmD7iVgVlcoiNcRC6GvxmyuueMN57pYV21WerVeHmaPGdiYfeNf1y/QYfebzTRVwa3IPsSI4erbAu2Wg9iYpTk90XIGzirEBjPgPA+OsFc8oHFZBWNaIFEDIdvBJrI6BlWBg8khXvPPYq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ZumRw45N4NnRx98tdiQewtqnmYOrNpAKAB32A6GGKkXHDhv/Il3HVZBEkKAq+XpYZRqy3TSpVQkc20BUHUYTKNrENGZ3Axogclh3AO+IbeEab4RzrZMV/bXwG1rrjA02Fp85kaRPUgUHn7xa7usQvnAosHsKWelMVB7JsoRYl02iXhLhe5UYIDsT4uR+8qQ6htUs+PZCpn2sip8kv4lUNB8esih4kKMtxE9bwje2yyDATTlOa5vOpagQQynl2jKW+FlqJE659ZMWaXJm/AuJH2kW6tQBVQTwvm5m7fAyoGPj6P1PpJL8TEGoJiSKI3e9/o04Owgza8nEWOr1jX+WEOJHIjIiNp/KP/NGDYtjX2xWxHeOvIoZaCLRx6XTA/3lSEjz4831A9mCg9MGQO+ZChB61iGx+0+S+a50QNTxENfAhk= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1d549080-c03a-4610-35b4-08dcf4d93e25 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 09:41:46.9716 (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: jquN5EKyi/ULP0XFZaqcxlMw2O+JAKUkXm6wXP99XaPxxJzVUFXsWJuF3WSErI7mOYWN8oKjmAG96D5YhqL6iPy4uqdhG78jN2lk7JDByvg= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6121 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-25_06,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410250073 X-Proofpoint-GUID: daerc3PM5lacqOz2kOHa2IyfqB3VU98K X-Proofpoint-ORIG-GUID: daerc3PM5lacqOz2kOHa2IyfqB3VU98K X-Rspam-User: X-Rspamd-Queue-Id: D3AD61C000F X-Rspamd-Server: rspam01 X-Stat-Signature: 3me33cucdn4og19cpw5hg468d8fwrizu X-HE-Tag: 1729849280-421427 X-HE-Meta: U2FsdGVkX183eb64hUdcNUmEaKHZXOBMOXsykIb2x1+Xj3oa94NxON06LBM09jhlntGv/ZnDyzXTNoqkbAXlURIgAcA82O1qZ7GCgtXfGKWE8xND+4ZxdTLd6afO8XatPe8Hn7PctJCdMHia3YbkebyzfSd2OtU2gJOnB4uJTzq8Eqe2zBoJm14wG5Mo4QtM8ROAvUzdOyw0Td7H4uMvmrlpB1iMQ9yrbypk1aIJ3Imkdm4w3xRz6ZkoN68F7dzInEkLcIGHwsWdwfFaacAAX6rQUJhW4Pxl6nWYKM/AMY8iK4YfJxKzKZDzCAQY31nWIYvEsEXePeZzLL2ZXPxMquhRTGBcUpWsnbQ3+K/Tvvl325MtxmT8Q5iz5zj9QuZ3Tv4cON+k8mLMKR0RF+3kd7oZXO7PGjPvlKFmM+mOGPLZVSIpftYuvX4d27hSyOsf1zVXd3mHEO0TOnRAz3/ULqmJvu7k4jYRkKE63u6cJUlKRErqm4ASErwHXcJxbyRCN8fQoBk/5FGRuH4r2MttAZyF7TwzIp/lDpgMRpgh7f0UiiqxveVlVIDvJoS1PgLYWGy2R2fwRbQwP0Ol03Bd3+AbN2h2Pn7W4AKmSc/p5mBTc0ZT9YZBXhntMJc63itrlbvDrAIkJcEPh01/Vb5777holICUzSlHHg0HsC99Mdlb61/1no9ctFepuV/UlM2M29Rfd/+P2nB2ihCsPqMCOfOV6NttDmz3kgVhjrMtj51hZUGUJgWrhNu1W74GSpLDWtnlAbMYaMGQhW+8aZ5k7sJnlYnWW2haHtLvuNvo44KI80nq9OxeqJAMyPtN841yLdDE4bhBVsSqm8VZgLnPhIuUPcCkhu5dzT0qPTK3FgRcI2jWsx9VdQNYUpajd1OVGzxhsK7POKcnq7beN7xB7VRGXl4h1PDQC/sLvOQvJ8c849XHqIkv2QonIb2lYDDeACv8JrfWYfobTL6a34/ jC7KOw6b KqafhaBe5zz42o868ye4edYsva6OEQDlopMpIjfZWfEPa6Cxh+9JZt9It9pLJZVQwtUpIaQboZlC/Xl9w+90ux8P3jXNh3+TJSph9BZbm3x8bObA6gSb/1I9va5psFNdsqgemiGcwuwoLhkYDWMmoM02Zevm89PE7xDxKWHW6dL2lmyFQUEHGkQMJheRHD07JUSiz2ZKzws3qFj6KzaeWFTBW04/LHcD2SnuYV29k8RfbyebC+GLkSIWbToedOIswxqamc9Q7Q2gDVgq7ZUlwsArkFyxGvDFoX2pg9T3KsDQAICBBjENJ7KoQi1kiEeBSmJrJ7S9sHt8f0CAsE7Ve+99eAt/oXD//K4XK1YVxuLpSYLburWoLEQg3z7cPOIlsN1xtgLeeTUrsNAzc1cTWr39Zc4KOAHpFwgwgVdkHvQ8lKVw9kgDB8Nslkn8b5GqIv4hMnXgG3OCFsSMCt8UkmyilS8Td/Q4c7LN6atKs4QgHUdUdizkvUd2BwDIiDFAVyuaUZmhSMo67L91KQYf6un4gRLYkxdJV1DJTETGVBlS6Jn0dKpuwZY3rvoXWAOwexnwW35atnlDubVtsGjc7nVLEvwRrG6MB/WCKAIqqTCemYNpb7tV/579Z/Tst35j2oQDj 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. Due to the refactoring of the central __pidfd_get_pid() function we can implement this functionality centrally, providing the use of this sentinel in most functionality which utilises pidfd's. We need to explicitly adjust kernel_waitid_prepare() to permit this (though it wouldn't really make sense to use this there, we provide the ability for consistency). We explicitly disallow use of this in setns(), which would otherwise have required explicit custom handling, as it doesn't make sense to set the current calling thread to join the namespace of itself. As the callers of pidfd_get_pid() expect an increased reference count on the pid we do so in the self case, reducing churn and avoiding any breakage from existing logic which decrements this reference count. This change implicitly provides PIDFD_SELF_* support in the waitid(P_PIDFS, ...), process_madvise(), process_mrelease(), pidfd_send_signal(), and pidfd_getfd() system calls. Things such as polling a pidfs and general fd operations are not supported, this strictly provides the sentinel for APIs which explicitly accept a pidfd. Reviewed-by: Shakeel Butt Signed-off-by: Lorenzo Stoakes --- include/linux/pid.h | 8 ++++-- include/uapi/linux/pidfd.h | 15 +++++++++++ kernel/exit.c | 3 ++- kernel/nsproxy.c | 1 + kernel/pid.c | 51 ++++++++++++++++++++++++-------------- 5 files changed, 57 insertions(+), 21 deletions(-) diff --git a/include/linux/pid.h b/include/linux/pid.h index d466890e1b35..3b2ac7567a88 100644 --- a/include/linux/pid.h +++ b/include/linux/pid.h @@ -78,11 +78,15 @@ struct file; * __pidfd_get_pid() - Retrieve a pid associated with the specified pidfd. * * @pidfd: The pidfd whose pid we want, or the fd of a /proc/ file if - * @alloc_proc is also set. + * @alloc_proc is also set, or PIDFD_SELF_* to refer to the current + * thread or thread group leader. * @allow_proc: If set, then an fd of a /proc/ file can be passed instead * of a pidfd, and this will be used to determine the pid. + * @flags: Output variable, if non-NULL, then the file->f_flags of the - * pidfd will be set here. + * pidfd will be set here or If PIDFD_SELF_THREAD is set, this is + * set to PIDFD_THREAD, otherwise if PIDFD_SELF_THREAD_GROUP then + * this is set to zero. * * Returns: If successful, the pid associated with the pidfd, otherwise an * error. diff --git a/include/uapi/linux/pidfd.h b/include/uapi/linux/pidfd.h index 565fc0629fff..0ca2ebf906fd 100644 --- a/include/uapi/linux/pidfd.h +++ b/include/uapi/linux/pidfd.h @@ -29,4 +29,19 @@ #define PIDFD_GET_USER_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 9) #define PIDFD_GET_UTS_NAMESPACE _IO(PIDFS_IOCTL_MAGIC, 10) +/* + * Special sentinel values which can be used to refer to the current thread or + * thread group leader (which from a userland perspective is the process). + */ +#define PIDFD_SELF PIDFD_SELF_THREAD +#define PIDFD_SELF_PROCESS PIDFD_SELF_THREAD_GROUP + +#define PIDFD_SELF_THREAD -100 /* Current thread. */ +#define PIDFD_SELF_THREAD_GROUP -200 /* Current thread group leader. */ + +static inline int pidfd_is_self_sentinel(pid_t pid) +{ + return pid == PIDFD_SELF_THREAD || pid == PIDFD_SELF_THREAD_GROUP; +} + #endif /* _UAPI_LINUX_PIDFD_H */ diff --git a/kernel/exit.c b/kernel/exit.c index 619f0014c33b..3eb20f8252ee 100644 --- a/kernel/exit.c +++ b/kernel/exit.c @@ -71,6 +71,7 @@ #include #include +#include #include #include @@ -1739,7 +1740,7 @@ int kernel_waitid_prepare(struct wait_opts *wo, int which, pid_t upid, break; case P_PIDFD: type = PIDTYPE_PID; - if (upid < 0) + if (upid < 0 && !pidfd_is_self_sentinel(upid)) return -EINVAL; pid = pidfd_get_pid(upid, &f_flags); diff --git a/kernel/nsproxy.c b/kernel/nsproxy.c index dc952c3b05af..d239f7eeaa1f 100644 --- a/kernel/nsproxy.c +++ b/kernel/nsproxy.c @@ -550,6 +550,7 @@ SYSCALL_DEFINE2(setns, int, fd, int, flags) struct nsset nsset = {}; int err = 0; + /* If fd is PIDFD_SELF_*, implicitly fail here, as invalid. */ if (!fd_file(f)) return -EBADF; diff --git a/kernel/pid.c b/kernel/pid.c index 94c97559e5c5..8742157b36f8 100644 --- a/kernel/pid.c +++ b/kernel/pid.c @@ -535,33 +535,48 @@ struct pid *find_ge_pid(int nr, struct pid_namespace *ns) } EXPORT_SYMBOL_GPL(find_ge_pid); +static struct pid *pidfd_get_pid_self(unsigned int pidfd, unsigned int *flags) +{ + bool is_thread = pidfd == PIDFD_SELF_THREAD; + enum pid_type type = is_thread ? PIDTYPE_PID : PIDTYPE_TGID; + struct pid *pid = *task_pid_ptr(current, type); + + /* The caller expects an elevated reference count. */ + get_pid(pid); + return pid; +} + struct pid *__pidfd_get_pid(unsigned int pidfd, bool allow_proc, unsigned int *flags) { - struct pid *pid; - struct fd f = fdget(pidfd); - struct file *file = fd_file(f); + if (pidfd_is_self_sentinel(pidfd)) { + return pidfd_get_pid_self(pidfd, flags); + } else { + struct pid *pid; + struct fd f = fdget(pidfd); + struct file *file = fd_file(f); - if (!file) - return ERR_PTR(-EBADF); + if (!file) + return ERR_PTR(-EBADF); - pid = pidfd_pid(file); - /* If we allow opening a pidfd via /proc/, do so. */ - if (IS_ERR(pid) && allow_proc) - pid = tgid_pidfd_to_pid(file); + pid = pidfd_pid(file); + /* If we allow opening a pidfd via /proc/, do so. */ + if (IS_ERR(pid) && allow_proc) + pid = tgid_pidfd_to_pid(file); - if (IS_ERR(pid)) { + if (IS_ERR(pid)) { + fdput(f); + return pid; + } + + /* Pin pid before we release fd. */ + get_pid(pid); + if (flags) + *flags = file->f_flags; fdput(f); + return pid; } - - /* Pin pid before we release fd. */ - get_pid(pid); - if (flags) - *flags = file->f_flags; - fdput(f); - - return pid; } /** From patchwork Fri Oct 25 09:41:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13850350 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 77198D0C5F9 for ; Fri, 25 Oct 2024 09:42:05 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 04BF36B00A2; Fri, 25 Oct 2024 05:42:05 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id F16D36B00A3; Fri, 25 Oct 2024 05:42:04 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id CF40B6B00A4; Fri, 25 Oct 2024 05:42:04 -0400 (EDT) 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 A93C26B00A2 for ; Fri, 25 Oct 2024 05:42:04 -0400 (EDT) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay10.hostedemail.com (Postfix) with ESMTP id 97426C06D7 for ; Fri, 25 Oct 2024 09:41:43 +0000 (UTC) X-FDA: 82711633116.02.78CC192 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf19.hostedemail.com (Postfix) with ESMTP id C44D01A0003 for ; Fri, 25 Oct 2024 09:41:36 +0000 (UTC) Authentication-Results: imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=WSgfrBWl; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=lOmlAua6; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf19.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729849268; a=rsa-sha256; cv=pass; b=mDGVi6YoRzTEl21IMYh52gLMCmYJ4DcJ1JUHYwI8zz9h15mFDlve+t3vi+ehAgO8JKgosu rn/dJ176oUC0cF7VuICpZAnCi+WXnxkpK6BPygnjZ1+KYq1YGr3JJsMTVFPsXmBmD1yczW kTC2JarDDNQAd85SjzxZmwnf/08Li1g= ARC-Authentication-Results: i=2; imf19.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=WSgfrBWl; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=lOmlAua6; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf19.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729849268; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=SLlbDZlZ3nLzA+OMshfpAja8xZBB1l8GJOD6tbMQ7pA=; b=28E4OHRAaekZC0+GTng5ATugoUBni5IkfL5WtIyLXfGJNh7po/0WemWoe7uV85aqMRQ2Ck TW757mTn1/lPFubUcGuUBypcRuNGopj4tWOwyvOArxsOTjam6V1VeA2kmDUD4uNPd+Afd/ zo1rscMgpSh0ijuxhdW/VK42B5u4xPY= Received: from pps.filterd (m0333521.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49P8BZG8005832; Fri, 25 Oct 2024 09:41:54 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=SLlbDZlZ3nLzA+OMshfpAja8xZBB1l8GJOD6tbMQ7pA=; b= WSgfrBWl2sYMqXQtdSQbn6UEGQgYeGnjRMU5BcojRJoGFuqZN+tJd+TEjOIp3bSg 1EeR2KfXaaFX/lYUJ0M0SNqaPhy3/ONpnvvezK/InH2ScaoxbPOeboKgLmTIEbjh jYc1dtMGyY4c8HqNxNztMdIF96KvtDwIJjvSwDGuTFCZIvgzQjrw0795nhhvpGJU KeSuBfwGHRNreSmzejFhwmQG+lIwk/PI37mi4w+5PpqnEwfn/X0jw6qBMdgbuH4x mFor1T9kpm0BRzFS8t5D89L4VmIQSQcOzr4qXwD4BgHN0wKLKHPYxkvNYFN8L5A0 woNkzTZzpzEMxqSVivXmcw== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42c53uvk1s-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:54 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49P8gDuV001662; Fri, 25 Oct 2024 09:41:53 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2172.outbound.protection.outlook.com [104.47.57.172]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42g36a9y8q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sgdSu4tmrR+arS06AgM0LNH4xmXpS5N176v1/USAhEMEWOC0TECj4FPB4VtZzS5otglr/gbwf2coBKAT61O1i1G6rxrSj/sWrB7EHn7IWXwLeGXv561LHVIqjNgi8ltdobXh2hSJoW4GrgI2yVCoYHRp1+vRT0BbZ5ZPRHrTSKlahEjMlrXmNpet9GFNGOx8hmlJtFbLaZBoHDHRhwKsceo0DQTeRPQa9d+wHYBRAyZFKVZbI74qLboNlVVyqh1vR1suGftDq+o/Qw2ADozS1I8npMX6LR/yDY7OsAAhcLldrD2J5jOxIgI8n4zgcxs1UkAdK0ORfazvRd3lp9gM2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=SLlbDZlZ3nLzA+OMshfpAja8xZBB1l8GJOD6tbMQ7pA=; b=WDe6SEKNxCAKcbTmfSgrL90UKhlwXlvM7dn37XX4BEFgXNFLfndvPS0qzpBN/K9CON6OikUVo9WZC30uQZxv0ayfWT9cvny9RMlZhpgL6qaQlmNBxJHcTTdFifpn7ccfvUYCRuocoF+9T2sUWyRPBNb18qaS5UtfHyTc8LsDBOP1pSgrugNA4JMVTwDm/OF1ubkqm1JspKmxwaDxgiii+/kWhgWuk56oR7077vz0CZr/HFLtNsJHDLhXo1S+xmgTC7lbxp601kHOtqx6q3W2O264hCILRE7QHShXri/nHiicmGARTDKyzWqqhGKKZ4C+pItwfJWfGGxs8ODPae9bWg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=SLlbDZlZ3nLzA+OMshfpAja8xZBB1l8GJOD6tbMQ7pA=; b=lOmlAua689kAFCthFnJWNizWEeAZerRgjwzW708mClNJFDTjs2HvHK0ofjo33GqdHBT9y9bsGyrZxhTszwQUSzhv86FuoSn8Ep2ThPNt6o092b1ZuXB77pVsFl3iTW6JZ+0puBEAc00F3BhgVhg6O0U03K4t917n6qOBXGu6qXQ= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by IA1PR10MB6121.namprd10.prod.outlook.com (2603:10b6:208:3ab::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Fri, 25 Oct 2024 09:41:50 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.014; Fri, 25 Oct 2024 09:41:50 +0000 From: Lorenzo Stoakes To: Christian Brauner Cc: Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , John Hubbard Subject: [PATCH v5 3/5] tools: testing: separate out wait_for_pid() into helper header Date: Fri, 25 Oct 2024 10:41:32 +0100 Message-ID: <391ca859c6e7c997647f43863a756808d368f8d4.1729848252.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO2P265CA0377.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:a3::29) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|IA1PR10MB6121:EE_ X-MS-Office365-Filtering-Correlation-Id: d184e8d2-3bee-4e55-bb7e-08dcf4d94062 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: dxET7Lb0S6TU4XQkkrk/7zZgq0wP/7shpYSDYGAzgVQ9EGCzucqBYzRur4W1Zmoq9IwtWz8waop5X0jYnxKu8aBH6dIUuu6l8ducp46sKkV6a+mwTbaGgg4fWzU6kWgBFakZ+pKEo1+XTBLVA9UPQtFruu/Jq/hCpu36NVsof6HcvsH8U7O6ReEWiqoQ4/RI77d0Aamxi2PYySu5FEsncm+gLPEGnW+f1yEMDUepzz7VlmT6mATV/GCwNYP35TiUnuB9XYMGXU/T+sdNcSAFyOlW+B3M/y17pKZVVYRTAfa0jcObg7xt+nXJd3mR7A3sKwMco/Fs/jw9yCF5IoNgTgmIDadjp6gIQXk0Mi6jjbW412dSxrDPwbm3zCqulUEJp3i2GOX72ATPtoVPKWtcZmFCxLdqEJ4e/WbdZXS6ZhJNpUqZ0XSpJWMkcm7SJCdvlELdbM7Gaoer4SWxN+QwJXBYgVZe9Ol3dfP8bU2NO9Dr57qSv3xfTWB9qd1H5IAN/NSJZhVP4eBOQw9nfbpm8uAKjtgNsWDGJiUPMe6pNlStvXyeLSISh6My43/xe59W/T5MY+faB645bAq6mGYUPphlVB9NyUhKfac8vll/bgRowusiBNeF1FIcvPQcDgCq/qALc8azaBtzQmGXUivON1imi5dT0mUZ7jgA69+FBMhWemBRo7QvtcKr7yjJwgS81/i5niirwhkzm6sLymvqKLhrwwP+O2NhAaqjWVcJgjcHiv/vTFupTuu1QIv+l87g8ikPfmeTUGXfzqPh7QclRGFTsAvDe5ZPBPeDKogERdfvRKqVEyZcpWjv1dwyV286RRVmkKdZn02O2KEGSAifCKD+IZOUuNZ066mRFAmpVEKufamxPe11OaB+QLhOT3XWZoxE+Br+rD7fJFk9huE6q0JX48dDlWJsPYFnem/QG4E81Emr0ywKOsD1fVSot9QhksKeJQwrjonObtH8X7FQhB5A6p0HA6yOAT+0AOWFqAIMADwiNntqqAESsND9BldXqxNX03H4vhne0PlgFotv2sTWln5bgehzdDGPyxrt3cIP7JPc64ctPnINtc5k5pUJ3ptLzdoWzehKApeocsq4n/Hogn8hAdveKYs5cMVMqyhZfKlYVz63JFxR6+fyvqbCmtYVrViaknhgE+cGU9+qJUOoYNoc2UhYdv6tO9dWkT+MudE/k+Kf5aX1WXoiTM/QoAiFsAD0KaPaiXyEJwiEgYqA8pkJsyfFqTbckmjzou626anjulnoQ2iasa/Z5EgAyTeaM++B/l4sihulWp0vPuAvOD8xyj2ZqrhcG4uGYjRThHthhtQ9Uzx0Bqqyr9tA 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)(10070799003)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: QvM5UmjLoFG9y9JN4IoiZDV2BdJAL/U2mNSmNQOnvJ61vCZpTIC1X/npwTzBWhA2uDrL0VcHRYDEFU38f7xrG0Ghdq/pVbsYJVfA/mv2beX28tt5aaYSzDErSE8wnmaGQuxdF2eM04+YiLmJ9v9nrbWLJ5ZhOppUK/cAQDl3ZhWnRkVk8vlYaBb/F+XdsS/H+QZDspW7LrCl+BakVs6PD/j3GkgCP0o0pFK6I8QF51WRBeHsEs59haBsocsCNnsA5DTHG5CP/01ob9UNU5ZbMubVY/Q3AtwUSaHJFELbLVYq1euW8lPoSi5Fc14LYkqjgzVpdk26p5DNhgskF0q5xoP7lIxZ7M8+ZPg/xSGvVr3IZhRSa3Jtt0MNcEqa3EvoQ2JikceZ4veC/yO5ovu78DGPCGH0hfCWOhJqxfuosN/mIz+R/UXZ63ewyb1Q/VMoHvGCoMX3Rdp5X2Sbge3dG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Q8KlAzwvqduM1Eu+EmHpOYnY7ORVTg3OViXEoEBBDPdZvgJvPbU/R8yuc410ze2llX2ErORN4rHCxQrJqsj2PL87fU7flMvVGgPUS3/19aqmhmlNrNISNnwsw36DZvjO2w== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: JMkO1U5gdOyjD6QZ7zFjQ2gwjmsz8AErz93tR5jpjD54jWFDCs7vcZeHKA1OBau4NFL6R+dBEsga0+TncgVgag0ia19uGtrwCQ5XMvK2ab1ZFNkt1AqXApaKbB8G3aO2jzIDPcgNekPdPMqWVAVlO6WRx9+cx+1qK1BfvAB9jZRB5CsA+eHFciDvSkeqYlfNf4hLoK03Rts47rQTUMbgRg0s7bEnVAsE0ZJNPQCdB8j6qUpSocshnyfGTh+T3tkDBm+9PjrtC7p7aXF4gII9gJTfYp7E8P8xe0DJsDN37JnNMi3CA4nP7dyOVcK60ei5uHPDooe4J7bN+qpJi4tK/ZDteq6HO8TcR3+YgUqzsDmxD4+5I6rbr18mpLm0XHbWFPNALbLFbze+QXvcJ0Iiq76L+dosIr3DyQeJmxqM0D4/7zFa/TeOmbA32G031cjIkuga61gAf/eXbGwMmdSs5hOG5GZ23K4TGZ2zAJoJYGOyVsnyzWCAquh1peCgBOgZNrV4DjWX3A/tDNuSsKbsZ5h7knLjRk8dLIbK1vthVyZhNSaH7WN74PNXkyJz8bN9bgilvaJm/1QjUJ0jSo+rIYDQfAk4JNUiUdfvAcv7bWg= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: d184e8d2-3bee-4e55-bb7e-08dcf4d94062 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 09:41:50.7860 (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: Y+btAPDiwaR5mDz6CRXHVCoH4FYmleoiRobOEE14ntl80tKgS3OBzsZG8+d7K2X+Nn2eDezDa2mxNJGxfwdcGLGZ2LvRCyokUvo9RKw7hac= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6121 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-25_06,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410250073 X-Proofpoint-GUID: 5FgkEX0XTqnEDSHi1T4J8rYwtS3ykv-L X-Proofpoint-ORIG-GUID: 5FgkEX0XTqnEDSHi1T4J8rYwtS3ykv-L X-Rspam-User: X-Rspamd-Queue-Id: C44D01A0003 X-Rspamd-Server: rspam01 X-Stat-Signature: q8rix6wnyapeapmz61ohz5q1toxkc6y4 X-HE-Tag: 1729849296-957243 X-HE-Meta: U2FsdGVkX1+iXby3YtJstzcWBJHmrH3iupE5xqqCQHz+ctSJcW2GoKeIWmDAvNrHfhndaMBmnXo9tiuKhOVQIDcyJTlI3u2hx6FaqlvAS0813D8GgVITtjjAlfvd0RwPzZKuat/MxD2bWkAlfKd0EkiCeqIvhj7zH7gqUndWb2AhRUSRg/yy1UqXDugs6SLL4OsjVIQXUbJ+uK2udXnNCqpBgw5eSwGaR8Kq215G4vv9Pjmiqb8bWxOMWbKzGNWPBHcLfbG2TKdTaExZcB/Jy1rpVdcN85OUn/z1a9V3Kd1zi0rf+OIV2AuvEKO4sDcdhUmF+331jo/isncr01ZORBmXiUB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Aa3WK3Fi5DXmRRwPdAyOpa7cimI/nQaHl03vaMHHiZe/iaYkH7JhWkh7RSo+HLTghm9YGclWUf9Nfk31uhurnp+x0wp+EBMlYxgdAr5Ot56+/hOnW7qcQ3i9+Nxl1dsaZ1Ba3fnxgMECDZk1c9LXwKCqY/hDbuEv87O+Qfgtwo01kfnA/GNrXq1hvr7fUBieS8E5x+yDI/kE43EA2aFnEsOmLye8M+kqPWyfwfcriGF4cS0nD73iTfJ5IgMhGI6+cYQ= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: It seems tests other than the pidfd tests use the wait_for_pid() function declared in pidfd.h. Since we will shortly be modifying pidfd.h in a way that might clash with other tests, separate this out and update tests accordingly. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/cgroup/test_kill.c | 2 +- .../pid_namespace/regression_enomem.c | 2 +- tools/testing/selftests/pidfd/pidfd.h | 26 +------------ tools/testing/selftests/pidfd/pidfd_helpers.h | 39 +++++++++++++++++++ 4 files changed, 42 insertions(+), 27 deletions(-) create mode 100644 tools/testing/selftests/pidfd/pidfd_helpers.h diff --git a/tools/testing/selftests/cgroup/test_kill.c b/tools/testing/selftests/cgroup/test_kill.c index 0e5bb6c7307a..2367f645fe89 100644 --- a/tools/testing/selftests/cgroup/test_kill.c +++ b/tools/testing/selftests/cgroup/test_kill.c @@ -10,7 +10,7 @@ #include #include "../kselftest.h" -#include "../pidfd/pidfd.h" +#include "../pidfd/pidfd_helpers.h" #include "cgroup_util.h" /* diff --git a/tools/testing/selftests/pid_namespace/regression_enomem.c b/tools/testing/selftests/pid_namespace/regression_enomem.c index 7d84097ad45c..f3e6989c8069 100644 --- a/tools/testing/selftests/pid_namespace/regression_enomem.c +++ b/tools/testing/selftests/pid_namespace/regression_enomem.c @@ -12,7 +12,7 @@ #include #include "../kselftest_harness.h" -#include "../pidfd/pidfd.h" +#include "../pidfd/pidfd_helpers.h" /* * Regression test for: diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h index 88d6830ee004..0f3fc51cec73 100644 --- a/tools/testing/selftests/pidfd/pidfd.h +++ b/tools/testing/selftests/pidfd/pidfd.h @@ -17,6 +17,7 @@ #include #include "../kselftest.h" +#include "pidfd_helpers.h" #ifndef P_PIDFD #define P_PIDFD 3 @@ -68,31 +69,6 @@ #define PIDFD_SKIP 3 #define PIDFD_XFAIL 4 -static inline int wait_for_pid(pid_t pid) -{ - int status, ret; - -again: - ret = waitpid(pid, &status, 0); - if (ret == -1) { - if (errno == EINTR) - goto again; - - ksft_print_msg("waitpid returned -1, errno=%d\n", errno); - return -1; - } - - if (!WIFEXITED(status)) { - ksft_print_msg( - "waitpid !WIFEXITED, WIFSIGNALED=%d, WTERMSIG=%d\n", - WIFSIGNALED(status), WTERMSIG(status)); - return -1; - } - - ret = WEXITSTATUS(status); - return ret; -} - static inline int sys_pidfd_open(pid_t pid, unsigned int flags) { return syscall(__NR_pidfd_open, pid, flags); diff --git a/tools/testing/selftests/pidfd/pidfd_helpers.h b/tools/testing/selftests/pidfd/pidfd_helpers.h new file mode 100644 index 000000000000..5637bfe888de --- /dev/null +++ b/tools/testing/selftests/pidfd/pidfd_helpers.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __PIDFD_HELPERS_H +#define __PIDFD_HELPERS_H + +#define _GNU_SOURCE +#include +#include +#include +#include +#include +#include "../kselftest.h" + +static inline int wait_for_pid(pid_t pid) +{ + int status, ret; + +again: + ret = waitpid(pid, &status, 0); + if (ret == -1) { + if (errno == EINTR) + goto again; + + ksft_print_msg("waitpid returned -1, errno=%d\n", errno); + return -1; + } + + if (!WIFEXITED(status)) { + ksft_print_msg( + "waitpid !WIFEXITED, WIFSIGNALED=%d, WTERMSIG=%d\n", + WIFSIGNALED(status), WTERMSIG(status)); + return -1; + } + + ret = WEXITSTATUS(status); + return ret; +} + +#endif /* __PIDFD_HELPERS_H */ From patchwork Fri Oct 25 09:41:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13850351 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 5977ED0C5F8 for ; Fri, 25 Oct 2024 09:42:09 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id E2E8F6B00A5; Fri, 25 Oct 2024 05:42:08 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id DE0126B00A6; Fri, 25 Oct 2024 05:42:08 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id B6DB06B00A7; Fri, 25 Oct 2024 05:42:08 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0017.hostedemail.com [216.40.44.17]) by kanga.kvack.org (Postfix) with ESMTP id 8C2016B00A5 for ; Fri, 25 Oct 2024 05:42:08 -0400 (EDT) Received: from smtpin23.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay06.hostedemail.com (Postfix) with ESMTP id E0B42AC091 for ; Fri, 25 Oct 2024 09:41:29 +0000 (UTC) X-FDA: 82711632948.23.0DF21AE Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf13.hostedemail.com (Postfix) with ESMTP id D20CF2000B for ; Fri, 25 Oct 2024 09:41:44 +0000 (UTC) Authentication-Results: imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Aojlg+fK; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=arBAV2EF; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf13.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1729849272; a=rsa-sha256; cv=pass; b=S4EKgvhi0p+eo1nQRIAoWhRI9Fl+G2+2isPtbvPESv+h4MCkUyrYuF5J75IlrVbsosoWNV c7qgEmCiKg0wViup5rd1sNl75PchP5Wts3vZse4zMUrn2wWjJ+xy6R69IDHBHnxUo6R1bV jB9Tpkuenh21NL651C9TriQHoTZs5yY= ARC-Authentication-Results: i=2; imf13.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Aojlg+fK; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=arBAV2EF; dmarc=pass (policy=reject) header.from=oracle.com; spf=pass (imf13.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.165.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1") ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1729849272; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=//aIKsfakC4UDo1gdtqhmI6TrmfLl1HZuQqSyReu2Fg=; b=hDxZ/9DjmSbduSUcom2DALKY58zo9lcxhZQXsaDMunVDtSvF5MnqKNstZzUKODe4sTA6jB 9V1HE4+MnmTChv+hsgwa6LzSk6V4N4g4AV2AfS1D+1HQzYUaQTruXXrS8TfZZyMpcCBj8L R+sqmWOsQIG0eWYcT3H4jGltVpRlz3w= Received: from pps.filterd (m0246629.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49P8BaME014274; Fri, 25 Oct 2024 09:41:57 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=//aIKsfakC4UDo1gdtqhmI6TrmfLl1HZuQqSyReu2Fg=; b= Aojlg+fKaQX4H6xJF+nRy5G9M0/Cq+6/N1nIG2LJUk+JHtrDgmxd/2kV1FIEVPzG F456ojeUr4PFhrjnET/SZ9g3E4eS1905gN4MatQQGiHvdcADnCWCwkLI8sPTxYZH aiKAfSHjaiduV3AEPp5xQyuq/yIwhldXrfAgl80rtXl7T59MfqSQhtpibe9/EpKG a4u2R1PhS29TrDm9AnxKilQlvzezmakdBHMgUUd4+0kU3tBM91C1Pl4ZlI8QAnTz jeOpfDMrn53B4dmVG5Xb+mPw614buQsf7ajD2sGzFKJ7mA9iaNIITIS6JZkpiP85 SSjpnGKZCGjSrFUeHdqcag== Received: from phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta03.appoci.oracle.com [138.1.37.129]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42c55emffy-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:57 +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 49P9VBDq036957; Fri, 25 Oct 2024 09:41:56 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2173.outbound.protection.outlook.com [104.47.57.173]) by phxpaimrmta03.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42emh53wkq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:56 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=s+v0D3t6JTOyNtaLO4i1XkGEjoUkT8SXDlY23GhUnrMYHeXpWRBchqE7jvT/CxgD3bNkPo3u1h54DQDYvM51ir7TB5D9gwsQWhy4C1naHqSeoMsBc0BRWwx90JzyM7S4UAPWNSXLFD0zRfs7BvDVVTpPK6wu3h5PQdj78hCwJbINzY5EtnflldMyLMKqqqmS7l88Dm8IuQxEnaB/hXSKG6bqoSeC25sfs9goz4gNoXx7R3/WV+/PhEMfRQ/UoHFfurpOffgau5Hzg3nRrN8uQSpJiQRJc5ngCyEvNn2Ch06dieR14ULOKSY0huHZfb98cIQE5QYSr9FRjVKBYapavA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=//aIKsfakC4UDo1gdtqhmI6TrmfLl1HZuQqSyReu2Fg=; b=Xj+p2PxdtciUEAqCX8so7EsNJhzjxabq4egQepes70TNfk+H4rlKYtnfg/6Jq4P93s7BopMorUIOSqrhM5h72eYezMCqwldTrTRbqL9KdRofR5aY0O7HIe5GQFTCfMjvp0vNtGcRw94iqgIIGtweaV4KjUpN2fLOcsZDwtWpJnECk6hCvdvyTIHhnvMySo0e6G80yCBY30vcWbgt4+pYyNdsEAc1IZ6X3/Bnd+7U6eFabLlg2Ub/XVjh/gkr172UeBBtIJKJlM73BOycnIzikf6HHHVxJqeAxdH4dD9euXl6ZruhjtoVGSZPFYgZd2l1MBPliuapTnXH+EW51aTHPg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=//aIKsfakC4UDo1gdtqhmI6TrmfLl1HZuQqSyReu2Fg=; b=arBAV2EFzZ3i3mY4LbDkIiQ6dGJ8B3Aai5/eUg02j5pALog9xI/PB++tY6NviMMCA6VHHbAb1G1Be0y4hfT67YblWJ+am/AOVfWcJh3++pBtjozOT2nKBZyTNoBJ5r4WQHZF9LzBrcTLvuXS9bE7dEz2twzZgp4tCgFPFham3Dk= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by IA1PR10MB6121.namprd10.prod.outlook.com (2603:10b6:208:3ab::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Fri, 25 Oct 2024 09:41:53 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.014; Fri, 25 Oct 2024 09:41:53 +0000 From: Lorenzo Stoakes To: Christian Brauner Cc: Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , John Hubbard Subject: [PATCH v5 4/5] selftests: pidfd: add pidfd.h UAPI wrapper Date: Fri, 25 Oct 2024 10:41:33 +0100 Message-ID: <1002ac9d986cacf44dca8cdf392d62e26528eb83.1729848252.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO2P123CA0094.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:139::9) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|IA1PR10MB6121:EE_ X-MS-Office365-Filtering-Correlation-Id: 2a015b8b-97a4-44b0-a390-08dcf4d94228 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: awErcbrjTu0Egf/QTjvxki00G7uJ7Qzp76ObuLB5bI89SZmmyWpcCGwBRBg2KgxZA6bbYhjeTrneXWVRf6nHzbdfhMpsiMLEccB4D1PkVaqz3UhbI7ZnKXtkWLylGTgeLGWANrZBhGJxRxxWgmwegy2MyeolD+sKuatYy4+AdX7cmQ+ISBL1zr7X79+t2+E9s+eDFoP+pm8QEy2K6jthuG+wiPvURai0f8KHkGw3jFA0YK7eAgfB9nQx+EcdNmWSA+1duz26BZpIOOD6W7HvfWpa8dNsxJKGDracoXA8xwErWYLhu9YFyuxpTYF6tSd+hv3iGHdH/6LvR7S/DyDko7w91KkI7yN/js+x2oirUdgMKJGJ50czwx7efJVtcujbdPX26BDX1wA7HdMoT/w6Cd+wJeG1naRNlNrAbpNOIjTgPy+nGG2uVK+e6vl+GATl9nE4wJSfF9hf+sbi2FeIRBH/yupwxnmOWNITMMbEyR/ORDvJdjOFRlGfUg2GMhp8j+fRW0jOpZAXrJfRD3iRON2/PBprzhInYdCRN+M6U4E3yCOcLTqSUCzStSlkyBCH1W/Zr8PMbJcCC1fiSE0hcdywlbjnX/QOb87IRDaG/Ao2d92J40RqmUtrQg5TwHTOWxITp0pJuMa8OXcDfPW1dQGj/BGD35Z4l2/I5upq6DRZgaw3pK8/p2U5L41ev9tBnbSNc8YvacMfuYVMdYGqU2WuqKCLaqy4c+MMzuT5eMlqa5t50nS3nvelRpZj2OVkjLM7+pNB4stwGKbmwaMCU9kZuy4Sc+hP0dW5j2B/IM1NZxS53RML9cHTyOInWqWoW9qABsgZXEEfpIe3gIKYLTCa97/Ipo6ty+g/pkIUyB3Wfk9qapFbbLBHBpNclyJqSGzOu4Czm0kpa3Ag8Sbr1qAKMuZ/gvfnXh4MYasNaA/Fd5bnQbekTBlRP1kIk1AAXD1ZpGCGOiDF582YFYjTau82tz1kAP/2wAZu76Vq1nu2NnGtJZKqhQCFVxYDf//OqZTIWeJ6S1KnB0qbpO8mq3N2zt0HVUUW8fxWAleb/9A9XJgatCmQFpfZZL3tsufl77EQXvIz9TZogXd0sXsjA8wuCM3Nq3LveLhDguqyIb6ek3/vqu7tGZtUSBbRp+U3MGlcI7xuuCbCjIyx6hzLyegygr94hDVMSVPeeUwf81uY7BlxI6yP4Exchtx6OrC6xPg9LGaYPrg89GkVWCSAJazUUDGLIBFrVjnJduWCuAImIPYhTqNjMCm/vlp6o8UcOIeu6fHUDup2uGV5O9qqvWJPB6gu48rlmJ3pe0Ja58oJy2yr+7Y9uUVP5hcfIQz8 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)(10070799003)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6bfDWLRWtXpybuPezo/EXfYtkdZgcpex7QDMmjA4WqAled//N+62c4vYlCs1AI11Ca4OaR8frISiujxPvywCd1ra1SnilHpkLjY/oUtaW3CLzXQ/AS1XYkDyeCTxg4f/lI3W6VXZCDis9a0y1K7okbjpTY4v4SrxxJ/r8r/AXu102y11O7Fe3CXOdL6FotXTh97Mtkx0P+hcVUw9rnpxU9xT8K++sQnY9tJdwtV68mUGT9bDuMaGxLS6eTt5084/nijyRVxlkFFYGV0T/F2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+hmYAnv/+76nUZDmMq2Bn/AYp6YPAtjT8dXyAnNj+AQ88fMa6NYlSIwAcY1OZpUkjeR9lpV6iOxfOhSvYfoZlGyBfgT2W7KuHHmYAjQa/L2qWC9uUJP3ywv/f6d0/jU8L4Snf/5zfoYEkYssToyfQxnDy8gN4W1NMA+yXdQYNqYZtDmCuxiliePfgu9gXKnN80VDzU2jekPm0qKiYKdEAnAqYKf2oc3MZV/wd5KYt4cYMHPKpg1OhOuzoDVnqi8kqJCEkQYNTOsXJAraw/lA1rfdnz56+g6DZARBT6K9kMVL/jdZ51tgQVd51HlHfs8biMyA== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: QkMfr6yTh6GoXiCSPpUXWiVED6YWG5T25wwVMeNjOeRjixcFlhN4XeCyNR/2kzbtEOkPIDlND/qCm6V3O3sqYqhk0kVnJ+d792thElck7EX3chG5Y2ekJIr3GAD6gnV1CFrG+FHehkfB6HhFcNOEc7201OBJbi1lV9QtEXi7oQhTs8ZbsXHX6jV/cuTHocrjfA3gyAvO9i1nDKOqVCO8R62IttO67flXBqRlkgvJVEH8U0GfkFbjBbqLnzUD697TT1GI7SfUAbyb9+ZOy9EO6HEmbCmKrFNl0/Qt8SbHqQZJKJDk73LFOaliYkfBCxZPoZysko/kiktvDJ5eAkrPmJXnb+Y4ncTpsbVg1AJqN9wJk9DEh35qien3AbzExb0d9UaXyxksli0cUf7Lx09WhVbIiI6J90tx2Ds4lP/3yO8TJflyAkFPmvwKc5IjH45Da+4dUe2SPymckEFEstAM36g7BoXV+j1zmAJjAWaMK8PvY0xkZWQIlp1ki7iECeK5L4SEmbp2PsnosaYiRGV0Eoq9NtwVqwtgsDBHw7nCJGsZ1pl9N0EtZUtEN8bKe6TF5LplXQupRATrkRA1+tbrDxLnA5fTdxLd/yTbKMgtV6Y= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2a015b8b-97a4-44b0-a390-08dcf4d94228 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 09:41:53.7288 (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: enKY8pkm2t0s/rqlC15lPTIsAGIDhROiAz+mRld2+/M0a0+wSIuNv0wCFeLRL8lns6ELPOk+n/Q6n7HmyvrXN4JbDeOT0B7t2VfIlIqnjDo= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6121 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-25_06,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 malwarescore=0 adultscore=0 mlxlogscore=999 mlxscore=0 bulkscore=0 spamscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410250073 X-Proofpoint-ORIG-GUID: H9G-8VMbDrnKc7wRgbtI08FpLtwuQbRz X-Proofpoint-GUID: H9G-8VMbDrnKc7wRgbtI08FpLtwuQbRz X-Rspam-User: X-Rspamd-Queue-Id: D20CF2000B X-Rspamd-Server: rspam01 X-Stat-Signature: 5yeiyuocaxmifpykm68a9ghmar46ikxj X-HE-Tag: 1729849304-64464 X-HE-Meta: U2FsdGVkX19ZWMrahoUihp442mNDUx79UM+lB2KirE/GEKbKJWY/1XAcQ24kgKmF9QNUzHIBwNcaNx7G/8HBAnui2PD+IRnIvXJMKolhXDgQaCxhznLkB5hbnxELkTjFGegKn+LNZmkujskJXGR6SJ8io5V/IyzIuXgzciT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q4EZ/oPvdiIE+6KTeHAN2+PgHMhxI5doZBl88IbTHFrMOxEG0IQwaL9rhZfVqQ9OHltZ2xLTdy4vQTmR6MmUv/UQzhU/kfwASQ+PIgyz78NQiOL/BMzoVAUhoeFfBaorVdWnfKcRyJRwFDC2ZMMsby5CJv2g8Ch9L4gN266uxQQh0xKL/ZZkA9pwft0qhHWwua347o2jFGyq/WN/HWYD1Cg94qfcfan2gxXe9NdXpInoDptogY9nMhSAUMWVurGswh9rMkLiY2IvdFyG8A3ads65A42JyV2IymgVj2FOjAOysQP/rS4q/QKSiY+mtO1r7IfYb44cWKKT6kd019PAbwvKOaPFQKElQfH+eX7b6mNq3fSzkyx9IlP6egCeud1m0z37EoT1sg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000009, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Conflicts can arise between system fcntl.h and linux/fcntl.h, imported by the linux/pidfd.h UAPI header. Work around this by adding a wrapper for linux/pidfd.h to tools/include/ which sets the linux/fcntl.h header guard ahead of importing the pidfd.h header file. Adjust the pidfd selftests Makefile to reference this include directory and put it at a higher precidence than any make header installed headers to ensure the wrapper is preferred. This way we can directly import the UAPI header file without issue, use the latest system header file without having to duplicate anything. Reviewed-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/include/linux/pidfd.h | 14 ++++++++++++++ tools/testing/selftests/pidfd/Makefile | 3 +-- 2 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 tools/include/linux/pidfd.h diff --git a/tools/include/linux/pidfd.h b/tools/include/linux/pidfd.h new file mode 100644 index 000000000000..113c8023072d --- /dev/null +++ b/tools/include/linux/pidfd.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#ifndef _TOOLS_LINUX_PIDFD_H +#define _TOOLS_LINUX_PIDFD_H + +/* + * Some systems have issues with the linux/fcntl.h import in linux/pidfd.h, so + * work around this by setting the header guard. + */ +#define _LINUX_FCNTL_H +#include "../../../include/uapi/linux/pidfd.h" +#undef _LINUX_FCNTL_H + +#endif /* _TOOLS_LINUX_PIDFD_H */ diff --git a/tools/testing/selftests/pidfd/Makefile b/tools/testing/selftests/pidfd/Makefile index d731e3e76d5b..f5038c9dae14 100644 --- a/tools/testing/selftests/pidfd/Makefile +++ b/tools/testing/selftests/pidfd/Makefile @@ -1,8 +1,7 @@ # SPDX-License-Identifier: GPL-2.0-only -CFLAGS += -g $(KHDR_INCLUDES) -pthread -Wall +CFLAGS += -g -isystem $(top_srcdir)/tools/include $(KHDR_INCLUDES) -pthread -Wall TEST_GEN_PROGS := pidfd_test pidfd_fdinfo_test pidfd_open_test \ pidfd_poll_test pidfd_wait pidfd_getfd_test pidfd_setns_test include ../lib.mk - From patchwork Fri Oct 25 09:41:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13850352 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 145F9D0C5F4 for ; Fri, 25 Oct 2024 09:42:13 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 974486B00A6; Fri, 25 Oct 2024 05:42:12 -0400 (EDT) Received: by kanga.kvack.org (Postfix, from userid 40) id 8FBD66B00A7; Fri, 25 Oct 2024 05:42:12 -0400 (EDT) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 6D87B6B00A8; Fri, 25 Oct 2024 05:42:12 -0400 (EDT) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0013.hostedemail.com [216.40.44.13]) by kanga.kvack.org (Postfix) with ESMTP id 48CD56B00A6 for ; Fri, 25 Oct 2024 05:42:12 -0400 (EDT) Received: from smtpin06.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay04.hostedemail.com (Postfix) with ESMTP id 40C481A0758 for ; Fri, 25 Oct 2024 09:41:37 +0000 (UTC) X-FDA: 82711632948.06.9EBFC29 Received: from mx0a-00069f02.pphosted.com (mx0a-00069f02.pphosted.com [205.220.165.32]) by imf05.hostedemail.com (Postfix) with ESMTP id 95DF7100002 for ; Fri, 25 Oct 2024 09:41:31 +0000 (UTC) Authentication-Results: imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=T7SIR7zr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=JzmotlE4; spf=pass (imf05.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=1729849123; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=wY6kdgChMItf6mowLK+7M+e6qDkjxAzv9eXffTxVzSk=; b=lQ/XHTodIkQhw6654jubTeiHckEP0SMS0NvUzqS/Kvi9hGaeZ/e1Sj6db9QOdoLqelLW9S UOPqv8xKlHkzXEo4cafY60Ul662RXmIYKkQ0k89XbWKu6/iyFxGS1S0yxacPg93xO3aE8U MxsoEC0QMPFDU5VoaWJKBlnpuIdLPis= ARC-Authentication-Results: i=2; imf05.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=T7SIR7zr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=JzmotlE4; spf=pass (imf05.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=1729849123; a=rsa-sha256; cv=pass; b=fnR/r2P1SEOaCRKdCA60DJZspCiNJ0xoGNFkzjRE1DUzfRpc2oMvV5j0k8aeMPj9tvJfjF ajBMZv0C0E555VktUoefmEJV6Gr7++5ebFXCdylpBP9YIGz097QeI6ZCgqXxyNwH4epELI ulboRq8yRhfSO7gauWpjEI7j2+zDarY= Received: from pps.filterd (m0246627.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 49P8BXd1026773; Fri, 25 Oct 2024 09:42:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=wY6kdgChMItf6mowLK+7M+e6qDkjxAzv9eXffTxVzSk=; b= T7SIR7zruLPBUdWn69jxBGKZ1lnV9mJk9rc/XaYI+q0hd+Z+u+tBFqQPXG1IMwQU PuAtKufm4sc2bzgYnG7BBz6ZGRQ/4uIQ5M2J9myBCX2cif1x3nrQ0htRo9l4bQ6A e9S/zcBveV20+XUuSH35WpOdseW/o/Ge5Fe95NYQ8V3YhihQas9AO9ay7jb4kDAH GpcYetaYQ09QYSBtKgXvUDfE+MNXkQEeqaTQ6eRc2iJcj0aJsghtBCYyH7Cl/c0h inZvAMfjJrAkh67P02JUt75VQA31smB3fOKtZDNV1s3S9ZmZnGvcPNMSKiGtO62q egpe5BLTo0c8JyTQhtx6hQ== Received: from phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta01.appoci.oracle.com [138.1.114.2]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 42c55v4kf0-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:42:00 +0000 (GMT) Received: from pps.filterd (phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 49P8Mfjc002210; Fri, 25 Oct 2024 09:41:59 GMT Received: from nam11-dm6-obe.outbound.protection.outlook.com (mail-dm6nam11lp2171.outbound.protection.outlook.com [104.47.57.171]) by phxpaimrmta01.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 42g36a9ybt-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 25 Oct 2024 09:41:59 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=qfWEdDcI6JMq4cvoz9tEjbhSB/rPbgzUnHhBg9RNk7cKdQLRIE8gCEdZtgP5DMWU1UNY75lKX4YECo+BPea4o0x8eYfzkD+o6QYAHIkdTgT3zJNR5Lpst4keUCdYsJLAqBFS9eJSeP3OWmCp69YUUGbkC8y/Wg581u23orILrV1ZipngOMVmqUX0jQMVAHo/m9RvMiJVQ5OtCyfq+o0aU8s+NQ1IoGAN7a3eN7mASfMs+Fu1T8bgSvYb08mbA1At5Db2haxQeKHhnL48rCBZnv1Th41ZuprmyXZTYFpn+8JBMjy0vd8FXwXVqec/tLPbwUwKgDdwQBU6gPqAHiqM9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=wY6kdgChMItf6mowLK+7M+e6qDkjxAzv9eXffTxVzSk=; b=dbrD9fEwLHQl1LFLJ2bkPkW96MF/lo4nP1P05RAF8+Pf0FAE57T+g6TMZHK9jtmSgKOcka0guRjcKVeWDjlLaYwWdh1Ae+/epRaIjCqHpSOEWeFyCLfMfsf73wmgzSaiydNx4P4jlLUhEHV4xvtzG1tWaKFmYgvcvdJeTvN8yLqKb9u2oOqEUR39IQB4drMdIZujM0oxWwsAoqI3O/x7+LqTo8xTL9nU+pFRCttRGDZ14w2+MGf/3ZFzr2D/NEui7OhHwzLlpF/qr+QBY4B0xkbTzWYQAkUy+n8xlimwpAooA8+b/5bpc+n4Xfby0IB+INwnBO+42PrjIzJkh430IA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=wY6kdgChMItf6mowLK+7M+e6qDkjxAzv9eXffTxVzSk=; b=JzmotlE4Gd2v1juemedHvlZySF2mZbQD0x7376EXToXyVUzY0Hob93MRNhACy2OYjqIvBF5MxRiEgLttYTcOBqnu+Axw3rlH4ONQHMoS0TWnjtD6f0Bf00RZV0ZsO+M8EF69qQVKlVj+uVG3RG+GRIv6+1q5D+3nlqJX/qhnR8U= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by IA1PR10MB6121.namprd10.prod.outlook.com (2603:10b6:208:3ab::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Fri, 25 Oct 2024 09:41:56 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8093.014; Fri, 25 Oct 2024 09:41:56 +0000 From: Lorenzo Stoakes To: Christian Brauner Cc: Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , John Hubbard Subject: [PATCH v5 5/5] selftests: pidfd: add tests for PIDFD_SELF_* Date: Fri, 25 Oct 2024 10:41:34 +0100 Message-ID: <36d9dbea7475850ac9206fcd0d3ea1f1d02312fb.1729848252.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: References: X-ClientProxiedBy: LO3P123CA0031.GBRP123.PROD.OUTLOOK.COM (2603:10a6:600:388::10) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|IA1PR10MB6121:EE_ X-MS-Office365-Filtering-Correlation-Id: 5837dcf0-4138-4b4e-4aff-08dcf4d943fb X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|10070799003|366016|7416014|376014|1800799024; X-Microsoft-Antispam-Message-Info: 7y7I41QU/uHo360g6gBhDjMAJBfro2kqm/f1ZUFANDCRbI7sm5Vk90nftW0f35MPCLyrJqkVfD/VHREB5dpt+XdzzsJ43mCKBNhCJoaf9V8v7hpw5jWeTcFZI12gs55LMJIFzX6SfkKnhKubAOxWTPEH2jTeerLEgifqo4BzjxV89WD8W54kqtlW8A1c6ap7yX8UeBT70yyhPi1cxvNPcJOPh4lwczyBcoWtSZwXHgxzJHHwhMQrs+v4Dmau55WCZkchPMxhvXxZKF8tuxJIsUyfAiR9sNv7u4Ee5Ds+Q1ijozk73nLfu/c+GYejMMMWpzaUMXfoJ4X540Wn3ybRgm4Zwk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CAT:NONE;SFS:(13230040)(10070799003)(366016)(7416014)(376014)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: d2tWEioTJC8LAkL+0WpzxZg8GE62VPfEj1kV4UyNZfB/F/4c0bYtACZVTzGWhkMWkdslPW7D85yfqGfnVOnkTttKcn4Tp0LsTKmNr8gwxji1M7K2EZBf5XoZVkQZ/NkfdJR8Ad0bgSL2frD+MkTeF8H0fPtXC8uOHHIfOCwlMlg/sxSU1v9uvOoIrUjrKFD7R731C51uJrDZP+Ezo6NrAuKE2S4JTXeZgaXL9BHwQ0n1xR+vlYSPEtn9QFzdB3DFWuR+HuoDAgrCRdQpzrABpWU5D5Vyb9r7eauT3ItH+IWHFD2mvAX4QgBjIhBuW0TBE8/NrztngiE44jGPwhOmdls1tP0vsOb2gAeEz3VHl1VkWiDyIPtYf4A3qM9rUBm7ZgVEh9mGGO6e3icRDHh29D9cWF/uu3M37det+q3wD3/82kLW/AEYV+X7kyNgNz7rvOMHvml3gxdDfPXV7z0P8CCf8AdH8Gs21rDHR2GQ1AjUriekW9Oi/Q+xoKN7X8osyB6pTn+PJHyIqIkN2rdiFORFgA/h8hnruDzgAC5IujLjiaIsiUn/EJPNNNU2zwCMLE9+iqeKGTl7UhF4+Oq86vrqpJijx6+XynJr3WAbUKPHNSGsD1QAP42c2oOt2xtwn7rswi/fuNynRMOsVnqc6noLiptbQLXTut0KYGYhrZsV2NvMDFsPlcLMzma6fxoDg4VPSSyCc8B9H5rI7A1m1SLDhA6Uqdc+7bJOAs/nccT/DEBJgaiAQFY7CiWR6eF6xPESzBWhSE9LzSHpci4MnxaiM9gh2uQtBogQnvBfr4FNI8qbYTpDunwcdUKsdwHuvBH4ZPKwXinGpwrkOe05g09Bdh7WziMTGah0uR+u1KbA0UldoN9lj5MznMybiMJPvQuoyQia9a3EBcyf2+/5sNNuWJhITiNbM01+AGO7BKFODvWcV3zbf90DK02kq78pYsWI78Blp4KF+lUbhkQR8afLMuDKKt9XwxFqBPyRqpy1gnjV6W2NzXIFcbO7xFlkDNdSkS3UZhYMcSGMuVywCx71l00OZjj5uwufSpW7DiZIssHACAfZFBdoAxriTGJBjh1fYJGeeu4JagYr/hplzKI94vfrZOTlwpYCCug9SR/cNtfjegOh3FVehSkAdADECWBQs5v9n5RB8FBgA/bRpTabvFYlPDrcD7fBJXvrSLmIameOn62VKc2OttLJG4689jI/kJlddyc3xJ3+iVxylpqiWLV+Iz2zbKXzENXLKt6MSREVoMSPDP6AtTuD4U0vrJUPIjd+Uh/gsGZO2XhOS3y5leRWD16pUmwoW6pSnh+GwYWlSX95jIhraF2c1WacpFE2PLeOWqEZbqXqcVavSydjbQFHRODOJGKhyLpm9K8GiM8a5ZnApBgjMeM5lXanyr9INEh7Nj2dZqvCAIch2lHQvFzQsNKqnX8o+0c6S2yQKYdUHIciJdQ2bZG6JGW2aIQIy0mPeNsK4V9exFPk2LuYdIW6PC47iqe/xGghHJLRZI1zXdMno6kHeZuhe2ChrhbvfkYwBUU9waYunf3BwiRvu2WMgasECi9IvrD3Si+QPEfGPNlcKr1Yxn0JF1YBTmDRwkbcP/BxSmbXNy8oaDh1BemEdDL0/GLZXGPeCNC1GY0wUq9TAQU5pklX18O2YJiTbmMniDlBF00zNsLHHg== X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +Qpu+I6Nr+FZmZSwcag+LVp8y5Ws2vcdcjvZReCwygKchJC06gP6rBTAfiCmAcfdieERQKY6cnPsOF/GyJPsft3yDF0/q5EKMA2xKvpoZDBcmMFQ6uHlRj3RhWNqLYBqvfAAXmZ/ncP1Ze9gwd6sAHecK8lapUeU49eKujD7RGWzRl8xYxytJ2QXLX28lboOtRTpoM3KrwKlte8RVv9aQC1CoazidwQcVwZfDnNdvBwW5kGXQqPYwAHStidoAlLTt0UrtJ7lW17m7/2g3MnKCb6Vm672NqzmOtfRHmIqY2L/3c+9kam5gJOV1kVh2dmYdgm6RpZ0tHN+4f9MtB2uFNX1lTjmcHmvZxPEVZT6BU3nOt7wOtGCcrVnYrd4HmspEm6DC1aPGg3MgkZQT/eKuR29cpWt44Vtym39o4MVw2Byt8zpZ0tJMsvGb2wXLvUP9BKccY/WPfuATwZg6JvF8y0KezOenfejYFFWZIvVChS0Ov67DxvnjDzjR5ZbMRx6fRJW1CKWHG6QZSMPmb3aEO+bzHqiSIcMxtLeI3bCSkYsaBwfyvdzDqUbJMiLrjUCpUbQOGQ207RXMLTCa21SJU9JuQge08WjUrF2Glui95E= X-OriginatorOrg: oracle.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5837dcf0-4138-4b4e-4aff-08dcf4d943fb X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2024 09:41:56.6619 (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: fW9Qg/7O8fW9a6gk+PHCaGJBp0vyU224R4eAq27i1JLNIrmq8EhhDNj2Ug6s7FFhfEHboIzm2d5JILi/YZRcsGOm1gcGHFKFsSqXmr2QvNw= X-MS-Exchange-Transport-CrossTenantHeadersStamped: IA1PR10MB6121 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1051,Hydra:6.0.680,FMLib:17.12.62.30 definitions=2024-10-25_06,2024-10-25_02,2024-09-30_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 mlxscore=0 mlxlogscore=999 suspectscore=0 bulkscore=0 malwarescore=0 adultscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2409260000 definitions=main-2410250073 X-Proofpoint-GUID: fZaWXAsNQzc4D_kL-EFj7EnRL01cgrnR X-Proofpoint-ORIG-GUID: fZaWXAsNQzc4D_kL-EFj7EnRL01cgrnR X-Rspamd-Server: rspam06 X-Rspamd-Queue-Id: 95DF7100002 X-Stat-Signature: 4uh6tiwzcrbpyzhowmdu3g3u9nemgcfp X-Rspam-User: X-HE-Tag: 1729849291-427639 X-HE-Meta: U2FsdGVkX1+jPojb3vVuF4cLk7KTiPlAML+VcjpoXhYyKQqIwp/gaFCyLbWaDG5lZvudy4jx8X87r+LnWDXO7I6GOzWExxYNiKNJufH/S4IiW3vI03BLB9HQtg5j0HRyKcxH+bADnZL8aRpZrTxVD/Zl5AFAqPUa4kjpaJ+m2oXvCytNEYpJ51u1Fyl/RKruVjiQdqPOCOO7MWy9YHjEZwcW2X0oQnvpRPEA77hJGdC79svILjWOhZ4i6QaKBJLz8lC3jdBie7ZbAe32GM6RpMVVXVhwf6BohopO3pxMu8121VY5enG5ofyay+CzN2842ELxTt5CV5Abnox8cG19wJdXTa/Lz2KrUfHPCWXWsZzTS8+K73yOsHninYxlBDlqg1uQzTPp2fhHn+YRJ1MjzHKVblE6xGfnOzEdH+pOqVdPItdotd6R4ukA/GENKpp3Dxi50WvcqscFlp1JZ0NOo1nCqcna/CFfRryL+f32GvwoxQhZcaqBKk1KrrH68VXQaYUot8fpPkSpkR2uXT93xXoezCGu06aQQtBj8PbSM3wU28debcivI4lYWw6o25X237PS0zTokqD5ccQBgbed5CDkLhxovFL9OjPjRwiQsOGud0jxedhJCydEf+hKxm/uOvUT4Jvm/7KiYmzo5r4sTY+E7Ghq3hMOZdyK8DSXQNloaiqZYBwyH5VxacAnrnC844FVUXYbZlV0BM+RQ7f/7aV6Lwbp+Gb6ab+lhjdVwALlLUlG3+PlFKeOmG0M3+MtbGlWuC865dKLG7BWAEyJEpyF0Rt6XuwG+ewY7iOZQK6DdqHdZvFtei61fdv0r4PbQyCCRkT9Yl990mlWiW549QA0XFWun/QJJ7a1a4NK8aoX2BiBkMPZE18sDua52rQnv0NM7N7r5rKukM+wpEWPJDzwubpgqku4n0F+T3/7log+LUgge89hpQmyRNjwXzKr0d7lsbmpzHGQM3mk/pi Y75sogDH dN0+jLwK8y/M8/qrBI3Qiy+B6qp9Rtd143wyANSSqIymBv00L9b7STX4ySDTpEc9iisfSSY2gBGBON5naNIvm6atoGhj4+2qKEs1ks4lAD4c9qT43YV7gJUnzA+eFyLSfBKrKQICPJtknfmbtql7nLVoBV+KmT81JAjvBWg5L5PqQoiBPok+pADH3xIAuFMAHIrBPxYej2BRl+0zR3VxGMOmSO8eMYxfx/YbwaHIUn8EdF8mdKqNm7mRLhgM2I6baDDS2HTFD1hd2/sF74Hh6MtQia/LePYRmEoLqL6LipJhdF0sfm4ObPG36F8PLnTVeDI623rxHtSMOSlL9BnA310WVBwsje140RpNeeRjvxefkPRuGQYviMEsP3BfT5TzM6wOYD+3bnmqzHIx8PawaGmvd9UaahjCZaDXGgNj0w0NVFPMP/6Y1ElDDjzUQ7oqAUL5FkGE9oV5fBmQZv697aYMjNXgZ/bHRpjZjKPz5EqolL1uXBRfJdibmunaaJFxEoF0ruSRJhqGfU/cYbbY0AtQFopMrlt57sW6iWdSPWW5pMz7vJHSbVFYSYTA09xZL9wwi3+Xiun2Z23S2LGwMpk2GXknmvnMMXqvRm/fAlWMLiExG95qksxvTryNpknU3M0IQOnCuXtuuDqa07b9M81gpecMFhthfwFJd4otvBQ65Zzon0F5aPkJJC7Ypt28goxwm X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add tests to assert that PIDFD_SELF_* correctly refers to the current thread and process. This is only practically meaningful to pidfd_send_signal() and pidfd_getfd(), but also explicitly test that we disallow this feature for setns() where it would make no sense. We cannot reasonably wait on ourself using waitid(P_PIDFD, ...) so while in theory PIDFD_SELF_* would work here, we'd be left blocked if we tried it. We defer testing of mm-specific functionality which uses pidfd, namely process_madvise() and process_mrelease() to mm testing (though note the latter can not be sensibly tested as it would require the testing process to be dying). Reviewed-by: Shuah Khan Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 2 + .../selftests/pidfd/pidfd_getfd_test.c | 141 ++++++++++++++++++ .../selftests/pidfd/pidfd_setns_test.c | 11 ++ tools/testing/selftests/pidfd/pidfd_test.c | 76 ++++++++-- 4 files changed, 218 insertions(+), 12 deletions(-) diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h index 0f3fc51cec73..1dbe48c1cf46 100644 --- a/tools/testing/selftests/pidfd/pidfd.h +++ b/tools/testing/selftests/pidfd/pidfd.h @@ -16,6 +16,8 @@ #include #include +#include + #include "../kselftest.h" #include "pidfd_helpers.h" diff --git a/tools/testing/selftests/pidfd/pidfd_getfd_test.c b/tools/testing/selftests/pidfd/pidfd_getfd_test.c index cd51d547b751..48d224b13c01 100644 --- a/tools/testing/selftests/pidfd/pidfd_getfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_getfd_test.c @@ -6,6 +6,7 @@ #include #include #include +#include #include #include #include @@ -15,6 +16,7 @@ #include #include #include +#include #include #include @@ -114,6 +116,94 @@ static int child(int sk) return ret; } +static int __pidfd_self_thread_worker(unsigned long page_size) +{ + int memfd; + int newfd; + char *ptr; + int err = 0; + + /* + * Unshare our FDs so we have our own set. This means + * PIDFD_SELF_THREAD_GROUP will fal. + */ + if (unshare(CLONE_FILES) < 0) { + err = -errno; + goto exit; + } + + /* Truncate, map in and write to our memfd. */ + memfd = sys_memfd_create("test_self_child", 0); + if (memfd < 0) { + err = -errno; + goto exit; + } + + if (ftruncate(memfd, page_size)) { + err = -errno; + goto exit_close_memfd; + } + + ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED, memfd, 0); + if (ptr == MAP_FAILED) { + err = -errno; + goto exit_close_memfd; + } + ptr[0] = 'y'; + if (munmap(ptr, page_size)) { + err = -errno; + goto exit_close_memfd; + } + + /* Get a thread-local duplicate of our memfd. */ + newfd = sys_pidfd_getfd(PIDFD_SELF_THREAD, memfd, 0); + if (newfd < 0) { + err = -errno; + goto exit_close_memfd; + } + + if (memfd == newfd) { + err = -EINVAL; + goto exit_close_fds; + } + + /* Map in new fd and make sure that the data is as expected. */ + ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED, newfd, 0); + if (ptr == MAP_FAILED) { + err = -errno; + goto exit_close_fds; + } + + if (ptr[0] != 'y') { + err = -EINVAL; + goto exit_close_fds; + } + + if (munmap(ptr, page_size)) { + err = -errno; + goto exit_close_fds; + } + +exit_close_fds: + close(newfd); +exit_close_memfd: + close(memfd); +exit: + return err; +} + +static void *pidfd_self_thread_worker(void *arg) +{ + unsigned long page_size = (unsigned long)arg; + int ret; + + /* We forward any errors for the caller to handle. */ + ret = __pidfd_self_thread_worker(page_size); + return (void *)(intptr_t)ret; +} + FIXTURE(child) { /* @@ -264,6 +354,57 @@ TEST_F(child, no_strange_EBADF) EXPECT_EQ(errno, ESRCH); } +TEST(pidfd_self) +{ + int memfd = sys_memfd_create("test_self", 0); + unsigned long page_size = sysconf(_SC_PAGESIZE); + int newfd; + char *ptr; + pthread_t thread; + void *res; + int err; + + ASSERT_GE(memfd, 0); + ASSERT_EQ(ftruncate(memfd, page_size), 0); + + /* + * Map so we can assert that the duplicated fd references the same + * memory. + */ + ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED, memfd, 0); + ASSERT_NE(ptr, MAP_FAILED); + ptr[0] = 'x'; + ASSERT_EQ(munmap(ptr, page_size), 0); + + /* Now get a duplicate of our memfd. */ + newfd = sys_pidfd_getfd(PIDFD_SELF_THREAD_GROUP, memfd, 0); + ASSERT_GE(newfd, 0); + ASSERT_NE(memfd, newfd); + + /* Now map duplicate fd and make sure it references the same memory. */ + ptr = mmap(NULL, page_size, PROT_READ | PROT_WRITE, + MAP_SHARED, newfd, 0); + ASSERT_NE(ptr, MAP_FAILED); + ASSERT_EQ(ptr[0], 'x'); + ASSERT_EQ(munmap(ptr, page_size), 0); + + /* Cleanup. */ + close(memfd); + close(newfd); + + /* + * Fire up the thread and assert that we can lookup the thread-specific + * PIDFD_SELF_THREAD (also aliased by PIDFD_SELF). + */ + ASSERT_EQ(pthread_create(&thread, NULL, pidfd_self_thread_worker, + (void *)page_size), 0); + ASSERT_EQ(pthread_join(thread, &res), 0); + err = (int)(intptr_t)res; + + ASSERT_EQ(err, 0); +} + #if __NR_pidfd_getfd == -1 int main(void) { diff --git a/tools/testing/selftests/pidfd/pidfd_setns_test.c b/tools/testing/selftests/pidfd/pidfd_setns_test.c index 7c2a4349170a..bbd39dc5ceb7 100644 --- a/tools/testing/selftests/pidfd/pidfd_setns_test.c +++ b/tools/testing/selftests/pidfd/pidfd_setns_test.c @@ -752,4 +752,15 @@ TEST(setns_einval) close(fd); } +TEST(setns_pidfd_self_disallowed) +{ + ASSERT_EQ(setns(PIDFD_SELF_THREAD, 0), -1); + EXPECT_EQ(errno, EBADF); + + errno = 0; + + ASSERT_EQ(setns(PIDFD_SELF_THREAD_GROUP, 0), -1); + EXPECT_EQ(errno, EBADF); +} + TEST_HARNESS_MAIN diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c index 9faa686f90e4..440447cf89ba 100644 --- a/tools/testing/selftests/pidfd/pidfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_test.c @@ -42,12 +42,41 @@ static pid_t pidfd_clone(int flags, int *pidfd, int (*fn)(void *)) #endif } -static int signal_received; +static pthread_t signal_received; static void set_signal_received_on_sigusr1(int sig) { if (sig == SIGUSR1) - signal_received = 1; + signal_received = pthread_self(); +} + +static int send_signal(int pidfd) +{ + int ret = 0; + + if (sys_pidfd_send_signal(pidfd, SIGUSR1, NULL, 0) < 0) { + ret = -EINVAL; + goto exit; + } + + if (signal_received != pthread_self()) { + ret = -EINVAL; + goto exit; + } + +exit: + signal_received = 0; + return ret; +} + +static void *send_signal_worker(void *arg) +{ + int pidfd = (int)(intptr_t)arg; + int ret; + + /* We forward any errors for the caller to handle. */ + ret = send_signal(pidfd); + return (void *)(intptr_t)ret; } /* @@ -56,8 +85,11 @@ static void set_signal_received_on_sigusr1(int sig) */ static int test_pidfd_send_signal_simple_success(void) { - int pidfd, ret; + int pidfd; const char *test_name = "pidfd_send_signal send SIGUSR1"; + pthread_t thread; + void *thread_res; + int err; if (!have_pidfd_send_signal) { ksft_test_result_skip( @@ -66,25 +98,45 @@ static int test_pidfd_send_signal_simple_success(void) return 0; } + signal(SIGUSR1, set_signal_received_on_sigusr1); + + /* Try sending a signal to ourselves via /proc/self. */ pidfd = open("/proc/self", O_DIRECTORY | O_CLOEXEC); if (pidfd < 0) ksft_exit_fail_msg( "%s test: Failed to open process file descriptor\n", test_name); + err = send_signal(pidfd); + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on sending pidfd signal\n", + test_name, err); + close(pidfd); - signal(SIGUSR1, set_signal_received_on_sigusr1); + /* Now try the same thing only using PIDFD_SELF_THREAD_GROUP. */ + err = send_signal(PIDFD_SELF_THREAD_GROUP); + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on PIDFD_SELF_THREAD_GROUP signal\n", + test_name, err); - ret = sys_pidfd_send_signal(pidfd, SIGUSR1, NULL, 0); - close(pidfd); - if (ret < 0) - ksft_exit_fail_msg("%s test: Failed to send signal\n", + /* + * Now try the same thing in a thread and assert thread ID is equal to + * worker thread ID. + */ + if (pthread_create(&thread, NULL, send_signal_worker, + (void *)(intptr_t)PIDFD_SELF_THREAD)) + ksft_exit_fail_msg("%s test: Failed to create thread\n", test_name); - - if (signal_received != 1) - ksft_exit_fail_msg("%s test: Failed to receive signal\n", + if (pthread_join(thread, &thread_res)) + ksft_exit_fail_msg("%s test: Failed to join thread\n", test_name); + err = (int)(intptr_t)thread_res; + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on PIDFD_SELF_THREAD signal\n", + test_name, err); - signal_received = 0; ksft_test_result_pass("%s test: Sent signal\n", test_name); return 0; }