Re: [RFC 2/2] x86/pti/64: Remove the SYSCALL64 entry trampoline

From: Dave Hansen
Date: Mon Jul 23 2018 - 08:59:42 EST


On 07/22/2018 10:45 AM, Andy Lutomirski wrote:
> static void __init pti_clone_user_shared(void)
> {
> + unsigned cpu;
> +
> pti_clone_p4d(CPU_ENTRY_AREA_BASE);
> +
> + for_each_possible_cpu(cpu) {
> + /*
> + * The SYSCALL64 entry code needs to be able to find the
> + * thread stack and needs one word of scratch space in which
> + * to spill a register. All of this lives in the TSS, in
> + * the sp1 and sp2 slots.
> + */

I had to remind myself about the r/o cpu_entry_area alias here. Should
we maybe call it out explicitly?

/*
* The TSS is also mapped read-only into the cpu_entry_area.
* The cpu_entry_area copy is used r/o by the hardware for the
* hardware stack switching, like interrupt entry.
*
* The copies being mapped here are the normal r/w per-cpu
* areas. We need r/w because we spill a register here.
*/

BTW, since we have this alias, do we still *need* the r/o cpu_entry_area
alias? Or do we still get some value from keeping the thing referenced
by hardware r/o?