From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-BN7-obe.outbound.protection.outlook.com (mail-bn7nam10on2058.outbound.protection.outlook.com [40.107.92.58]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id E386F14A4CC for ; Fri, 27 Sep 2024 01:47:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.92.58 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727401657; cv=fail; b=qju69ipnctUx9Qp1L4uUYGp7JUS01SWsp3FtMeXRoX9cJSOkNgtZCYPCyj/+nvhGIV82PnDiLMupOErTr9gNgkuVjWoLbjh+NJ07C18b9JDotnfohjOluDB3T7YHLq5/BF2dOYJ+zgirpy3cA3A91Ur+EN6VMsSd5ho+RNNYqSQ= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727401657; c=relaxed/simple; bh=QNqoz3dPI8GyxhXMYtNWtYTfBoQ0bYDex1/3ZnQ3A54=; h=Message-ID:Date:MIME-Version:Subject:To:CC:References:From: In-Reply-To:Content-Type; b=r1EruWBiZfS0Hjwc27PjuumRAxkT/CWLQtfuqDzdk2mi2w1E0kLa05F+XUj5hOHJXfHAbLhU4dusWU+lteAwIDOo4JLapah5ODx9/0A02Wf8BpeuQwUTcyYzhelw1tCAfcYN7rSimimj0d7Wu8af5v1KeYKmhvBH7TrjL83o08w= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com; spf=fail smtp.mailfrom=amd.com; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b=wFMNGr4t; arc=fail smtp.client-ip=40.107.92.58 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=amd.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=amd.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=amd.com header.i=@amd.com header.b="wFMNGr4t" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=iU/Q8VKD1br1d7wdQqO7Q1oiqZkLjyHWU1L/1zEuuTlRZdTp0KugtnoPArp4hsn/0+aRAeQDSDpxKVVt9BFLbFdTUGe71QJLgYxQLNOrlo1+6R7QnnUeVM6HFoFhtYmLZE9s5UMKeunNb0xCulilXc4TVB2k27VwwGqN1fdGRpSVdjZi70d+M1IEDnm3CgBvthc2ImerUKgK8gfTXDBHCGMxgklTAzTj4w7XLyZiZLUC6OMm5Qpj5Yu58050kv7jCjA2T9Tgw3OXYmohBw2EDlVbWceuuSc4Fm3eaQ535DVc7z7dBAzaRh0TUQZzUvrlew+W5C7MunHu6yvJ9KkJ2Q== 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=re69GDicJsTVYB8i/wCJt4K1EhDG8JMiCWJegOKlVFw=; b=e0I7xmXpkCvtXlSgmCZRuhWczbLgbGxYA57K8ZT5AGmki41awPLwcS96BbdcRd0aWtnUExpsG8/ycRtsDo5rKeFimLqu1iQguhX2nRwgR1woKeHAcaoYzLjOi1+1aYo4kTYK68oMbSMaHTFO9P+E5MZH9GMt75m53W+tDRWIB0oknCNBwvDKZEmosuyfkD59fw9T5a3lszRlsYn1sjoniblHvcC216eAZHNOKqGC7JeXCIAH+fPi6veNIAK64gC6VYTPaEWLm59Aqfcut+3ZnjGk1VRW+NLnrvS/lw2HFkCOAM83tEOdmdVDbGqiQm2TJ7dg2GSI4L3NXbyN034WtA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 165.204.84.17) smtp.rcpttodomain=google.com smtp.mailfrom=amd.com; dmarc=pass (p=quarantine sp=quarantine pct=100) action=none header.from=amd.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=re69GDicJsTVYB8i/wCJt4K1EhDG8JMiCWJegOKlVFw=; b=wFMNGr4t/66QbS97MsVBK1VfE1XCPkolbspCDIuqnobu3xjeC1rDSllKfuHRNZkoOpDK5Qom8ZResleX9ri8p1eYfZSk1H5cVHKxC2OyaNjvEXehq2toMhE6E/FRkixv8w6uQM9tJyUu3fiptqVCv+I7WSglspi4lL9YQ3wZVmE= Received: from BY5PR13CA0017.namprd13.prod.outlook.com (2603:10b6:a03:180::30) by SJ2PR12MB8926.namprd12.prod.outlook.com (2603:10b6:a03:53b::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.22; Fri, 27 Sep 2024 01:47:32 +0000 Received: from CO1PEPF000075ED.namprd03.prod.outlook.com (2603:10b6:a03:180:cafe::60) by BY5PR13CA0017.outlook.office365.com (2603:10b6:a03:180::30) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 01:47:31 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 165.204.84.17) smtp.mailfrom=amd.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=amd.com; Received-SPF: Pass (protection.outlook.com: domain of amd.com designates 165.204.84.17 as permitted sender) receiver=protection.outlook.com; client-ip=165.204.84.17; helo=SATLEXMB04.amd.com; pr=C Received: from SATLEXMB04.amd.com (165.204.84.17) by CO1PEPF000075ED.mail.protection.outlook.com (10.167.249.36) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.20.8005.15 via Frontend Transport; Fri, 27 Sep 2024 01:47:01 +0000 Received: from SATLEXMB06.amd.com (10.181.40.147) by SATLEXMB04.amd.com (10.181.40.145) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 26 Sep 2024 20:46:59 -0500 Received: from SATLEXMB03.amd.com (10.181.40.144) by SATLEXMB06.amd.com (10.181.40.147) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.39; Thu, 26 Sep 2024 20:46:54 -0500 Received: from [172.18.112.153] (10.180.168.240) by SATLEXMB03.amd.com (10.181.40.144) with Microsoft SMTP Server id 15.1.2507.39 via Frontend Transport; Thu, 26 Sep 2024 20:46:53 -0500 Message-ID: <572b339b-7dab-4db0-8ee8-d805f8211aa3@amd.com> Date: Thu, 26 Sep 2024 21:46:53 -0400 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 4/5] x86/xen: Avoid relocatable quantities in Xen ELF notes To: Ard Biesheuvel , CC: Ard Biesheuvel , Juergen Gross , "Boris Ostrovsky" , , References: <20240926104113.80146-7-ardb+git@google.com> <20240926104113.80146-11-ardb+git@google.com> Content-Language: en-US From: Jason Andryuk In-Reply-To: <20240926104113.80146-11-ardb+git@google.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 7bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000075ED:EE_|SJ2PR12MB8926:EE_ X-MS-Office365-Filtering-Correlation-Id: d0af9c1e-4caf-4712-54c6-08dcde965a1f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?utf-8?B?S1lrZzc1YllEV2txOWhkYzFneTZqeXVrOW94NHZwMzY2WmY5SWJ3dU14Tzc2?= =?utf-8?B?VUlWbm4zdG5CRkRBeXViRmZJTzUwbnVNVVJwNFBRWXhLQTU5WXdFajBETHlh?= =?utf-8?B?d3hPOVErL0tESjJtTDZoV2JJSUF3cm56QjhPWE1TVVpXanZwLzhza3lxL1hJ?= =?utf-8?B?VjVIbmNONUVGTXVuSEFrUmJtT1haNEx2bkg2cGJZbkFkdWhBRmxlM2NxL29P?= =?utf-8?B?dVhhaVNaUjJXSUN5eHpUUFBPSlFETnl2b3QwL2RGMEtaUElnRmNUUmhQMlEy?= =?utf-8?B?dWtYcktIR1Z2VVpwaTU2aVRzS1VIS2VTK1JUb1ZyN2FtMlE5Ums4bDAzS2pj?= =?utf-8?B?VjJyeUdVeThQb0NRc092NGdOZ3IzSzNxc2RMUHhTNU1GQWxSZE4zZ0dRb2JZ?= =?utf-8?B?SFQrOWtXZEFYVm9ISTVQNXhycERwZHhzdlZ5TXFqOW5idSthb2h5OTFOV2pz?= =?utf-8?B?VFFWM3R4T3UwUVZIQjlQdXp2ajF5UlVlb1N2QVlRVyswd0VJMUxKVmxucmZr?= =?utf-8?B?K1lNSThmVmlXdmd4akpNUkhYUzZZMWRKckQwN3k4eWd5S1FISHY0dE1TaktP?= =?utf-8?B?Y1hmSEV2VWY2cDlIanlKNVRud2daSlRqUGUyZHh5cjVOM1J6aS82Z201eWVD?= =?utf-8?B?ZWZKU0VxOFlLYmlGN0k2MW9zYUZKNS81NEJyaGFPY1FmSFBtaVdSTTNxT2Ns?= =?utf-8?B?YzdyMVhIM05CenhwU1lZN2hBRi9PRCtkYmVDTmtxUVpjZzVEY1NyU3pSV0hP?= =?utf-8?B?aWNWUFhsZFNXazQwbk5RMTRzMnVpYnFtTlRmTWJGdWs3ejlPWVZGOEdQSWNJ?= =?utf-8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hEMHVWRkRK?= =?utf-8?B?VjJOL1M4SGYzUUxsRlFKdUVnRk1ZdWtCMGZRNGJYZWtVcG9NNTg2azR5aFlQ?= =?utf-8?Q?cs9PRo2JToG5zA07eHDX0uWfd8hXuh8/k7GY8=3D?= X-Forefront-Antispam-Report: CIP:165.204.84.17;CTRY:US;LANG:en;SCL:1;SRV:;IPV:CAL;SFV:NSPM;H:SATLEXMB04.amd.com;PTR:InfoDomainNonexistent;CAT:NONE;SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024);DIR:OUT;SFP:1101; X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Sep 2024 01:47:01.2294 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: d0af9c1e-4caf-4712-54c6-08dcde965a1f X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=3dd8961f-e488-4e60-8e11-a82d994e183d;Ip=[165.204.84.17];Helo=[SATLEXMB04.amd.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000075ED.namprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SJ2PR12MB8926 On 2024-09-26 06:41, Ard Biesheuvel wrote: > From: Ard Biesheuvel > > Xen puts virtual and physical addresses into ELF notes that are treated > by the linker as relocatable by default. Doing so is not only pointless, > given that the ELF notes are only intended for consumption by Xen before > the kernel boots. It is also a KASLR leak, given that the kernel's ELF > notes are exposed via the world readable /sys/kernel/notes. > > So emit these constants in a way that prevents the linker from marking > them as relocatable. This involves place-relative relocations (which > subtract their own virtual address from the symbol value) and linker > provided absolute symbols that add the address of the place to the > desired value. > > While at it, switch to a 32-bit field for XEN_ELFNOTE_PHYS32_ENTRY, > which better matches the intent as well as the Xen documentation and > source code. QEMU parses this according to the ELF bitness. It looks like this reads 8 bytes on 64bit, and 4 on 32. So I think this change would break its parsing. (I don't use QEMU PVH and I'm not that familiar with its implementation.) Regards, Jason