Home | History | Annotate | Download | only in prekern
History log of /src/sys/arch/amd64/stand/prekern/locore.S
RevisionDateAuthorComments
 1.11  19-Mar-2019  maxv Fix/remove some half-baked stuff I left in the prekern:

- Page-align the idt store, to be extra sure.
- Remove unneeded prototypes.
- Drop the TSS, we don't care and aren't even using it.
- Initialize %ss with a default value.
- Fix three exception handlers, no need to push an error code.

No actual impact, because these things are used only when returning from
exceptions received in the prekern; these exceptions are not supposed to
be ever received, never are, and if they were we wouldn't return anyway.
 1.10  09-Mar-2019  maxv Start replacing the x86 PTE bits.
 1.9  07-Mar-2019  maxv Drop PG_RO, PG_KR and PG_PROT, they are useless and create confusion.
 1.8  25-May-2018  maxv branches: 1.8.2;
Hide a bunch of local symbols.
 1.7  22-Dec-2017  maxv branches: 1.7.2;
Sync comments with reality.
 1.6  26-Nov-2017  maxv branches: 1.6.2;
Add rdrand.
 1.5  14-Nov-2017  maxv Remove XXX: set FRAMESIZE to the kernel value. Verily I don't understand
why we are doing that in the non-kaslr kernels, but let's just reproduce
the behavior.

jump_kernel is changed to use callq, so that the stack alignment is
preserved.
 1.4  10-Nov-2017  maxv Add cpuid and rdseed.
 1.3  29-Oct-2017  maxv Randomize the kernel segments independently. That is to say, put text,
rodata and data at different addresses (and in a random order).

To achieve that, the mapping order in the prekern is changed. Until now,
we were creating the kernel map the following way:
-> choose a random VA
-> map [kernpa_start; kernpa_end[ at this VA
-> parse the ELF structures from there
-> determine where exactly the kernel segments are located
-> relocate etc
Now, we are doing:
-> create a read-only view of [kernpa_start; kernpa_end[
-> from this view, compute the size of the "head" region
-> choose a random VA in the HEAD window, and map the head there
-> for each region in (text, rodata, data, boot)
-> compute the size of the region from the RO view
-> choose a random VA in the KASLR window
-> map the region there
-> relocate etc

Each time we map a region, we initialize its bootspace fields right away.

The "head" region must be put before the other regions in memory, because
the kernel uses (headva + sh_offset) to get the addresses of the symbols,
and the offset is unsigned.

Given that the head does not have an mcmodel constraint, its location is
randomized in a window located below the KASLR window.

The rest of the regions being in the same window, we need to detect
collisions.

Note that the module map is embedded in the "boot" region, and that
therefore its location is randomized too.
 1.2  11-Oct-2017  maxv Remove this #if, these options belong to the kernel and not the prekern.
No real change since eblob is always here. And I was apparently drunk
when writing some comments.
 1.1  10-Oct-2017  maxv Add the amd64 prekern. It is a kernel relocator used for Kernel ASLR (see
tech-kern@). It works, but is not yet linked to the build system, because
I can't build a distribution right now.
 1.6.2.2  03-Dec-2017  jdolecek update from HEAD
 1.6.2.1  26-Nov-2017  jdolecek file locore.S was added on branch tls-maxphys on 2017-12-03 11:35:48 +0000
 1.7.2.1  25-Jun-2018  pgoyette Sync with HEAD
 1.8.2.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed