Received: by 2002:a05:6a10:eb17:0:0:0:0 with SMTP id hx23csp3584504pxb; Tue, 7 Sep 2021 03:08:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyFkv387EdJkdKtwe4I2cjJi7sE04HZpqlLZbRCbQi1NzBMZAdg0t5j8WMCeUi4UCWqgbV1 X-Received: by 2002:a05:6638:b10:: with SMTP id a16mr14989839jab.149.1631009315952; Tue, 07 Sep 2021 03:08:35 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1631009315; cv=pass; d=google.com; s=arc-20160816; b=Xc0LFR4c8A7BYv7z2Fdfyk+rY0vEPTeioS27Ht6BC3xTSXAI8pLYA3MB5ZMlb6I7G7 wW8i5gVM05HNtYU+qdd77i+O04vGRZpnaNR5KL/0rH8+9HNJTRV4f+jX9TayqUdITesR vhYN3dwRyHR8iFeG0YQFXIsd6T7ZxC4DvaZTD1r1GhUC8HUCw4z5i6dwR7XAxOQTXgLq VHbdtd+J3kLujIRlubdu7e+9poWqTq7nLUr3eT9UhYSJ8xqiyCOtyrmy+nPOiayNZVnD IlybUCDlAGkRswDTJuWOoBHhOjHeWCgWwG54pUcskPVAGDMq/nM7XxHBk6ebCEWSGDww r1ig== 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=VGr5KaKrPB+ECiV3mI7JH4ZubnK2Jw/FcM9+PIVCR9A=; b=hiefKh8wtNOUUNdaN97OmzFw2UCcsMk8mrBqGsrkPuZRP+P6L0mtNow8Ew6eMNF432 1mlZWMpR76Xhif7NNLANTYmgEbd5q0FdM1AgCSeXYkpcb62HUjv0JvfFolOX/ltopqyK 9QimZvrhXa0hQCxcYTlfmRw/fOfA/g6ghtt9Q8q9e0eBzgMk5wVGzFsJkmq25gn2DPY2 ELhGk3ZP7AjL7WiD4vj/n8Qg7l+lMVYnXIsMiVoRKjTRKpzdepfDsooemBNXaCO/juBa vnD6SKywou1xISfDIcwjKdUCLul76o5xISrta/Nt0oOM4tjJFXt0sQWsG9mcyBF02/wt N18g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@suse.com header.s=mimecast20200619 header.b=hqRjfrkr; 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 15si7888088ilt.96.2021.09.07.03.08.24; Tue, 07 Sep 2021 03:08:35 -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=hqRjfrkr; 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 S243380AbhIGKIl (ORCPT + 99 others); Tue, 7 Sep 2021 06:08:41 -0400 Received: from de-smtp-delivery-102.mimecast.com ([194.104.109.102]:47252 "EHLO de-smtp-delivery-102.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236729AbhIGKIk (ORCPT ); Tue, 7 Sep 2021 06:08:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.com; s=mimecast20200619; t=1631009253; 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=VGr5KaKrPB+ECiV3mI7JH4ZubnK2Jw/FcM9+PIVCR9A=; b=hqRjfrkrRphKiA3n4lLVBEI4pTxvwCvUrlc7+mzk+krKLb60c4bY4mdJS1xathkrVrDikq 6NbsCq7Lpk5eewybHy+osieBqobG/PR770sAgXbNzQO4l6osvoBz7aHfQJmL3D2lCFHhOt Fd2mFSwusz3B/UB0O0kgy7WHo7jo+Tw= Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2172.outbound.protection.outlook.com [104.47.17.172]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-9-Cy3fR7TTMiqk8fr6zznO7w-2; Tue, 07 Sep 2021 12:07:32 +0200 X-MC-Unique: Cy3fR7TTMiqk8fr6zznO7w-2 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=E7w8LcHGWrntrIYAkeiSiGk55H9JXGxZWhzHMFppR/cRrQdSZv+/igXsqnHTmP0Db4BWfQ3SykDnf9DCNSlASWI78IYAYrGBxrUsI92qSlLC7WOiPER6Ot6kzhw90XiSweJmrg/Q5/zTEg9NkLFa6ZIskZhmAB/qwoykyhZvyZSNOxmDLzfvGmrTTZejD5lDZ0BpYAh/a1F6AEt6A8zJq/4c7vitO2JvcAZAc3Gei1wZCMmRbdnT6DHFc5xuEKUR1bPBy4EK8xK9Hh7P9qhyl7aFHqdZhmoj/YOkM2xOiHThcXDRxuwrPLlrxD5OwKJ1tzyQWIVkWznrpiCei+EsAQ== 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=VGr5KaKrPB+ECiV3mI7JH4ZubnK2Jw/FcM9+PIVCR9A=; b=fkAvpHWiBc9h1bqrhaK5I963N+DD6VmjRJlVSZiYOy6sj/8wPjtRuPllCh0S1I58WDZ+0EamhtXYH4+lgXm6+X8D6Vwk5l2f+bvvJC1eGKvv0hWEvotTrer/ve6ZdCEUkJ4bT2GKn9U47on+ZDsb4zzdSW1dC877irj87ABIrhBOJdGkEfDC2Y6aE9fnFKbDodlk+6qeAPOoB6EiM3IJlCVnwxLP80+C61HtcTkPokC7kkprSxBQ75aR+phEqm/5nIEX3WnyF2Z2cZu1znJVmCmYQx5+VbzY+tKrSrPPmV451fQaCEdRwFQkGnqvz3T+6HFszpEShKMzIeBlGBxtnA== 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 VI1PR04MB6176.eurprd04.prod.outlook.com (2603:10a6:803:f6::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.21; Tue, 7 Sep 2021 10:07:30 +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.4500.014; Tue, 7 Sep 2021 10:07:29 +0000 Subject: [PATCH 1/9] xen/x86: prevent PVH type from getting clobbered From: Jan Beulich To: Juergen Gross , Boris Ostrovsky Cc: Stefano Stabellini , lkml , "xen-devel@lists.xenproject.org" References: <4efa804e-3250-227f-00c7-347581366cd4@suse.com> Message-ID: <46ec0dab-8b5e-f20f-225b-3f4c57f34a61@suse.com> Date: Tue, 7 Sep 2021 12:07:28 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 In-Reply-To: <4efa804e-3250-227f-00c7-347581366cd4@suse.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-ClientProxiedBy: PR3P189CA0027.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:52::32) To VI1PR04MB5600.eurprd04.prod.outlook.com (2603:10a6:803:e7::16) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.156.60.236] (37.24.206.209) by PR3P189CA0027.EURP189.PROD.OUTLOOK.COM (2603:10a6:102:52::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4478.21 via Frontend Transport; Tue, 7 Sep 2021 10:07:29 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: f341c0ab-13c6-4607-4725-08d971e74d4e X-MS-TrafficTypeDiagnostic: VI1PR04MB6176: 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:7691; X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mSGEp41nFGKSmsQ1+MLYGHCoH7IgpiKvEoU6D4xsANOmdp6UCOt/3I+nOU1vHoWalA6KkS+wA7wqDtHUZIRQBIehvDnx2GlF1+ZewAcb0ozqIt7ieq++7xCeyMIx5pjW55O6XF+fFgqh9bK44aP5DV1P0ntT0AjhQYYnEolvzc1xCQWdv5EmGJ3smF+SPQDZXktIL3GBCrO9Uku3m/OkGizM7S13IW8Tl531sGroXAIWHZRe9TuSm3StKoZBbxglJyHkgfeNrk9vFou7DLmhXlTSksp3e8jo8AMT0+QghHGwEZZf/c8TVBb8lmr4str+sRIYCcnrHKG/7S8TE8zfaP7Hwr45iDEmXBNTO5F+6r2YQ8GgVwnMhEc22HxlMnQV+Ec3cH8yk9Nr/y5q+q/INT4JNLNvpDy0aybhmVZCX0WRM2asjWFG/Gdda4XJf136N8sv1u14ten8vwPTe5Idor9TmvFLOBqv19L4jvEGuzYVLxDIWL32pp2gkfMu77iTTirxGQaV0Rk2EgMa1KmJQhtwEWUshxm/QoJqAdOFj6WiIIdN5amGvyOnZpWrEzPrsxbUSPRrKeihhrcgNv2la0Hi9XYvpK/7RcHrCQUR68EmHJQsVIFdyc0a6gOWCzfXi1o8oVsbP+FUOSNX1EhtFtWXWPhBgMMxhWCDifgVj/bKGAXoOxah13OmLA8enrsR23bHWeay2HdW/YJ5sxh16jGt8PYBFPRy7SnXnmFaSqE= 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)(136003)(39860400002)(346002)(396003)(376002)(54906003)(66476007)(66556008)(2616005)(86362001)(8676002)(66946007)(31696002)(956004)(26005)(38100700002)(6486002)(4326008)(8936002)(186003)(31686004)(36756003)(110136005)(316002)(478600001)(16576012)(2906002)(5660300002)(43740500002)(45980500001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?N2dzMlRpR3RYckx2TFFiNFhLWUd2OGZraEd0dmJpUExudTV6b0ZOTThkTXNu?= =?utf-8?B?MVZQMzdCMUFCU3hFTnlucTd3aFhvRmkxUW12VnduWkNneWdmSCsxS3lsZXdK?= =?utf-8?B?Ymo0TVBDbWhLZEhPRW42cVk5YlhTRkJDK3orODlSTjhVeExmNlBVSUl1TDhU?= =?utf-8?B?ZEk3Y0hPYnBCNUkwK3VYcVp5MnRVVjZUYUxpOGZpNFdpUlRzYmtJaWlJdkpl?= =?utf-8?B?NFlwZ0pGcmd1b1dKSWd6RlhnRnhMUXVHT2FoOEgxTWZTRzlCRERCR3FVU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SEdNVDlRUktwb2hV?= =?utf-8?B?aCtqQW9NSzFobEdKRUlTMUNvYkZuQk1UbUZkUVo5YlFRMHVDc1RoRkh6eU5D?= =?utf-8?B?bU5QTDRtLzZVV2FjVnpmenUzYk5ZTnlQbTJlWU1OUG1EaWVKUjZmTTVZOVFG?= =?utf-8?B?YkNDYUp6MmVoWDJ6cytiazVtRUtLSlpKRStlSStOM1ZZOW43RmFRcFdRM2ZG?= =?utf-8?B?emswc054N1dpNnp0dFdvNFZCcXU2cE0yTlBZTmtXMEtRcG1lbGNiWEJkeVgv?= =?utf-8?B?WVZJVi91eTlRV2VFMS9XdktNbVFadE1hcXF6T29vU0xqTWIwSUZob0luTGdo?= =?utf-8?B?ckNFTjRVZVpOeU5XMFBJVVZxenc1T096VGpTSkxBWTRCK0V3YzJkM0JZUUlE?= =?utf-8?B?L0dkcUlINUxkYStoYWc1Umc5cFV5Q1pUMjVBRW94bGdzbGliZFJRSCtHV1lq?= =?utf-8?B?czVHalpSWWRDWXdTaHFIUExrdS85dVB6UFJpanFVNG9Sd2N3Y3UvcVZ6cWNO?= =?utf-8?B?QVk2MWhpZjFuMEEyWndoSjNTdHBHODJEWFlIMkVZbFk4K0NTNmpGQUZ0VkJU?= =?utf-8?Q?HDMt7eyMsTxeoDgm20BozDq9gHtYRZ43Ot0vBJe?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: f341c0ab-13c6-4607-4725-08d971e74d4e X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB5600.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Sep 2021 10:07:29.9054 (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: QvS5/u6jIhA5YQ0631sjlbwiEn+yvGE77jAgeJqeSx60mKCJMyT7CZAKFxhZymyjUu4zRhQJG1MeuVMh54jebg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR04MB6176 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Like xen_start_flags, xen_domain_type gets set before .bss gets cleared. Hence this variable also needs to be prevented from getting put in .bss, which is possible because XEN_NATIVE is an enumerator evaluating to zero. Any use prior to init_hvm_pv_info() setting the variable again would lead to wrong decisions; one such case is xenboot_console_setup() when called as a result of "earlyprintk=xen". Use __ro_after_init as more applicable than either __section(".data") or __read_mostly. Signed-off-by: Jan Beulich --- a/arch/x86/xen/enlighten.c +++ b/arch/x86/xen/enlighten.c @@ -52,9 +52,6 @@ DEFINE_PER_CPU(struct vcpu_info, xen_vcp DEFINE_PER_CPU(uint32_t, xen_vcpu_id); EXPORT_PER_CPU_SYMBOL(xen_vcpu_id); -enum xen_domain_type xen_domain_type = XEN_NATIVE; -EXPORT_SYMBOL_GPL(xen_domain_type); - unsigned long *machine_to_phys_mapping = (void *)MACH2PHYS_VIRT_START; EXPORT_SYMBOL(machine_to_phys_mapping); unsigned long machine_to_phys_nr; @@ -69,9 +66,11 @@ __read_mostly int xen_have_vector_callba EXPORT_SYMBOL_GPL(xen_have_vector_callback); /* - * NB: needs to live in .data because it's used by xen_prepare_pvh which runs - * before clearing the bss. + * NB: These need to live in .data or alike because they're used by + * xen_prepare_pvh() which runs before clearing the bss. */ +enum xen_domain_type __ro_after_init xen_domain_type = XEN_NATIVE; +EXPORT_SYMBOL_GPL(xen_domain_type); uint32_t xen_start_flags __section(".data") = 0; EXPORT_SYMBOL(xen_start_flags);