public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] manual: Document getcontext uc_stack value on Linux [BZ #759]
@ 2017-05-16 19:11 Adhemerval Zanella
  2017-06-23 18:52 ` Adhemerval Zanella
  0 siblings, 1 reply; 10+ messages in thread
From: Adhemerval Zanella @ 2017-05-16 19:11 UTC (permalink / raw)
  To: libc-alpha

As decribed in BZ#759, Linux getcontext implementation on Linux does
differs from other SysV system about the returned uc_stack.  This is
true not only for i386, but for all the architecture I could actually
check (aarch64, arm, alpha, hppa, m68k, mips, mips64, mips64n32,
powerpc, powerpc64, powerpc64le, s390x, sh, sparc, sparc64, and x86).

And I think we should not change current behavior for some reasons:

1. POSIX 2008 removed this SySV interface for a good reason and changing
   this behavior adds nothing for current portable code.  POSIX 2001
   specification does states that stack should be saved [1] and current
   GLIBC code does in a arch-specific manner (inside the mcontext_t)
   which allows the setcontext to work correctly.

2. Changing this behavior would potentially require compat symbols and
   I see no gain in adding compat symbols for deprecated interfaces.

3. Also, for comment #2 in BZ#759, it is up to kernel do setup the contents
   for ucontext_t and currently it does not provide the stack information
   as well.  Trying to change it is also another fix that does not worth
   the possible gains.

Instead my proposal is to make it clear the current interface behavior in
glibc documentation and close this bug as invalid.

	[BZ #759]
	* manual/setjmp.texi (getcontex): Document uc_stack value on Linux.

[1] http://pubs.opengroup.org/onlinepubs/009695399/functions/getcontext.html
---
 ChangeLog          | 5 +++++
 manual/setjmp.texi | 5 +++++
 2 files changed, 10 insertions(+)

diff --git a/manual/setjmp.texi b/manual/setjmp.texi
index 94d16be..07cc7bf 100644
--- a/manual/setjmp.texi
+++ b/manual/setjmp.texi
@@ -302,6 +302,11 @@ the content of the registers, the signal mask, and the current stack.
 Executing the contents would start at the point where the
 @code{getcontext} call just returned.
 
+On Linux the stack information return on @code{uc_stack} is empty by
+default.  It also the case for signal handling information through
+@code{sigaction} with @code{SA_SIGINFO}.  It could be obtained using
+architecture specific field from @code{uc_mcontext} member.
+
 The function returns @code{0} if successful.  Otherwise it returns
 @code{-1} and sets @var{errno} accordingly.
 @end deftypefun
-- 
2.7.4

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2017-08-08 18:40 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-16 19:11 [PATCH] manual: Document getcontext uc_stack value on Linux [BZ #759] Adhemerval Zanella
2017-06-23 18:52 ` Adhemerval Zanella
2017-07-11 17:56   ` Adhemerval Zanella
2017-07-11 18:23     ` Zack Weinberg
2017-07-11 18:28       ` Adhemerval Zanella
2017-07-11 20:25         ` Zack Weinberg
2017-07-11 21:43           ` Adhemerval Zanella
2017-08-08 18:27             ` Adhemerval Zanella
2017-08-08 18:30               ` Zack Weinberg
2017-08-08 18:40                 ` Adhemerval Zanella

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).