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 = shmat(shmid, NULL, 0);            /* where data is a struct pointer
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 AM Paul Floyd via Valgrind-users <
valgrind-users@lists.sourceforge.net> 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
> > ==6423==    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 error.
> >
> > 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[] = {
>
>     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
> Valgrind-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/valgrind-users
>
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users

Reply via email to