public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Paul Smith <psmith@gnu.org>
To: gcc@gcc.gnu.org
Subject: Incorrect change to generic_morestack.c:__morestack_load_mmap()?
Date: Wed, 30 Jan 2019 18:01:00 -0000	[thread overview]
Message-ID: <f9b961a0b1929df317b4ba447b26ddb0f4503925.camel@gnu.org> (raw)

I was looking through the diffs between GCC 8.1.0 and GCC 8.2.0 and saw
this change, which doesn't look right to me: it changes munmap() to use
the new static_pagesize variable, but that variable is not assigned
until after it's used.  Since it's global it's always 0, so this code
runs munmap(0, 0) which doesn't seem too useful to me.

I checked and the current SVN trunk still has this change as-is.



@@ -825,7 +811,12 @@
      TLS accessor function is resolved.  */
   mmap (__morestack_current_segment, 0, PROT_READ, MAP_ANONYMOUS, -1, 0);
   mprotect (NULL, 0, 0);
-  munmap (0, getpagesize ());
+  munmap (0, static_pagesize);
+
+  /* Initialize these values here, so as to avoid dynamic linker
+     activity as part of a __morestack call. */
+  static_pagesize = getpagesize();
+  use_guard_page = getenv ("SPLIT_STACK_GUARD") != 0;
 }

 /* This function may be used to iterate over the stack segments.


                 reply	other threads:[~2019-01-30 18:01 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=f9b961a0b1929df317b4ba447b26ddb0f4503925.camel@gnu.org \
    --to=psmith@gnu.org \
    --cc=gcc@gcc.gnu.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).