about summary refs log tree commit diff
path: root/src/signal
diff options
context:
space:
mode:
authorRich Felker <dalias@aerifal.cx>2015-09-23 18:33:49 +0000
committerRich Felker <dalias@aerifal.cx>2015-09-23 18:33:49 +0000
commitb61df2294f662540786f2558f691eba7447ff5ba (patch)
tree097e5fc922c4379fe7291f9381fa4fb0b79c1228 /src/signal
parent6c5cad2aa56745302c1d42d2c8baf6424d29c0f3 (diff)
downloadmusl-b61df2294f662540786f2558f691eba7447ff5ba.tar.gz
musl-b61df2294f662540786f2558f691eba7447ff5ba.tar.xz
musl-b61df2294f662540786f2558f691eba7447ff5ba.zip
fix signal return for sh/fdpic
the restorer function pointer provided in the kernel sigaction
structure is interpreted by the kernel as a raw code address, not a
function descriptor.

this commit moves the declarations of the __restore and __restore_rt
symbols to ksigaction.h so that arch versions of the file can override
them, and introduces a version for sh which declares them as objects
rather than functions.

an alternate solution would have been defining SA_RESTORER to 0 so
that the functions are not used, but this both requires executable
stack (since the sh kernel does not have a vdso page with permanent
restorer functions) and crashes on qemu user-level emulation.
Diffstat (limited to 'src/signal')
-rw-r--r--src/signal/sh/restore.s2
-rw-r--r--src/signal/sigaction.c2
2 files changed, 0 insertions, 4 deletions
diff --git a/src/signal/sh/restore.s b/src/signal/sh/restore.s
index eaedcdfb..d5df8e14 100644
--- a/src/signal/sh/restore.s
+++ b/src/signal/sh/restore.s
@@ -1,5 +1,4 @@
 .global __restore
-.type   __restore, @function
 __restore:
 	mov   #119, r3  !__NR_sigreturn
 	trapa #31
@@ -11,7 +10,6 @@ __restore:
 	or    r0, r0
 
 .global __restore_rt
-.type   __restore_rt, @function
 __restore_rt:
 	mov   #100, r3  !__NR_rt_sigreturn
 	add   #73, r3
diff --git a/src/signal/sigaction.c b/src/signal/sigaction.c
index d5f47741..ab23a6f2 100644
--- a/src/signal/sigaction.c
+++ b/src/signal/sigaction.c
@@ -6,8 +6,6 @@
 #include "libc.h"
 #include "ksigaction.h"
 
-void __restore(), __restore_rt();
-
 static int unmask_done;
 static unsigned long handler_set[_NSIG/(8*sizeof(long))];