Bug 757700

Summary: missing valgrind suppression for _wordcopy_fwd_dest_aligned and friends
Product: [Fedora] Fedora Reporter: Paolo Bonzini <pbonzini>
Component: valgrindAssignee: Mark Wielaard <mjw>
Status: CLOSED RAWHIDE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dodji, jakub, mjw, pbonzini, pbrezina, vvitek
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 730952 Environment:
Last Closed: 2012-10-05 18:28:25 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Paolo Bonzini 2011-11-28 12:40:08 UTC
valgrind reports a problem with this in all UTF-8 locales:

echo 'abcdefghijklmno' | valgrind sed -e 's/\(.*z[^z]*z.*\)//p'

==21112== Invalid read of size 8
==21112==    at 0x338F28F49D: _wordcopy_fwd_dest_aligned (wordcopy.c:205)
==21112==    by 0x338F2890DB: __GI_memmove (memmove.c:76)
==21112==    by 0x338F2C6001: re_string_reconstruct (regex_internal.c:675)
==21112==    by 0x338F2CFC6F: re_search_internal (regexec.c:829)
==21112==    by 0x338F2D50EB: re_search_stub (regexec.c:463)
==21112==    by 0x338F2D5B67: re_search (regexec.c:326)
==21112==    by 0x4078C1: match_regex (regexp.c:252)
==21112==    by 0x406D9B: execute_program (execute.c:1189)
==21112==    by 0x40758F: process_files (execute.c:1857)
==21112==    by 0x4023AB: main (sed.c:366)
==22516==  Address 0x4c45b88 is 56 bytes inside a block of size 60 alloc'd
==21112==    at 0x4A075B2: realloc (vg_replace_malloc.c:525)
==21112==    by 0x338F2C4DCF: re_string_realloc_buffers (regex_internal.c:143)
==21112==    by 0x338F2C9C86: extend_buffers (regexec.c:4116)
==21112==    by 0x338F2D0AFE: re_search_internal (regexec.c:1164)
==21112==    by 0x338F2D50EB: re_search_stub (regexec.c:463)
==21112==    by 0x338F2D5B67: re_search (regexec.c:326)
==21112==    by 0x4078C1: match_regex (regexp.c:252)
==21112==    by 0x406D9B: execute_program (execute.c:1189)
==21112==    by 0x40758F: process_files (execute.c:1857)
==21112==    by 0x4023AB: main (sed.c:366)
==21112==

Comment 1 Jakub Jelinek 2011-11-29 09:25:23 UTC
Valgrind just should be smarter on partial reads after the end of allocation, there are plenty of bugreports about that.  Essentially if a read is partially before and partially after end of allocation and is aligned, it would be nice if valgrind poisened the undefined bits in the value and only warned if those bits aren't just ignored later on.  It might take a long time to get such a support though, for now just take Address ... is N bytes inside a block of size M alloc'd
for N < M with a grain of salt.

Comment 2 Fedora End Of Life 2012-08-07 16:25:38 UTC
This message is a notice that Fedora 15 is now at end of life. Fedora
has stopped maintaining and issuing updates for Fedora 15. It is
Fedora's policy to close all bug reports from releases that are no
longer maintained. At this time, all open bugs with a Fedora 'version'
of '15' have been closed as WONTFIX.

(Please note: Our normal process is to give advanced warning of this
occurring, but we forgot to do that. A thousand apologies.)

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, feel free to reopen
this bug and simply change the 'version' to a later Fedora version.

Bug Reporter: Thank you for reporting this issue and we are sorry that
we were unable to fix it before Fedora 15 reached end of life. If you
would still like to see this bug fixed and are able to reproduce it
against a later version of Fedora, you are encouraged to click on
"Clone This Bug" (top right of this page) and open it against that
version of Fedora.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

The process we are following is described here:
http://fedoraproject.org/wiki/BugZappers/HouseKeeping

Comment 3 Mark Wielaard 2012-08-08 11:12:49 UTC
still an issue with valgrind-3.8.0-TEST1

Comment 4 Mark Wielaard 2012-10-05 18:28:25 UTC
Although Jakub's analysis in comment #1 is correct this particular instance has been fixed in valgrind 3.8.1 by intercepting __GI_memmove. See https://bugs.kde.org/show_bug.cgi?id=306612