Le 18/08/2017 à 20:52, matthew green a écrit :
"Maxime Villard" writes:
Module Name: src
Committed By: maxv
Date: Fri Aug 18 10:28:53 UTC 2017
Modified Files:
src/sys/arch/amd64/conf: kern.ldscript
src/sys/arch/i386/conf: kern.ldscript kern.ldscript.4MB
Log Message:
Fill the .text padding with 0xcc (int3), in such a way that any jump into
this area will automatically fault. The alignment within the section is
necessary, in order to fill strictly all of the padding (took me a while
to figure this out); but it does not change the kernel size.
Greatly inspired from FreeBSD, but for some reason they decided not to
apply the alignment.
it's really a pity that we have almost _2MB_ of basically wasted
space in the kernel. there's really no good reason for it. it's
not as if ELF files are incapable of expressing discontiguous
sections separately without zero or other filling. the int3
filling could be done at run time.
you didn't introduce this issue, but you did add 1MB of wastage
a while back now. can you please look at fixing this?
I already know how to fix it, change max-page-size to 0x1000. But it causes
the kernel to have three PT_LOAD sections, and the bootloader expects only
two. Fixing the bootloader is more complicated, because several things are
shared between architectures.
it both slows boot and fills my boot disk/partition.
(filling in the padding at run time is slower than having it done in the
kernel statically.)
Maxime