public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/6684] New: Segmentation fault after getcontext() and setcontext() on ppc64
@ 2008-06-20 22:55 khoroshilov at linuxtesting dot org
  2008-08-14  3:38 ` [Bug libc/6684] " drepper at redhat dot com
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: khoroshilov at linuxtesting dot org @ 2008-06-20 22:55 UTC (permalink / raw)
  To: glibc-bugs

#include <ucontext.h>
#include <stdarg.h>
#include <stdio.h>

typedef struct ReturnValue { int a; } ReturnValue;
ReturnValue defaultReturnValue = { 0 };

ucontext_t globalUcp;

int outputMessage( char * format, ... ) {
    int res;
    va_list arg_list;
    va_start( arg_list, format );
    res = vprintf( format, arg_list );
    va_end( arg_list );
    return res;
}

ReturnValue getcontextCall( void ) {
    outputMessage( "getcontextCall : 1\n" );
    getcontext( & globalUcp );
    outputMessage( "getcontextCall : 2\n" );
    return defaultReturnValue;
}

ReturnValue setcontextCall( void ) {
    outputMessage( "setcontextCall : 1\n" );
    setcontext( & globalUcp );
    outputMessage( "setcontextCall : 2\n" );
    return defaultReturnValue;
}

int main( int argc,const char ** argv ) {
    getcontextCall();
    setcontextCall();
    return 0;
}


The example above leads to segmentation fault in the outputMessage() function
after call of the setcontext() on ppc64 platform. The output of the process is
as follows:

getcontextCall : 1
getcontextCall : 2
setcontextCall : 1
Segmentation fault

If someone replace "typedef struct ReturnValue { int a; } ReturnValue;" by
"typedef int ReturnValue;" in the example segmentation fault disappears.

See also: http://linuxtesting.org/results/report?num=S0688

-- 
           Summary: Segmentation fault after getcontext() and setcontext()
                    on ppc64
           Product: glibc
           Version: 2.4
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: khoroshilov at linuxtesting dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=6684

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 6+ messages in thread
[parent not found: <bug-6684-131@http.sourceware.org/bugzilla/>]

end of thread, other threads:[~2014-07-04  6:52 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-06-20 22:55 [Bug libc/6684] New: Segmentation fault after getcontext() and setcontext() on ppc64 khoroshilov at linuxtesting dot org
2008-08-14  3:38 ` [Bug libc/6684] " drepper at redhat dot com
2008-08-14  6:44 ` khoroshilov at linuxtesting dot org
2008-08-14 13:51 ` drepper at redhat dot com
2008-08-14 20:26 ` khoroshilov at linuxtesting dot org
     [not found] <bug-6684-131@http.sourceware.org/bugzilla/>
2014-07-04  6:52 ` fweimer at redhat dot com

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).