From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1SiZVE-0005nV-CN for garchives@archives.gentoo.org; Sat, 23 Jun 2012 23:12:29 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id E8E1821C103; Sat, 23 Jun 2012 23:12:08 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id B575121C102 for ; Sat, 23 Jun 2012 23:12:08 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 1C8261B4041 for ; Sat, 23 Jun 2012 23:12:08 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id CF254E5436 for ; Sat, 23 Jun 2012 23:12:06 +0000 (UTC) From: "Mike Frysinger" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Mike Frysinger" Message-ID: <1340492847.4fcb367b1a7ff06a55c8bc4a25c38e46b77a1261.vapier@gentoo> Subject: [gentoo-commits] proj/sandbox:master commit in: / X-VCS-Repository: proj/sandbox X-VCS-Files: configure.ac localdecls.h X-VCS-Directories: / X-VCS-Committer: vapier X-VCS-Committer-Name: Mike Frysinger X-VCS-Revision: 4fcb367b1a7ff06a55c8bc4a25c38e46b77a1261 X-VCS-Branch: master Date: Sat, 23 Jun 2012 23:12:06 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: 00a88a4c-e26c-4ab0-ab45-8f86b5232b23 X-Archives-Hash: 43d9c3c59c96bcd916c8947ebf732733 commit: 4fcb367b1a7ff06a55c8bc4a25c38e46b77a1261 Author: Mike Frysinger gentoo org> AuthorDate: Sat Jun 23 02:42:08 2012 +0000 Commit: Mike Frysinger gentoo org> CommitDate: Sat Jun 23 23:07:27 2012 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/sandbox.git;a= =3Dcommit;h=3D4fcb367b libsandbox: handle broken kernel headers Sometimes the struct in asm/ptrace.h is too small for what the kernel actually writes. Check to see which struct is larger (the one that the kernel declares or the C library declares), and use that. Signed-off-by: Mike Frysinger gentoo.org> --- configure.ac | 2 ++ localdecls.h | 11 +++++++++++ 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 ]) save_CPPFLAGS=3D$CPPFLAGS CPPFLAGS=3D"-I$srcdir $CPPFLAGS" AC_CHECK_TYPES([struct user_regs_struct, struct pt_regs],,,[#include "he= aders.h"]) +AC_CHECK_SIZEOF([struct user_regs_struct],,[#include "headers.h"]) +AC_CHECK_SIZEOF([struct pt_regs],,[#include "headers.h"]) CPPFLAGS=3D$save_CPPFLAGS =20 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 =20 #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)