Re: Need support in debugging Valgrind 3.18 glibc segv error
kiran hardas <[email protected]> Fri, 21 Mar 2025 13:36:52 +0530
| Newsgroups | gmane.comp.debugging.valgrind |
|---|---|
| Message-ID | <CAPyEgmYd13HdBzm9xBX8eMLZhSHV2Pm_BOWcwnTfXs6zNAssXQ@mail.gmail.com> |
--===============2124971403235572773== Content-Type: multipart/alternative; boundary="0000000000006c05160630d5bd47" --0000000000006c05160630d5bd47 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Hi Paul/Team, Thank you for your suggestion. I added the entry for shmget function in coregrind/m_syswrap/syswrap-x86-linux.c and the error got resolved for shmget function. Yes it is x86 linux that is getting used. Similar errors came for shmat, shmdt, shmctl functions. I added similar entries of those functions too in the table and resolved the errors. Currently i am getting error from shmat function as "Invalid argument" from my application code. The data pointer returned by shmat function is coming as 0xffffffff which is -1 (error). I am calling the shmat as below in my application code data =3D shmat(shmid, NULL, 0); /* where data is a struct pointe= r and shmid is 1 obtained by a successful shmget call */ I verified the arguments for this shmat function and they seem to be fine. Also checked for permission issues. I am suspecting memory issue which could be resulting in shmat attach failure after running valgrind (have glibc 2.40). Would appreciate any advice/suggestion you can provide for this issue. Thanks in advance On Sun, Mar 16, 2025 at 1:47=E2=80=AFAM Paul Floyd via Valgrind-users < [email protected]> wrote: > > On 3/12/25 22:40, kiran hardas wrote: > > 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 > > <http://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 erro= r. > > > > Any pointers or suggestions would be appreciated, Thanks. > > > Hi > > That looks like shmget on x86. Can you confirm that? > > If so could you build valgrind with this patch > > diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c > b/coregrind/m_syswrap/syswrap-x86-l > inux.c > index 50384817d..5c0b57789 100644 > --- a/coregrind/m_syswrap/syswrap-x86-linux.c > +++ b/coregrind/m_syswrap/syswrap-x86-linux.c > @@ -1621,6 +1621,8 @@static SyscallTableEntry syscall_table[] =3D { > > GENX_(__NR_rseq, sys_ni_syscall), // 386 > > + LINX_(__NR_shmget, sys_shmget), // 395 > + > LINXY(__NR_clock_gettime64, sys_clock_gettime64), // 403 > LINX_(__NR_clock_settime64, sys_clock_settime64), // 404 > > > and let us know if it works? > > It's likely that you will also need shmat shmctl and shmdt as well. > > A+ > > Paul > > > > > _______________________________________________ > Valgrind-users mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/valgrind-users > --0000000000006c05160630d5bd47 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr">Hi Paul/Team,<div><br></div><div>Thank you for your sugges= tion. I added the entry for shmget function in coregrind/m_syswrap/syswrap-= x86-linux.c</div><div>and the error got resolved for shmget function. Yes i= t is x86 linux that is=C2=A0getting used. Similar errors came for shmat, sh= mdt, shmctl functions.</div><div>I added similar entries of those functions= too in the table and resolved the=C2=A0errors.=C2=A0</div><div><br></div><= div>Currently i am getting error from shmat function as "Invalid argum= ent" from my application code.</div><div>The data pointer returned by = shmat function is coming as 0xffffffff which is -1 (error). I am calling th= e shmat as below</div><div>=C2=A0in my application code</div><div><br></div= ><div>data =3D shmat(shmid, NULL, 0);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 /* where data is a struct pointer and shmid is 1 obtained by a successf= ul=C2=A0shmget call */</div><div><br></div><div>I verified the arguments fo= r this shmat function and they seem to be fine. Also checked for permission= issues.</div><div>I am suspecting memory issue which could be resulting in= shmat attach failure after running valgrind (have glibc 2.40).</div><div><= br></div><div>Would appreciate any advice/suggestion you can provide for th= is issue.</div><div><br></div><div>Thanks in advance</div></div><br><div cl= ass=3D"gmail_quote gmail_quote_container"><div dir=3D"ltr" class=3D"gmail_a= ttr">On Sun, Mar 16, 2025 at 1:47=E2=80=AFAM Paul Floyd via Valgrind-users = <<a href=3D"mailto:[email protected]">valgrind-users@= lists.sourceforge.net</a>> wrote:<br></div><blockquote class=3D"gmail_qu= ote" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,20= 4);padding-left:1ex"><br> On 3/12/25 22:40, kiran hardas wrote:<br> > Hi=C2=A0Philippe/Team,<br> ><br> > Thank you Philippe for your suggestions, I was able=C2=A0to resolve th= e <br> > earlier errors by adding additional valgrind options and loading the <= br> > symbol table.<br> > In my application, few variables and a function pointer was <br> > uninitialised which led to previous errors mentioned=C2=A0in earlier= =C2=A0email.<br> ><br> > Proceeding further with my earlier activity, right now i am <br> > seeing=C2=A0error related to unhandled syscall no. 395 in valgrind log= s. I <br> > thought to bring this up in this mail chain for your suggestions/input= s.<br> ><br> ><br> > # ./usr/test/bin/valgrind --version -v<br> > valgrind-3.24.0-fcdaa47426-20241101<br> ><br> > GNU/Linux 5.4<br> > Glibc 2.40<br> > gcc 14.2<br> > binutils 2.43<br> ><br> ><br> > Error snippet:<br> ><br> > --6423-- WARNING: unhandled x86-linux syscall: 395<br> > =3D=3D6423=3D=3D =C2=A0 =C2=A0at 0x1F757398: shmget (in /lib/<a href= =3D"http://libc-2.40.so" rel=3D"noreferrer" target=3D"_blank">libc-2.40.so<= /a> <br> > <<a href=3D"http://libc-2.40.so" rel=3D"noreferrer" target=3D"_blan= k">http://libc-2.40.so</a>>)<br> > by 0xF597083: <application backtraces><br> > ...<br> > ...<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 consider this a bug.=C2=A0 Please report<br> > --6423-- it at <a href=3D"http://valgrind.org/support/bug_reports.html= " rel=3D"noreferrer" target=3D"_blank">http://valgrind.org/support/bug_repo= rts.html</a>.<br> ><br> > From my analysis of valgrind code, i can see the shmget wrappers are <= br> > present in coregrind/m_syswrap area, but still it is throwing such err= or.<br> ><br> > Any pointers or suggestions would be appreciated, Thanks.<br> ><br> Hi<br> <br> That looks like shmget on x86. Can you confirm that?<br> <br> If so could you build valgrind with this patch<br> <br> diff --git a/coregrind/m_syswrap/syswrap-x86-linux.c <br> b/coregrind/m_syswrap/syswrap-x86-l<br> inux.c<br> index 50384817d..5c0b57789 100644<br> --- a/coregrind/m_syswrap/syswrap-x86-linux.c<br> +++ b/coregrind/m_syswrap/syswrap-x86-linux.c<br> @@ -1621,6 +1621,8 @@static SyscallTableEntry syscall_table[] =3D {<br> <br> =C2=A0=C2=A0=C2=A0=C2=A0GENX_(__NR_rseq, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0sys_ni_syscall), =C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0// 386<br> <br> + =C2=A0=C2=A0LINX_(__NR_shmget, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0sys_shmget), =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0// 395<br> +<br> =C2=A0=C2=A0=C2=A0=C2=A0LINXY(__NR_clock_gettime64, =C2=A0=C2=A0sys_clock_g= ettime64), =C2=A0// 403<br> =C2=A0=C2=A0=C2=A0=C2=A0LINX_(__NR_clock_settime64, =C2=A0=C2=A0sys_clock_s= ettime64), =C2=A0// 404<br> <br> <br> and let us know if it works?<br> <br> It's likely that you will also need shmat shmctl and shmdt as well.<br> <br> A+<br> <br> Paul<br> <br> <br> <br> <br> _______________________________________________<br> Valgrind-users mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">V= [email protected]</a><br> <a href=3D"https://lists.sourceforge.net/lists/listinfo/valgrind-users" rel= =3D"noreferrer" target=3D"_blank">https://lists.sourceforge.net/lists/listi= nfo/valgrind-users</a><br> </blockquote></div> --0000000000006c05160630d5bd47-- --===============2124971403235572773== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --===============2124971403235572773== 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 --===============2124971403235572773==--