diff --git a/valgrind-3.8.1-sendmsg-flags.patch b/valgrind-3.8.1-sendmsg-flags.patch index ad5f454..779e8ea 100644 --- a/valgrind-3.8.1-sendmsg-flags.patch +++ b/valgrind-3.8.1-sendmsg-flags.patch @@ -1,9 +1,35 @@ +commit fc75e5ea3e57d58bbbbd3fd8fff3a71de9a1b172 +Author: tom +Date: Thu Feb 28 12:50:55 2013 +0000 + + Don't check the flags word in msghdr for sendmsg as the + kernel will neither read nor write it. + + Patch from Mark Wielaard to fix BZ#315441. + + + git-svn-id: svn://svn.valgrind.org/valgrind/trunk@13294 a5019735-40e9-0310-863c-91ae7b9d1cf9 + +diff --git a/memcheck/tests/filter_stderr b/memcheck/tests/filter_stderr +index abd6792..3d62d94 100755 +--- a/memcheck/tests/filter_stderr ++++ b/memcheck/tests/filter_stderr +@@ -22,6 +22,9 @@ sed "s/checked [0-9,]* bytes./checked ... bytes./" | + # records. So we filter out the loss record numbers. + perl -p -e "s/in loss record \d+ of \d+/in loss record ... of .../" | + ++# Filter out glibc debuginfo if installed. ++perl -p -e "s/\(syscall-template.S:[0-9]*\)/(in \/...libc...)/" | ++ + $dir/../../memcheck/tests/filter_memcheck "$@" + + exit 0 diff --git a/memcheck/tests/sendmsg.c b/memcheck/tests/sendmsg.c new file mode 100644 -index 0000000..f47da1d +index 0000000..2039f07 --- /dev/null +++ b/memcheck/tests/sendmsg.c -@@ -0,0 +1,56 @@ +@@ -0,0 +1,74 @@ +#include +#include +#include @@ -37,8 +63,7 @@ index 0000000..f47da1d + exit (EXIT_FAILURE); + } + -+ // Create msg_hdr. Note that msg_flags isn't being set. -+ msg.msg_name = NULL; ++ // Create msg_hdr. Oops, we forget to set msg_name... + msg.msg_namelen = 0; + iov[0].iov_base = "one"; + iov[0].iov_len = 3; @@ -49,7 +74,26 @@ index 0000000..f47da1d + msg.msg_control = NULL; + msg.msg_controllen = 0; + -+ ssize_t s = sendmsg (fd, &msg, 0); ++ size_t s = sendmsg (fd, &msg, 0); ++ ++ // Note how we now do set msg_name, but don't set msg_flags. ++ // The msg_flags field is ignored by sendmsg. ++ msg.msg_name = NULL; ++ ++ fd = socket (AF_INET, SOCK_DGRAM, 0); ++ if (fd == -1) ++ { ++ perror ("socket()"); ++ exit (EXIT_FAILURE); ++ } ++ ++ if (connect (fd, (struct sockaddr *) &sa, sizeof (sa)) == -1) ++ { ++ perror ("connect ()"); ++ exit (EXIT_FAILURE); ++ } ++ ++ s = sendmsg (fd, &msg, 0); + if (s == -1) + { + perror ("sendmsg ()"); @@ -62,10 +106,15 @@ index 0000000..f47da1d +} diff --git a/memcheck/tests/sendmsg.stderr.exp b/memcheck/tests/sendmsg.stderr.exp new file mode 100644 -index 0000000..1dbac26 +index 0000000..38e20c5 --- /dev/null +++ b/memcheck/tests/sendmsg.stderr.exp -@@ -0,0 +1 @@ +@@ -0,0 +1,6 @@ ++Syscall param sendmsg(msg) points to uninitialised byte(s) ++ at 0x........: sendmsg (in /...libc...) ++ by 0x........: main (sendmsg.c:45) ++ Address 0x........ is on thread 1's stack ++ +sendmsg: 6 diff --git a/memcheck/tests/sendmsg.vgtest b/memcheck/tests/sendmsg.vgtest new file mode 100644 @@ -75,39 +124,6 @@ index 0000000..f252b62 @@ -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 @@ @@ -203,3 +219,71 @@ index 0000000..f252b62 @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@ +--- a/coregrind/m_syswrap/syswrap-generic.c.orig 2013-02-28 15:14:08.035441439 +0100 ++++ b/coregrind/m_syswrap/syswrap-generic.c 2013-02-28 15:18:13.035249059 +0100 +@@ -848,7 +848,8 @@ + Char *name, + struct vki_msghdr *msg, + UInt length, +- void (*foreach_func)( ThreadId, Bool, Char *, Addr, SizeT ) ++ void (*foreach_func)( ThreadId, Bool, Char *, Addr, SizeT ), ++ Bool recv + ) + { + Char *fieldName; +@@ -866,7 +867,11 @@ + foreach_func ( tid, True, fieldName, (Addr)&msg->msg_iovlen, sizeof( msg->msg_iovlen ) ); + foreach_func ( tid, True, fieldName, (Addr)&msg->msg_control, sizeof( msg->msg_control ) ); + foreach_func ( tid, True, fieldName, (Addr)&msg->msg_controllen, sizeof( msg->msg_controllen ) ); +- foreach_func ( tid, False, fieldName, (Addr)&msg->msg_flags, sizeof( msg->msg_flags ) ); ++ ++ /* msg_flags is completely ignored for send_mesg, recv_mesg doesn't read ++ the field, but does write to it. */ ++ if ( recv ) ++ foreach_func ( tid, False, fieldName, (Addr)&msg->msg_flags, sizeof( msg->msg_flags ) ); + + if ( msg->msg_name ) { + VG_(sprintf) ( fieldName, "(%s.msg_name)", name ); +@@ -1509,7 +1514,7 @@ + void + ML_(generic_PRE_sys_sendmsg) ( ThreadId tid, Char *name, struct vki_msghdr *msg ) + { +- msghdr_foreachfield ( tid, name, msg, ~0, pre_mem_read_sendmsg ); ++ msghdr_foreachfield ( tid, name, msg, ~0, pre_mem_read_sendmsg, False ); + } + + /* ------ */ +@@ -1517,13 +1522,13 @@ + void + ML_(generic_PRE_sys_recvmsg) ( ThreadId tid, Char *name, struct vki_msghdr *msg ) + { +- msghdr_foreachfield ( tid, name, msg, ~0, pre_mem_write_recvmsg ); ++ msghdr_foreachfield ( tid, name, msg, ~0, pre_mem_write_recvmsg, True ); + } + + void + ML_(generic_POST_sys_recvmsg) ( ThreadId tid, Char *name, struct vki_msghdr *msg, UInt length ) + { +- msghdr_foreachfield( tid, name, msg, length, post_mem_write_recvmsg ); ++ msghdr_foreachfield( tid, name, msg, length, post_mem_write_recvmsg, True ); + check_cmsg_for_fds( tid, msg ); + } + +--- a/memcheck/tests/Makefile.am.orig 2013-02-28 15:14:08.220442048 +0100 ++++ b/memcheck/tests/Makefile.am 2013-02-28 15:20:17.575659460 +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 \ diff --git a/valgrind.spec b/valgrind.spec index d48f779..b89afc1 100644 --- a/valgrind.spec +++ b/valgrind.spec @@ -3,7 +3,7 @@ Summary: Tool for finding memory management bugs in programs Name: %{?scl_prefix}valgrind Version: 3.8.1 -Release: 8%{?dist} +Release: 9%{?dist} Epoch: 1 License: GPLv2 URL: http://www.valgrind.org/ @@ -433,6 +433,9 @@ echo ===============END TESTING=============== %endif %changelog +* Thu Feb 28 2013 Mark Wielaard 3.8.1-9 +- Replace valgrind-3.8.1-sendmsg-flags.patch with upstream version. + * Tue Feb 19 2013 Mark Wielaard 3.8.1-8 - Add valgrind-3.8.1-sendmsg-flags.patch - Add valgrind-3.8.1-ptrace-setgetregset.patch