#include <stdbool.h>
#include <stackinfo.h>
#include <caller.h>
+#include <sysdep.h>
#include "kernel-features.h"
/* 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),
no_growsupdown = true;
else
# endif
- return errno;
+ {
+ result = errno;
+ goto out;
+ }
}
#endif
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.
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.
/* 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)