summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
authorRoland McGrath <roland@gnu.org>2005-07-18 04:11:19 +0000
committerRoland McGrath <roland@gnu.org>2005-07-18 04:11:19 +0000
commitdb9535f323b1f4160fee8a70eb80ca94b3bbe1ee (patch)
tree2f966fa0e9c84dc2e10cc2da633d39068e6145dd /sysdeps
parentf8d784018dfe7c1a1e97bf255c3d7b0c357cd7e2 (diff)
2005-02-07 Ulrich Drepper <drepper@redhat.com>
* sysdeps/unix/sysv/linux/dl-execstack.c: Include sysdep.h. (_dl_make_stack_executable): Make sure registers are set correctly.
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/unix/sysv/linux/dl-execstack.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/sysdeps/unix/sysv/linux/dl-execstack.c b/sysdeps/unix/sysv/linux/dl-execstack.c
index 6ef9679045..0a5b83b69c 100644
--- a/sysdeps/unix/sysv/linux/dl-execstack.c
+++ b/sysdeps/unix/sysv/linux/dl-execstack.c
@@ -24,6 +24,7 @@
#include <stdbool.h>
#include <stackinfo.h>
#include <caller.h>
+#include <sysdep.h>
#include "kernel-features.h"
@@ -38,6 +39,7 @@ _dl_make_stack_executable (void **stack_endp)
/* This gives us the highest/lowest page that needs to be changed. */
uintptr_t page = ((uintptr_t) *stack_endp
& -(intptr_t) GLRO(dl_pagesize));
+ int result = 0;
/* Challenge the caller. */
if (__builtin_expect (__check_caller (RETURN_ADDRESS (0),
@@ -60,7 +62,10 @@ _dl_make_stack_executable (void **stack_endp)
no_growsupdown = true;
else
# endif
- return errno;
+ {
+ result = errno;
+ goto out;
+ }
}
#endif
@@ -85,7 +90,10 @@ _dl_make_stack_executable (void **stack_endp)
else
{
if (errno != ENOMEM) /* Unexpected failure mode. */
- return errno;
+ {
+ result = errno;
+ goto out;
+ }
if (size == GLRO(dl_pagesize))
/* We just tried to mprotect the top hole page and failed.
@@ -108,7 +116,10 @@ _dl_make_stack_executable (void **stack_endp)
else
{
if (errno != ENOMEM) /* Unexpected failure mode. */
- return errno;
+ {
+ result = errno;
+ goto out;
+ }
if (size == GLRO(dl_pagesize))
/* We just tried to mprotect the lowest hole page and failed.
@@ -133,6 +144,11 @@ _dl_make_stack_executable (void **stack_endp)
/* Remember that we changed the permission. */
GL(dl_stack_flags) |= PF_X;
- return 0;
+ out:
+#ifdef check_consistency
+ check_consistency ();
+#endif
+
+ return result;
}
rtld_hidden_def (_dl_make_stack_executable)