This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
Hi!
On Thu, 14 Jun 2012 11:08:53 +0200, I wrote:
> Despite libc-help's yesterday's discussion on a similar topic, and in
> spirit of what other architectures are using, I plan to commit the
> following, assuming Kaz agrees that the sleep instruction is a suitable
> choice.
Actually, how about this one instead:
* sysdeps/sh/abort-instr.h: New file.
* sysdeps/unix/sysv/linux/sh/makecontext.S (.Lexitcode): Terminate the
process in case exit returns.
diff --git a/sysdeps/sh/abort-instr.h b/sysdeps/sh/abort-instr.h
new file mode 100644
index 0000000..69381ae
--- /dev/null
+++ b/sysdeps/sh/abort-instr.h
@@ -0,0 +1,3 @@
+/* An instruction which should crash any program is `sleep'. */
+#define ABORT_INSTRUCTION_ASM sleep
+#define ABORT_INSTRUCTION asm ("sleep")
diff --git a/sysdeps/unix/sysv/linux/sh/makecontext.S b/sysdeps/unix/sysv/linux/sh/makecontext.S
index 70ea9f4..2aa3889 100644
--- a/sysdeps/unix/sysv/linux/sh/makecontext.S
+++ b/sysdeps/unix/sysv/linux/sh/makecontext.S
@@ -17,6 +17,7 @@
<http://www.gnu.org/licenses/>. */
#include <sysdep.h>
+#include <abort-instr.h>
#include "ucontext_i.h"
@@ -124,9 +125,11 @@ ENTRY(__makecontext)
#endif
jsr @r1
mov r0, r4
+ /* The 'exit' call should never return. In case it does cause the
+ process to terminate. */
0:
bra 0b
- nop
+ ABORT_INSTRUCTION_ASM
.align 2
#ifdef PIC
GrÃÃe,
Thomas
Attachment:
pgp00000.pgp
Description: PGP signature
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |