https://gcc.gnu.org/bugzilla/show_bug.cgi?id=113785

--- Comment #1 from ro at CeBiTec dot Uni-Bielefeld.DE <ro at CeBiTec dot 
Uni-Bielefeld.DE> ---
I've found what's going on: as described in Solaris makecontext(3C), the
function changed starting with Solaris 10:

NOTES
       The  semantics  of the uc_stack member of the ucontext_t structure have
       changed as they apply to inputs to makecontext(). Prior to Solaris  10,
       the  ss_sp member of the uc_stack structure represented the high memory
       address of the area reserved for the stack. The ss_sp member now repre-
       sents  the  base  (low  memory  address), in keeping with other uses of
       ss_sp.

       This change in the meaning of ss_sp is now the  default  behavior.  The
       -D__MAKECONTEXT_V2_SOURCE  compilation  flag  used  in Solaris 9 update
       releases to access this behavior is obsolete.

To preserve, binary compatiblity, the old behaviour of makecontext() has
been retained, and the following snippet in <ucontext.h> ensures that a
different function with the new behavious is called from user code
instead:

/* makecontext removed in SUSv4 (XPG7, UNIX V7) */
#if !defined(_XPG7) || defined(__EXTENSIONS__)
#ifdef __sparc
#ifdef __PRAGMA_REDEFINE_EXTNAME
#pragma redefine_extname        makecontext     __makecontext_v2
#else
#define makecontext     __makecontext_v2
#endif
#endif  /* __sparc */
#endif  /* !defined(_XPG7) || ... */

However, libasan knows nothing about this and just intercepts unadorned
makecontext, but this interceptor is never called.

I've got a patch (attached for reference) that changes the makecontext
interceptor to call __makecontext_v2 instead on Solaris/SPARC.  With
this, the c-c++-common/asan/swapcontext-test-1.c test now PASSes on
Solaris/SPARC.

I'm going to submit it upstream soon.

Reply via email to