Add valgrind-3.8.1-sendmsg-flags.patch KDE#315441

This commit is contained in:
Mark Wielaard 2013-02-19 15:03:28 +01:00
parent af872804f2
commit 447d2863e9
2 changed files with 213 additions and 1 deletions

View File

@ -0,0 +1,205 @@
diff --git a/memcheck/tests/sendmsg.c b/memcheck/tests/sendmsg.c
new file mode 100644
index 0000000..f47da1d
--- /dev/null
+++ b/memcheck/tests/sendmsg.c
@@ -0,0 +1,56 @@
+#include <netinet/ip.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+
+#define PORT 12345
+
+int
+main (int argc, char **argv)
+{
+ int fd;
+ struct sockaddr_in sa;
+ struct msghdr msg;
+ struct iovec iov[2];
+
+ fd = socket (AF_INET, SOCK_DGRAM, 0);
+ if (fd == -1)
+ {
+ perror ("socket()");
+ exit (EXIT_FAILURE);
+ }
+
+ sa.sin_family = AF_INET;
+ sa.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
+ sa.sin_port = htons (PORT);
+ if (connect (fd, (struct sockaddr *) &sa, sizeof (sa)) == -1)
+ {
+ perror ("connect ()");
+ exit (EXIT_FAILURE);
+ }
+
+ // Create msg_hdr. Note that msg_flags isn't being set.
+ msg.msg_name = NULL;
+ msg.msg_namelen = 0;
+ iov[0].iov_base = "one";
+ iov[0].iov_len = 3;
+ iov[1].iov_base = "two";
+ iov[1].iov_len = 3;
+ msg.msg_iov = &iov;
+ msg.msg_iovlen = 2;
+ msg.msg_control = NULL;
+ msg.msg_controllen = 0;
+
+ ssize_t s = sendmsg (fd, &msg, 0);
+ if (s == -1)
+ {
+ perror ("sendmsg ()");
+ exit (EXIT_FAILURE);
+ }
+ else
+ fprintf (stderr, "sendmsg: %d\n", (int) s);
+
+ exit(0);
+}
diff --git a/memcheck/tests/sendmsg.stderr.exp b/memcheck/tests/sendmsg.stderr.exp
new file mode 100644
index 0000000..1dbac26
--- /dev/null
+++ b/memcheck/tests/sendmsg.stderr.exp
@@ -0,0 +1 @@
+sendmsg: 6
diff --git a/memcheck/tests/sendmsg.vgtest b/memcheck/tests/sendmsg.vgtest
new file mode 100644
index 0000000..f252b62
--- /dev/null
+++ b/memcheck/tests/sendmsg.vgtest
@@ -0,0 +1,2 @@
+prog: sendmsg
+vgopts: -q
--
1.7.1
--- valgrind-3.8.1/coregrind/m_syswrap/syswrap-generic.c.orig 2013-02-19 14:45:13.000000000 +0100
+++ valgrind-3.8.1/coregrind/m_syswrap/syswrap-generic.c 2013-02-19 14:48:37.640413500 +0100
@@ -817,7 +817,8 @@
{
Char *outmsg = strdupcat ( "di.syswrap.pmrs.1",
"sendmsg", msg, VG_AR_CORE );
- PRE_MEM_READ( outmsg, base, size );
+ if ( read )
+ PRE_MEM_READ( outmsg, base, size );
VG_(arena_free) ( VG_AR_CORE, outmsg );
}
--- valgrind-3.8.1/memcheck/tests/Makefile.am.orig 2013-02-19 14:45:13.467514264 +0100
+++ valgrind-3.8.1/memcheck/tests/Makefile.am 2013-02-19 14:50:13.871894644 +0100
@@ -179,6 +179,7 @@
realloc2.stderr.exp realloc2.vgtest \
realloc3.stderr.exp realloc3.vgtest \
sbfragment.stdout.exp sbfragment.stderr.exp sbfragment.vgtest \
+ sendmsg.stderr.exp sendmsg.vgtest \
sh-mem.stderr.exp sh-mem.vgtest \
sh-mem-random.stderr.exp sh-mem-random.stdout.exp64 \
sh-mem-random.stdout.exp sh-mem-random.vgtest \
@@ -282,6 +283,7 @@
post-syscall \
realloc1 realloc2 realloc3 \
sbfragment \
+ sendmsg \
sh-mem sh-mem-random \
sigaltstack signal2 sigprocmask static_malloc sigkill \
stpncpy \
--- valgrind-3.8.1/memcheck/tests/Makefile.in.orig 2013-02-19 14:46:14.305186272 +0100
+++ valgrind-3.8.1/memcheck/tests/Makefile.in 2013-02-19 14:59:41.284835217 +0100
@@ -105,20 +105,20 @@
partial_load$(EXEEXT) pdb-realloc$(EXEEXT) \
pdb-realloc2$(EXEEXT) pipe$(EXEEXT) pointer-trace$(EXEEXT) \
post-syscall$(EXEEXT) realloc1$(EXEEXT) realloc2$(EXEEXT) \
- realloc3$(EXEEXT) sbfragment$(EXEEXT) sh-mem$(EXEEXT) \
- sh-mem-random$(EXEEXT) sigaltstack$(EXEEXT) signal2$(EXEEXT) \
- sigprocmask$(EXEEXT) static_malloc$(EXEEXT) sigkill$(EXEEXT) \
- stpncpy$(EXEEXT) strchr$(EXEEXT) str_tester$(EXEEXT) \
- supp_unknown$(EXEEXT) supp1$(EXEEXT) supp2$(EXEEXT) \
- suppfree$(EXEEXT) test-plo$(EXEEXT) trivialleak$(EXEEXT) \
- unit_libcbase$(EXEEXT) unit_oset$(EXEEXT) varinfo1$(EXEEXT) \
- varinfo2$(EXEEXT) varinfo3$(EXEEXT) varinfo4$(EXEEXT) \
- varinfo5$(EXEEXT) varinfo5so.so$(EXEEXT) varinfo6$(EXEEXT) \
- vcpu_fbench$(EXEEXT) vcpu_fnfns$(EXEEXT) wcs$(EXEEXT) \
- xml1$(EXEEXT) wrap1$(EXEEXT) wrap2$(EXEEXT) wrap3$(EXEEXT) \
- wrap4$(EXEEXT) wrap5$(EXEEXT) wrap6$(EXEEXT) wrap7$(EXEEXT) \
- wrap7so.so$(EXEEXT) wrap8$(EXEEXT) writev1$(EXEEXT) \
- $(am__EXEEXT_1)
+ realloc3$(EXEEXT) sbfragment$(EXEEXT) sendmsg$(EXEEXT) \
+ sh-mem$(EXEEXT) sh-mem-random$(EXEEXT) sigaltstack$(EXEEXT) \
+ signal2$(EXEEXT) sigprocmask$(EXEEXT) static_malloc$(EXEEXT) \
+ sigkill$(EXEEXT) stpncpy$(EXEEXT) strchr$(EXEEXT) \
+ str_tester$(EXEEXT) supp_unknown$(EXEEXT) supp1$(EXEEXT) \
+ supp2$(EXEEXT) suppfree$(EXEEXT) test-plo$(EXEEXT) \
+ trivialleak$(EXEEXT) unit_libcbase$(EXEEXT) unit_oset$(EXEEXT) \
+ varinfo1$(EXEEXT) varinfo2$(EXEEXT) varinfo3$(EXEEXT) \
+ varinfo4$(EXEEXT) varinfo5$(EXEEXT) varinfo5so.so$(EXEEXT) \
+ varinfo6$(EXEEXT) vcpu_fbench$(EXEEXT) vcpu_fnfns$(EXEEXT) \
+ wcs$(EXEEXT) xml1$(EXEEXT) wrap1$(EXEEXT) wrap2$(EXEEXT) \
+ wrap3$(EXEEXT) wrap4$(EXEEXT) wrap5$(EXEEXT) wrap6$(EXEEXT) \
+ wrap7$(EXEEXT) wrap7so.so$(EXEEXT) wrap8$(EXEEXT) \
+ writev1$(EXEEXT) $(am__EXEEXT_1)
@DWARF4_TRUE@am__append_12 = dw4
subdir = memcheck/tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@@ -434,6 +434,9 @@
sbfragment_SOURCES = sbfragment.c
sbfragment_OBJECTS = sbfragment.$(OBJEXT)
sbfragment_LDADD = $(LDADD)
+sendmsg_SOURCES = sendmsg.c
+sendmsg_OBJECTS = sendmsg.$(OBJEXT)
+sendmsg_LDADD = $(LDADD)
sh_mem_SOURCES = sh-mem.c
sh_mem_OBJECTS = sh-mem.$(OBJEXT)
sh_mem_LDADD = $(LDADD)
@@ -610,8 +613,8 @@
origin3-no.c origin4-many.c origin5-bz2.c origin6-fp.c \
overlap.c partial_load.c partiallydefinedeq.c pdb-realloc.c \
pdb-realloc2.c pipe.c pointer-trace.c post-syscall.c \
- realloc1.c realloc2.c realloc3.c sbfragment.c sh-mem.c \
- sh-mem-random.c sigaltstack.c sigkill.c signal2.c \
+ realloc1.c realloc2.c realloc3.c sbfragment.c sendmsg.c \
+ sh-mem.c sh-mem-random.c sigaltstack.c sigkill.c signal2.c \
sigprocmask.c static_malloc.c stpncpy.c str_tester.c strchr.c \
$(supp1_SOURCES) $(supp2_SOURCES) $(supp_unknown_SOURCES) \
suppfree.c test-plo.c trivialleak.c unit_libcbase.c \
@@ -641,8 +644,8 @@
origin3-no.c origin4-many.c origin5-bz2.c origin6-fp.c \
overlap.c partial_load.c partiallydefinedeq.c pdb-realloc.c \
pdb-realloc2.c pipe.c pointer-trace.c post-syscall.c \
- realloc1.c realloc2.c realloc3.c sbfragment.c sh-mem.c \
- sh-mem-random.c sigaltstack.c sigkill.c signal2.c \
+ realloc1.c realloc2.c realloc3.c sbfragment.c sendmsg.c \
+ sh-mem.c sh-mem-random.c sigaltstack.c sigkill.c signal2.c \
sigprocmask.c static_malloc.c stpncpy.c str_tester.c strchr.c \
$(supp1_SOURCES) $(supp2_SOURCES) $(supp_unknown_SOURCES) \
suppfree.c test-plo.c trivialleak.c unit_libcbase.c \
@@ -1112,6 +1115,7 @@
realloc2.stderr.exp realloc2.vgtest \
realloc3.stderr.exp realloc3.vgtest \
sbfragment.stdout.exp sbfragment.stderr.exp sbfragment.vgtest \
+ sendmsg.stderr.exp sendmsg.vgtest \
sh-mem.stderr.exp sh-mem.vgtest \
sh-mem-random.stderr.exp sh-mem-random.stdout.exp64 \
sh-mem-random.stdout.exp sh-mem-random.vgtest \
@@ -1560,6 +1564,9 @@
sbfragment$(EXEEXT): $(sbfragment_OBJECTS) $(sbfragment_DEPENDENCIES)
@rm -f sbfragment$(EXEEXT)
$(LINK) $(sbfragment_OBJECTS) $(sbfragment_LDADD) $(LIBS)
+sendmsg$(EXEEXT): $(sendmsg_OBJECTS) $(sendmsg_DEPENDENCIES)
+ @rm -f sendmsg$(EXEEXT)
+ $(LINK) $(sendmsg_OBJECTS) $(sendmsg_LDADD) $(LIBS)
sh-mem$(EXEEXT): $(sh_mem_OBJECTS) $(sh_mem_DEPENDENCIES)
@rm -f sh-mem$(EXEEXT)
$(LINK) $(sh_mem_OBJECTS) $(sh_mem_LDADD) $(LIBS)
@@ -1775,6 +1782,7 @@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/realloc2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/realloc3.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sbfragment.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sendmsg.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh-mem-random.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sh-mem.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sigaltstack.Po@am__quote@

