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; 5+ 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] 5+ messages in thread
* [Bug libc/6684] Segmentation fault after getcontext() and setcontext() on ppc64 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 ` drepper at redhat dot com 2008-08-14 6:44 ` khoroshilov at linuxtesting dot org ` (2 subsequent siblings) 3 siblings, 0 replies; 5+ messages in thread From: drepper at redhat dot com @ 2008-08-14 3:38 UTC (permalink / raw) To: glibc-bugs ------- Additional Comments From drepper at redhat dot com 2008-08-14 03:37 ------- This code is invalid. It just works by accident. You cannot leave the call frame you try to reinstate. -- What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |RESOLVED Resolution| |INVALID 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] 5+ messages in thread
* [Bug libc/6684] Segmentation fault after getcontext() and setcontext() on ppc64 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 3 siblings, 0 replies; 5+ messages in thread From: khoroshilov at linuxtesting dot org @ 2008-08-14 6:44 UTC (permalink / raw) To: glibc-bugs ------- Additional Comments From khoroshilov at linuxtesting dot org 2008-08-14 06:43 ------- (In reply to comment #1) > This code is invalid. It just works by accident. You cannot leave the call > frame you try to reinstate. I do not see such restriction for applications neither in POSIX nor in man pages. Should it be a bug in POSIX? -- 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] 5+ messages in thread
* [Bug libc/6684] Segmentation fault after getcontext() and setcontext() on ppc64 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 3 siblings, 0 replies; 5+ messages in thread From: drepper at redhat dot com @ 2008-08-14 13:51 UTC (permalink / raw) To: glibc-bugs ------- Additional Comments From drepper at redhat dot com 2008-08-14 13:49 ------- (In reply to comment #2) > Should it be a bug in POSIX? No. You just don't understand how these functions work. -- 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] 5+ messages in thread
* [Bug libc/6684] Segmentation fault after getcontext() and setcontext() on ppc64 2008-06-20 22:55 [Bug libc/6684] New: Segmentation fault after getcontext() and setcontext() on ppc64 khoroshilov at linuxtesting dot org ` (2 preceding siblings ...) 2008-08-14 13:51 ` drepper at redhat dot com @ 2008-08-14 20:26 ` khoroshilov at linuxtesting dot org 3 siblings, 0 replies; 5+ messages in thread From: khoroshilov at linuxtesting dot org @ 2008-08-14 20:26 UTC (permalink / raw) To: glibc-bugs ------- Additional Comments From khoroshilov at linuxtesting dot org 2008-08-14 20:24 ------- (In reply to comment #3) > (In reply to comment #2) > > Should it be a bug in POSIX? > > No. You just don't understand how these functions work. I thought I have not to khow how any functions work BEFORE reading their POSIX definitions (man pages). I do not see how to understand this usage limitation from the existing text if the reader does not know implementation details. POSIX follows a very good rule to explicitly specify any usage limitation and here is an obvious violation of the rule. -- 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] 5+ messages in thread
end of thread, other threads:[~2008-08-14 20:26 UTC | newest] Thread overview: 5+ 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
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).