Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1237206

Summary: valgrind wrongly discards memory regions
Product: Red Hat Enterprise Linux 7 Reporter: Miloš Prchlík <mprchlik>
Component: valgrindAssignee: Mark Wielaard <mjw>
Status: CLOSED ERRATA QA Contact: Miloš Prchlík <mprchlik>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.2CC: jakub, mfranc
Target Milestone: rc   
Target Release: ---   
Hardware: ppc64le   
OS: Unspecified   
Whiteboard:
Fixed In Version: valgrind-3.10.0-11.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 09:05:03 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 1240796    
Bug Blocks:    

Description Miloš Prchlík 2015-06-30 14:14:48 UTC
Description of problem:

Upstream test suite of pcp is using valgrind to run several pcp (and testing) binaries in search for memory leaks and other warnings. On powerpc boxes valgrind started to produce huge number of "Conditional jump or move depends on uninitialised value(s)" warnings, related to glibc string function (strlen, strdup, ...).

E.g. running this particular command:

  valgrind --vgdb=full --vgdb-error=2 /usr/libexec/pcp/bin/pcp-atop 1 3

leads to hundreds of similar warnings:

==29017== Conditional jump or move depends on uninitialised value(s)
==29017==    at 0x43DDEE4: ??? (in /usr/lib64/power8/libc-2.17.so)
==29017==    by 0x41389E7: ??? (in /usr/lib64/libpcp.so.3)
==29017==    by 0x4138D8B: ??? (in /usr/lib64/libpcp.so.3)
==29017==    by 0x4138FCB: ??? (in /usr/lib64/libpcp.so.3)
==29017==    by 0x413BAFB: ??? (in /usr/lib64/libpcp.so.3)
==29017==    by 0x41335D3: ??? (in /usr/lib64/libpcp.so.3)
==29017==    by 0x4133CFB: ??? (in /usr/lib64/libpcp.so.3)
==29017==    by 0x41060AF: ??? (in /usr/lib64/libpcp.so.3)
==29017==    by 0x10027103: setup_context (various.c:560)
==29017==    by 0x10027103: setup_globals (various.c:594)
==29017==    by 0x10002F83: main (atop.c:418)
==29017== 


gdb provides some additional info:

#0  .__strlen_power7 () at ../sysdeps/powerpc/powerpc64/power7/strlen.S:80
#1  0x000000000443b7bc in __GI___strdup (s=<optimized out>) at strdup.c:41
#2  0x0000000004170b20 in posix_formatter (var=<optimized out>, prefix=<optimized out>, val=<optimized out>) at config.c:159
#3  0x0000000004170ea4 in __pmconfig (formatter=formatter@entry=@0x41ce6c8: 0x4170a30 <posix_formatter>, fatal=fatal@entry=1) at config.c:221
#4  0x00000000041710cc in pmgetconfig (name=0x41a21f0 "PCP_RUN_DIR", fatal=<optimized out>) at config.c:251
#5  0x0000000004173a0c in __pmPMCDLocalSocketDefault () at auxconnect.c:922
#6  0x000000000416c4f4 in parseSocketPath (position=<optimized out>, position@entry=0xfff00d430, rslt=<optimized out>, rslt@entry=0xfff00d540, spec=0x10027cd8 "local:") at spec.c:535
#7  0x000000000416cc0c in __pmParseHostAttrsSpec (spec=0x10027cd8 "local:", host=0xfff00d540, count=0xfff00d53c, attributes=0x10060098, errmsg=0xfff00d548) at spec.c:917
#8  0x000000000413ff70 in pmNewContext (type=<optimized out>, name=0x10027cd8 "local:") at context.c:486
#9  0x00000000100263bc in setup_context (opts=0xfff00d930) at various.c:560
#10 setup_globals (opts=0xfff00d930) at various.c:594
#11 0x0000000010003164 in main (argc=<optimized out>, argv=<optimized out>) at atop.c:418
(gdb) l
75                 the first doubleword and decrement the address in case the first
76                 doubleword really contains a null byte.  */
77
78              cmpdi   cr6,r10,0
79              addi    r4,r4,-8
80              bne     cr6,L(done)
81
82              /* The null byte must be in the second doubleword.  Adjust the address
83                 again and move the result of cmpb to r10 so we can calculate the
84                 length.  */
(gdb)


Running valgrind with -v option reveals even more:

