010-mips-Fix-new-syscall-numbers.patch 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143
  1. From 82e935c564699456a766044faa39367b47cce793 Mon Sep 17 00:00:00 2001
  2. From: Hauke Mehrtens <hauke@hauke-m.de>
  3. Date: Sun, 31 Oct 2021 23:11:11 +0100
  4. Subject: [PATCH] mips: Fix new syscall numbers
  5. The MIPS32 and MIPS64 O32 ABI are adding 4000 to all syscall numbers.
  6. The MIPS64 N64 ABI adds 5000 to each syscall and the MIPS64 N32 ABI adds
  7. 6000 to each syscall number. We can not use the shared file for MIPS and
  8. have to define this for each sycall separately.
  9. Without this change valgrind is not able to detect new syscalls like
  10. clock_gettime64 correctly.
  11. Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
  12. ---
  13. include/pub_tool_vkiscnums_asm.h | 3 --
  14. include/vki/vki-scnums-mips32-linux.h | 40 +++++++++++++++++++++++++++
  15. include/vki/vki-scnums-mips64-linux.h | 40 +++++++++++++++++++++++++++
  16. 3 files changed, 80 insertions(+), 3 deletions(-)
  17. --- a/include/pub_tool_vkiscnums_asm.h
  18. +++ b/include/pub_tool_vkiscnums_asm.h
  19. @@ -63,15 +63,12 @@
  20. # include "vki/vki-scnums-arm64-linux.h"
  21. #elif defined(VGP_mips32_linux)
  22. -# include "vki/vki-scnums-shared-linux.h"
  23. -# include "vki/vki-scnums-32bit-linux.h"
  24. # include "vki/vki-scnums-mips32-linux.h"
  25. #elif defined(VGP_nanomips_linux)
  26. # include "vki/vki-scnums-nanomips-linux.h"
  27. #elif defined(VGP_mips64_linux)
  28. -# include "vki/vki-scnums-shared-linux.h"
  29. # include "vki/vki-scnums-mips64-linux.h"
  30. #elif defined(VGP_x86_freebsd) || defined(VGP_amd64_freebsd)
  31. --- a/include/vki/vki-scnums-mips32-linux.h
  32. +++ b/include/vki/vki-scnums-mips32-linux.h
  33. @@ -401,6 +401,46 @@
  34. #define __NR_pkey_free (__NR_Linux + 365)
  35. #define __NR_statx (__NR_Linux + 366)
  36. +#define __NR_clock_gettime64 (__NR_Linux + 403)
  37. +#define __NR_clock_settime64 (__NR_Linux + 404)
  38. +#define __NR_clock_adjtime64 (__NR_Linux + 405)
  39. +#define __NR_clock_getres_time64 (__NR_Linux + 406)
  40. +#define __NR_clock_nanosleep_time64 (__NR_Linux + 407)
  41. +#define __NR_timer_gettime64 (__NR_Linux + 408)
  42. +#define __NR_timer_settime64 (__NR_Linux + 409)
  43. +#define __NR_timerfd_gettime64 (__NR_Linux + 410)
  44. +#define __NR_timerfd_settime64 (__NR_Linux + 411)
  45. +#define __NR_utimensat_time64 (__NR_Linux + 412)
  46. +#define __NR_pselect6_time64 (__NR_Linux + 413)
  47. +#define __NR_ppoll_time64 (__NR_Linux + 414)
  48. +#define __NR_io_pgetevents_time64 (__NR_Linux + 416)
  49. +#define __NR_recvmmsg_time64 (__NR_Linux + 417)
  50. +#define __NR_mq_timedsend_time64 (__NR_Linux + 418)
  51. +#define __NR_mq_timedreceive_time64 (__NR_Linux + 419)
  52. +#define __NR_semtimedop_time64 (__NR_Linux + 420)
  53. +#define __NR_rt_sigtimedwait_time64 (__NR_Linux + 421)
  54. +#define __NR_futex_time64 (__NR_Linux + 422)
  55. +#define __NR_sched_rr_get_interval_time64 (__NR_Linux + 423)
  56. +#define __NR_pidfd_send_signal (__NR_Linux + 424)
  57. +#define __NR_io_uring_setup (__NR_Linux + 425)
  58. +#define __NR_io_uring_enter (__NR_Linux + 426)
  59. +#define __NR_io_uring_register (__NR_Linux + 427)
  60. +#define __NR_open_tree (__NR_Linux + 428)
  61. +#define __NR_move_mount (__NR_Linux + 429)
  62. +#define __NR_fsopen (__NR_Linux + 430)
  63. +#define __NR_fsconfig (__NR_Linux + 431)
  64. +#define __NR_fsmount (__NR_Linux + 432)
  65. +#define __NR_fspick (__NR_Linux + 433)
  66. +
  67. +#define __NR_pidfd_open (__NR_Linux + 434)
  68. +#define __NR_clone3 (__NR_Linux + 435)
  69. +#define __NR_close_range (__NR_Linux + 436)
  70. +#define __NR_openat2 (__NR_Linux + 437)
  71. +
  72. +#define __NR_faccessat2 (__NR_Linux + 439)
  73. +
  74. +#define __NR_epoll_pwait2 (__NR_Linux + 441)
  75. +
  76. /*
  77. * Offset of the last Linux o32 flavoured syscall
  78. */
  79. --- a/include/vki/vki-scnums-mips64-linux.h
  80. +++ b/include/vki/vki-scnums-mips64-linux.h
  81. @@ -363,6 +363,26 @@
  82. #define __NR_pkey_free (__NR_Linux + 325)
  83. #define __NR_statx (__NR_Linux + 326)
  84. +#define __NR_pidfd_send_signal (__NR_Linux + 424)
  85. +#define __NR_io_uring_setup (__NR_Linux + 425)
  86. +#define __NR_io_uring_enter (__NR_Linux + 426)
  87. +#define __NR_io_uring_register (__NR_Linux + 427)
  88. +#define __NR_open_tree (__NR_Linux + 428)
  89. +#define __NR_move_mount (__NR_Linux + 429)
  90. +#define __NR_fsopen (__NR_Linux + 430)
  91. +#define __NR_fsconfig (__NR_Linux + 431)
  92. +#define __NR_fsmount (__NR_Linux + 432)
  93. +#define __NR_fspick (__NR_Linux + 433)
  94. +
  95. +#define __NR_pidfd_open (__NR_Linux + 434)
  96. +#define __NR_clone3 (__NR_Linux + 435)
  97. +#define __NR_close_range (__NR_Linux + 436)
  98. +#define __NR_openat2 (__NR_Linux + 437)
  99. +
  100. +#define __NR_faccessat2 (__NR_Linux + 439)
  101. +
  102. +#define __NR_epoll_pwait2 (__NR_Linux + 441)
  103. +
  104. #elif defined(VGABI_N32)
  105. /*
  106. @@ -702,6 +722,26 @@
  107. #define __NR_pkey_free (__NR_Linux + 329)
  108. #define __NR_statx (__NR_Linux + 330)
  109. +#define __NR_pidfd_send_signal (__NR_Linux + 424)
  110. +#define __NR_io_uring_setup (__NR_Linux + 425)
  111. +#define __NR_io_uring_enter (__NR_Linux + 426)
  112. +#define __NR_io_uring_register (__NR_Linux + 427)
  113. +#define __NR_open_tree (__NR_Linux + 428)
  114. +#define __NR_move_mount (__NR_Linux + 429)
  115. +#define __NR_fsopen (__NR_Linux + 430)
  116. +#define __NR_fsconfig (__NR_Linux + 431)
  117. +#define __NR_fsmount (__NR_Linux + 432)
  118. +#define __NR_fspick (__NR_Linux + 433)
  119. +
  120. +#define __NR_pidfd_open (__NR_Linux + 434)
  121. +#define __NR_clone3 (__NR_Linux + 435)
  122. +#define __NR_close_range (__NR_Linux + 436)
  123. +#define __NR_openat2 (__NR_Linux + 437)
  124. +
  125. +#define __NR_faccessat2 (__NR_Linux + 439)
  126. +
  127. +#define __NR_epoll_pwait2 (__NR_Linux + 441)
  128. +
  129. #else
  130. #error unknown mips64 abi
  131. #endif