001-mips-o32-fix-build.patch 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. From 2c8b6de913973274e877639658e9e7273a012adb Mon Sep 17 00:00:00 2001
  2. From: "Dmitry V. Levin" <[email protected]>
  3. Date: Tue, 8 Jan 2019 19:23:44 +0000
  4. Subject: [PATCH] mips o32: fix build
  5. Commit 917c2ccf3a67 "Refactor stack pointers" moved mips_REG_* macros
  6. from linux/mips/arch_regs.h to linux/mips/arch_regs.c because these
  7. macros are no longer used outside syscall.c or files included by
  8. syscall.c, but this caused a build regression on mips o32 because
  9. decode_syscall_subcall() uses mips_REG_SP prior to its definition.
  10. * syscall.c (decode_syscall_subcall): Move ...
  11. * linux/mips/get_syscall_args.c: ... here.
  12. * NEWS: Mention this fix.
  13. Reported-by: Baruch Siach <[email protected]>
  14. Fixes: v4.26~61 "Refactor stack pointers"
  15. ---
  16. NEWS | 1 +
  17. linux/mips/get_syscall_args.c | 26 ++++++++++++++++++++++++++
  18. syscall.c | 27 ++-------------------------
  19. 3 files changed, 29 insertions(+), 25 deletions(-)
  20. --- a/linux/mips/get_syscall_args.c
  21. +++ b/linux/mips/get_syscall_args.c
  22. @@ -37,3 +37,29 @@ arch_get_syscall_args(struct tcb *tcp)
  23. #endif
  24. return 1;
  25. }
  26. +
  27. +#ifdef SYS_syscall_subcall
  28. +static void
  29. +decode_syscall_subcall(struct tcb *tcp)
  30. +{
  31. + if (!scno_is_valid(tcp->u_arg[0]))
  32. + return;
  33. + tcp->scno = tcp->u_arg[0];
  34. + tcp->qual_flg = qual_flags(tcp->scno);
  35. + tcp->s_ent = &sysent[tcp->scno];
  36. + memmove(&tcp->u_arg[0], &tcp->u_arg[1],
  37. + sizeof(tcp->u_arg) - sizeof(tcp->u_arg[0]));
  38. + /*
  39. + * Fetching the last arg of 7-arg syscalls (fadvise64_64
  40. + * and sync_file_range) requires additional code,
  41. + * see linux/mips/get_syscall_args.c
  42. + */
  43. + if (tcp->s_ent->nargs == MAX_ARGS) {
  44. + if (umoven(tcp,
  45. + mips_REG_SP + MAX_ARGS * sizeof(tcp->u_arg[0]),
  46. + sizeof(tcp->u_arg[0]),
  47. + &tcp->u_arg[MAX_ARGS - 1]) < 0)
  48. + tcp->u_arg[MAX_ARGS - 1] = 0;
  49. + }
  50. +}
  51. +#endif /* SYS_syscall_subcall */
  52. --- a/syscall.c
  53. +++ b/syscall.c
  54. @@ -349,31 +349,8 @@ decode_ipc_subcall(struct tcb *tcp)
  55. #endif /* SYS_ipc_subcall */
  56. #ifdef SYS_syscall_subcall
  57. -static void
  58. -decode_syscall_subcall(struct tcb *tcp)
  59. -{
  60. - if (!scno_is_valid(tcp->u_arg[0]))
  61. - return;
  62. - tcp->scno = tcp->u_arg[0];
  63. - tcp->qual_flg = qual_flags(tcp->scno);
  64. - tcp->s_ent = &sysent[tcp->scno];
  65. - memmove(&tcp->u_arg[0], &tcp->u_arg[1],
  66. - sizeof(tcp->u_arg) - sizeof(tcp->u_arg[0]));
  67. -# ifdef LINUX_MIPSO32
  68. - /*
  69. - * Fetching the last arg of 7-arg syscalls (fadvise64_64
  70. - * and sync_file_range) requires additional code,
  71. - * see linux/mips/get_syscall_args.c
  72. - */
  73. - if (tcp->s_ent->nargs == MAX_ARGS) {
  74. - if (umoven(tcp,
  75. - mips_REG_SP + MAX_ARGS * sizeof(tcp->u_arg[0]),
  76. - sizeof(tcp->u_arg[0]),
  77. - &tcp->u_arg[MAX_ARGS - 1]) < 0)
  78. - tcp->u_arg[MAX_ARGS - 1] = 0;
  79. - }
  80. -# endif /* LINUX_MIPSO32 */
  81. -}
  82. +/* The implementation is architecture specific. */
  83. +static void decode_syscall_subcall(struct tcb *);
  84. #endif /* SYS_syscall_subcall */
  85. static void