shithub: riscv

Download patch

ref: 7bb1a9a18566ea9c8ae7f6c2fa99e448026521d2
parent: e988d56a2f6b87531a12559a336b5de4471605b4
author: cinap_lenrek <cinap_lenrek@felloff.net>
date: Thu Aug 29 03:35:22 EDT 2019

pc64: map kernel text readonly and everything else no-execute

the idea is to catch bugs and make kernel exploitation
harder by mapping the kernel text section readonly
and everything else no-execute.

l.s maps the KZERO address space using 2MB pages so
to get the 4K granularity for the text section we use
the new ptesplit() function to split that mapping up.

we need to set EFER no-execute enable bit early
in apbootstrap so secondary application processors
will understand the NX bit in our shared kernel page
tables. also APBOOTSTRAP needs to be kept executable.

rebootjump() needs to mark REBOOTADDR page executable.