Need support in debugging Valgrind 3.18 glibc segv error

kiran hardas <[email protected]> Wed, 29 Jan 2025 19:03:47 +0530
Newsgroups gmane.comp.debugging.valgrind
Message-ID <CAPyEgmZqL7+_Zv+vr9PJi6KmY5RTgdrO=ZT4D0xbHxYGGA3aLQ@mail.gmail.com>
--===============2351608429099235757==
Content-Type: multipart/alternative; boundary="000000000000a0c99e062cd85c66"

--000000000000a0c99e062cd85c66
Content-Type: text/plain; charset="UTF-8"

Hi Team,

Good Evening,

I need some support in debugging an issue in Valgrind 3.18.

I have an application which I am trying to check with Valgrind tool for
memory issues. I have the valgrind source code which is compiled and built
along with my application using same set of libraries. But while checking
with valgrind tool i get an invalid address error in libc library (mostly
implying null pointer dereferencing/free) and valgrind is terminating. I am
unable to find the exact place in glibc code where this error is coming
from and need any help which you can provide.

Please find further details below,

$ ./usr/test/bin/valgrind --version -v
valgrind-3.18.1-42b08ed5bd-20211015

GNU/Linux 5.4
Glibc 2.40
gcc 14.2
binutils 2.43

This same valgrind was working when i was using glibc 2.23 but giving this
error when i upgraded glibc to 2.40
For valgrind 3.18 i have applied rseq patches and nop code error (0x2E 0x8D
0xB4 0x26) patches also required for latest glibc 2.40.

Error log snippet:
------------------------
...
...
==13089==
--13089-- REDIR: 0x1f749f60 (libc.so.6:???) redirected to 0x1e59bd70
(strcmp)
==13089== Jump to the invalid address stated on the next line
==13089==    at 0x0: ???
==13089==    by 0x1F607366: ??? (in /lib/libc-2.40.so)
==13089==    by 0x1F607423: (below main) (in /lib/libc-2.40.so)
==13089==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
==13089==
==13089==
==13089== Process terminating with default action of signal 11 (SIGSEGV):
dumping core
==13089==  Bad permissions for mapped region at address 0x0
==13089==    at 0x0: ???
==13089==    by 0x1F607366: ??? (in /lib/libc-2.40.so)
==13089==    by 0x1F607423: (below main) (in /lib/libc-2.40.so)
==13089==


Approaches tried
-----------------------
1. I reduced the optimisation level in glibc to -O1, but still no
further symbol details are available
2. The core file generated for valgrind crash is also not showing any
symbol details at crash point. (only showing ??)
3. Tried adding more option to valgrind like --track-origins=yes
, --read-var-info=yes . But not giving any more info for the error.


I would appreciate any pointers team can provide in debugging this issue.

Thanks in advance

Regards,
Kiran H.

--000000000000a0c99e062cd85c66
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr">Hi Team,<div><br></div><div>Good Evening,</div><div><br></=
div><div>I need some support in debugging an issue in Valgrind 3.18.=C2=A0<=
/div><div><br></div><div>I have an application which I am trying to check w=
ith Valgrind tool for memory issues. I have the valgrind source code which =
is compiled and built along with my application using same=C2=A0set of libr=
aries. But while checking with valgrind tool i get an=C2=A0invalid address =
error in libc library (mostly implying null pointer dereferencing/free) and=
 valgrind is terminating. I am unable to find the exact place in glibc code=
 where this error is coming from and need any help which you can provide.</=
div><div><br></div><div>Please find further=C2=A0details below,</div><div><=
br></div><div>$ ./usr/test/bin/valgrind --version -v<br>valgrind-3.18.1-42b=
08ed5bd-20211015<br></div><div><br></div><div>GNU/Linux 5.4</div><div>Glibc=
 2.40</div><div>gcc 14.2</div><div>binutils 2.43</div><div><br></div><div>T=
his same valgrind was working when i was using glibc 2.23 but giving this e=
rror when i upgraded glibc to 2.40</div><div><div>For valgrind 3.18 i have=
=C2=A0applied rseq patches and nop code error (0x2E 0x8D 0xB4 0x26) patches=
 also required for latest glibc 2.40.</div></div><div><br></div><div>Error =
log snippet:</div><div>------------------------</div><div>...</div><div>...=
</div><div>=3D=3D13089=3D=3D<br>--13089-- REDIR: 0x1f749f60 (libc.so.6:???)=
 redirected to 0x1e59bd70 (strcmp)<br>=3D=3D13089=3D=3D Jump to the invalid=
 address stated on the next line<br>=3D=3D13089=3D=3D =C2=A0 =C2=A0at 0x0: =
???<br>=3D=3D13089=3D=3D =C2=A0 =C2=A0by 0x1F607366: ??? (in /lib/<a href=
=3D"http://libc-2.40.so">libc-2.40.so</a>)<br>=3D=3D13089=3D=3D =C2=A0 =C2=
=A0by 0x1F607423: (below main) (in /lib/<a href=3D"http://libc-2.40.so">lib=
c-2.40.so</a>)<br>=3D=3D13089=3D=3D =C2=A0Address 0x0 is not stack&#39;d, m=
alloc&#39;d or (recently) free&#39;d<br>=3D=3D13089=3D=3D<br>=3D=3D13089=3D=
=3D<br>=3D=3D13089=3D=3D Process terminating with default action of signal =
11 (SIGSEGV): dumping core<br>=3D=3D13089=3D=3D =C2=A0Bad permissions for m=
apped region at address 0x0<br>=3D=3D13089=3D=3D =C2=A0 =C2=A0at 0x0: ???<b=
r>=3D=3D13089=3D=3D =C2=A0 =C2=A0by 0x1F607366: ??? (in /lib/<a href=3D"htt=
p://libc-2.40.so">libc-2.40.so</a>)<br>=3D=3D13089=3D=3D =C2=A0 =C2=A0by 0x=
1F607423: (below main) (in /lib/<a href=3D"http://libc-2.40.so">libc-2.40.s=
o</a>)<br>=3D=3D13089=3D=3D</div><div><br></div><div><br></div><div>Approac=
hes tried</div><div>-----------------------</div><div>1. I reduced the opti=
misation level in glibc to -O1, but still no further=C2=A0symbol details ar=
e available</div><div>2. The core file generated for valgrind crash is also=
 not showing any symbol details at crash point. (only showing ??)</div><div=
>3. Tried adding more option to valgrind like=C2=A0--track-origins=3Dyes ,=
=C2=A0--read-var-info=3Dyes . But not giving any more info for the error.</=
div><div><br></div><div><br></div><div>I would appreciate any pointers team=
 can provide in debugging this issue.</div><div><br></div><div>Thanks in ad=
vance</div><div><br></div><div>Regards,</div><div>Kiran H.</div><div><br></=
div></div>

--000000000000a0c99e062cd85c66--


--===============2351608429099235757==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline


--===============2351608429099235757==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Valgrind-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/valgrind-users

--===============2351608429099235757==--