aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@twiddle.net>2011-03-28 14:44:49 -0700
committerRichard Henderson <rth@twiddle.net>2011-03-28 14:44:49 -0700
commit39262cc898cdb3f6e26195aceb4e07c2b5c81df8 (patch)
tree133d21f7a988b938fea420cba011ca4cf1117628
parent8825867bdd4b0acb81f91729f54e202529581108 (diff)
downloadglibc-39262cc898cdb3f6e26195aceb4e07c2b5c81df8.tar.xz
glibc-39262cc898cdb3f6e26195aceb4e07c2b5c81df8.zip
[alpha] Fix wrong register use in ____longjmp_chk.
-rw-r--r--ChangeLog.alpha5
-rw-r--r--sysdeps/unix/sysv/linux/alpha/____longjmp_chk.S21
2 files changed, 19 insertions, 7 deletions
diff --git a/ChangeLog.alpha b/ChangeLog.alpha
index 82384ac7e1..55f8768987 100644
--- a/ChangeLog.alpha
+++ b/ChangeLog.alpha
@@ -1,3 +1,8 @@
+2011-03-28 Aurelien Jarno <aurelien@aurel32.net>
+
+ * sysdeps/unix/sysv/linux/alpha/____longjmp_chk.S(____longjmp_chk):
+ Fix wrong register in stack pointer comparison.
+
2011-03-01 Aurelien Jarno <aurelien@aurel32.net>
* sysdeps/alpha/fpu/feupdateenv.c (feupdateenv): Add libm_hidden_def.
diff --git a/sysdeps/unix/sysv/linux/alpha/____longjmp_chk.S b/sysdeps/unix/sysv/linux/alpha/____longjmp_chk.S
index 5194ed818c..53eb0f2c51 100644
--- a/sysdeps/unix/sysv/linux/alpha/____longjmp_chk.S
+++ b/sysdeps/unix/sysv/linux/alpha/____longjmp_chk.S
@@ -1,4 +1,5 @@
-/* Copyright (C) 1992, 1994, 1997, 2006, 2010 Free Software Foundation, Inc.
+/* Copyright (C) 1992, 1994, 1997, 2006, 2010, 2011
+ Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -58,11 +59,17 @@ ____longjmp_chk:
PTR_DEMANGLE2(s3, t1)
PTR_DEMANGLE2(fp, t1)
#endif
- cmpule t0, sp, t1
- bne t1, .Lfail
+ /* ??? While this is a proper test for detecting a longjmp to an
+ invalid frame within any given stack, the main thread stack is
+ located *below* almost everything in the address space. Which
+ means that the test at Lfail vs the signal stack will almost
+ certainly never pass. We ought bounds check top and bottom of
+ the current thread's stack. */
+ cmpule s3, sp, t1
+ bne t1, $Lfail
.align 4
-.Lok:
+$Lok:
mov s0, a0
mov s1, v0
mov s3, t0
@@ -103,7 +110,7 @@ ____longjmp_chk:
ret
.align 4
-.Lfail:
+$Lfail:
cfi_restore_state
lda v0, __NR_sigaltstack
lda a0, 0
@@ -118,13 +125,13 @@ ____longjmp_chk:
cfi_adjust_cfa_offset(-32)
/* Without working sigaltstack we cannot perform the test. */
- bne a3, .Lok
+ bne a3, $Lok
addq t0, t2, t0 /* t0 = ss_sp + ss_size */
subq t0, s3, t0 /* t0 = (ss_sp + ss_size) - new_sp */
cmpule t2, t0, t0 /* t0 = (t0 >= ss_size) */
and t0, t1, t0 /* t0 = (t0 >= ss_size) & (ss_flags & SS_ONSTACK) */
- bne t0, .Lok
+ bne t0, $Lok
ldah a0, longjmp_msg(gp) !gprelhigh
lda a0, longjmp_msg(a0) !gprellow