View File

@ -3,7 +3,7 @@
Summary: Tool for finding memory management bugs in programs Summary: Tool for finding memory management bugs in programs
Name: %{?scl_prefix}valgrind Name: %{?scl_prefix}valgrind
Version: 3.8.1 Version: 3.8.1
Release: 7%{?dist} Release: 8%{?dist}
Epoch: 1 Epoch: 1
License: GPLv2 License: GPLv2
URL: http://www.valgrind.org/ URL: http://www.valgrind.org/
@ -138,6 +138,9 @@ Patch32: valgrind-3.8.1-sigill_diag.patch
# Allow building against glibc-2.17. Upstream commit svn 13228. # Allow building against glibc-2.17. Upstream commit svn 13228.
Patch33: valgrind-3.8.1-glibc-2.17.patch Patch33: valgrind-3.8.1-glibc-2.17.patch
# KDE#315441 - sendmsg syscall should ignore unset msghdr msg_flags
Patch34: valgrind-3.8.1-sendmsg-flags.patch
%ifarch x86_64 ppc64 %ifarch x86_64 ppc64
# Ensure glibc{,-devel} is installed for both multilib arches # 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 BuildRequires: /lib/libc.so.6 /usr/lib/libc.so /lib64/libc.so.6 /usr/lib64/libc.so
@ -271,6 +274,7 @@ touch ./none/tests/amd64/bmi.stderr.exp
%patch31 -p1 %patch31 -p1
%patch32 -p1 %patch32 -p1
%patch33 -p1 %patch33 -p1
%patch34 -p1
# To suppress eventual automake warnings/errors # To suppress eventual automake warnings/errors
rm -f gdbserver_tests/filter_gdb.orig rm -f gdbserver_tests/filter_gdb.orig
@ -420,6 +424,9 @@ echo ===============END TESTING===============
%endif %endif
%changelog %changelog
* Tue Feb 19 2013 Mark Wielaard <mjw@redhat.com> 3.8.1-8
- Add valgrind-3.8.1-sendmsg-flags.patch
* Thu Feb 07 2013 Jon Ciesla <limburgher@gmail.com> 1:3.8.1-7 * Thu Feb 07 2013 Jon Ciesla <limburgher@gmail.com> 1:3.8.1-7
- Merge review fixes, BZ 226522. - Merge review fixes, BZ 226522.