3.8.1-20 Add valgrind-3.8.1-ptrace-include-configure.patch (#992847)

This commit is contained in:
Mark Wielaard 2013-08-08 14:47:40 +02:00
parent eec2f9fae6
commit c4cbc6042e
2 changed files with 195 additions and 1 deletions

View File

@ -0,0 +1,187 @@
commit e40952a7bbfa5ddbd5c4dc00392363a7069d3c15
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Thu Jul 25 20:40:17 2013 +0000
do not include linux/ptrace.h in vgdb.c
Include of linux/ptrace.h was added in revision r11740,
to avoid compilation error on s390x (fedora and suse).
The compilation error was retrieved thanks to archeological research
done by Christian Borntraeger: without this include, the following was given:
error: 'PT_ENDREGS' undeclared
There was also some errors on ppc64 around the same time:
error: 'PTRACE_GETREGS' undeclared
Currently, the inclusion of linux/ptrace.h gives a problem on amd64/fedora20:
/usr/include/linux/ptrace.h:58:8: error: redefinition of struct ptrace_peeksiginfo_args
/usr/include/sys/ptrace.h:191:8: note: originally defined here
According to man ptrace, it is good enough to include sys/ptrace.h
(which should avoid the problem on amd64/f20).
The linux/ptrace.h is deemed not necessary anymore as:
1. Christian has tested on sles11sp2 on s390x.
2. since linux/ptrace.h was added in vgdb.c, #ifdef PT_ENDREGS and
#ifdef PTRACE_GETREGS were added
=> remove the linux/ptrace.h
(tested on x86/f12, ppc64/f18, amd64/deb6, sles11sp2/s390x)
Thanks to Christian for the investigations
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13471 a5019735-40e9-0310-863c-91ae7b9d1cf9
commit f03cccfa732b9890860ba7fb743c5f0938515ab9
Author: philippe <philippe@a5019735-40e9-0310-863c-91ae7b9d1cf9>
Date: Sat Aug 3 20:34:58 2013 +0000
Update configure machinery to detect PTRACE_GETREGS
Using #ifdef PTRACE_GETREGS gives difficulties as in some
platforms (e.g. mips) PTRACE_GETREGS is not defined as a
preprocessor symbols unless linux/ptrace.h is included.
However, including linux/ptrace.h causes compilation error on some
other platforms
=> better detect that PTRACE_GETREGS can be used using the
configure machinery.
This should make vgdb PTRACE_GETREGS working again on
various platforms (x86/amd64/mips/...) as PTRACE_GETREGS
was disabled on all of these following r13471
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13482 a5019735-40e9-0310-863c-91ae7b9d1cf9
diff -ur valgrind-3.8.1.orig/config.h.in valgrind-3.8.1/config.h.in
--- valgrind-3.8.1.orig/config.h.in 2013-08-08 13:32:08.086267278 +0200
+++ valgrind-3.8.1/config.h.in 2013-08-08 13:49:16.000000000 +0200
@@ -207,6 +207,9 @@
/* Define to 1 if you have the `pthread_yield' function. */
#undef HAVE_PTHREAD_YIELD
+/* Define to 1 if you have the `PTRACE_GETREGS' ptrace request. */
+#undef HAVE_PTRACE_GETREGS
+
/* Define to 1 if you have the `readlinkat' function. */
#undef HAVE_READLINKAT
diff -ur valgrind-3.8.1.orig/configure valgrind-3.8.1/configure
--- valgrind-3.8.1.orig/configure 2013-08-08 13:32:08.122267596 +0200
+++ valgrind-3.8.1/configure 2013-08-08 13:49:21.697522489 +0200
@@ -6731,6 +6731,45 @@
# Checking for various library functions and other definitions
#----------------------------------------------------------------------------
+# Check for PTRACE_GETREGS
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for PTRACE_GETREGS" >&5
+$as_echo_n "checking for PTRACE_GETREGS... " >&6; }
+cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
+
+#include <stddef.h>
+#include <sys/ptrace.h>
+#include <sys/user.h>
+
+int
+main ()
+{
+
+ void *p;
+ long res = ptrace (PTRACE_GETREGS, 0, p, p);
+
+ ;
+ return 0;
+}
+_ACEOF
+if ac_fn_c_try_compile "$LINENO"; then :
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+$as_echo "#define HAVE_PTRACE_GETREGS 1" >>confdefs.h
+
+
+else
+
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+
# Check for CLOCK_MONOTONIC
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for CLOCK_MONOTONIC" >&5
diff -ur valgrind-3.8.1.orig/configure.in valgrind-3.8.1/configure.in
--- valgrind-3.8.1.orig/configure.in 2013-08-08 13:32:08.086267278 +0200
+++ valgrind-3.8.1/configure.in 2013-08-08 13:32:29.283455153 +0200
@@ -1004,6 +1004,25 @@
# Checking for various library functions and other definitions
#----------------------------------------------------------------------------
+# Check for PTRACE_GETREGS
+
+AC_MSG_CHECKING([for PTRACE_GETREGS])
+AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
+#include <stddef.h>
+#include <sys/ptrace.h>
+#include <sys/user.h>
+]], [[
+ void *p;
+ long res = ptrace (PTRACE_GETREGS, 0, p, p);
+]])], [
+AC_MSG_RESULT([yes])
+AC_DEFINE([HAVE_PTRACE_GETREGS], 1,
+ [Define to 1 if you have the `PTRACE_GETREGS' ptrace request.])
+], [
+AC_MSG_RESULT([no])
+])
+
+
# Check for CLOCK_MONOTONIC
AC_MSG_CHECKING([for CLOCK_MONOTONIC])
diff -ur valgrind-3.8.1.orig/coregrind/vgdb.c valgrind-3.8.1/coregrind/vgdb.c
--- valgrind-3.8.1.orig/coregrind/vgdb.c 2013-08-08 13:32:08.080267224 +0200
+++ valgrind-3.8.1/coregrind/vgdb.c 2013-08-08 13:34:39.247611009 +0200
@@ -102,7 +102,6 @@
#include <sys/user.h>
#if defined(VGO_linux)
# include <sys/prctl.h>
-# include <linux/ptrace.h>
#endif
#endif
@@ -696,7 +695,7 @@
// runtime check not yet done.
// 0 : PTRACE_GETREGS runtime check has failed.
// 1 : PTRACE_GETREGS defined and runtime check ok.
-#ifdef PTRACE_GETREGS
+#ifdef HAVE_PTRACE_GETREGS
static int has_working_ptrace_getregs = -1;
#endif
@@ -707,7 +706,7 @@
Bool getregs (int pid, void *regs, long regs_bsz)
{
DEBUG(1, "getregs regs_bsz %ld\n", regs_bsz);
-# ifdef PTRACE_GETREGS
+# ifdef HAVE_PTRACE_GETREGS
if (has_working_ptrace_getregs) {
// Platforms having GETREGS
long res;
@@ -778,7 +777,7 @@
DEBUG(1, "setregs regs_bsz %ld\n", regs_bsz);
// Note : the below is checking for GETREGS, not SETREGS
// as if one is defined and working, the other one should also work.
-# ifdef PTRACE_GETREGS
+# ifdef HAVE_PTRACE_GETREGS
if (has_working_ptrace_getregs) {
// Platforms having SETREGS
long res;

View File

@ -3,7 +3,7 @@
Summary: Tool for finding memory management bugs in programs
Name: %{?scl_prefix}valgrind
Version: 3.8.1
Release: 19%{?dist}
Release: 20%{?dist}
Epoch: 1
License: GPLv2
URL: http://www.valgrind.org/
@ -175,6 +175,9 @@ Patch44: valgrind-3.8.1-ptrace-thread-area.patch
# KDE#320116 Support Linux kernel AF_BLUETOOTH for bind()
Patch45: valgrind-3.8.1-af-bluetooth.patch
# Don't include linux/ptrace.h. Upstream commits r13471 and r13482.
Patch46: valgrind-3.8.1-ptrace-include-configure.patch
%ifarch x86_64 ppc64
# Ensure glibc{,-devel} is installed for both multilib arches
BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@ -319,6 +322,7 @@ touch ./memcheck/tests/linux/getregset.stderr.exp
%patch43 -p1
%patch44 -p1
%patch45 -p1
%patch46 -p1
# These tests go into an endless loop on ARM
# There is a __sync_add_and_fetch in the testcase.
@ -480,6 +484,9 @@ echo ===============END TESTING===============
%endif
%changelog
* Thu Aug 08 2013 Mark Wielaard <mjw@redhat.com> - 3.8.1-20
- Add valgrind-3.8.1-ptrace-include-configure.patch (#992847)
* Sun Aug 04 2013 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1:3.8.1-19
- Rebuilt for https://fedoraproject.org/wiki/Fedora_20_Mass_Rebuild