0003-src-client-linux-handler-exception_handler.cc-rename.patch 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. From 2fa414c8655c421e7eb0bb1719928babb0ecf7c6 Mon Sep 17 00:00:00 2001
  2. From: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  3. Date: Thu, 26 Dec 2019 22:21:33 +0100
  4. Subject: [PATCH] src/client/linux/handler/exception_handler.cc: rename tgkill
  5. to BreakpadTgkill()
  6. MIME-Version: 1.0
  7. Content-Type: text/plain; charset=UTF-8
  8. Content-Transfer-Encoding: 8bit
  9. Since glibc 2.30, a tgkill() function was added in the C library, and
  10. its definition obviously conflicts with the internal definition of
  11. google-breakpad, causing build failures:
  12. src/client/linux/handler/exception_handler.cc:109:12: error: ‘int tgkill(pid_t, pid_t, int)’ was declared ‘extern’ and later ‘static’ [-fpermissive]
  13. 109 | static int tgkill(pid_t tgid, pid_t tid, int sig) {
  14. | ^~~~~~
  15. In file included from /usr/include/signal.h:374,
  16. from ./src/client/linux/handler/exception_handler.h:33,
  17. from src/client/linux/handler/exception_handler.cc:66:
  18. /usr/include/bits/signal_ext.h:29:12: note: previous declaration of ‘int tgkill(__pid_t, __pid_t, int)’
  19. 29 | extern int tgkill (__pid_t __tgid, __pid_t __tid, int __signal);
  20. | ^~~~~~
  21. Upstream google-breakpad simply dropped the use of the internal
  22. tgkill() in commit
  23. https://chromium.googlesource.com/breakpad/breakpad/+/7e3c165000d44fa153a3270870ed500bc8bbb461. However,
  24. this is not realistic for Buildroot, since we do support old systems
  25. where the system C library will not necessarily provide tgkill().
  26. Signed-off-by: Thomas Petazzoni <thomas.petazzoni@bootlin.com>
  27. ---
  28. src/client/linux/handler/exception_handler.cc | 4 ++--
  29. 1 file changed, 2 insertions(+), 2 deletions(-)
  30. diff --git a/src/client/linux/handler/exception_handler.cc b/src/client/linux/handler/exception_handler.cc
  31. index b63f973b..b4c279b8 100644
  32. --- a/src/client/linux/handler/exception_handler.cc
  33. +++ b/src/client/linux/handler/exception_handler.cc
  34. @@ -106,7 +106,7 @@
  35. #endif
  36. // A wrapper for the tgkill syscall: send a signal to a specific thread.
  37. -static int tgkill(pid_t tgid, pid_t tid, int sig) {
  38. +static int BreakpadTgkill(pid_t tgid, pid_t tid, int sig) {
  39. return syscall(__NR_tgkill, tgid, tid, sig);
  40. return 0;
  41. }
  42. @@ -387,7 +387,7 @@ void ExceptionHandler::SignalHandler(int sig, siginfo_t* info, void* uc) {
  43. // In order to retrigger it, we have to queue a new signal by calling
  44. // kill() ourselves. The special case (si_pid == 0 && sig == SIGABRT) is
  45. // due to the kernel sending a SIGABRT from a user request via SysRQ.
  46. - if (tgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
  47. + if (BreakpadTgkill(getpid(), syscall(__NR_gettid), sig) < 0) {
  48. // If we failed to kill ourselves (e.g. because a sandbox disallows us
  49. // to do so), we instead resort to terminating our process. This will
  50. // result in an incorrect exit code.
  51. --
  52. 2.24.1