public inbox for glibc-cvs@sourceware.org help / color / mirror / Atom feed
From: Fangrui Song <maskray@sourceware.org> To: glibc-cvs@sourceware.org Subject: [glibc/google/grte/v5-2.27/master] nptl: Make mmap and munmap in thread stack allocation interposable Date: Thu, 27 Oct 2022 20:50:13 +0000 (GMT) [thread overview] Message-ID: <20221027205013.6EEAC384642B@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=16ca0733a06f551aca8a5ecd38bcb719c4a56634 commit 16ca0733a06f551aca8a5ecd38bcb719c4a56634 Author: Nilay Vaish <nilayvaish@google.com> Date: Thu Oct 27 11:33:49 2022 -0700 nptl: Make mmap and munmap in thread stack allocation interposable b/238021577: __mmap and __munmap are not interposable. Call interposable mmap and munmap instead so that we can capture thread stack allocations. Diff: --- nptl/allocatestack.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nptl/allocatestack.c b/nptl/allocatestack.c index 9f6a75695e..1989ca7c86 100644 --- a/nptl/allocatestack.c +++ b/nptl/allocatestack.c @@ -276,7 +276,7 @@ __free_stacks (size_t limit) /* Remove this block. This should never fail. If it does something is really wrong. */ - if (__munmap (curr->stackblock, curr->stackblock_size) != 0) + if (munmap (curr->stackblock, curr->stackblock_size) != 0) abort (); /* Maybe we have freed enough. */ @@ -558,7 +558,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, /* If a guard page is required, avoid committing memory by first allocate with PROT_NONE and then reserve with required permission excluding the guard page. */ - mem = __mmap (NULL, size, (guardsize == 0) ? prot : PROT_NONE, + mem = mmap (NULL, size, (guardsize == 0) ? prot : PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS | MAP_STACK, -1, 0); if (__glibc_unlikely (mem == MAP_FAILED)) @@ -585,7 +585,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, pagesize_m1); if (setup_stack_prot (mem, size, guard, guardsize, prot) != 0) { - __munmap (mem, size); + munmap (mem, size); return errno; } } @@ -628,7 +628,7 @@ allocate_stack (const struct pthread_attr *attr, struct pthread **pdp, assert (errno == ENOMEM); /* Free the stack memory we just allocated. */ - (void) __munmap (mem, size); + (void) munmap (mem, size); return errno; }
reply other threads:[~2022-10-27 20:50 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20221027205013.6EEAC384642B@sourceware.org \ --to=maskray@sourceware.org \ --cc=glibc-cvs@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: linkBe 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).