diff options
author | Ard Biesheuvel <ardb@kernel.org> | 2020-02-10 17:02:31 +0100 |
---|---|---|
committer | Ard Biesheuvel <ardb@kernel.org> | 2020-02-22 23:37:37 +0100 |
commit | 04a7d0e15606769ef58d5cee912c5d08d93ded92 (patch) | |
tree | 55df0d0cad3812a146ddd4407e51263a2978c4de /drivers/firmware/efi/libstub/Makefile | |
parent | e6d832ea9ac63316ee72df5e9f21698cfd486698 (diff) |
efi/libstub/x86: Avoid overflowing code32_start on PE entry
When using the native PE entry point (as opposed to the EFI handover
protocol entry point that is used more widely), we set code32_start,
which is a 32-bit wide field, to the effective symbol address of
startup_32, which could overflow given that the EFI loader may have
located the running image anywhere in memory, and we haven't reached
the point yet where we relocate ourselves.
Since we relocate ourselves if code32_start != pref_address, this
isn't likely to lead to problems in practice, given how unlikely
it is that the truncated effective address of startup_32 happens
to equal pref_address. But it is better to defer the assignment
of code32_start to after the relocation, when it is guaranteed to
fit.
While at it, move the call to efi_relocate_kernel() to an earlier
stage so it is more likely that our preferred offset in memory has
not been occupied by other memory allocations done in the mean time.
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Diffstat (limited to 'drivers/firmware/efi/libstub/Makefile')
0 files changed, 0 insertions, 0 deletions