m68knommu-fix-signal.patch 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. m68knommu: fix user a5 register being overwritten
  2. On no-MMU systems the application a5 register can be overwitten with the
  3. address of the process data segment when processing application signals.
  4. For flat format applications compiled with full absolute relocation this
  5. effectively corrupts the a5 register on signal processing - and this very
  6. quickly leads to process crash and often takes out the whole system with
  7. a panic as well.
  8. This has no effect on flat format applications compiled with the more
  9. common PIC methods (such as -msep-data). These format applications reserve
  10. a5 for the pointer to the data segment anyway - so it doesn't change it.
  11. A long time ago the a5 register was used in the code packed into the user
  12. stack to enable signal return processing. And so it had to be restored on
  13. end of signal cleanup processing back to the original a5 user value. This
  14. was historically done by saving away a5 in the sigcontext structure. At
  15. some point (a long time back it seems) the a5 restore process was changed
  16. and it was hard coded to put the user data segment address directly into a5.
  17. Which is ok for the common PIC compiled application case, but breaks the
  18. full relocation application code.
  19. We no longer use this type of signal handling mechanism and so we don't
  20. need to do anything special to save and restore a5 at all now. So remove the
  21. code that hard codes a5 to the address of the user data segment.
  22. Signed-off-by: Greg Ungerer <gerg@linux-m68k.org>
  23. ---
  24. arch/m68k/kernel/signal.c | 1 -
  25. 1 file changed, 1 deletion(-)
  26. diff --git a/arch/m68k/kernel/signal.c b/arch/m68k/kernel/signal.c
  27. index 2dcee3a..9202f82 100644
  28. --- a/arch/m68k/kernel/signal.c
  29. +++ b/arch/m68k/kernel/signal.c
  30. @@ -213,7 +213,6 @@ static inline int frame_extra_sizes(int f)
  31. static inline void adjustformat(struct pt_regs *regs)
  32. {
  33. - ((struct switch_stack *)regs - 1)->a5 = current->mm->start_data;
  34. /*
  35. * set format byte to make stack appear modulo 4, which it will
  36. * be when doing the rte
  37. --
  38. 1.9.1