[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <81185a7e-9fe5-4e97-8e67-11cac946f263@amd.com>
Date: Fri, 27 Sep 2024 18:12:34 -0400
From: Jason Andryuk <jason.andryuk@....com>
To: Ard Biesheuvel <ardb+git@...gle.com>, <linux-kernel@...r.kernel.org>
CC: Ard Biesheuvel <ardb@...nel.org>, Juergen Gross <jgross@...e.com>, Boris
Ostrovsky <boris.ostrovsky@...cle.com>, <x86@...nel.org>,
<xen-devel@...ts.xenproject.org>
Subject: Re: [PATCH 5/5] x86/pvh: Avoid absolute symbol references in
.head.text
On 2024-09-26 06:41, Ard Biesheuvel wrote:
> From: Ard Biesheuvel <ardb@...nel.org>
>
> 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@...nel.org>
Reviewed-by: Jason Andryuk <jason.andryuk@....com>
Tested-by: Jason Andryuk <jason.andryuk@....com>
Thanks,
Jason
Powered by blists - more mailing lists