0099-x86-entry-Add-task_top_of_stack-to-find-the-top-of-a.patch 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. From 181d224dabca9a9061a6955cf3d49a4eba7294bf Mon Sep 17 00:00:00 2001
  2. From: Andy Lutomirski <[email protected]>
  3. Date: Thu, 2 Nov 2017 00:59:11 -0700
  4. Subject: [PATCH 099/242] x86/entry: Add task_top_of_stack() to find the top of
  5. a task's stack
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. CVE-2017-5754
  10. This will let us get rid of a few places that hardcode accesses to
  11. thread.sp0.
  12. Signed-off-by: Andy Lutomirski <[email protected]>
  13. Cc: Borislav Petkov <[email protected]>
  14. Cc: Brian Gerst <[email protected]>
  15. Cc: Dave Hansen <[email protected]>
  16. Cc: Linus Torvalds <[email protected]>
  17. Cc: Peter Zijlstra <[email protected]>
  18. Cc: Thomas Gleixner <[email protected]>
  19. Link: http://lkml.kernel.org/r/b49b3f95a8ff858c40c9b0f5b32be0355324327d.1509609304.git.luto@kernel.org
  20. Signed-off-by: Ingo Molnar <[email protected]>
  21. (cherry picked from commit 3500130b84a3cdc5b6796eba1daf178944935efe)
  22. Signed-off-by: Andy Whitcroft <[email protected]>
  23. Signed-off-by: Kleber Sacilotto de Souza <[email protected]>
  24. (cherry picked from commit f1078e10e361afaeb22ee72c54d5ad397e19728d)
  25. Signed-off-by: Fabian Grünbichler <[email protected]>
  26. ---
  27. arch/x86/include/asm/processor.h | 2 ++
  28. 1 file changed, 2 insertions(+)
  29. diff --git a/arch/x86/include/asm/processor.h b/arch/x86/include/asm/processor.h
  30. index 85ddfc1a9bb5..f83fbf1b6dd9 100644
  31. --- a/arch/x86/include/asm/processor.h
  32. +++ b/arch/x86/include/asm/processor.h
  33. @@ -788,6 +788,8 @@ static inline void spin_lock_prefetch(const void *x)
  34. #define TOP_OF_INIT_STACK ((unsigned long)&init_stack + sizeof(init_stack) - \
  35. TOP_OF_KERNEL_STACK_PADDING)
  36. +#define task_top_of_stack(task) ((unsigned long)(task_pt_regs(task) + 1))
  37. +
  38. #ifdef CONFIG_X86_32
  39. /*
  40. * User space process size: 3GB (default).
  41. --
  42. 2.14.2