Re: [PATCH v5 05/20] x86/decompressor: Use proper sequence to take the address of the GOT

From: Borislav Petkov
Date: Fri Jul 07 2023 - 09:56:59 EST


On Fri, Jun 23, 2023 at 04:00:30PM +0200, Ard Biesheuvel wrote:
> if you assemble this
>
> movl $_GLOBAL_OFFSET_TABLE_, %eax
> movl $_GLOBAL_OFFSET_TABLE, %eax
>
> you'll end up with
>
> 0: b8 01 00 00 00 mov $0x1,%eax
> 1: R_386_GOTPC _GLOBAL_OFFSET_TABLE_
> 5: b8 00 00 00 00 mov $0x0,%eax
> 6: R_386_32 _GLOBAL_OFFSET_TABLE
>
> So it is not possible to take the absolute address of
> _GLOBAL_OFFSET_TABLE_ via an absolute relocation, you will always get
> the relative offset instead.

Right.

Thx.

--
Regards/Gruss,
Boris.

https://people.kernel.org/tglx/notes-about-netiquette