Re: [PATCH v3] x86/boot/64/clang: Use fixup_pointer() to access '__supported_pte_mask'

From: Kirill A. Shutemov
Date: Tue May 15 2018 - 16:15:51 EST


On Wed, May 09, 2018 at 11:18:22AM +0200, Alexander Potapenko wrote:
> Clang builds with defconfig started crashing after commit fb43d6cb91ef
> ("x86/mm: Do not auto-massage page protections")
> This was caused by introducing a new global access in __startup_64().
>
> Code in __startup_64() can be relocated during execution, but the compiler
> doesn't have to generate PC-relative relocations when accessing globals
> from that function. Clang actually does not generate them, which leads
> to boot-time crashes. To work around this problem, every global pointer
> must be adjusted using fixup_pointer().
>
> Signed-off-by: Alexander Potapenko <glider@xxxxxxxxxx>
> Fixes: fb43d6cb91ef ("x86/mm: Do not auto-massage page protections")

Acked-by: Kirill A. Shutemov <kirill.shutemov@xxxxxxxxxxxxxxx>

--
Kirill A. Shutemov