From patchwork Thu Jan 30 20:40:30 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Stoakes X-Patchwork-Id: 13954959 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1468EC0218A for ; Thu, 30 Jan 2025 20:41:04 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 994162802B0; Thu, 30 Jan 2025 15:41:03 -0500 (EST) Received: by kanga.kvack.org (Postfix, from userid 40) id 91BAF280058; Thu, 30 Jan 2025 15:41:03 -0500 (EST) X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 746B52802B0; Thu, 30 Jan 2025 15:41:03 -0500 (EST) X-Delivered-To: linux-mm@kvack.org Received: from relay.hostedemail.com (smtprelay0016.hostedemail.com [216.40.44.16]) by kanga.kvack.org (Postfix) with ESMTP id 51B78280058 for ; Thu, 30 Jan 2025 15:41:03 -0500 (EST) Received: from smtpin02.hostedemail.com (a10.router.float.18 [10.200.18.1]) by unirelay07.hostedemail.com (Postfix) with ESMTP id BECCE1601D8 for ; Thu, 30 Jan 2025 20:41:02 +0000 (UTC) X-FDA: 83065287564.02.EAC4A5B Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by imf23.hostedemail.com (Postfix) with ESMTP id 6F9F6140017 for ; Thu, 30 Jan 2025 20:40:59 +0000 (UTC) Authentication-Results: imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Ft7g8fPr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hS3yGOQJ; spf=pass (imf23.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=hostedemail.com; s=arc-20220608; t=1738269659; h=from:from:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:dkim-signature; bh=Bk4iEJmNOs0gKjCIyK6jOaRhyYYz7iRVbjW4yL2p6M4=; b=IHvFMaqmiCqFj8KzLqj/ZYSHFkaVrVx+qEzhaDuahrlOada16msaguhvGpKMhnmL66DGxo yL0lJlQ2fZMwS0lQcnLKz1ctdcwA2DWLDovSojJhgiSbSEX/l6G/LZwNckYjsgyvUznUBB ZdnoLHEsyOpGDD8nlwfVtTFyfBN8PDc= ARC-Seal: i=2; s=arc-20220608; d=hostedemail.com; t=1738269659; a=rsa-sha256; cv=pass; b=N68oi9z4bmUWbKq3eegcYl0J3SjzHSlpZE/9pA9rfafDBFjT+Z3yGfnDjRsjdDgMP+ENA2 vXkIy+ZwL4OE9gdOiQFvPfRPWVsB0TwYYsTzgVcxMo5mSBxxqbJkGqQ9EMVZNVO5+1Lihl LSv4dmuCcMbIhc5/SW7RuOAI/tKncPQ= ARC-Authentication-Results: i=2; imf23.hostedemail.com; dkim=pass header.d=oracle.com header.s=corp-2023-11-20 header.b=Ft7g8fPr; dkim=pass header.d=oracle.onmicrosoft.com header.s=selector2-oracle-onmicrosoft-com header.b=hS3yGOQJ; spf=pass (imf23.hostedemail.com: domain of lorenzo.stoakes@oracle.com designates 205.220.177.32 as permitted sender) smtp.mailfrom=lorenzo.stoakes@oracle.com; arc=pass ("microsoft.com:s=arcselector10001:i=1"); dmarc=pass (policy=reject) header.from=oracle.com Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 50UKH0et026817; Thu, 30 Jan 2025 20:40:52 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=cc :content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s= corp-2023-11-20; bh=Bk4iEJmNOs0gKjCIyK6jOaRhyYYz7iRVbjW4yL2p6M4=; b= Ft7g8fPr0hn07dsuEe9MphtGbWYQsT77SEDgmFoXA4pRYxWdybufzqdJZBPQ/Lj0 O5mE+QifF3YWv3YAcHKWO9aK2Ouu48rveN0Ov4O6e6XM5E3QrpQPp/vTXR/23NTr b79SXAXLRgLQlT3vhbow+IjSIMVuntbc3OdonmxDbPbj9d+uU9Rf1haqwVFEBrIB 4q3EEHYd4kgMB6+h5KBv5P+2GmSCQXn93UXp1bnj2b8/DQh/KVJhEAm56Jv6D8OL ++d6Ta1d7X1ujHY1K3NZ+lD/Q4DPCowvo1cjJhh8eIvfd8Qgh1Gdy44sFxZ++btq O9LAsSE9RryB6pyKr2Sn7A== Received: from phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (phxpaimrmta02.appoci.oracle.com [147.154.114.232]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 44ggaqg1u5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:52 +0000 (GMT) Received: from pps.filterd (phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com [127.0.0.1]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (8.18.1.2/8.18.1.2) with ESMTP id 50UJNXhp006240; Thu, 30 Jan 2025 20:40:51 GMT Received: from nam12-mw2-obe.outbound.protection.outlook.com (mail-mw2nam12lp2045.outbound.protection.outlook.com [104.47.66.45]) by phxpaimrmta02.imrmtpd1.prodappphxaev1.oraclevcn.com (PPS) with ESMTPS id 44gfhtk6tc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 30 Jan 2025 20:40:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=piHxRbML8qMkjDXY/3cFu/kMLrVXnSRk9bPO94SoqBJjCVEY9aFaVqSNPbSj9X5BBI0atUWP/RyPJUhoYfVzp6LUikHxoYp1gny7xFC9OIa27yULyKJEKWh4jhQDoAZasqM+Ryp3M7Lo8DBpPW/hzzkEd6H2LCFPz8PbkBzxOxfesmO1AIh2HaDeNCWoJngYEswq8gEXGMImaIxQYUi/8N5HkBqzBblNiBNpu3HEj/2Nithz7quVOEX1MkDw9ZVru4dTey7mYOTWYK3Trh6iVNQ0H9tJqhM1dSncAbL0JzC+eyYKhXEuxbSVQDTMRSdAxYm/5TjC+cmZBneFLdLeCw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Bk4iEJmNOs0gKjCIyK6jOaRhyYYz7iRVbjW4yL2p6M4=; b=zJeX/fgL59OnUTOPwFNZPA+REpZavGL/XP/rbVsc9DH0PKvp0XyAv0MA52FCAf4k7UXAFgma8m/+ThcTsRclqnVExkwyy2jWZ4gCN/MoI+b6DbbDr+hwfoLxUKB0VCSySUK3cjDUcShvz8MXszQEuWnBP33fChyLkoOmvXqOWY6drJKEuM4+CY5l2oCpG012NIviB55KNhTx2uaIMxQxQgDSbXWICdviatwlYTVR5IhFEo2JEMCeIsCZ9WVtgXa5uTlYDADxx3/OyPdlIiJ0BH8D9+0GhIZyjUcg1RPuezmZMm9lzA4gMQFbEF81UT9pOuP4Tkw8dzfdSxxMNZOsOg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=oracle.com; dmarc=pass action=none header.from=oracle.com; dkim=pass header.d=oracle.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.onmicrosoft.com; s=selector2-oracle-onmicrosoft-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Bk4iEJmNOs0gKjCIyK6jOaRhyYYz7iRVbjW4yL2p6M4=; b=hS3yGOQJ5k56H2UXrCj/p74sktNsUgJvZBbnlr80xyhdlXi47gz4Aar+a+gqURqZPfobnYJmKsoK6h/ewb1n6GzRjvkCWlRnDZKpsoBXTIGL0oVqTzGKLtVwhOs8+VbSqFT+AMyqf3M3GGf5XpDzmBXKKylfiYPVh5cNs4EjOWY= Received: from BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) by SN7PR10MB6547.namprd10.prod.outlook.com (2603:10b6:806:2aa::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8377.23; Thu, 30 Jan 2025 20:40:49 +0000 Received: from BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9]) by BYAPR10MB3366.namprd10.prod.outlook.com ([fe80::baf2:dff1:d471:1c9%6]) with mapi id 15.20.8398.018; Thu, 30 Jan 2025 20:40:49 +0000 From: Lorenzo Stoakes To: Christian Brauner Cc: Shuah Khan , "Liam R . Howlett" , Suren Baghdasaryan , Vlastimil Babka , pedro.falcato@gmail.com, linux-kselftest@vger.kernel.org, linux-mm@kvack.org, linux-fsdevel@vger.kernel.org, linux-api@vger.kernel.org, linux-kernel@vger.kernel.org, Oliver Sang , John Hubbard , Tejun Heo , Johannes Weiner , Michal Koutny , Andrew Morton , Shakeel Butt Subject: [PATCH v7 5/6] selftests: pidfd: add tests for PIDFD_SELF_* Date: Thu, 30 Jan 2025 20:40:30 +0000 Message-ID: <7ab0e48b26ba53abf7b703df2dd11a2e99b8efb2.1738268370.git.lorenzo.stoakes@oracle.com> X-Mailer: git-send-email 2.48.1 In-Reply-To: References: X-ClientProxiedBy: LO4P265CA0072.GBRP265.PROD.OUTLOOK.COM (2603:10a6:600:2af::21) To BYAPR10MB3366.namprd10.prod.outlook.com (2603:10b6:a03:14f::25) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BYAPR10MB3366:EE_|SN7PR10MB6547:EE_ X-MS-Office365-Filtering-Correlation-Id: 3634b2da-05bf-40d8-d37b-08dd416e6129 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|376014|7416014|366016|1800799024; X-Microsoft-Antispam-Message-Info: eJgoeI35AdpeIo9siq0kV42bzU9vaEM0IRlu6XcaVrI0p+SjU5zmRG/B4UJl0GNxfE2KOFiMlmJmqc+obdhFkI16vl1q7btYKrJVZP52r0c4muGN3YQAghQ6rK/YHQBNK0Xg7z6a7YKHtxSPpUiXnT4PO1qckWs5f5xA6PppkKE9O4yiYiESAkE6PQCZ5isYoxKz8WIC/HE5om9QEEoilD+wS62GdWLFWazRcEHMBK8/AnIhyehgN+R5zDVQv2gDt3eH5bfbLUUcuRBpSRmHo2CYcN/P+w0+VcNoyKyDji6X+Fu1hPlQoFSFRPJszPS+GLR9TKGNhJal2TYon7uFfyRbwsq9CxkDITsswQxBVxZkX7E9Tidxb/kRTRBNaCHFfKdSxq+NBe0YwQV3NnagKtTSz1Jjbuse7fqWonYYSveVqvgMLcL54uX/Az+jP0/4IBN7rmtn+p6Piuq/qntqxvM+pSsjA9FvCtNotmYulG2oykmyJv77q/4VmTkgbLZzWCeOkhg38jfFoQNM33x8yJWOIOWKsWlwgCxXiT9nS2niG0e1vJ8W3/yTl8vsbrsUx4PQ1CmiWGolDv2gjPfejble4ijd668G+9o8M4p/xrk+D98us/9ZkgtOYJlnJO4w1i0CMA20/bHOn98BAGFpP3/KSgcHPYMOgSOLQYCH3E8xDLUeXhiJoauiAjqHdRrkQhGR/R4u4Rfy+L14JZJ3HXPbJs6Lekm2XQ0DeuKizR5WzCrupVd6JfkjKf+Phhd2pwyd4H/++CxSonvtau4g9GWCKDCHnfl1P2/ucOshS9aXPnlboCPO97w5QQYKyZPvGgMZQGPh+PDQ949KzmHwxy4FQYIQBGVgAoUSxEb5Z3g8gh/q3aQLpMJQ/VW/yo8BsL51LBPk5W0o5zxGDkr0KcKwfORbYyi4kSwkJsWSnquf5j/8Bnz7teixCXfzf06xpc+d+i0BgET4r1mv/dCjr0VZVC+WtgE+QbRStAr/by4jb4YzmZfMSOIjek+IA76w0c7vGP/8FeqzVhtTSpjxQcI5kJHaFzfaNSRRi481XdHYRwe4wdB53+o6HhQjop8hvdN+7ht7HGjDdjp5QgNVMPk6eERNsvz3Dd5o1d7Phwe88zInJwdCsu18v1rUYkDMD8LX5Vuj2R2hE09X7SYZK81r43AzZnb8l1NJDN6/+MHURV7H/HXur1//lAXDCcfROoCcUXjhrco62dqH0ZIOyTljIMGKj8vEBbVeeYwEhIlasyrSksIF1Q3vQ6R8QXas+Fpwpho+4+qDvtFEwRkewVL7pnITUchrIVz+sscKa50din4q9eBHKWdzrfkj/eU+D1xRfLXGSNxe8m8HJHlKXzi/j5U+FfjBf5dNOcMY84EEzFkjbyeGB13FXkB4knTr X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BYAPR10MB3366.namprd10.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(376014)(7416014)(366016)(1800799024);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: wfABsDEwsqh9BaLFFQ3I1ELdWJ8cbdCESevd1/yHV5QSKN8TpXLpB8SxDgyXbkdTVIfrymz+QzVZRBqPA82bq35Hp+aK2rpQLxk5kRQNODZbVg9pCmZRTJp0xilaxa8ksQwON9hZPn/T/yC1FooKFhTvtbXTBFl9VCN1fWcBmWQU1yBIRhKi1Wg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-MS-Exchange-CrossTenant-Network-Message-Id: 3634b2da-05bf-40d8-d37b-08dd416e6129 X-MS-Exchange-CrossTenant-AuthSource: BYAPR10MB3366.namprd10.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Jan 2025 20:40:48.9776 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 4e2c6054-71cb-48f1-bd6c-3a9705aca71b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 99vuMzWRjg0R4X33wE3RdCyXTK0VwXBp655ufj129knETZL7+unesUVW7QHYTebZHqQhMQ8vyKQCXF7mtcoNyikfMQ5Ag5ML0UOmocFS130= X-MS-Exchange-Transport-CrossTenantHeadersStamped: SN7PR10MB6547 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1057,Hydra:6.0.680,FMLib:17.12.68.34 definitions=2025-01-30_09,2025-01-30_01,2024-11-22_01 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxlogscore=999 spamscore=0 malwarescore=0 mlxscore=0 adultscore=0 bulkscore=0 phishscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2501170000 definitions=main-2501300158 X-Proofpoint-ORIG-GUID: 6jpQdmPgzVkG9Pnyrlra1A1ppx64t9wS X-Proofpoint-GUID: 6jpQdmPgzVkG9Pnyrlra1A1ppx64t9wS X-Rspamd-Queue-Id: 6F9F6140017 X-Stat-Signature: prjog5gwhdgcrn9khrs3wuwjhg85qh7k X-Rspam-User: X-Rspamd-Server: rspam12 X-HE-Tag: 1738269659-329319 X-HE-Meta: U2FsdGVkX1/1WwkB85/LClgOIxyhOXcBdDHDT2hDqrDAiq9aH8hOg9FUrN+5v+tdjnaPQFrNN+8RLZSEZBfM1JMZ1x2J3pkVeiBkQTzcixIQbB0wvkAOvoPxQ/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53dlM6LRTMFCdw0Mj2hHcAYseAC1+H4T2nHkcbziRDxy35PNBaDzP/+6gSPU0KhSZRwd4D0Nscy3AW4JWTDSJpzuSVyo80EDygldYhtR/pZ8b9dDD6j/zpS53gQspEewNyximiJl7Fs8ny9nCXl06KoGTwlcZI+b+BgKqfXFbtmefoF6+RkkXgLM1r1/2WTOvCXP9iPvlmCNGh4H2OOjQcdId/M7Hn3UJ8k4fY0CUtA2p5MhRcr1fk4oXfF4jiVrwY6Al+WEcv6OML6qi9DEjrBoVl/H46esJCrg3jwZdMS6Axah8TCP/Li9qvYmya7Y/hE4nbIOS7aLVK+L47ZQvZmUSV/moEOWc+1W9plxxNaSUXa7Nud12Oey1NYksBTa7Lr6iodz2Nqt5VDKo1RMi0n5tyCZdVYpa6HJ6aljCsOG2n2xR61b9Plm+sDa6GNTtTn5Z1viaNXzuymZvg= X-Bogosity: Ham, tests=bogofilter, spamicity=0.000025, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: List-Subscribe: List-Unsubscribe: Add tests to assert that PIDFD_SELF* correctly refers to the current thread and process. We explicitly test pidfd_send_signal(), however We defer testing of mm-specific functionality which uses pidfd, namely process_madvise() and process_mrelease() to mm testing (though note the latter can not be sensibly tested as it would require the testing process to be dying). We also correct the pidfd_open_test.c fields which refer to .request_mask whereas the UAPI header refers to .mask, which otherwise break the import of the UAPI header. Signed-off-by: Lorenzo Stoakes --- tools/testing/selftests/pidfd/pidfd.h | 2 + .../testing/selftests/pidfd/pidfd_open_test.c | 6 +- tools/testing/selftests/pidfd/pidfd_test.c | 76 ++++++++++++++++--- 3 files changed, 69 insertions(+), 15 deletions(-) diff --git a/tools/testing/selftests/pidfd/pidfd.h b/tools/testing/selftests/pidfd/pidfd.h index d02cfc5ef77b..cc684d872253 100644 --- a/tools/testing/selftests/pidfd/pidfd.h +++ b/tools/testing/selftests/pidfd/pidfd.h @@ -15,6 +15,8 @@ #include #include +#include + #include "../kselftest.h" #include "../clone3/clone3_selftests.h" #include "pidfd_helpers.h" diff --git a/tools/testing/selftests/pidfd/pidfd_open_test.c b/tools/testing/selftests/pidfd/pidfd_open_test.c index ce413a221bac..9a40ccb1ff6d 100644 --- a/tools/testing/selftests/pidfd/pidfd_open_test.c +++ b/tools/testing/selftests/pidfd/pidfd_open_test.c @@ -31,7 +31,7 @@ #define PIDFD_INFO_CGROUPID (1UL << 0) struct pidfd_info { - __u64 request_mask; + __u64 mask; __u64 cgroupid; __u32 pid; __u32 tgid; @@ -148,7 +148,7 @@ static pid_t get_pid_from_fdinfo_file(int pidfd, const char *key, size_t keylen) int main(int argc, char **argv) { struct pidfd_info info = { - .request_mask = PIDFD_INFO_CGROUPID, + .mask = PIDFD_INFO_CGROUPID, }; int pidfd = -1, ret = 1; pid_t pid; @@ -227,7 +227,7 @@ int main(int argc, char **argv) getegid(), info.sgid); goto on_error; } - if ((info.request_mask & PIDFD_INFO_CGROUPID) && info.cgroupid == 0) { + if ((info.mask & PIDFD_INFO_CGROUPID) && info.cgroupid == 0) { ksft_print_msg("cgroupid should not be 0 when PIDFD_INFO_CGROUPID is set\n"); goto on_error; } diff --git a/tools/testing/selftests/pidfd/pidfd_test.c b/tools/testing/selftests/pidfd/pidfd_test.c index e9728e86b4f2..fcd85cad9f18 100644 --- a/tools/testing/selftests/pidfd/pidfd_test.c +++ b/tools/testing/selftests/pidfd/pidfd_test.c @@ -42,12 +42,41 @@ static pid_t pidfd_clone(int flags, int *pidfd, int (*fn)(void *)) #endif } -static int signal_received; +static pthread_t signal_received; static void set_signal_received_on_sigusr1(int sig) { if (sig == SIGUSR1) - signal_received = 1; + signal_received = pthread_self(); +} + +static int send_signal(int pidfd) +{ + int ret = 0; + + if (sys_pidfd_send_signal(pidfd, SIGUSR1, NULL, 0) < 0) { + ret = -EINVAL; + goto exit; + } + + if (signal_received != pthread_self()) { + ret = -EINVAL; + goto exit; + } + +exit: + signal_received = 0; + return ret; +} + +static void *send_signal_worker(void *arg) +{ + int pidfd = (int)(intptr_t)arg; + int ret; + + /* We forward any errors for the caller to handle. */ + ret = send_signal(pidfd); + return (void *)(intptr_t)ret; } /* @@ -56,8 +85,11 @@ static void set_signal_received_on_sigusr1(int sig) */ static int test_pidfd_send_signal_simple_success(void) { - int pidfd, ret; + int pidfd; const char *test_name = "pidfd_send_signal send SIGUSR1"; + pthread_t thread; + void *thread_res; + int err; if (!have_pidfd_send_signal) { ksft_test_result_skip( @@ -66,25 +98,45 @@ static int test_pidfd_send_signal_simple_success(void) return 0; } + signal(SIGUSR1, set_signal_received_on_sigusr1); + + /* Try sending a signal to ourselves via /proc/self. */ pidfd = open("/proc/self", O_DIRECTORY | O_CLOEXEC); if (pidfd < 0) ksft_exit_fail_msg( "%s test: Failed to open process file descriptor\n", test_name); + err = send_signal(pidfd); + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on sending pidfd signal\n", + test_name, err); + close(pidfd); - signal(SIGUSR1, set_signal_received_on_sigusr1); + /* Now try the same thing only using PIDFD_SELF_THREAD_GROUP. */ + err = send_signal(PIDFD_SELF_THREAD_GROUP); + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on PIDFD_SELF_THREAD_GROUP signal\n", + test_name, err); - ret = sys_pidfd_send_signal(pidfd, SIGUSR1, NULL, 0); - close(pidfd); - if (ret < 0) - ksft_exit_fail_msg("%s test: Failed to send signal\n", + /* + * Now try the same thing in a thread and assert thread ID is equal to + * worker thread ID. + */ + if (pthread_create(&thread, NULL, send_signal_worker, + (void *)(intptr_t)PIDFD_SELF_THREAD)) + ksft_exit_fail_msg("%s test: Failed to create thread\n", test_name); - - if (signal_received != 1) - ksft_exit_fail_msg("%s test: Failed to receive signal\n", + if (pthread_join(thread, &thread_res)) + ksft_exit_fail_msg("%s test: Failed to join thread\n", test_name); + err = (int)(intptr_t)thread_res; + if (err) + ksft_exit_fail_msg( + "%s test: Error %d on PIDFD_SELF_THREAD signal\n", + test_name, err); - signal_received = 0; ksft_test_result_pass("%s test: Sent signal\n", test_name); return 0; }