[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 5/5] x86/pvh: Avoid absolute symbol references in .head.text


  • To: Ard Biesheuvel <ardb+git@xxxxxxxxxx>, <linux-kernel@xxxxxxxxxxxxxxx>
  • From: Jason Andryuk <jason.andryuk@xxxxxxx>
  • Date: Fri, 27 Sep 2024 18:12:34 -0400
  • 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)
  • 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=s40uRk3UtBizo0GptK6ek3Ty2ez5G/xN4ICAoAukDEE=; b=gDYev7QqHdnuYiCeAcm8jJ9g+TceQfEeYhc3Ur3/nGqqxrGxFMogRLj4p6i8KxdodcJ5lQw3yn7tpKA6Jj21wBOeIWf6YGQkXUgYsg4mBgr198kFl4e1lipLBaWBbMKHz3W8+2miGavKl/76abMlDucTwnDlntQ/gfEokdoldbfJqEWzy+6zQ4U/sNnvIwpSipeaX9HG0x58ei9vzUp3IEMiSMrIJ0X/JYJQiAt2AOvon2ikvpUVYbKIAawM9WUUTYLUXIxYdPsuMbX8t3NYsxwLPIipba1cuLoEkvZJCKm2TPu1Kq5GPNBH2PSGshhwgE5DDt5MlTmZsD8nk6l/Xw==
  • Arc-seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=cd+J7QlTLW2RHcGsD5DBitMyqx/t889Cu8SHA4C8SBdMpFqcA+ONKratCZOSAi/rDLgB9yAg1W33rW8QwjAHu2aQZn5RLkFc/iEzZEXj1PkBEVVHeufcn8+d8pv9O+KWbB4ztr7Iq5xeAuCVkyFUQ+7FiMnCfKfSowPXyR7cLxGtpv7bk3PV7HoXyBoV0noBJq6wtknONSzj+LCT+XG0WHaQQ6QOnF7x4VpgIl/99ddqEWpJ2GR+p8Pq5s1Zi7PYCEvi2fn9hNewKCv2zcPxocfT/26ZUfyBy/aHRq+wXpdUnWoZDwEtdjHyxK2wJwjiqoL5kbZIuC2xxeiebLa5SQ==
  • Cc: Ard Biesheuvel <ardb@xxxxxxxxxx>, Juergen Gross <jgross@xxxxxxxx>, Boris Ostrovsky <boris.ostrovsky@xxxxxxxxxx>, <x86@xxxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • Delivery-date: Fri, 27 Sep 2024 22:12:59 +0000
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

On 2024-09-26 06:41, Ard Biesheuvel wrote:
From: Ard Biesheuvel <ardb@xxxxxxxxxx>

The .head.text section contains code that may execute from a different
address than it was linked at. This is fragile, given that the x86 ABI
can refer to global symbols via absolute or relative references, and the
toolchain assumes that these are interchangeable, which they are not in
this particular case.

For this reason, all absolute symbol references are being removed from
code that is emitted into .head.text. Subsequently, build time
validation may be added that ensures that no absolute ELF relocations
exist at all in that ELF section.

In the case of the PVH code, the absolute references are in 32-bit code,
which get emitted with R_X86_64_32 relocations, and these are even more
problematic going forward, as it prevents running the linker in PIE
mode.

So update the 64-bit code to avoid _pa(), and to only rely on relative
symbol references: these are always 32-bits wide, even in 64-bit code,
and are resolved by the linker at build time.

Signed-off-by: Ard Biesheuvel <ardb@xxxxxxxxxx>

Reviewed-by: Jason Andryuk <jason.andryuk@xxxxxxx>
Tested-by: Jason Andryuk <jason.andryuk@xxxxxxx>

Thanks,
Jason



 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.