about summary refs log tree commit diff
path: root/libio/fileno.c
diff options
context:
space:
mode:
authorWill Newton <will.newton@linaro.org>2014-03-12 16:14:51 +0000
committerWill Newton <will.newton@linaro.org>2014-04-17 11:38:50 +0100
commit37d350073888887637aa67dddf988d9c4b226032 (patch)
treea893453561890056eca3e79e58e0564b15b8b10d /libio/fileno.c
parent423a7160af7fcffc61aac5e2e36d0b6b5b083214 (diff)
downloadglibc-37d350073888887637aa67dddf988d9c4b226032.tar.gz
glibc-37d350073888887637aa67dddf988d9c4b226032.tar.xz
glibc-37d350073888887637aa67dddf988d9c4b226032.zip
aarch64: Re-implement setcontext without rt_sigreturn syscall
The current implementation of setcontext uses rt_sigreturn to restore
the contents of registers. This contrasts with the way most other
architectures implement setcontext:

  powerpc64, mips, tile:

  Call rt_sigreturn if context was created by a call to a signal handler,
  otherwise restore in user code.

  powerpc32:

  Call swapcontext system call and don't call sigreturn or rt_sigreturn.

  x86_64, sparc, hppa, sh, ia64, m68k, s390, arm:

  Only support restoring "synchronous" contexts, that is contexts
  created by getcontext, and restoring in user code and don't call
  sigreturn or rt_sigreturn.

  alpha:

  Call sigreturn (but not rt_sigreturn) in all cases to do the restore.

The text of the setcontext manpage suggests that the requirement to be
able to restore a signal handler created context has been dropped from
SUSv2:

  If  the context was obtained by a call to a signal handler, then old
  standard text says that "program execution continues with the program
  instruction following the instruction interrupted by the signal".
  However, this sentence was removed in SUSv2, and the present verdict
  is "the result is unspecified".

Implementing setcontext by calling rt_sigreturn unconditionally causes
problems when used with sigaltstack as in BZ #16629. On this basis it
seems that aarch64 is broken and that new ports should only support
restoring contexts created with getcontext and do not need to call
rt_sigreturn at all.

This patch re-implements the aarch64 setcontext function to restore
the context in user code in a similar manner to x86_64 and other ports.

ChangeLog:

2014-04-17  Will Newton  <will.newton@linaro.org>

	[BZ #16629]
	* sysdeps/unix/sysv/linux/aarch64/setcontext.S (__setcontext):
	Re-implement to restore registers in user code and avoid
	rt_sigreturn system call.
Diffstat (limited to 'libio/fileno.c')
0 files changed, 0 insertions, 0 deletions