Received: by 2002:a05:6a10:d5a5:0:0:0:0 with SMTP id gn37csp290097pxb; Thu, 30 Sep 2021 06:13:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxEPBgphj1ZDRF6VCubvTaT1RRFUutu5/JhwMKSOn8dt1zay7th0NNOiyRnK2dmbYWUFmfk X-Received: by 2002:a17:902:7613:b0:13d:c6f0:1ecf with SMTP id k19-20020a170902761300b0013dc6f01ecfmr4278934pll.16.1633007596998; Thu, 30 Sep 2021 06:13:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1633007596; cv=pass; d=google.com; s=arc-20160816; b=qvCl7DRFvc9M7sDfwYOL4JGZBZAFEyo75HZMo0qH2aB3jOtvuEacBV/62pP7NzqKY2 /dRlNyBlNn4MxHEtOuRj/f7dMf11LTm4mblAmcZ2FhTfAobQlKJyTkDFt1ytPG4QpkX6 GPUhLKaDnI2VhE2vnOLRr7nlDMKQs1qFn/p1re4aOuhSv/Mq+4HD7J6ZbDQOPHYsGZxU J96Ncu8ouTAhz/Qo10mheDp3Co3fUSqNKpp3piSfx68omzOY7CN49nyMTIupaMYnLN0U PN93ainpczIB5/wbxTyNkSfh5dkv8tUhO8zPcBUCeCSQeMG6xi/UDxNtl6RFCVoT/HOU lEZQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:references :cc:to:from:subject:dkim-signature; bh=kPPXxxwugPBH+beN9q4uizgqAq1OKQYB05wUlCmlLlM=; b=Ow2VXh3jy9vkgThhlaBDsqBTnR5aCNFN+EDppKlRircWI9m0HFpyJIV5lwQIMzPHZa jibTdOYqn2UcTSsGSeLjdor16K/M9xL9SoBhsgE6f4UTexLBkV1pS5DVXz78K9H1yPm1 Es9EjGj3y2WU8xCXuucNzUL3YDVzG2vl1pcClE47X9HyEu2CznqDDTKrObQ125JxtyLx C0tXvToYH0RFiOZkFloN4gE0x/52iMUuvELkSY1D5WT751xQdWVma1lb48+bdmZgg47K ZkNk4fsJA4qm/ZMm4dePMe1LS3ABCTO4mlmawcnGY/c8LhHauInXb3pekVIQrZIDLHTv Om4Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=KE1jczkP; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c15si3140661pja.72.2021.09.30.06.12.56; Thu, 30 Sep 2021 06:13:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=KE1jczkP; arc=pass (i=1 spf=pass spfdomain=suse.com dkim=pass dkdomain=suse.com dmarc=pass fromdomain=suse.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=NONE dis=NONE) header.from=suse.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350952AbhI3MjL (ORCPT + 99 others); Thu, 30 Sep 2021 08:39:11 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.111.102]:21942 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350938AbhI3MjK (ORCPT ); Thu, 30 Sep 2021 08:39:10 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1633005446; 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=kPPXxxwugPBH+beN9q4uizgqAq1OKQYB05wUlCmlLlM=; b=KE1jczkPjRiGYi1Af8INeMw6vNy/tRNOAmuF7RjGtwuJStzm7pFbWblctRGKbNnzGbFmHm 6+5D/2lvjvsACUAoH5cR/ca3Ns670cFhFGo4MwCdyQg3lwSzraeqD7E4FtoIF6KQfG9DVK Lr9SWQhCsvs89C7bOEGCZex+b84Hbpo= 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-18-xfIf_bZcPQyeHCkSQiq7nA-2; Thu, 30 Sep 2021 14:37:25 +0200 X-MC-Unique: xfIf_bZcPQyeHCkSQiq7nA-2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XilTaAxqeBZWIJGbAE5s+aGyJxwBTKSk8JJIcQrGqZ56NngxDJh9hPmPvxM+fRJQTOOB8UH7l9TvHBP2yjvJNk2u7t5ZIXVOBZZ2pgHd2OUxBbsavaHT65oINnSGheq2AgnETqceJNhs8rRDrLvf2Mwn2fwG+z8yPgwpQ0X5wvFKQ6800h8iOyqyeGAtYYPQKIKTfP8YRaq8U+JObZf6Zc87ncHz9vA/3KQPwS8BTst102uFq1izpVMFUAglboi19KA1Le00aggzRFcl4Kz2GhsUCqQ3RoeahTcOaD0p8VzszyCWvwdBYEYwT25OcSHBfoi6/AJnFOskedlbBRqHgQ== 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=kPPXxxwugPBH+beN9q4uizgqAq1OKQYB05wUlCmlLlM=; b=L81yw8xq8kuaHu8deo1awIB9H4n/kFDii481Ozwug91sYMLO9KNforOxYqXeAE6KaYblcI6PkfRJkyuE0vNEbiKRemO9hHxneo51pjXTovhT0QgvlLRa3LoeEqVFyMTvLE8U0LwTwlzxbPVDsGpGfmycn48kUh1rwFCe/NG8SAZlhUocJtmcsqlJTfcuS8WQspEXM4XC2lZUIo8u27f6nEkyXYGPJwmU+p6/kqDEjKwZ0r8Z3BoblFLH0U9wXHh3Z7VCfMDJLFVg/+82qREaMopTNDrv7a8rQ3galWv6Dx1Fo5LuWX3RDraRs+KnxISelYZ3+zZEFD06EkxqCJ6VYQ== 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: lists.xenproject.org; dkim=none (message not signed) header.d=none;lists.xenproject.org; dmarc=none action=none header.from=suse.com; Received: from VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) by VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.13; Thu, 30 Sep 2021 12:37:22 +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.4566.014; Thu, 30 Sep 2021 12:37:21 +0000 Subject: [PATCH 6/6] xen/x86: restrict PV Dom0 identity mapping From: Jan Beulich To: Juergen Gross , Boris Ostrovsky Cc: Stefano Stabellini , lkml , "xen-devel@lists.xenproject.org" References: <022b1a5e-4121-6bae-f07c-4ad5eac12481@suse.com> Message-ID: <038b8c02-3621-d66a-63ae-982ccf67ae88@suse.com> Date: Thu, 30 Sep 2021 14:37:19 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 In-Reply-To: <022b1a5e-4121-6bae-f07c-4ad5eac12481@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: AS8PR04CA0044.eurprd04.prod.outlook.com (2603:10a6:20b:312::19) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 Received: from [10.156.60.236] (37.24.206.209) by AS8PR04CA0044.eurprd04.prod.outlook.com (2603:10a6:20b:312::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.16 via Frontend Transport; Thu, 30 Sep 2021 12:37:21 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2cfb7984-2657-4317-0ae4-08d9840f0c60 X-MS-TrafficTypeDiagnostic: VI1PR04MB5600: 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: XvmdscEd9rEdQFfFcHzHE1yUzmCA78KefJFiaS7tFz7cTJRHRuJb5OVAubYJ/hJnDKcaueTs421LujF3q2Gq74K6EKMuda/8MmLMK15SeKvZ3iB+HEliVw3Vpkat8CpnlVaIWdyk8tBxSJs7E94elR/+7cS7aRfU3aJYV+fLwULbQSA471/n+h7e1H/Fq0AWl0TE/sVeGnAznw1QpzpaNU52beKmxKjL8DyTUSFpGt3U6ZaZ++2osWQekH0GlOyQ3VoPJXLiVnEPM+5E1k9uet3VlQdAY6j8zFRIM6B3FfkD+ojsMqME2UNz7+tFnjAQwfc/2BQafiOv6ElT7GUygYdOry4RH4o61ClJMhKGmCSsJI3mpsT+VMaYgxNOZvx1OwvTfH3K1CjFez0uYtKGWZQPegnhcRIB+co5wZB8Oac16+v19khbEap0d/Qi3CFgMLDotqVe5PRInBTTm2a0LxGvsgD84nD/a9igeJ9A7hjSiIPJ4+SUo4Uo1NMb/OLRohHufORSrIfFmfoPsCvx/DcEo8LAS9YbCSZX/nlBrkKnCONLsaGbmdnOWRGko1e7bfaBV/9UnPr+wsNs0Q/EPvzTFdbOtXAKIdfm4yH99c9aNpR7+25fXkiX2/JpwT2h2Pxjd5u92hxxQdMwtWRagqyiWt/0jC/YuBrtHUF89CQ5h+6NWmJ69+0oQYKrKgdDib07cB7P5+rAvc2CtRDwAyNDVfI2ThBQT8SVCYhhjaXbMBDOlMJ912X64JEspchd 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)(508600001)(2906002)(316002)(5660300002)(83380400001)(38100700002)(66556008)(66476007)(66946007)(16576012)(110136005)(54906003)(8676002)(31696002)(8936002)(31686004)(4744005)(186003)(6486002)(956004)(4326008)(2616005)(36756003)(86362001)(26005)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?M2p2R1N1S3czTkRsYXdxQ2MwZjdXdlAzVlYrVkRFWmNXVzhveTlQWlo4cWpE?= =?utf-8?B?dE1tNmNZUEcrU244WGl0c2Q5eWhhMXQ2WHQ5ck9qVDlEb1VCZnNaS0RCT0Vt?= =?utf-8?B?K2dXWWtLMm1DYWF4cjd4NDA1MEEvWXlnaU9jY0NkME9iTzFVbk01c2o0b2lW?= =?utf-8?B?MlJrK3R5d2Z0Y0kvTW1yck1PWHhEM3lIeUVmdVFscjZnZXFPMHJUcVFDV3kw?= =?utf-8?B?cjM4K0V5dEQrajhZT2dWMzhPdWNUWVZsUU9OSTlQTzNNL2tENlhMcld3NWRF?= =?utf-8?B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WV3pk?= =?utf-8?B?UXYwL2prWnJ2R2VxZ055bXp5cGxzZVlKaFFrZTZWUXpEeCsrbUxtN3NRNVN3?= =?utf-8?B?d1ZMbEk1NTIzL2ZFalJ4Tm5vVmZBV1RPWUlOQWR6NXlkNFg5OGFIN1FsVlE5?= =?utf-8?B?WklRckQvRVV4aEJXUUdjQjJhSDJlc00xVmpvUW9Ba2pwSS95dzVtL3JlNm82?= =?utf-8?B?S3NNL0kwVDA5azBYOXNZdlVld1RuY0dnN2I2ZDkvYmRUY01FWVN3OExYUHAr?= =?utf-8?B?TkJpbk1XdXZEZVVheXh6UW45VFdqQUJQT0VjczYyNlVsTmlCVmozd21FMzJB?= =?utf-8?B?cmtkYzBrRCttcXlOK0h4eEo0aFIzZldyajA0UWN1WkxiRXBiMkgwZXdHWG9G?= =?utf-8?B?RkpnZWh2QXhTdHJPRnlJbEhkM1o4ZnJKczVMYmNwd1Vldk5GYWJ3TExIZ2xh?= =?utf-8?B?SUx1aC94eXIvTGNlWEhlNERJeEpyYVRuN3c0eWtweU5XYjI5TW5ZL0pzemY4?= =?utf-8?B?WFBEYXlEZFVqRmFHclJQRndWNzBpUEU0NFM4bEpRM0xaVWVCQ3ZzMGgySXgx?= =?utf-8?Q?93ZKV8oWsM+vckc/XhkCzli11oCJHU6m/B8ieBu?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2cfb7984-2657-4317-0ae4-08d9840f0c60 X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Sep 2021 12:37:21.8021 (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: N+68ucEy+pC2zMfLvWa3YBirMpv4MDFLr5fQVKEKl3arg/Yr/kg/vljVeeZ6LHuxaQ1Uv2OjsEoU6X25wHf1UQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB5600 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When moving away RAM pages, there having been a mapping of those is not a proper indication that instead MMIO should be mapped there. At the point in time this effectively covers the low megabyte only. Mapping of that is, however, the job of init_mem_mapping(). Comparing the two one can also spot that we've been wrongly (or at least inconsistently) using PAGE_KERNEL_IO here. Simply zap any such mappings instead. Signed-off-by: Jan Beulich --- a/arch/x86/xen/setup.c +++ b/arch/x86/xen/setup.c @@ -425,13 +425,13 @@ static unsigned long __init xen_set_iden } /* - * If the PFNs are currently mapped, the VA mapping also needs - * to be updated to be 1:1. + * If the PFNs are currently mapped, their VA mappings need to be + * zapped. */ for (pfn = start_pfn; pfn <= max_pfn_mapped && pfn < end_pfn; pfn++) (void)HYPERVISOR_update_va_mapping( (unsigned long)__va(pfn << PAGE_SHIFT), - mfn_pte(pfn, PAGE_KERNEL_IO), 0); + native_make_pte(0), 0); return remap_pfn; }