From: Florian Weimer <fweimer@redhat.com>
To: libc-alpha@sourceware.org
Subject: [PATCH 09/13] nptl: Simplify the change_stack_perm calling convention
Date: Thu, 06 May 2021 20:11:00 +0200 [thread overview]
Message-ID: <ef929637e500700116868d02f0f359ad2e0bbd5b.1620323953.git.fweimer@redhat.com> (raw)
In-Reply-To: <cover.1620323953.git.fweimer@redhat.com>
Only ia64 needs the page mask, and it is straightforward
to compute the value within the function itself.
---
nptl/allocatestack.c | 29 +++++------------------------
1 file changed, 5 insertions(+), 24 deletions(-)
diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c
index 71cfa874d1..46089163f4 100644
--- a/nptl/allocatestack.c
+++ b/nptl/allocatestack.c
@@ -293,13 +293,10 @@ queue_stack (struct pthread *stack)
static int
-change_stack_perm (struct pthread *pd
-#ifdef NEED_SEPARATE_REGISTER_STACK
- , size_t pagemask
-#endif
- )
+change_stack_perm (struct pthread *pd)
{
#ifdef NEED_SEPARATE_REGISTER_STACK
+ size_t pagemask = __getpagesize () - 1;
void *stack = (pd->stackblock
+ (((((pd->stackblock_size - pd->guardsize) / 2)
& pagemask) + pd->guardsize) & pagemask));
@@ -628,11 +625,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp,
if (__builtin_expect ((GL(dl_stack_flags) & PF_X) != 0
&& (prot & PROT_EXEC) == 0, 0))
{
- int err = change_stack_perm (pd
-#ifdef NEED_SEPARATE_REGISTER_STACK
- , ~pagesize_m1
-#endif
- );
+ int err = change_stack_perm (pd);
if (err != 0)
{
/* Free the stack memory we just allocated. */
@@ -796,20 +789,12 @@ __make_stacks_executable (void **stack_endp)
if (err != 0)
return err;
-#ifdef NEED_SEPARATE_REGISTER_STACK
- const size_t pagemask = ~(__getpagesize () - 1);
-#endif
-
lll_lock (GL (dl_stack_cache_lock), LLL_PRIVATE);
list_t *runp;
list_for_each (runp, &GL (dl_stack_used))
{
- err = change_stack_perm (list_entry (runp, struct pthread, list)
-#ifdef NEED_SEPARATE_REGISTER_STACK
- , pagemask
-#endif
- );
+ err = change_stack_perm (list_entry (runp, struct pthread, list));
if (err != 0)
break;
}
@@ -820,11 +805,7 @@ __make_stacks_executable (void **stack_endp)
if (err == 0)
list_for_each (runp, &GL (dl_stack_cache))
{
- err = change_stack_perm (list_entry (runp, struct pthread, list)
-#ifdef NEED_SEPARATE_REGISTER_STACK
- , pagemask
-#endif
- );
+ err = change_stack_perm (list_entry (runp, struct pthread, list));
if (err != 0)
break;
}
--
2.30.2
next prev parent reply other threads:[~2021-05-06 18:10 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-06 18:08 [PATCH 00/13] Linux: Move most stack management out of libpthread Florian Weimer
2021-05-06 18:08 ` [PATCH 01/13] scripts/versions.awk: Add strings and hashes to <first-versions.h> Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:09 ` [PATCH v2 02/13] elf, nptl: Resolve recursive lock implementation early Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-10 5:54 ` Florian Weimer
2021-05-06 18:10 ` [PATCH 03/13] nptl: Export __libc_multiple_threads from libc as an internal symbol Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:10 ` [PATCH 04/13] Linux: Explicitly disable cancellation checking in the dynamic loader Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:10 ` [PATCH 05/13] Linux: Simplify and fix the definition of SINGLE_THREAD_P Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:10 ` [PATCH 06/13] nptl: Eliminate __pthread_multiple_threads Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:10 ` [PATCH 07/13] elf: Introduce __tls_pre_init_tp Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:10 ` [PATCH 08/13] nptl: Move more stack management variables into _rtld_global Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:11 ` Florian Weimer [this message]
2021-05-09 21:42 ` [PATCH 09/13] nptl: Simplify the change_stack_perm calling convention Carlos O'Donell
2021-05-06 18:11 ` [PATCH 10/13] nptl: Move changing of stack permissions into ld.so Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:11 ` [PATCH 11/13] nptl: Simplify resetting the in-flight stack in __reclaim_stacks Florian Weimer
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:11 ` [PATCH 12/13] nptl: Move __default_pthread_attr, __default_pthread_attr_lock into libc Florian Weimer
2021-05-09 21:41 ` Carlos O'Donell
2021-05-09 21:42 ` Carlos O'Donell
2021-05-06 18:11 ` [PATCH 13/13] Linux: Move __reclaim_stacks into the fork implementation in libc Florian Weimer
2021-05-09 21:41 ` Carlos O'Donell
2021-05-09 21:42 ` [PATCH 00/13] Linux: Move most stack management out of libpthread Carlos O'Donell
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ef929637e500700116868d02f0f359ad2e0bbd5b.1620323953.git.fweimer@redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).