102-MIPS-only-process-negative-stack-offsets-on-stack-tr.patch 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. From: Felix Fietkau <[email protected]>
  2. Date: Wed, 18 Apr 2018 10:50:05 +0200
  3. Subject: [PATCH] MIPS: only process negative stack offsets on stack traces
  4. Fixes endless back traces in cases where the compiler emits a stack
  5. pointer increase in a branch delay slot (probably for some form of
  6. function return).
  7. [ 3.475442] BUG: MAX_STACK_TRACE_ENTRIES too low!
  8. [ 3.480070] turning off the locking correctness validator.
  9. [ 3.485521] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.14.34 #0
  10. [ 3.491475] Stack : 00000000 00000000 00000000 00000000 80e0fce2 00000034 00000000 00000000
  11. [ 3.499764] 87c3838c 80696377 8061047c 00000000 00000001 00000001 87c2d850 6534689f
  12. [ 3.508059] 00000000 00000000 80e10000 00000000 00000000 000000cf 0000000f 00000000
  13. [ 3.516353] 00000000 806a0000 00076891 00000000 00000000 00000000 ffffffff 00000000
  14. [ 3.524648] 806c0000 00000004 80e10000 806a0000 00000003 80690000 00000000 80700000
  15. [ 3.532942] ...
  16. [ 3.535362] Call Trace:
  17. [ 3.537818] [<80010a48>] show_stack+0x58/0x100
  18. [ 3.542207] [<804c2f78>] dump_stack+0xe8/0x170
  19. [ 3.546613] [<80079f90>] save_trace+0xf0/0x110
  20. [ 3.551010] [<8007b1ec>] mark_lock+0x33c/0x78c
  21. [ 3.555413] [<8007bf48>] __lock_acquire+0x2ac/0x1a08
  22. [ 3.560337] [<8007de60>] lock_acquire+0x64/0x8c
  23. [ 3.564846] [<804e1570>] _raw_spin_lock_irqsave+0x54/0x78
  24. [ 3.570186] [<801b618c>] kernfs_notify+0x94/0xac
  25. [ 3.574770] [<801b7b10>] sysfs_notify+0x74/0xa0
  26. [ 3.579257] [<801b618c>] kernfs_notify+0x94/0xac
  27. [ 3.583839] [<801b7b10>] sysfs_notify+0x74/0xa0
  28. [ 3.588329] [<801b618c>] kernfs_notify+0x94/0xac
  29. [ 3.592911] [<801b7b10>] sysfs_notify+0x74/0xa0
  30. [ 3.597401] [<801b618c>] kernfs_notify+0x94/0xac
  31. [ 3.601983] [<801b7b10>] sysfs_notify+0x74/0xa0
  32. [ 3.606473] [<801b618c>] kernfs_notify+0x94/0xac
  33. [ 3.611055] [<801b7b10>] sysfs_notify+0x74/0xa0
  34. [ 3.615545] [<801b618c>] kernfs_notify+0x94/0xac
  35. [ 3.620125] [<801b7b10>] sysfs_notify+0x74/0xa0
  36. [ 3.624619] [<801b618c>] kernfs_notify+0x94/0xac
  37. [ 3.629197] [<801b7b10>] sysfs_notify+0x74/0xa0
  38. [ 3.633691] [<801b618c>] kernfs_notify+0x94/0xac
  39. [ 3.638269] [<801b7b10>] sysfs_notify+0x74/0xa0
  40. [ 3.642763] [<801b618c>] kernfs_notify+0x94/0xac
  41. Signed-off-by: Felix Fietkau <[email protected]>
  42. ---
  43. --- a/arch/mips/kernel/process.c
  44. +++ b/arch/mips/kernel/process.c
  45. @@ -395,6 +395,8 @@ static inline int is_sp_move_ins(union m
  46. if (ip->i_format.opcode == addiu_op ||
  47. ip->i_format.opcode == daddiu_op) {
  48. + if (ip->i_format.simmediate > 0)
  49. + return 0;
  50. *frame_size = -ip->i_format.simmediate;
  51. return 1;
  52. }