tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: amd64: kernel aslr support



Le 05/10/2017 à 09:12, Martin Husemann a écrit :
On Wed, Oct 04, 2017 at 09:00:50PM +0200, Maxime Villard wrote:
This implementation is based on a specialized kernel, called the prekern, which
relocates the real NetBSD kernel. The bootloader loads both the prekern and the
kernel in memory, and jumps into the prekern with a set of arguments; the
prekern relocates the kernel and then jumps into it, passing it the arguments
from the bootloader plus several other values.

Can you explain why this needs a specialized prekern?
Can't you just use the normal kernel binary and a make all of prekern
a special function inside the main kernel, maybe in a separate section
that is then not reloacted?

I don't think it is possible to compile some parts as relocatable and some
others as static. What we could do is compile both the kernel and the prekern
separately, and use objcopy to merge them.

But the real issue is the bootloader. If you look for, you can see that my
bootloader patch does not change the loadfile_static function - which is used
by all the architectures. Modifying it to support kernels that are both dynamic
and static is complicated and adds to the already existing mess, and we can
expect breakages on some obscure architectures.

(as a side note, for the next GSOC there really should be a "cleanup libsa and
all our bootloaders" project...)

The advantage of having a separate prekern is that you can update the kernel
without touching the prekern, or the other way around.

Maxime


Home | Main Index | Thread Index | Old Index