https://bugs.kde.org/show_bug.cgi?id=517697

            Bug ID: 517697
           Summary: Implement CLRSSONSTACK and SETUJMPBUF handling on
                    Solaris.
    Classification: Developer tools
           Product: valgrind
      Version First 3.26.0
       Reported In:
          Platform: Other
                OS: Unspecified
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: general
          Assignee: [email protected]
          Reporter: [email protected]
  Target Milestone: ---

Valgrind on Solaris reports:

$ valgrind /usr/bin/curl
==27540== Memcheck, a memory error detector
==27540== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==27540== Using Valgrind-3.26.0 and LibVEX; rerun with -h for copyright info
==27540== Command: /usr/bin/curl
==27540== 
==27540== 
==27540== Valgrind detected that your program requires
==27540== the following unimplemented functionality:
==27540==    Syswrap of the context call with flag 5.
==27540== This may be because the functionality is hard to implement,
==27540== or because no reasonable program would behave this way,
==27540== or because nobody has yet needed it.  In any case, let us know at
==27540== www.valgrind.org and/or try to work around the problem, if you can.
==27540== 
==27540== Valgrind has to exit now.  Sorry.  Bye!
==27540== 
...

There are two syscalls which are not implemented - CLRSSONSTACK and SETUJMPBUF
(as seen in /usr/include/sys/ucontext.h).

It was also reported here: https://github.com/oracle/solaris-userland/issues/19

We have fixed this issue by this patch
https://github.com/oracle/solaris-userland/blob/master/components/valgrind/patches/08-setcontext.patch
. I'm trying to offer it here with the hope if it being merged even if I do not
feel to be the best person to exmplain and/or understand it ... There are no
checks for the two syscalls, only and acknowledgement if their existence. I'll
quote Casper Dik who did the fix:


```
There seems to be no reason to do a lot at this system call as it
is a "no customer serviceable parts inside" function and called once
(at most) when starting a process; when the second thread is started
or when on_fault() is called for the first time.

...

syscall(SYS_context, SETUJMPBUF, buf, func));

SETUJMPBUF == 5.
This tells the kernel where thread keeps a pointer to the setjmpbuf()
and the place where the kernel can find siglongjmp()
The functionality is used handle libc's on_fault()/no_fault() where
we do not care if SIGBUS/SIGSEGV are blocked.
The buffer should be a valid pointer and the function can be 0 (Intel)
or siglongjmp() in the case of SPARC.
If you're not sure this is actually a bug, instead post about it at
https://discuss.kde.org

...

This is syscal(SYS_context(CLRSSONSTACK) which is triggered in the
case of a longjmp() from the alternative signal stack to the real
stack to clear the kernel's idea on which stack you are executing.
```

The code should compile also on older Solaris releases.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to