From 22e8c33b21e83e48adb1bc914c8298083130fa0d Mon Sep 17 00:00:00 2001 From: Mark Mentovai Date: Mon, 13 Nov 2017 17:03:32 -0500 Subject: [PATCH] linux: Provide PTRACE_GET_THREAD_AREA for 32-bit x86 with glibc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit glibc’s own should provide this but doesn’t. See https://sourceware.org/bugzilla/show_bug.cgi?id=22433. The copy in compat provided it when targeting x86-64 and using glibc. util/linux/ptracer.cc uses it when targeting both 32-bit x86 and x86-64, so the compat definition must be made to apply to 32-bit x86 too. This also provides a #define using the same name as the constant, which is what glibc’s does for other constants. Bug: crashpad:30 Change-Id: I5a0734a236d1c25398fb69e66f58dfe118658b68 Reviewed-on: https://chromium-review.googlesource.com/765257 Commit-Queue: Mark Mentovai Reviewed-by: Joshua Peraza --- compat/linux/sys/ptrace.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/compat/linux/sys/ptrace.h b/compat/linux/sys/ptrace.h index 57c5c5ba..e68125b5 100644 --- a/compat/linux/sys/ptrace.h +++ b/compat/linux/sys/ptrace.h @@ -19,9 +19,12 @@ #include -#if defined(__GLIBC__) && defined(__x86_64__) +// https://sourceware.org/bugzilla/show_bug.cgi?id=22433 +#if !defined(PTRACE_GET_THREAD_AREA) && \ + defined(__GLIBC__) && (defined(__i386__) || defined(__x86_64__)) static constexpr __ptrace_request PTRACE_GET_THREAD_AREA = static_cast<__ptrace_request>(25); -#endif // __GLIBC__ && __x86_64__ +#define PTRACE_GET_THREAD_AREA PTRACE_GET_THREAD_AREA +#endif // !PTRACE_GET_THREAD_AREA && __GLIBC__ && (__i386__ || __x86_64__) #endif // CRASHPAD_COMPAT_LINUX_SYS_PTRACE_H_