Page MenuHomeFreeBSD

loader: Allocate trampoline as EfiLoaderCode, not Data
ClosedPublic

Authored by emaste on Tue, Jul 21, 7:23 PM.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

I tested this patch on the nigeria-sp7 in the Kitchener office, and it resolves an exception that originally took place during the loader stage.

stand/efi/loader/arch/amd64/elf64_freebsd.c
114

The trampoline stack is located at the same page as code. So for EfiLoaderCode, could it be that some fw would deny the write?

stand/efi/loader/arch/amd64/elf64_freebsd.c
114

I am not certain, but believe that we will get only RWX or RW from AllocatePages for code or data. It may happen for PE image sections but not for allocations, I think.

If this is a concern we'd need to split into two allocations I suppose. Or EFI_MEMORY_ATTRIBUTE_PROTOCOL

This revision is now accepted and ready to land.Tue, Jul 21, 9:01 PM

So you can't allocate pages for code read only... you've got to write to them sometime and there's no interface to change the mapping.

EFI_MEMORY_ATTRIBUTE_PROTOCOL is the interface to change mapping