Re: Need support in debugging Valgrind 3.18 glibc segv error

kiran hardas <[email protected]> Thu, 13 Mar 2025 03:10:49 +0530
Newsgroups gmane.comp.debugging.valgrind
Message-ID <CAPyEgmb2V0r6fNyXqqdnYY_3SDSM++QKkqZ6y=tOXLmT655Zbg@mail.gmail.com>
--===============4036398615945673213==
Content-Type: multipart/alternative; boundary="000000000000bb820f06302c0f96"

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

Hi Philippe/Team,

Thank you Philippe for your suggestions, I was able to resolve the earlier
errors by adding additional valgrind options and loading the symbol table.
In my application, few variables and a function pointer was uninitialised
which led to previous errors mentioned in earlier email.

Proceeding further with my earlier activity, right now i am seeing error
related to unhandled syscall no. 395 in valgrind logs. I thought to bring
this up in this mail chain for your suggestions/inputs.


# ./usr/test/bin/valgrind --version -v
valgrind-3.24.0-fcdaa47426-20241101

GNU/Linux 5.4
Glibc 2.40
gcc 14.2
binutils 2.43


Error snippet:

--6423-- WARNING: unhandled x86-linux syscall: 395
=3D=3D6423=3D=3D    at 0x1F757398: shmget (in /lib/libc-2.40.so)
by 0xF597083:  <application backtraces>
...
...
--6423-- You may be able to write your own handler.
--6423-- Read the file README_MISSING_SYSCALL_OR_IOCTL.
--6423-- Nevertheless we consider this a bug.  Please report
--6423-- it at http://valgrind.org/support/bug_reports.html.

From my analysis of valgrind code, i can see the shmget wrappers are
present in coregrind/m_syswrap area, but still it is throwing such error.

Any pointers or suggestions would be appreciated, Thanks.




Regards,
Kiran H.

On Thu, Jan 30, 2025 at 1:54=E2=80=AFAM Philippe Waroquiers <
[email protected]> wrote:

> Is glibc compiled with debug info ?
> Without a way to see where the problem happens in glibc, this will be
> difficult
> to understand.
> If/when you have glibc debug info, you might use valgrind --vgdb-error=3D=
0
> and debug
> glibc startup under valgrind+gdb
>
> Alternatively, you might add -v -v -v -d -d -d to have more information
> produced by
> valgrind, but that will likely not help much without glibc debug.
>
> In the original mail, you show an extract of the error logs.
> Was there any other error before ?
> Because the problem might originate from an earlier error.
>
> Finally, do you encounter the same problem with e.g. --tool=3Dnone or
> --tool=3Dcallgrind ?
> (none will do no transformation to the guest process and callgrind will
> not replace
> malloc/free, so that might give a hint).
>
> Thanks
> Philippe
>
>
>
>
> On Thu, 2025-01-30 at 01:00 +0530, kiran hardas wrote:
> > Yes Philippe, I did try out Valgrind 3.24, but it too gave same error.
> >
> > Regards,
> > Kiran H.
> >
> > On Wed, Jan 29, 2025 at 11:56=E2=80=AFPM Philippe Waroquiers <
> [email protected]>
> > wrote:
> > > The first thing to try is to compile and use a more recent valgrind
> version.
> > > (3.18 is something like 4 years old while 3.24 is from Oct 24).
> > >
> > > Thanks
> > > Philippe
> > >
> > >
> > > On Wed, 2025-01-29 at 19:03 +0530, kiran hardas wrote:
> > > > 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 wit=
h
> 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:
> > > > ------------------------
> > > > ...
> > > > ...
> > > > =3D=3D13089=3D=3D
> > > > --13089-- REDIR: 0x1f749f60 (libc.so.6:???) redirected to 0x1e59bd7=
0
> (strcmp)
> > > > =3D=3D13089=3D=3D Jump to the invalid address stated on the next li=
ne
> > > > =3D=3D13089=3D=3D    at 0x0: ???
> > > > =3D=3D13089=3D=3D    by 0x1F607366: ??? (in /lib/libc-2.40.so)
> > > > =3D=3D13089=3D=3D    by 0x1F607423: (below main) (in /lib/libc-2.40=
.so)
> > > > =3D=3D13089=3D=3D  Address 0x0 is not stack'd, malloc'd or (recentl=
y) free'd
> > > > =3D=3D13089=3D=3D
> > > > =3D=3D13089=3D=3D
> > > > =3D=3D13089=3D=3D Process terminating with default action of signal=
 11
> (SIGSEGV): dumping
> > > > core
> > > > =3D=3D13089=3D=3D  Bad permissions for mapped region at address 0x0
> > > > =3D=3D13089=3D=3D    at 0x0: ???
> > > > =3D=3D13089=3D=3D    by 0x1F607366: ??? (in /lib/libc-2.40.so)
> > > > =3D=3D13089=3D=3D    by 0x1F607423: (below main) (in /lib/libc-2.40=
.so)
> > > > =3D=3D13089=3D=3D
> > > >
> > > >
> > > > 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=3Dyes
> , --read-var-
> > > > info=3Dyes .
> > > > 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.
> > > >
> > > > _______________________________________________
> > > > Valgrind-users mailing list
> > > > [email protected]
> > > > https://lists.sourceforge.net/lists/listinfo/valgrind-users
> > >
>
>

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