==18054== Memcheck, a memory error detector
==18054== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==18054== Using Valgrind-3.10.0 and LibVEX; rerun with -h for copyright info
==18054== Command: /usr/libexec/pcp/bin/pcp-atop 1 3
==18054== Parent PID: 25287
==18054== 
--18054-- 
--18054-- Valgrind options:
--18054--    -v
--18054--    --log-file=valgrind.log
--18054-- Contents of /proc/version:
--18054--   Linux version 3.10.0-229.7.2.el7.ppc64le (mockbuild.eng.bos.redhat.com) (gcc version 4.8.3 20140911 (Red Hat 4.8.3-9) (GCC) ) #1 SMP Wed Jun 3 21:46:46 EDT 2015
--18054-- Arch and hwcaps: PPC64, LittleEndian, ppc64-int-flt-vmx-FX-GX-VX-DFP-ISA2_07
--18054-- Page sizes: currently 65536, max supported 65536
--18054-- Valgrind library directory: /usr/lib64/valgrind
--18054-- Reading syms from /usr/lib64/ld-2.17.so
--18054--   Considering /usr/lib/debug/.build-id/c5/55a0a9021937ec92a1a32a1d825fa54dc649f1.debug ..
--18054--   .. build-id is valid
--18054-- Reading syms from /usr/libexec/pcp/bin/pcp-atop
--18054--   Considering /usr/lib/debug/.build-id/6b/62153121693020e25e82a7677d87e7b2525de4.debug ..
--18054--   .. build-id is valid
--18054-- Warning: cross-CU LIMITATION: some inlined fn names
--18054-- might be shown as UnknownInlinedFun
--18054-- Reading syms from /usr/lib64/valgrind/memcheck-ppc64le-linux
--18054--   Considering /usr/lib/debug/.build-id/42/c5d2624ff38dd4852b9af2c93c5bd799d570fa.debug ..
--18054--   .. build-id is valid
--18054--    object doesn't have a dynamic symbol table
--18054-- Scheduler: using generic scheduler lock implementation.
--18054-- Reading suppressions file: /usr/lib64/valgrind/default.supp
==18054== embedded gdbserver: reading from /tmp/vgdb-pipe-from-vgdb-to-18054-by-root-on-ibm-p8-kvm-04-guest-05.rhts.eng.bos.redhat.com
==18054== embedded gdbserver: writing to   /tmp/vgdb-pipe-to-vgdb-from-18054-by-root-on-ibm-p8-kvm-04-guest-05.rhts.eng.bos.redhat.com
==18054== embedded gdbserver: shared mem   /tmp/vgdb-pipe-shared-mem-vgdb-18054-by-root-on-ibm-p8-kvm-04-guest-05.rhts.eng.bos.redhat.com
==18054== 
==18054== TO CONTROL THIS PROCESS USING vgdb (which you probably
==18054== don't want to do, unless you know exactly what you're doing,
==18054== or are doing some strange experiment):
==18054==   /usr/lib64/valgrind/../../bin/vgdb --pid=18054 ...command...
==18054== 
==18054== TO DEBUG THIS PROCESS USING GDB: start GDB like this
==18054==   /path/to/gdb /usr/libexec/pcp/bin/pcp-atop
==18054== and then give GDB the following command
==18054==   target remote | /usr/lib64/valgrind/../../bin/vgdb --pid=18054
==18054== --pid is optional if only one valgrind process is running
==18054== 
--18054-- REDIR: 0x4024ebc (ld64.so.2:strlen+8) redirected to 0x380a0164 (vgPlain_ppc64_linux_REDIR_FOR_strlen)
--18054-- REDIR: 0x40233a0 (ld64.so.2:index+8) redirected to 0x380a01a8 (vgPlain_ppc64_linux_REDIR_FOR_strchr)
--18054-- Reading syms from /usr/lib64/valgrind/vgpreload_core-ppc64le-linux.so
--18054--   Considering /usr/lib/debug/.build-id/52/6b3e63a0bbbe2ee15e55b1521fee1b48efa556.debug ..
--18054--   .. build-id is valid
--18054-- Reading syms from /usr/lib64/valgrind/vgpreload_memcheck-ppc64le-linux.so
--18054--   Considering /usr/lib/debug/.build-id/38/fcb577e54a37d21768f2c4550e999fdd1d7c20.debug ..
--18054--   .. build-id is valid
--18054-- Reading syms from /usr/lib64/libpcp_gui.so.2
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libpcp_gui.so.2
--18054--   Considering /usr/lib/debug/.build-id/8e/a9b45dd06c9521d819ed0a453d03f2ca706742.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/76/3c3088d9d741ec27a74c8a86a22430bd0c7f1b.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x40c18e0-0x40c50a4 in /usr/lib64/libpcp_gui.so.2 due to munmap()
--18054-- Reading syms from /usr/lib64/libpcp.so.3
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libpcp.so.3
--18054--   Considering /usr/lib/debug/.build-id/99/e1d87517c23317d5c1278912db3fc7f0c87d43.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x41006a0-0x41632ec in /usr/lib64/libpcp.so.3 due to munmap()
--18054-- Reading syms from /usr/lib64/libncurses.so.5.9
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libncurses.so.5.9
--18054--   Considering /usr/lib/debug/.build-id/56/e2b40ff981139f2b6d8fb09aec405a34946d97.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/88/c0b625632d86aa20c00e9831b1e3d665010148.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x41a69a0-0x41c7e94 in /usr/lib64/libncurses.so.5.9 due to munmap()
--18054-- Reading syms from /usr/lib64/libtinfo.so.5.9
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libtinfo.so.5.9
--18054--   Considering /usr/lib/debug/.build-id/99/b7e300d1c62c62672ca5a66447cf7a4d6dbe8a.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/88/c0b625632d86aa20c00e9831b1e3d665010148.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x41fcb60-0x420d78c in /usr/lib64/libtinfo.so.5.9 due to munmap()
--18054-- Reading syms from /usr/lib64/power8/libm-2.17.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/power8/libm-2.17.so
--18054--   Considering /usr/lib/debug/.build-id/b4/a6a3174bbd67a34310709870b67cca3438746f.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4245fa0-0x42b5150 in /usr/lib64/power8/libm-2.17.so due to munmap()
--18054-- Reading syms from /usr/lib64/power8/libc-2.17.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/power8/libc-2.17.so
--18054--   Considering /usr/lib/debug/.build-id/94/649b2771544096c5495a0bd5f809319bd90207.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4351380-0x44a43a0 in /usr/lib64/power8/libc-2.17.so due to munmap()
--18054-- Reading syms from /usr/lib64/libdl-2.17.so
--18054--   Considering /usr/lib/debug/.build-id/ac/95431e5c07b6fa5a4f676309cf79c1c40a2fac.debug ..
--18054--   .. build-id is valid
--18054-- Reading syms from /usr/lib64/libssl3.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libssl3.so
--18054--   Considering /usr/lib/debug/.build-id/ef/c88c412c77f42454b87baba84c254c8f650458.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/8a/4a7687c01d1f7305cf38407277d946081f006a.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x454a220-0x4578b88 in /usr/lib64/libssl3.so due to munmap()
--18054-- Reading syms from /usr/lib64/libnss3.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libnss3.so
--18054--   Considering /usr/lib/debug/.build-id/8e/79b78b1d9c79c3f14912da7b0e87628688ea1f.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/8a/4a7687c01d1f7305cf38407277d946081f006a.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x45c9ca0-0x46ccbb0 in /usr/lib64/libnss3.so due to munmap()
--18054-- Reading syms from /usr/lib64/libnspr4.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libnspr4.so
--18054--   Considering /usr/lib/debug/.build-id/75/9c3555901244e915285c9f5e2683fd87cb2a75.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x472b840-0x475c4c0 in /usr/lib64/libnspr4.so due to munmap()
--18054-- Reading syms from /usr/lib64/libsasl2.so.3.0.0
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libsasl2.so.3.0.0
--18054--   Considering /usr/lib/debug/.build-id/b0/4316587c61a4f0674a52a9626ed8fd639eab08.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/c3/f9a27034455df290056dd65bbe0fe65becf87f.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4794580-0x47ad828 in /usr/lib64/libsasl2.so.3.0.0 due to munmap()
--18054-- Reading syms from /usr/lib64/libavahi-common.so.3.5.3
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libavahi-common.so.3.5.3
--18054--   Considering /usr/lib/debug/.build-id/b2/e1824251f77428c2a643e6db15e0b12bee36cf.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/15/e7b97e783bf6a9f0a6721c60dca4219d861f50.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x47e2f40-0x47eace8 in /usr/lib64/libavahi-common.so.3.5.3 due to munmap()
--18054-- Reading syms from /usr/lib64/libavahi-client.so.3.2.9
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libavahi-client.so.3.2.9
--18054--   Considering /usr/lib/debug/.build-id/f0/144444f7f386e4b6fc57faf283e7c429a7ed11.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/15/e7b97e783bf6a9f0a6721c60dca4219d861f50.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4813400-0x481eddc in /usr/lib64/libavahi-client.so.3.2.9 due to munmap()
--18054-- Reading syms from /usr/lib64/power8/libpthread-2.17.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/power8/libpthread-2.17.so
--18054--   Considering /usr/lib/debug/.build-id/62/afab66f94df1878309b3609bed951a79e9d01b.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4854fa0-0x4865c38 in /usr/lib64/power8/libpthread-2.17.so due to munmap()
--18054-- Reading syms from /usr/lib64/libnssutil3.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libnssutil3.so
--18054--   Considering /usr/lib/debug/.build-id/5d/41b8c16f6125f2e84caf9557a39a1ca17793c0.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x489b660-0x48b0a60 in /usr/lib64/libnssutil3.so due to munmap()
--18054-- Reading syms from /usr/lib64/libplc4.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libplc4.so
--18054--   Considering /usr/lib/debug/.build-id/02/c317f8da0f5c308642a747c6c84c02756e9d75.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/e7/c66cfbfec53d29d09c944bb569b894c1edd7ad.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x48e1380-0x48e3bcc in /usr/lib64/libplc4.so due to munmap()
--18054-- Reading syms from /usr/lib64/libplds4.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libplds4.so
--18054--   Considering /usr/lib/debug/.build-id/f2/dc5b09cb9d53d8fb8061efb60753aff7ab3df3.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/e7/c66cfbfec53d29d09c944bb569b894c1edd7ad.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4910fa0-0x4912cb0 in /usr/lib64/libplds4.so due to munmap()
--18054-- Reading syms from /usr/lib64/libz.so.1.2.7
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libz.so.1.2.7
--18054--   Considering /usr/lib/debug/.build-id/20/b3d52a33f0bd214a8cdafb7b046f43050e60e3.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4941f00-0x4956338 in /usr/lib64/libz.so.1.2.7 due to munmap()
--18054-- Reading syms from /usr/lib64/power8/librt-2.17.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/power8/librt-2.17.so
--18054--   Considering /usr/lib/debug/.build-id/67/1e93dbad5affd5a5fd56c06b05c0bbe901067f.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4981b60-0x498626c in /usr/lib64/power8/librt-2.17.so due to munmap()
--18054-- Reading syms from /usr/lib64/libresolv-2.17.so
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libresolv-2.17.so
--18054--   Considering /usr/lib/debug/.build-id/2e/d209491020fc3b7e7538f8625e70759d28a774.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x49b36e0-0x49c6900 in /usr/lib64/libresolv-2.17.so due to munmap()
--18054-- Reading syms from /usr/lib64/libcrypt-2.17.so
--18054--   Considering /usr/lib/debug/.build-id/5b/b3f9978157d7dc90af9a4abc30a7456dccb6fc.debug ..
--18054--   .. build-id is valid
--18054-- Reading syms from /usr/lib64/libdbus-1.so.3.7.4
--18054-- ELF section outside all mapped regions
--18054-- Reading syms from /usr/lib64/libdbus-1.so.3.7.4
--18054--   Considering /usr/lib/debug/.build-id/9d/50f9a8a41db6581ab7426acf9009169ac12bdc.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/04/a265fc05b2231d5f924adcdd132dc2f79c6af5.debug ..
--18054--   .. build-id is valid
--18054-- Discarding syms at 0x4a47040-0x4a895cc in /usr/lib64/libdbus-1.so.3.7.4 due to munmap()
--18054-- Reading syms from /usr/lib64/libfreebl3.so
--18054--   Considering /usr/lib/debug/.build-id/4a/305eb7fcaaee18f440d117944de5c79864797e.debug ..
--18054--   .. build-id is valid
--18054--   Considering /usr/lib/debug/.build-id/c9/e8f503c70e061d4796fc2066d1e933b2dac21f.debug ..
--18054--   .. build-id is valid


