HomeFreeBSD

Fix some problems with the SPARSE_MAPPING option in the kernel linker.

Description

Fix some problems with the SPARSE_MAPPING option in the kernel linker.

  • Ensure that the end of the mapping passed to vm_page_wire() is page-aligned. vm_page_wire() expects this.
  • Wire pages before reading data into them.
  • Apply protections specified in the segment descriptor using vm_map_protect() once relocation processing is done.
  • On amd64, ensure that we load KLDs above KERNBASE, since they are compiled with the "kernel" memory model by default.

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: Netflix
Differential Revision: https://reviews.freebsd.org/D21756

Details