From nobody Fri Nov 29 17:40:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632305817; cv=pass; d=zohomail.com; s=zohoarc; b=Jc1SChbcjjV6N0XWyjvRyGmIr2R4wLJMJcKdFnAxq0oC+H0fmpIc6ucZZy2UrC0RO1D5MRYO8oO6tqLKc+7sJ1uVvwG+K6+t06YQF7EcY+NNuXkngAGt6PrywlgJ7i5xDlmyXpgncX/JrBX+Kmg3ccEQNpnUMvDaHwnNOwzt3Tg= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632305817; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=Ihy5AqkbKQlh/sKYZgTSszLHYrjLcDDqhUqK4o2XEtI=; b=l5jidY+2M9l+YMZyRHM1f71XUIn48+0BY84ZhjVn4Osh7mwyThAQSEDgqdST5Kk/VQvRH9DKC9bfePGwhjNIazF/eajXN7R6WOnFfmqIwnkdpjqUYQRT8eOGwI9ZZH9P9TUmXPqgzfPTZQmmQbnGI9MU+PynUHbIiIGRpEnVSNE= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632305817160856.5160255411336; Wed, 22 Sep 2021 03:16:57 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.192428.342856 (Exim 4.92) (envelope-from ) id 1mSzIw-0005HY-CQ; Wed, 22 Sep 2021 10:16:42 +0000 Received: by outflank-mailman (output) from mailman id 192428.342856; Wed, 22 Sep 2021 10:16:42 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSzIw-0005HR-9a; Wed, 22 Sep 2021 10:16:42 +0000 Received: by outflank-mailman (input) for mailman id 192428; Wed, 22 Sep 2021 10:16:40 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSzIu-0005HJ-SG for xen-devel@lists.xenproject.org; Wed, 22 Sep 2021 10:16:40 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 2c7bc96a-1b8e-11ec-b96a-12813bfff9fa; Wed, 22 Sep 2021 10:16:39 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2107.outbound.protection.outlook.com [104.47.17.107]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-34-1rM-3_mIPnu2w1oLQjm4IQ-1; Wed, 22 Sep 2021 12:16:37 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB4190.eurprd04.prod.outlook.com (2603:10a6:803:4b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.15; Wed, 22 Sep 2021 10:16:36 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4544.013; Wed, 22 Sep 2021 10:16:36 +0000 Received: from [10.156.60.236] (37.24.206.209) by FR3P281CA0023.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.6 via Frontend Transport; Wed, 22 Sep 2021 10:16:35 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2c7bc96a-1b8e-11ec-b96a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632305798; h=from:from: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; bh=Ihy5AqkbKQlh/sKYZgTSszLHYrjLcDDqhUqK4o2XEtI=; b=K/b87FAGIGJ2izaj7QLjGENwt+VWzCnazT4oFrNZC0c0JOh9V64eMOEOrmUiOV7NyFj9p4 7gWw5+/fAi/u4YFKmjePGzUkmd9+jcERcpTIU5ywEbS2/cMoEYkr79Fb5AirAcAUhHgzS4 nTqVqASwh4xOoU01mw/KvQiSMbSdceY= X-MC-Unique: 1rM-3_mIPnu2w1oLQjm4IQ-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=L5VQZxg717y8Nyolf0kqnaz7jbvhKbq+SsbF4PQMpjjxSb+wtykIjxpYc8yYcvO5oUR/uh/PNzQDGMiGI3COZaqYcpSgngYK7xe2FK7ujqq41hbfaHfzM0SFdT71ZLlssFWL70rdeUhA+hx9In3JVPbicusdksQV5jC/rOAdNHIO8futks2m6RQPz/JQ90HLr1PDBqZB6QMr3dDoXqF3opWPZUFVXsls/Oy9HxxSDer6ecT5hqwCENsGYpTRNoDadTeu0LGwDmMcKKZ4Qw55qaQRg1AvtpqxMQ4Idyxj1Qy+1zZ/vYCZXC69BpOweTvoDLorHrkQIAhxbZ/3J0Uk4w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=Ihy5AqkbKQlh/sKYZgTSszLHYrjLcDDqhUqK4o2XEtI=; b=fKw+T/6jhwEJrkEv7XmjK5n/vgkkuOFVrw9yDrJ/4vDywMqCizGc8v8w6WPbkZu1AzvQ3ekVFCCqqZsqBwR+8hx8ZvgjDER72MLaPXJW0eR/ludwFpBpsndtZgWoGhI4iNIHUZvn5HZLTjqd3ymBKUm9yMGXjHwilmscaVIfbxNKyPqvaqhzM3ruT2Edt/r3Hvl1fM0BPLRAODS3yrDea6Vi1TUPOGfO+BvJGMAG1lL/pNGfTyZ4LKFAZNTk00UAm3Sz5vkcYSZB4SqGsJDRzyvfQKRM4N7+CrrF+Ogk17W0mZI5rPajDehNlwUdHhRAEnlSv+qGQskfoz6X8Ivasg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=suse.com; Subject: [PATCH RFC 1/3] xen/privcmd: replace kcalloc() by kvcalloc() when allocating empty pages From: Jan Beulich To: Juergen Gross , Boris Ostrovsky Cc: Stefano Stabellini , "xen-devel@lists.xenproject.org" , lkml References: <0f0db6fa-2604-9a0d-1138-0063b5a39a87@suse.com> Message-ID: <6d698901-98a4-05be-c421-bcd0713f5335@suse.com> Date: Wed, 22 Sep 2021 12:16:35 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <0f0db6fa-2604-9a0d-1138-0063b5a39a87@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: FR3P281CA0023.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:1c::7) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 4514c639-5875-4107-bfd0-08d97db20ef4 X-MS-TrafficTypeDiagnostic: VI1PR04MB4190: X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:8882; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jLzYEODIBUA1//UERQZqtoL1gxZrcJRrDmhsdABv6FVgoEB54z1CCXGqfls2JAMPKnFbwp1FY8QyBtFkmLAn2qvjtp07W0MjbATD0g2y2/UTC/YWWVGgPe79eFHJ8E1Ofl+tnY5LrQ1h5EJbbLhbUnMkVspsQay76Gb8BW/9YRCcozAzvzhaZzGW5sjs6oV8VnlqNcpFidrr7WhyGxA0+qDhHWFaJGhTd7psp9Z/SCMqKH/hMEO9k5QWiWdUPzEYneFsS4E8Xa6lvAdgSxrn2M7rEGSf29Ewd344mNQkBCnpSHG0IaGVNc+lM/tNBH2kEa56VwlNZhnpKXfYZMpKt5MW9CZWCA9evD9xLONioBb3bx5ILK4lAGTLdsuAKIMRKqg8plME/2PcqpIlNpjbvkzg/Q8YtBa+bLEL8u2ONHxXkeivFpg/8o451Q8cEXsL1ZCFPA3blTULInsJHtEcPX9qdH5C5oJHSFf6aTOPmDl05J6ldcSMZHd5gzCI4zRbv1jh4paDVB806DKqEo3BdSY0tfTCC5xIbe+q2IPTIfOXiaAUQw6q5MmBh+yZJxPSWWgoZL8omD1x+FSfxBgzyX82K6XPHDyy+1yQMn5/IJl7ymF6f7FSU0BkDWDs+xO0AoDv9e6RrKOCHI9DFMU6XElBst6Ji59cQEzjXTzlsYG6SyO2VS7nNElpfPbPD52cSzfdtuuuQywdKzt3/RHdb76Vok0f1jPrq1xBbqY/k28= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(4326008)(316002)(26005)(8936002)(110136005)(31696002)(8676002)(6486002)(16576012)(186003)(83380400001)(508600001)(5660300002)(54906003)(31686004)(66476007)(36756003)(38100700002)(66946007)(86362001)(66556008)(2906002)(956004)(2616005)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?blZTaFFseTV2endMd2s0VisrV2dYckpXb1hDWUk5VmVJNjVFQjZLeFl1L1VG?= =?utf-8?B?c2FUbHk4c3U3cThTNmZObVhEcXZzSkFDRjNQVFBZNnlYUTV1R21HbFMzekds?= =?utf-8?B?MlROWkJsVitBZ0RrQ2cwZm5pSFN0bmNyRnJMWkt3bjV5blZ1dURmV1VZWTlj?= =?utf-8?B?QnAzakNqOWNaTmRHSFFuV0YzU285Smg3aDd6OXkvSVV6S1BxWnpmK21iOUtJ?= =?utf-8?B?clA2L0N0bUNoU3NFM1N4OXlRR01RTXQ0TzFKYmhNSjFKYklCc2Fjd1RtRnhG?= =?utf-8?B?bmtCR0NleXVLanRRQmxWQUl4VzhmazNSR3k4czcrTGlKMmZDVmF3ZS9oMGlX?= =?utf-8?B?bjlIczNwaGhFTndkMzB0WERFaGFIeWJXSGJpaGIvcFVmRX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dG9JMWcvbHNVNEMrQTdyVEJQalZxTHBL?= =?utf-8?B?ZTZNVnVzV1pXMVpMVEhuZ2pXazQydUZNcGFOZ3FNMGtDSkFjTnZSVjE5ak1N?= =?utf-8?B?U09GRW5jaTNOL1BwejN6dzF2Uy8yeGlvMEtHUDFzM3dhWFNMeEpkRnZWakVX?= =?utf-8?B?UjcwUVVXa3lQb1ZjSEl5RnViSE5oL25TN3I4ejBvQXB3bHdlbXRQdGVYb000?= =?utf-8?B?ODlCN0F2MjZ2akw3ZGdzZElXdGxoSFY3cVI0aVFhTUR5WXUvelJrRkh6ZFJp?= =?utf-8?B?a0U1K1ZTdVZZNERWSlVpd1c4aHlqS3lhNENLdUNFZWdPUXhOWU9meUc1R3dv?= =?utf-8?B?SEFPQkVPdnI1NTYwbWpQcEUyc0F2NHZ2QzZrcUlXY1FlMHVIL0pJbm41RTFo?= =?utf-8?B?aW5XakQySndDK1VmdUFVd3AwanZjUUFGaWxyNTRsei9QNThOTEZhK2RhTWpv?= =?utf-8?Q?uBZpnXUcTzZn+rSRIXZsXRHZ6s6fIFeFamEBOYf?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4514c639-5875-4107-bfd0-08d97db20ef4 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 10:16:35.9386 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: HW0YbVmdTsaANJAoAZwgIhIgF0LseVaLSA0hlmmR7vUU8Uwemvj3opwOmutQou0QlaA815pk9achUBVIzcuGJA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4190 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632305817721100001 Content-Type: text/plain; charset="utf-8" Osstest has been suffering test failures for a little while from order-4 allocation failures, resulting from alloc_empty_pages() calling kcalloc(). As there's no need for physically contiguous space here, switch to kvcalloc(). Signed-off-by: Jan Beulich Reviewed-by: Juergen Gross --- RFC: I cannot really test this, as alloc_empty_pages() only gets used in the auto-translated case (i.e. on Arm or PVH Dom0, the latter of which I'm not trusting enough yet to actually start playing with guests). There are quite a few more kcalloc() where it's not immediately clear how large the element counts could possibly grow nor whether it would be fine to replace them (i.e. physically contiguous space not required). I wasn't sure whether to Cc stable@ here; the issue certainly has been present for quite some time. But it didn't look to cause issues until recently. --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -420,7 +420,7 @@ static int alloc_empty_pages(struct vm_a int rc; struct page **pages; =20 - pages =3D kcalloc(numpgs, sizeof(pages[0]), GFP_KERNEL); + pages =3D kvcalloc(numpgs, sizeof(pages[0]), GFP_KERNEL); if (pages =3D=3D NULL) return -ENOMEM; =20 @@ -428,7 +428,7 @@ static int alloc_empty_pages(struct vm_a if (rc !=3D 0) { pr_warn("%s Could not alloc %d pfns rc:%d\n", __func__, numpgs, rc); - kfree(pages); + kvfree(pages); return -ENOMEM; } BUG_ON(vma->vm_private_data !=3D NULL); @@ -912,7 +912,7 @@ static void privcmd_close(struct vm_area else pr_crit("unable to unmap MFN range: leaking %d pages. rc=3D%d\n", numpgs, rc); - kfree(pages); + kvfree(pages); } =20 static vm_fault_t privcmd_fault(struct vm_fault *vmf) From nobody Fri Nov 29 17:40:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632305892; cv=pass; d=zohomail.com; s=zohoarc; b=BDOD+aoHlr5rANoyuCPwq69UGvL3rBn0uJqqbt2OLZg05kj1Gjxq9VRkVavZ8UdBtWZIG2Yvu/Z3VL78dgCgZCDwh9HSIjwiuywC8vMAnTSGIGegXt+v8I7qrb8W8ZgeD9Usr9hetWdBGaXvuxSovV+ApgZPoJUQLqmgVafpJqI= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632305892; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=or78mkWgiZ0tw8GzqU9/omJtttnIwfRDs2Aq8lzGU1U=; b=Wuah+wPD/BtEN4gcZN4/FBtgdQMRJbhf5kn7GqI+g2FGhNJn601gg9rslD3fUM8/BP4kJ26xQU6RnOLoPuHGhOUg7eyKEr0LsconWHqMYQ5HiCZt3irC9U3utHHHHBYaRdP7eEljAA8lzltqf6XPgTwasVS3b7LYVfiQ1g/KBT0= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632305892034578.5113288619038; Wed, 22 Sep 2021 03:18:12 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.192435.342868 (Exim 4.92) (envelope-from ) id 1mSzK7-00063C-Om; Wed, 22 Sep 2021 10:17:55 +0000 Received: by outflank-mailman (output) from mailman id 192435.342868; Wed, 22 Sep 2021 10:17:55 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSzK7-000635-L5; Wed, 22 Sep 2021 10:17:55 +0000 Received: by outflank-mailman (input) for mailman id 192435; Wed, 22 Sep 2021 10:17:54 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSzK6-00062x-5B for xen-devel@lists.xenproject.org; Wed, 22 Sep 2021 10:17:54 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 5890668c-1b8e-11ec-b96a-12813bfff9fa; Wed, 22 Sep 2021 10:17:53 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2112.outbound.protection.outlook.com [104.47.17.112]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-34-or5aBoWwPqO6SHe-yooqcw-1; Wed, 22 Sep 2021 12:17:50 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB4190.eurprd04.prod.outlook.com (2603:10a6:803:4b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.15; Wed, 22 Sep 2021 10:17:49 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4544.013; Wed, 22 Sep 2021 10:17:49 +0000 Received: from [10.156.60.236] (37.24.206.209) by AM0PR06CA0131.eurprd06.prod.outlook.com (2603:10a6:208:ab::36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 10:17:49 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 5890668c-1b8e-11ec-b96a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632305872; h=from:from: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; bh=or78mkWgiZ0tw8GzqU9/omJtttnIwfRDs2Aq8lzGU1U=; b=MbKhPPGrz6A1M2QEqZIo91Seij94xONIDj+pFzlHq4axePAz0a4g6OawxZJ25IpClJqRMg WAlnVRUTgvP+JrG/r9JPAw3RsM4ZaKd1b5Lx/qrOZ8qPguSDdurWj5NoK27FRO6zqN66xf R+sOWsRIfaAkhlUiFlb+oN0CqNaYha0= X-MC-Unique: or5aBoWwPqO6SHe-yooqcw-1 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pq42DDIJGOaxdlRTTXAtesDsX61o5He5iwNuSu1IvKWr0//tUA49NeO6CQT6mok2F9w2uUgT95mIo2bWc+QthDBNOZ9RrPgsE2ZZTcNaPxDLqhW6jvvpA+Xt9cB2/0kgIAIAV7BfZl7jwbxb0pDFBMTXmdXwYs2ZHCCWWg7ELb4EU+Ii+Vv7BGSh4ZXWQkt9qGbTEQU1A/MKN4z3PeAa2FDjlpu0G/fobBkaWR7fz2lLILbIHbkqBU1OzzdX54azdsqw77FJWvl28VtC7mcBxKxVcd71KoavNsSXo++W5HqPgMJl3EUngfT4PoRc1LTbyoJZuOPUXmJOPtih5bH4Yg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=or78mkWgiZ0tw8GzqU9/omJtttnIwfRDs2Aq8lzGU1U=; b=Bh9cC/Eybp/sXaq0Me5/3lkwwy1yg+YY1GdaRptkJWHjBn8N/n4qEQMdHtz/iWFRPawgyolq3PcNJK2S9oJr00CgEEl1sR6sMbI6GADZqqWp3komYglF2DJcWsRnDGoHw8AMdm1dXrCNEEWpAnPvs10V5fXYCpvKHeNxaavQAJd6pgVgES/75bJzZwGDTokP4XwPMlHOVqXI6ceUB+ilIf563CLbVp2H0dm/iESvC9DCQSvYCcyUUpaheUwfrv6ctfspK1BNtQ5iYs7H5nvYw/QZmtqJMfNmxjz7AZLg1RPQ7ifVJdaa+1yXa95xlvg64f6uW+0GKkny2tHPW7/tJw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=suse.com; Subject: [PATCH 2/3] xen/privcmd: fix error handling in mmap-resource processing From: Jan Beulich To: Juergen Gross , Boris Ostrovsky Cc: Stefano Stabellini , "xen-devel@lists.xenproject.org" , lkml References: <0f0db6fa-2604-9a0d-1138-0063b5a39a87@suse.com> Message-ID: Date: Wed, 22 Sep 2021 12:17:48 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <0f0db6fa-2604-9a0d-1138-0063b5a39a87@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR06CA0131.eurprd06.prod.outlook.com (2603:10a6:208:ab::36) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: d1b81141-4f67-4f24-d285-08d97db23af0 X-MS-TrafficTypeDiagnostic: VI1PR04MB4190: X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:5516; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: vzmey8F4XxSEclZIYX0Y/bNPxOlwfO6kBi7n9FD6Z2d5z3q40SidvZQrCrNEe3cC3cyulWDOOcrQ+YQWCJ9QMzNQKsKsSJzBLfNZoWV6bv///Cppt/hGv0pBGSLA6Gk0k76ordvSQnP0ZrC1xlTREKbcrp3AXocLJQo7Yqupl43qoHfBc8XP4nwojsLXrPcjQTwy6RWzRqULJjsenaBqvm87S4s+c0K3smgBT4EEF00qAwUDxo698Wz2D53jVzBZBz+Q4swHDWHO1K+O+Sv9WCbjKYc+5iHwiH0W53QsJJm3WGXie9PS2zZs/3ZHU5HleOSYEBrlF0JteYDahY2YjWlpnhlT8Q8PNpIbifWXS0GZ/sFyvG3tDUU/rQXvbK/63vyrhTX1yVWGOxvVEos0rqAwxMM54U1I9V+XPm/MmF4vOoMZbwT0j7xG63ew1KUoyyi8kTLM0mM2inbfMqBjn2YlHUqJN/TindTWXrOpNv5aLeM9vTvWfvj+JB9IpqXv3mVLu118U8ndLYR7KHVW1mF+caDM7gLCf41a/OvExgPyB95cXXBqxZVwYrSppNy3qVnqYtd2u025kSrH7kbEZoQb802zipUuYSIYH0iU5B9WJ7HUctsdhH/oIW7EBkQ8gCbclDMv4RM2gctJnguKsmVS9RLhhqsjETnScHpiaa5g4j+P5m/czEu6QX3a6yhhsOtUfho5zcQvfVRu7sIhxCKvjhxb88WwvwEs7M+zhT4= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(4326008)(316002)(26005)(8936002)(110136005)(31696002)(8676002)(6486002)(16576012)(186003)(508600001)(5660300002)(54906003)(31686004)(66476007)(36756003)(38100700002)(66946007)(86362001)(66556008)(2906002)(956004)(2616005)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?bXVraHVkZ3VMVEt5bFFlWllWSEpVUjMwQ1RpWXZqUCs5SWtYblNuMGd0ZkJJ?= =?utf-8?B?dndQQW9nN2NpRyt3NllkSGRqTWZFUXZoYkIwVzNEZWlOWnZpSUtWM1pCRTBZ?= =?utf-8?B?OVpHbk1xeGtGMzRvNnpObHUyNWZUVnNydFdvRlYxaXl3YkFselRHNWQ4Y3hl?= =?utf-8?B?Qy92VEVWc1BRT2VwU204T0xSSTNjZERXUUViN3d4WTNxNnFDRjVoVE1rcmNF?= =?utf-8?B?WU9WaklqZDdRWVFRRGtNVnA1Ykk4TEd3L3ZMaHVzUW10aElTU0dmd2RYVExl?= =?utf-8?B?aDFkSThNUzZrQkVZbHRkQ1I5b3A0THVnMVlIRkIrc3dBMjFYdTBEK3JlNG1N?= =?utf-8?B?QjJSbENTTWYxOXNaUTJxaEdEUjloQzVQc3o2QTIranVwaVlhc1FHNEtXd0RX?= =?utf-8?B?SGhKY2V1MXRwN1c1U2t5QStwOGhNaDlWamRvTlFEQjhVQ2pCU2xjWFpldnBU?= =?utf-8?B?dnpPSWR6UjUyU25zaFdVa2NteXowd2dLMHprdE8yVHlzblVlRzNsTndhMU53?= =?utf-8?B?clpEZGlvaHdvTUdZcVgzbDdYVy9NbFEyZ1dZSmZxOVVvN3ZXY1ZSQ3hkZS9m?= =?utf-8?B?WWlML2swd0E5M1VJTHVzcEZ5NUVVSU8wNllKZW9abEZwdGpBU25KQ0xPZVdy?= =?utf-8?B?R3dQMFMzN01EL3Nrd01HakI5aU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M0d1lnMDZMTUFDeCsrUWg0RjFCaTdoRXZhNlZ2c0tW?= =?utf-8?B?UzZDeFZVTjIwUWc4R2s5UHAyWlE3MlBEZUl4bVVUbnlseEhOYTRBVTlwUngz?= =?utf-8?B?UzcrUm82MkNWSk5hUlA0MThKYzEwTW9YQ285b2V2VW9xNGk0bWJPWVB3SjNt?= =?utf-8?Q?1pwRx5AGXYRigAASodJvomU/3WYKujQZgMSnw4I?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: d1b81141-4f67-4f24-d285-08d97db23af0 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 10:17:49.7196 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NDo1bw6H6EUu5BGCJ1Go3BIGApuV6ybSkpmaX66Us4ciSMCt68Qt/1TjQbAqHv81H+OmiaLXjUSECrn3AZGO6g== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4190 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632305892960100001 Content-Type: text/plain; charset="utf-8" xen_pfn_t is the same size as int only on 32-bit builds (and not even on Arm32). Hence pfns[] can't be used directly to read individual error values returned from xen_remap_domain_mfn_array(); every other error indicator would be skipped/ignored on 64-bit. Fixes: 3ad0876554ca ("xen/privcmd: add IOCTL_PRIVCMD_MMAP_RESOURCE") Cc: stable@vger.kernel.org Signed-off-by: Jan Beulich Reviewed-by: Boris Ostrovsky --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -803,11 +803,12 @@ static long privcmd_ioctl_mmap_resource( unsigned int domid =3D (xdata.flags & XENMEM_rsrc_acq_caller_owned) ? DOMID_SELF : kdata.dom; - int num; + int num, *errs =3D (int *)pfns; =20 + BUILD_BUG_ON(sizeof(*errs) > sizeof(*pfns)); num =3D xen_remap_domain_mfn_array(vma, kdata.addr & PAGE_MASK, - pfns, kdata.num, (int *)pfns, + pfns, kdata.num, errs, vma->vm_page_prot, domid, vma->vm_private_data); @@ -817,7 +818,7 @@ static long privcmd_ioctl_mmap_resource( unsigned int i; =20 for (i =3D 0; i < num; i++) { - rc =3D pfns[i]; + rc =3D errs[i]; if (rc < 0) break; } From nobody Fri Nov 29 17:40:16 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass(p=quarantine dis=none) header.from=suse.com ARC-Seal: i=2; a=rsa-sha256; t=1632305926; cv=pass; d=zohomail.com; s=zohoarc; b=hQVDDh9LRbYPnV9Qbs6TS4IuH7+m/UensZCpRTHh8lL1ZtsuLFPcLXu63BgtQT8MOyiwwVxa84rHI2EHNI4dTG53BIzdsFKny/BZjes/hK0saknIai/MDqX0KMmtxj17NGPAjjpALWV0Snc8RkM9tLMENsxCCExLjKLcrI46mhQ= ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1632305926; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=mKNtSH+m7Ctv8L/JFGkCYRCWB0Q8bcvCLMU0buPXpMY=; b=WZkGjjg+AC7pvci/mieMX1Qxu5Iha4Ugxx0yf7jmwkSHTM6vyaoF3yTCUaKvEGltfCeZkFZTutbP/ZqRJbL+Z+8EQUJCSnm5q2CrP9IBYKp1LIUwQl+UXH95PuY2ALPWM6IAPrkjk2F2LrO7ITG3Etg8ZxN9zEsgUdmKI8SkRhI= ARC-Authentication-Results: i=2; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; arc=pass (i=1 dmarc=pass fromdomain=suse.com); dmarc=pass header.from= (p=quarantine dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1632305926478980.7320554957704; Wed, 22 Sep 2021 03:18:46 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.192441.342878 (Exim 4.92) (envelope-from ) id 1mSzKi-0006cc-1S; Wed, 22 Sep 2021 10:18:32 +0000 Received: by outflank-mailman (output) from mailman id 192441.342878; Wed, 22 Sep 2021 10:18:32 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSzKh-0006cV-Ua; Wed, 22 Sep 2021 10:18:31 +0000 Received: by outflank-mailman (input) for mailman id 192441; Wed, 22 Sep 2021 10:18:31 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1mSzKh-0006cJ-FB for xen-devel@lists.xenproject.org; Wed, 22 Sep 2021 10:18:31 +0000 Received: from de-smtp-delivery-102.mimecast.com (unknown [194.104.111.102]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 6e99877e-1b8e-11ec-b96a-12813bfff9fa; Wed, 22 Sep 2021 10:18:30 +0000 (UTC) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2107.outbound.protection.outlook.com [104.47.17.107]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-32-4xuDO56rM0qlH9jh8_4EFA-2; Wed, 22 Sep 2021 12:18:28 +0200 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB4190.eurprd04.prod.outlook.com (2603:10a6:803:4b::23) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4523.15; Wed, 22 Sep 2021 10:18:26 +0000 Received: from VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b]) by VI1PR04MB5600.eurprd04.prod.outlook.com ([fe80::4d37:ec64:4e90:b16b%7]) with mapi id 15.20.4544.013; Wed, 22 Sep 2021 10:18:26 +0000 Received: from [10.156.60.236] (37.24.206.209) by AM0PR06CA0132.eurprd06.prod.outlook.com (2603:10a6:208:ab::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4544.13 via Frontend Transport; Wed, 22 Sep 2021 10:18:25 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 6e99877e-1b8e-11ec-b96a-12813bfff9fa DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1632305909; h=from:from: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; bh=mKNtSH+m7Ctv8L/JFGkCYRCWB0Q8bcvCLMU0buPXpMY=; b=FdPbRCnNparaOijdU1QBj3W4YpoJnoaBNmo5zA3Mshu5LlowSD5oa4D97EH8RqrxRIoGb9 I9JhfxpiY75EiCSgy4jV1G9zqNtTWx87WzaIVou1I1wOmNm9f6ayK0c8FWXkO/XfvW02jR oNa5fw8Mx61y8BFNodtVFNxwU6uek2c= X-MC-Unique: 4xuDO56rM0qlH9jh8_4EFA-2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=CjNCycKGV86L/ODvBIkFk1QMP8CJdyHhMCiR3RMebb3eb5WGurjawSgLjjwg7bbj1zIyrAbKkFU2bZN6Z/lnPjxSnmucDdoJ6BZifdPx7GqLTKiycQnWydGxBDQXcwHnXT4hpR3zecS8ArXiJwVoM6MnLSsEEuMQQwwEH/R6VWyUAW/+y0xlfcxsP2GUnaZ2cWZzfp9D0f7jRMyam2HZzxZrs1qIvwpDLLBukD///tGOWCp/buR/qNCsRuHZijVJ9miBcDTTZZtDvsiXiqtm2srIXAPS/qIeKw+3JNurc5eKWV/DtYtEshmjxw+reewsAe5MnjZkVr0IGOFiI2H85A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=mKNtSH+m7Ctv8L/JFGkCYRCWB0Q8bcvCLMU0buPXpMY=; b=SbeNcyePJ6wZtaGaJMb2cXRq1Useh6PufGpSoDvHCUX7x8iA6OrGGrLdfse6AJz93pdGXAH1ddyKQKAHWgPbrA4AH99ur+l76Y1Fa/VXF1vY7Q1cd8Liy62kq9tyzs8yEDhTbVsH+po2swU7WA782HKlx3uk1EiC9PwII05Vp+bc7nSbHzXmhfQrvIeOtBM9wraaQdTyBgEL5pATVEPe5EhH0BNZMg8wNGmml6vvzpBt2TX4RbCufa0qcHh5Kje15/XvI9+7sUhymthiCbHHJ8qQq07ri9CHWraPcyNim5U719TXB2T3if/XmLotqtO0UNXkF0kbZ4MRGdg/6GN1Xw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=suse.com; dmarc=pass action=none header.from=suse.com; dkim=pass header.d=suse.com; arc=none Authentication-Results: vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=none action=none header.from=suse.com; Subject: [PATCH 3/3] xen/privcmd: drop "pages" parameter from xen_remap_pfn() From: Jan Beulich To: Juergen Gross , Boris Ostrovsky Cc: Stefano Stabellini , "xen-devel@lists.xenproject.org" , lkml References: <0f0db6fa-2604-9a0d-1138-0063b5a39a87@suse.com> Message-ID: <036ad8a2-46f9-ac3d-6219-bdc93ab9e10b@suse.com> Date: Wed, 22 Sep 2021 12:18:25 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <0f0db6fa-2604-9a0d-1138-0063b5a39a87@suse.com> Content-Language: en-US Content-Transfer-Encoding: quoted-printable X-ClientProxiedBy: AM0PR06CA0132.eurprd06.prod.outlook.com (2603:10a6:208:ab::37) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: fa92bbca-4f8f-4de0-4489-08d97db250a6 X-MS-TrafficTypeDiagnostic: VI1PR04MB4190: X-LD-Processed: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba,ExtFwd X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:6790; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: x/dREiUX63gOXj3JmwHyqFFVDYH6WmNYUbQe4/Xkte5PjMylVy4+bokdrN8qgG0ZaOKcko29gxjkEbXSPLvH1FOpaMwq5b157Maz6RXDB2OPPJniuthixKFR+Vr7mw3pl+R2jIUzZM8oyzEwfYXwE5qQFPkIuyd5j80XGtYSvCShPrnq/CIKLaLr1WQgzBYU5/5oVYpyrcegXtmAljeh20gUzk/qB4yFZzyqTkfuyyQ6sP44nDfBinK08fsT5+bcgvwLKtbpoR/CzgBKVPeFroC2euluY0i33G84q12o3K5Ma+RnTXrN/y4l/Gah5Sfo1lPcOr1BTGuI65wq+mokMYnq3ImvSyE+XvBP8F5lMBb+R0i3fnnWATjcY+3prx93MUA9GjHscx8vDZNNbHLPobzGWMmPlESb/SAk1S+JyztJEPZK20mfw2HBd6dYvDNvQsrTXIHExbFz0QkhduiWsDL1iWuJQgJx/ywRpvMg1DSanPW364+2G6KsMxtoFj4Qs2UjYfl/XXIQtQC/Q1vDJoitUf6fK2XGs4XN3MpFaEnFP5X+kTx12SesEz96LBfJigvqnF7gT7xVmboPdCQbtVWIXchY1N0I/YVErzDMv+g3fAcwYHtOORsIV1HHfvrdtmA4JamagiQVjN/8yBIxEs60K+X9W0dsJIiTX8eV13WzdxptJZ54DDjcWrtiHIzfsMWCYdU05eYBMqpOQs6e6YmAsSqWzzGXi6DAQ9GSchY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB5600.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(366004)(54906003)(83380400001)(508600001)(31686004)(5660300002)(66476007)(2906002)(66556008)(956004)(2616005)(36756003)(38100700002)(66946007)(86362001)(8936002)(316002)(26005)(4326008)(110136005)(8676002)(16576012)(186003)(6486002)(31696002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?aXZGbFlML3R1c0xPU2o0cFYwb1llWE51RGlmRkxPNEpiRHhteUppRE14TWND?= =?utf-8?B?VS9iQm5UMnBraThkZ0tyS1N2VTNKemRQWVBTVitRVENYMDFEZG1meTlpempF?= =?utf-8?B?VnNhWEthT0FVdDI1QnlUcG5SYWdYZGFTZ05NNE1XKzRCUFQ5d3JwWVpiTHNQ?= =?utf-8?B?dXlnNTF0MENCMm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RiVnBGcmlWZHRDbVRRSzB3NUpjaEtxMWh5M0tqMVZJZkZS?= =?utf-8?B?SE51ZUM5R2RidHpVRnBGYituQ05LZnI1QU8xMVY4ZDZwS3JweThEcGg0SnNC?= =?utf-8?B?R2Ftc1dTODVjbTZXV2NtREVXUUErOW5YN3ZBalpBemhBRTVhNVQxbjNqbmxu?= =?utf-8?B?K0xBZWI1VTI2bVdua2VGVDMzc3loSHlYOCtCZ2tYT291UjIzcnRvSzJNN3FV?= =?utf-8?B?aXF5c2tEK1RvY0QwNHk2MlVyRnY3Wmg0bnZoelViVnpPNVhyZGZzcldqM3Vy?= =?utf-8?B?L1BtZXlDcnR4eE1hSis0bFJFQXlhczN5eVc5UHBSVVp0djh5emhWT0tVTUZF?= =?utf-8?B?N3UzdmxIV0VFMlc4WVZ4YjJVUWM4S3V2MTB1RStkd3hzZHZPTE9LS3ZyUEQ4?= =?utf-8?B?QW43L2NrcVVYNzRyUDZZTTRJWTJqbDRZUzNTVEJ1djdYRStpSEs4czdmOG9l?= =?utf-8?B?LzNyM3h2dWNSM2pFb1hickttamRrMWdSMGsvSE5UYjRLa3ZyMGQ4UnRkczYy?= =?utf-8?B?SjFFc1lYZnNTeGFRN1ZVKytndktqQThaYlpnTm9kSVhsWU4xdXRvRG1TV1Jo?= =?utf-8?B?aHY0aExlQ0hjcVRqSXBlUVFlYTY2OWdUTGNudDNHeXVzQUE3eFlEZ1lFeVlq?= =?utf-8?Q?A/DKQNSH/EUA/TjxtX1kC01peWDaKxX0+vf6YHT?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: fa92bbca-4f8f-4de0-4489-08d97db250a6 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Sep 2021 10:18:26.1589 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZX2I0VRntI1n/gqXn52Bnj1vW6lxkkAvmC7BCjfiQ2q+2qsEnebZ+1Fi1MmgH0JcNYvJKVGrE9vnsWvBRnncXA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB4190 X-ZohoMail-DKIM: pass (identity @suse.com) X-ZM-MESSAGEID: 1632305928462100001 Content-Type: text/plain; charset="utf-8" The function doesn't use it and all of its callers say in a comment that their respective arguments are to be non-NULL only in auto-translated mode. Since xen_remap_domain_mfn_array() isn't supposed to be used by non-PV, drop the parameter there as well. It was bogusly passed as non- NULL (PRIV_VMA_LOCKED) by its only caller anyway. For xen_remap_domain_gfn_range(), otoh, it's not clear at all why this wouldn't want / might not need to gain auto-translated support down the road, so the parameter is retained there despite now remaining unused (and the only caller passing NULL); correct a respective comment as well. Signed-off-by: Jan Beulich Reviewed-by: Boris Ostrovsky --- a/arch/x86/xen/mmu_pv.c +++ b/arch/x86/xen/mmu_pv.c @@ -2398,7 +2398,7 @@ static int remap_area_pfn_pte_fn(pte_t * =20 int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot, - unsigned int domid, bool no_translate, struct page **pages) + unsigned int domid, bool no_translate) { int err =3D 0; struct remap_data rmd; --- a/drivers/xen/privcmd.c +++ b/drivers/xen/privcmd.c @@ -257,7 +257,7 @@ static long privcmd_ioctl_mmap(struct fi LIST_HEAD(pagelist); struct mmap_gfn_state state; =20 - /* We only support privcmd_ioctl_mmap_batch for auto translated. */ + /* We only support privcmd_ioctl_mmap_batch for non-auto-translated. */ if (xen_feature(XENFEAT_auto_translated_physmap)) return -ENOSYS; =20 @@ -810,8 +810,7 @@ static long privcmd_ioctl_mmap_resource( kdata.addr & PAGE_MASK, pfns, kdata.num, errs, vma->vm_page_prot, - domid, - vma->vm_private_data); + domid); if (num < 0) rc =3D num; else if (num !=3D kdata.num) { --- a/include/xen/xen-ops.h +++ b/include/xen/xen-ops.h @@ -64,12 +64,12 @@ static inline void xen_destroy_contiguou #if defined(CONFIG_XEN_PV) int xen_remap_pfn(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot, - unsigned int domid, bool no_translate, struct page **pages); + unsigned int domid, bool no_translate); #else static inline int xen_remap_pfn(struct vm_area_struct *vma, unsigned long = addr, xen_pfn_t *pfn, int nr, int *err_ptr, pgprot_t prot, unsigned int domid, - bool no_translate, struct page **pages) + bool no_translate) { BUG(); return 0; @@ -146,7 +146,7 @@ static inline int xen_remap_domain_gfn_a */ BUG_ON(err_ptr =3D=3D NULL); return xen_remap_pfn(vma, addr, gfn, nr, err_ptr, prot, domid, - false, pages); + false); } =20 /* @@ -158,7 +158,6 @@ static inline int xen_remap_domain_gfn_a * @err_ptr: Returns per-MFN error status. * @prot: page protection mask * @domid: Domain owning the pages - * @pages: Array of pages if this domain has an auto-translated physmap * * @mfn and @err_ptr may point to the same buffer, the MFNs will be * overwritten by the error codes after they are mapped. @@ -169,14 +168,13 @@ static inline int xen_remap_domain_gfn_a static inline int xen_remap_domain_mfn_array(struct vm_area_struct *vma, unsigned long addr, xen_pfn_t *mfn, int nr, int *err_ptr, - pgprot_t prot, unsigned int domid, - struct page **pages) + pgprot_t prot, unsigned int domid) { if (xen_feature(XENFEAT_auto_translated_physmap)) return -EOPNOTSUPP; =20 return xen_remap_pfn(vma, addr, mfn, nr, err_ptr, prot, domid, - true, pages); + true); } =20 /* xen_remap_domain_gfn_range() - map a range of foreign frames @@ -200,8 +198,7 @@ static inline int xen_remap_domain_gfn_r if (xen_feature(XENFEAT_auto_translated_physmap)) return -EOPNOTSUPP; =20 - return xen_remap_pfn(vma, addr, &gfn, nr, NULL, prot, domid, false, - pages); + return xen_remap_pfn(vma, addr, &gfn, nr, NULL, prot, domid, false); } =20 int xen_unmap_domain_gfn_range(struct vm_area_struct *vma,