<div dir=3D"ltr">Hi=C2=A0Philippe/Team,<div><br></div><div>Thank you Philip=
pe for your suggestions, I was able=C2=A0to resolve the earlier errors by a=
dding additional valgrind options and loading the symbol table.</div><div>I=
n my application, few variables and a function pointer was uninitialised wh=
ich led to previous errors mentioned=C2=A0in earlier=C2=A0email.</div><div>=
<br></div><div>Proceeding further with my earlier activity, right now i am =
seeing=C2=A0error related to unhandled syscall no. 395 in valgrind logs. I =
thought to bring this up in this mail chain for your suggestions/inputs.</d=
iv><div><br></div><div><br></div><div># ./usr/test/bin/valgrind --version -=
v<br>valgrind-3.24.0-fcdaa47426-20241101<br></div><div><br></div><div><div>=
GNU/Linux 5.4</div><div>Glibc 2.40</div><div>gcc 14.2</div><div>binutils 2.=
43</div></div><div><br></div><div><br></div><div>Error snippet:</div><div><=
br></div><div>--6423-- WARNING: unhandled x86-linux syscall: 395<br>=3D=3D6=
423=3D=3D =C2=A0 =C2=A0at 0x1F757398: shmget (in /lib/<a href=3D"http://lib=
c-2.40.so">libc-2.40.so</a>)<br>by 0xF597083:=C2=A0

&lt;application backtraces&gt;<br>...=C2=A0 =C2=A0 =C2=A0=C2=A0</div><div>.=
..<br>--6423-- You may be able to write your own handler.<br>--6423-- Read =
the file README_MISSING_SYSCALL_OR_IOCTL.<br>--6423-- Nevertheless we consi=
der this a bug.=C2=A0 Please report<br>--6423-- it at <a href=3D"http://val=
grind.org/support/bug_reports.html">http://valgrind.org/support/bug_reports=
.html</a>.<br><br>From my analysis of valgrind code, i can see the shmget w=
rappers are present in coregrind/m_syswrap area, but still it is throwing s=
uch error.<br><br>Any pointers or suggestions would be appreciated, Thanks.=
</div><div><br></div><div><br></div><div><br></div><div><br></div><div>Rega=
rds,</div><div>Kiran H.=C2=A0 =C2=A0</div></div><br><div class=3D"gmail_quo=
te gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_attr">On Thu, Jan=
 30, 2025 at 1:54=E2=80=AFAM Philippe Waroquiers &lt;<a href=3D"mailto:phil=
[email protected]">[email protected]</a>&gt; wrote:<br>=
</div><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0px 0.8ex;b=
order-left:1px solid rgb(204,204,204);padding-left:1ex">Is glibc compiled w=
ith debug info ?<br>
Without a way to see where the problem happens in glibc, this will be diffi=
cult<br>
to understand.<br>
If/when you have glibc debug info, you might use valgrind --vgdb-error=3D0 =
and debug<br>
glibc startup under valgrind+gdb<br>
<br>
Alternatively, you might add -v -v -v -d -d -d to have more information pro=
duced by<br>
valgrind, but that will likely not help much without glibc debug.<br>
<br>
In the original mail, you show an extract of the error logs.<br>
Was there any other error before ?<br>
Because the problem might originate from an earlier error.<br>
<br>
Finally, do you encounter the same problem with e.g. --tool=3Dnone or --too=
l=3Dcallgrind ?<br>
(none will do no transformation to the guest process and callgrind will not=
 replace<br>
malloc/free, so that might give a hint).<br>
<br>
Thanks<br>
Philippe<br>
<br>
<br>
<br>
<br>
On Thu, 2025-01-30 at 01:00 +0530, kiran hardas wrote:<br>
&gt; Yes Philippe, I did try out Valgrind 3.24, but it too gave same error.=
<br>
&gt; <br>
&gt; Regards,<br>
&gt; Kiran H.<br>
&gt; <br>
&gt; On Wed, Jan 29, 2025 at 11:56=E2=80=AFPM Philippe Waroquiers &lt;<a hr=
ef=3D"mailto:[email protected]" target=3D"_blank">philippe.waro=
[email protected]</a>&gt;<br>
&gt; wrote:<br>
&gt; &gt; The first thing to try is to compile and use a more recent valgri=
nd version.<br>
&gt; &gt; (3.18 is something like 4 years old while 3.24 is from Oct 24).<b=
r>
&gt; &gt; <br>
&gt; &gt; Thanks<br>
&gt; &gt; Philippe<br>
&gt; &gt; <br>
&gt; &gt; <br>
&gt; &gt; On Wed, 2025-01-29 at 19:03 +0530, kiran hardas wrote:<br>
&gt; &gt; &gt; Hi Team,<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Good Evening,<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; I need some support in debugging an issue in Valgrind 3.18.=
=C2=A0<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; I have an application which I am trying to check with Valgri=
nd tool for memory<br>
&gt; &gt; &gt; issues. I<br>
&gt; &gt; &gt; have the valgrind source code which is compiled and built al=
ong with my application<br>
&gt; &gt; &gt; using same=C2=A0set of libraries. But while checking with va=
lgrind tool i get an=C2=A0invalid<br>
&gt; &gt; &gt; address error in libc library (mostly implying null pointer =
dereferencing/free) and<br>
&gt; &gt; &gt; valgrind is terminating. I am unable to find the exact place=
 in glibc code where<br>
&gt; &gt; &gt; this<br>
&gt; &gt; &gt; error is coming from and need any help which you can provide=
.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Please find further=C2=A0details below,<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; $ ./usr/test/bin/valgrind --version -v<br>
&gt; &gt; &gt; valgrind-3.18.1-42b08ed5bd-20211015<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; GNU/Linux 5.4<br>
&gt; &gt; &gt; Glibc 2.40<br>
&gt; &gt; &gt; gcc 14.2<br>
&gt; &gt; &gt; binutils 2.43<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; This same valgrind was working when i was using glibc 2.23 b=
ut giving this error<br>
&gt; &gt; &gt; when i<br>
&gt; &gt; &gt; upgraded glibc to 2.40<br>
&gt; &gt; &gt; For valgrind 3.18 i have=C2=A0applied rseq patches and nop c=
ode error (0x2E 0x8D 0xB4<br>
&gt; &gt; &gt; 0x26)<br>
&gt; &gt; &gt; patches also required for latest glibc 2.40.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Error log snippet:<br>
&gt; &gt; &gt; ------------------------<br>
&gt; &gt; &gt; ...<br>
&gt; &gt; &gt; ...<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D<br>
&gt; &gt; &gt; --13089-- REDIR: 0x1f749f60 (libc.so.6:???) redirected to 0x=
1e59bd70 (strcmp)<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D Jump to the invalid address stated on the =
next line<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D =C2=A0 =C2=A0at 0x0: ???<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D =C2=A0 =C2=A0by 0x1F607366: ??? (in /lib/<=
a href=3D"http://libc-2.40.so" rel=3D"noreferrer" target=3D"_blank">libc-2.=
40.so</a>)<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D =C2=A0 =C2=A0by 0x1F607423: (below main) (=
in /lib/<a href=3D"http://libc-2.40.so" rel=3D"noreferrer" target=3D"_blank=
">libc-2.40.so</a>)<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D =C2=A0Address 0x0 is not stack&#39;d, mall=
oc&#39;d or (recently) free&#39;d<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D Process terminating with default action of=
 signal 11 (SIGSEGV): dumping<br>
&gt; &gt; &gt; core<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D =C2=A0Bad permissions for mapped region at=
 address 0x0<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D =C2=A0 =C2=A0at 0x0: ???<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D =C2=A0 =C2=A0by 0x1F607366: ??? (in /lib/<=
a href=3D"http://libc-2.40.so" rel=3D"noreferrer" target=3D"_blank">libc-2.=
40.so</a>)<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D =C2=A0 =C2=A0by 0x1F607423: (below main) (=
in /lib/<a href=3D"http://libc-2.40.so" rel=3D"noreferrer" target=3D"_blank=
">libc-2.40.so</a>)<br>
&gt; &gt; &gt; =3D=3D13089=3D=3D<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Approaches tried<br>
&gt; &gt; &gt; -----------------------<br>
&gt; &gt; &gt; 1. I reduced the optimisation level in glibc to -O1, but sti=
ll no further=C2=A0symbol<br>
&gt; &gt; &gt; details<br>
&gt; &gt; &gt; are available<br>
&gt; &gt; &gt; 2. The core file generated for valgrind crash is also not sh=
owing any symbol details<br>
&gt; &gt; &gt; at<br>
&gt; &gt; &gt; crash point. (only showing ??)<br>
&gt; &gt; &gt; 3. Tried adding more option to valgrind like=C2=A0--track-or=
igins=3Dyes ,=C2=A0--read-var-<br>
&gt; &gt; &gt; info=3Dyes .<br>
&gt; &gt; &gt; But not giving any more info for the error.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; I would appreciate any pointers team can provide in debuggin=
g this issue.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Thanks in advance<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; Regards,<br>
&gt; &gt; &gt; Kiran H.<br>
&gt; &gt; &gt; <br>
&gt; &gt; &gt; _______________________________________________<br>
&gt; &gt; &gt; Valgrind-users mailing list<br>
&gt; &gt; &gt; <a href=3D"mailto:[email protected]" targ=
et=3D"_blank">[email protected]</a><br>
&gt; &gt; &gt; <a href=3D"https://lists.sourceforge.net/lists/listinfo/valg=
rind-users" rel=3D"noreferrer" target=3D"_blank">https://lists.sourceforge.=
net/lists/listinfo/valgrind-users</a><br>
&gt; &gt; <br>
<br>
</blockquote></div>

--000000000000bb820f06302c0f96--


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


--===============4036398615945673213==
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

--===============4036398615945673213==--