0103-x86-entry-32-Fix-cpu_current_top_of_stack-initializa.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. From 870277eb767ecec9293c5dd5ba5bf1c912251e85 Mon Sep 17 00:00:00 2001
  2. From: Andy Lutomirski <[email protected]>
  3. Date: Thu, 2 Nov 2017 00:59:15 -0700
  4. Subject: [PATCH 103/242] x86/entry/32: Fix cpu_current_top_of_stack
  5. initialization at boot
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. CVE-2017-5754
  10. cpu_current_top_of_stack's initialization forgot about
  11. TOP_OF_KERNEL_STACK_PADDING. This bug didn't matter because the
  12. idle threads never enter user mode.
  13. Signed-off-by: Andy Lutomirski <[email protected]>
  14. Reviewed-by: Borislav Petkov <[email protected]>
  15. Cc: Borislav Petkov <[email protected]>
  16. Cc: Brian Gerst <[email protected]>
  17. Cc: Dave Hansen <[email protected]>
  18. Cc: Linus Torvalds <[email protected]>
  19. Cc: Peter Zijlstra <[email protected]>
  20. Cc: Thomas Gleixner <[email protected]>
  21. Link: http://lkml.kernel.org/r/e5e370a7e6e4fddd1c4e4cf619765d96bb874b21.1509609304.git.luto@kernel.org
  22. Signed-off-by: Ingo Molnar <[email protected]>
  23. (cherry picked from commit cd493a6deb8b78eca280d05f7fa73fd69403ae29)
  24. Signed-off-by: Andy Whitcroft <[email protected]>
  25. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  26. (cherry picked from commit 258c98e7d4b8f1459772e656cd736c028a13add9)
  27. Signed-off-by: Fabian Grünbichler <[email protected]>
  28. ---
  29. arch/x86/kernel/smpboot.c | 3 +--
  30. 1 file changed, 1 insertion(+), 2 deletions(-)
  31. diff --git a/arch/x86/kernel/smpboot.c b/arch/x86/kernel/smpboot.c
  32. index d05006f6c31c..8ea3b18cbdc1 100644
  33. --- a/arch/x86/kernel/smpboot.c
  34. +++ b/arch/x86/kernel/smpboot.c
  35. @@ -961,8 +961,7 @@ void common_cpu_up(unsigned int cpu, struct task_struct *idle)
  36. #ifdef CONFIG_X86_32
  37. /* Stack for startup_32 can be just as for start_secondary onwards */
  38. irq_ctx_init(cpu);
  39. - per_cpu(cpu_current_top_of_stack, cpu) =
  40. - (unsigned long)task_stack_page(idle) + THREAD_SIZE;
  41. + per_cpu(cpu_current_top_of_stack, cpu) = task_top_of_stack(idle);
  42. #else
  43. initial_gs = per_cpu_offset(cpu);
  44. #endif
  45. --
  46. 2.14.2