aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--configure.ac2
-rw-r--r--localdecls.h11
2 files changed, 13 insertions, 0 deletions
diff --git a/configure.ac b/configure.ac
index da6f75d..573e412 100644
--- a/configure.ac
+++ b/configure.ac
@@ -119,6 +119,8 @@ AC_CHECK_TYPES([sighandler_t, sig_t, __sighandler_t],,,[#include <signal.h>])
save_CPPFLAGS=$CPPFLAGS
CPPFLAGS="-I$srcdir $CPPFLAGS"
AC_CHECK_TYPES([struct user_regs_struct, struct pt_regs],,,[#include "headers.h"])
+AC_CHECK_SIZEOF([struct user_regs_struct],,[#include "headers.h"])
+AC_CHECK_SIZEOF([struct pt_regs],,[#include "headers.h"])
CPPFLAGS=$save_CPPFLAGS
dnl Checks for library functions.
diff --git a/localdecls.h b/localdecls.h
index eef7295..be99617 100644
--- a/localdecls.h
+++ b/localdecls.h
@@ -68,6 +68,17 @@ typedef __sighandler_t sighandler_t;
#endif
#define HAVE_TRACE_REGS
+#if defined(HAVE_STRUCT_PT_REGS) && defined(HAVE_STRUCT_USER_REGS_STRUCT)
+/*
+ * Some systems have broken kernel headers who declare struct pt_regs as
+ * smaller than what the kernel actually operates on. If we have both
+ * reg structs available, pick the one that is larger in the hopes that
+ * we won't randomly clobber memory.
+ */
+# if SIZEOF_STRUCT_PT_REGS < SIZEOF_STRUCT_USER_REGS_STRUCT
+# undef HAVE_STRUCT_PT_REGS
+# endif
+#endif
#if defined(HAVE_STRUCT_PT_REGS)
typedef struct pt_regs trace_regs;
#elif defined(HAVE_STRUCT_USER_REGS_STRUCT)