For some reason valgrind believes that glibc is overlapping with itself, and discards the "overlapping" memory region. Valgrind's strlen (for example) are then not used as replacements for glibc's functions, and warnings arise.

I observed this behavior with the same versions of glibc, valgrind and pcp on boxes with different RHEL7.2 ppc trees: ppc64le tree on power8 box, ppc64 tree on power8 box, and also ppc64 tree on power7 box. Other two arches I tested pcp on (x86_64, s390x) do not show such behavior.


Version-Release number of selected component (if applicable):

pcp-3.10.5-2.el7.ppc64le
glibc-2.17-101.el7.ppc64le
valgrind-3.10.0-9.el7.ppc64le


How reproducible:


Steps to Reproduce:
1. Running pcp-atop binary is probably the easiest way, while I admit it's definitely not the simplest reproducer, which I haven't discovered so far.
2.
3.


Actual results:


Expected results:


Additional info:

Comment 1 Mark Wielaard 2015-07-04 22:43:00 UTC
The fix is as follows:

[Index: coregrind/m_debuginfo/debuginfo.c
===================================================================
--- coregrind/m_debuginfo/debuginfo.c	(revision 15387)@@ -68,7 +68,7 @@
+++ coregrind/m_debuginfo/debuginfo.c	(working copy)
@@ -1038,7 +1038,7 @@
 
    /* Note the details about the mapping. */
    DebugInfoMapping map;
-   map.avma = a;
+   map.avma = seg->start;
    map.size = seg->end + 1 - seg->start;
    map.foff = seg->offset;
    map.rx   = is_rx_map;

VG_(di_notify_mmap) assumes that the start of the segment (seg->start) returned by VG(am_find_nsegment) equals the address (a) returned by mmap. This usually is the case, but not here because of the following sequence of mmap calls to load glibc:

pid 21968] open("/lib64/power8/libc.so.6", O_RDONLY|O_CLOEXEC) = 3
[pid 21968] mmap(0x4330000, 1922488, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0) = 0x4330000
di_notify_mmap-0:
di_notify_mmap-1: 0x4330000-0x450ffff r-x
di_notify_mmap-2: /usr/lib64/power8/libc-2.17.so
di_notify_mmap-3: is_rx_map 1, is_rw_map 0, is_ro_map 0
di_notify_mmap-4: noting details in DebugInfo* at 0x802899310
[pid 21968] mmap(0x44f0000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1b0000) = 0x44f0000
di_notify_mmap-0:
di_notify_mmap-1: 0x44f0000-0x44fffff rw-
di_notify_mmap-2: /usr/lib64/power8/libc-2.17.so
di_notify_mmap-3: is_rx_map 0, is_rw_map 1, is_ro_map 0
di_notify_mmap-4: noting details in DebugInfo* at 0x802899310
di_notify_mmap-5: achieved accept state for /usr/lib64/power8/libc-2.17.so
--21968-- Reading syms from /usr/lib64/power8/libc-2.17.so
[pid 21968] open("/usr/lib64/power8/libc-2.17.so", O_RDONLY) = 4
--21968-- ELF section outside all mapped regions
[pid 21968] mmap(0x4500000, 160, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x4500000
di_notify_mmap-0:
di_notify_mmap-1: 0x4500000-0x450ffff rw-
[pid 21968] mmap(0x4500000, 65536, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x1c0000) = 0x4500000
di_notify_mmap-0:
di_notify_mmap-1: 0x44f0000-0x450ffff rw-
di_notify_mmap-2: /usr/lib64/power8/libc-2.17.so
di_notify_mmap-3: is_rx_map 0, is_rw_map 1, is_ro_map 0
di_notify_mmap-4: noting details in DebugInfo* at 0x802899310
di_notify_mmap-5: achieved accept state for /usr/lib64/power8/libc-2.17.so
--21968-- Reading syms from /usr/lib64/power8/libc-2.17.so

Note how the last mmap was for address 0x4500000 but the aspace manager seems to have figured out this really is a continues file mapping for the segment 0x44f0000-0x450ffff.

Since the original code did use the mmap address (map.start) plus the length of the segment (map.size), the debuginfo mapping now covers some address space after the actual ELF file mapping. Once some other ELF file is mapped into this space the glibc mapping will be discarded because valgrind thinks it is replaced. This will also get rid of all the overrides causing the issue seen.

Comment 2 Mark Wielaard 2015-07-07 13:05:00 UTC
Patch is now upstream as valgrind svn r15398.

Comment 5 Mark Wielaard 2015-07-28 12:04:43 UTC
Just for the record. This issue in binutils seems to have been the root cause:
https://bugzilla.redhat.com/show_bug.cgi?id=1247126

Comment 6 Miloš Prchlík 2015-10-02 15:40:05 UTC
Verified for build valgrind-3.10.0-16.el7, using pcp-3.10.6-2.el7.

Comment 8 errata-xmlrpc 2015-11-19 09:05:03 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://rhn.redhat.com/errata/RHBA-2015-2259.html