Skip to content

Commit

Permalink
x86, cpu: Call verify_cpu during 32bit CPU startup
Browse files Browse the repository at this point in the history
The XD_DISABLE-clearing side-effect needs to happen for both 32bit
and 64bit, but the 32bit init routines were not calling verify_cpu()
yet. This adds that call to gain the side-effect.

The longmode/SSE tests being performed in verify_cpu() need to happen very
early for 64bit but not for 32bit. Instead of including it in two places
for 32bit, we can just include it once in arch/x86/kernel/head_32.S.

Signed-off-by: Kees Cook <kees.cook@canonical.com>
LKML-Reference: <1289414154-7829-4-git-send-email-kees.cook@canonical.com>
Acked-by: Pekka Enberg <penberg@kernel.org>
Acked-by: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: H. Peter Anvin <hpa@linux.intel.com>
  • Loading branch information
Kees Cook authored and H. Peter Anvin committed Nov 10, 2010
1 parent ae84739 commit ebba638
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions arch/x86/kernel/head_32.S
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ ENTRY(startup_32_smp)
subl $0x80000001, %eax
cmpl $(0x8000ffff-0x80000001), %eax
ja 6f

/* Clear bogus XD_DISABLE bits */
call verify_cpu

mov $0x80000001, %eax
cpuid
/* Execute Disable bit supported? */
Expand Down Expand Up @@ -609,6 +613,8 @@ ignore_int:
#endif
iret

#include "verify_cpu.S"

__REFDATA
.align 4
ENTRY(initial_code)
Expand Down
1 change: 1 addition & 0 deletions arch/x86/kernel/verify_cpu.S
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
* arch/x86_64/boot/compressed/head_64.S: Boot cpu verification
* arch/x86_64/kernel/trampoline_64.S: secondary processor verfication
* arch/x86_64/kernel/head_32.S: processor startup
*
* verify_cpu, returns the status of longmode and SSE in register %eax.
* 0: Success 1: Failure
Expand Down

0 comments on commit ebba638

Please sign in to comment.