Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

x86, realmode: Set real_mode permissions early

Trampoline code is executed by APs with kernel low mapping on 64bit.
We need to set trampoline code to EXEC early before we boot APs.

Found the problem after switching to #PF handler set page table,
and we do not set initial kernel low mapping with EXEC anymore in
arch/x86/kernel/head_64.S.

Change to use early_initcall instead that will make sure trampoline
will have EXEC set.

-v2: Merge two comments according to Borislav Petkov <bp@alien8.de>

Signed-off-by: Yinghai Lu <yinghai@kernel.org>
Link: http://lkml.kernel.org/r/1359058816-7615-7-git-send-email-yinghai@kernel.org
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>

authored by

Yinghai Lu and committed by
H. Peter Anvin
231b3642 c2bdee59

+6 -5
+6 -5
arch/x86/realmode/init.c
··· 84 84 } 85 85 86 86 /* 87 - * set_real_mode_permissions() gets called very early, to guarantee the 88 - * availability of low memory. This is before the proper kernel page 87 + * setup_real_mode() gets called very early, to guarantee the 88 + * availability of low memory. This is before the proper kernel page 89 89 * tables are set up, so we cannot set page permissions in that 90 - * function. Thus, we use an arch_initcall instead. 90 + * function. Also trampoline code will be executed by APs so we 91 + * need to mark it executable at do_pre_smp_initcalls() at least, 92 + * thus run it as a early_initcall(). 91 93 */ 92 94 static int __init set_real_mode_permissions(void) 93 95 { ··· 113 111 114 112 return 0; 115 113 } 116 - 117 - arch_initcall(set_real_mode_permissions); 114 + early_initcall(set_real_mode_permissions);