glibc/sysdeps/unix/sysv/linux/sparc/sparc32
Adhemerval Zanella b33e946fbb sparc: Move sigreturn stub to assembly
It seems that some gcc versions might generates a stack frame for the
sigreturn stub requires on sparc signal handling.  For instance:

  $ cat test.c
  #define _GNU_SOURCE
  #include <sys/syscall.h>

  __attribute__ ((__optimize__ ("-fno-stack-protector")))
  void
  __sigreturn_stub (void)
  {
    __asm__ ("mov %0, %%g1\n\t"
            "ta  0x10\n\t"
            : /* no outputs */
            : "i" (SYS_rt_sigreturn));
  }
  $ gcc -v
  [...]
  gcc version 9.2.1 20200224 (Debian 9.2.1-30)
  $ gcc -O2 -m64 test.c -S -o -
  [...]
    __sigreturn_stub:
          save    %sp, -176, %sp
  #APP
  ! 9 "t.c" 1
          mov 101, %g1
          ta  0x10

  ! 0 "" 2
  #NO_APP
          .size   __sigreturn_stub, .-__sigreturn_stub

As indicated by kernel developers [1], the sigreturn stub can not change
the register window or the stack pointer since the kernel has setup the
restore frame at a precise location relative to the stack pointer when
the stub is invoked.

I tried to play with some compiler flags and even with _Noreturn and
__builtin_unreachable after the asm does not help (and Sparc does not
support naked functions).

To avoid similar issues, as the stack-protector support also have
stumbled, this patch moves the implementation of the sigreturn stubs to
assembly.

Checked on sparcv9-linux-gnu and sparc64-linux-gnu with gcc 9.2.1
and gcc 7.5.0.

[1] https://lkml.org/lkml/2016/5/27/465
2020-03-06 13:17:20 -03:00
..
bits Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
fpu
sparcv9/fpu Remove unused get_clockfreq files 2019-05-29 10:26:30 -03:00
____longjmp_chk.S Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
alphasort64.c Consolidate alphasort{64} and versionsort{64} implementation 2018-04-23 17:35:16 -03:00
arch-syscall.h Linux: Add tables with system call numbers 2020-01-02 10:18:10 +01:00
brk.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
c++-types.data
clone.S Linux: Use system call tables during build 2020-01-02 10:18:23 +01:00
fxstat.c
fxstatat.c
getcontext.S Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
Implies
jmp_buf-macros.h Add jmp_buf-macros.h 2017-11-09 05:10:03 -08:00
kernel_stat.h
ld.abilist ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] 2020-02-15 11:01:23 +01:00
libanl.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libBrokenLocale.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libc.abilist Finish move of clock_* functions to libc. [BZ #24959] 2019-09-04 14:39:38 +02:00
libcrypt.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libdl.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libm.abilist Make totalorder and totalordermag functions take pointer arguments. 2019-08-15 15:18:34 +00:00
libnsl.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libpthread.abilist nptl: Move pthread_setschedparam implementation into libc 2020-02-20 08:57:01 +01:00
libresolv.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
librt.abilist Finish move of clock_* functions to libc. [BZ #24959] 2019-09-04 14:39:38 +02:00
libthread_db.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
libutil.abilist Ignore absolute symbols in ABI tests. 2018-05-04 15:46:32 +00:00
localplt.data ld.so: Do not export free/calloc/malloc/realloc functions [BZ #25486] 2020-02-15 11:01:23 +01:00
lxstat.c
makecontext.c Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
Makefile
nldbl-abi.h
pipe.S Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
register-dump.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
setcontext.S Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
shlib-versions
sigaction.c sparc: Move sigreturn stub to assembly 2020-03-06 13:17:20 -03:00
sigcontextinfo.h Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
sigreturn_stub.S sparc: Move sigreturn stub to assembly 2020-03-06 13:17:20 -03:00
swapcontext.S Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
syscall.S Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
syscalls.list
sysdep.h sparc: Use Linux kABI for syscall return 2020-02-14 21:09:12 -03:00
ucontext_i.sym SPARC sys/ucontext.h namespace fixes (bug 21457). 2017-06-29 19:44:43 +00:00
Versions
versionsort64.c Consolidate alphasort{64} and versionsort{64} implementation 2018-04-23 17:35:16 -03:00
vfork.S Update copyright dates with scripts/update-copyrights. 2020-01-01 00:14:33 +00:00
xstat.c