public inbox for gcc-prs@sourceware.org
help / color / mirror / Atom feed
From: Neil Booth <neil@daikokuya.demon.co.uk>
To: nobody@gcc.gnu.org
Cc: gcc-prs@gcc.gnu.org,
Subject: Re: bootstrap/5149: gcc-20011217 reads beyond EOF on cygwin
Date: Thu, 20 Dec 2001 10:36:00 -0000	[thread overview]
Message-ID: <20011220183600.20035.qmail@sources.redhat.com> (raw)

The following reply was made to PR bootstrap/5149; it has been noted by GNATS.

From: Neil Booth <neil@daikokuya.demon.co.uk>
To: Werner Tuchan <tuwn@gmx.net>
Cc: neil@gcc.gnu.org, gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: bootstrap/5149: gcc-20011217 reads beyond EOF on cygwin
Date: Thu, 20 Dec 2001 18:33:23 +0000

 Werner Tuchan wrote:-
 
 > Thats the piece of code that loaded the file, this time its libgcc2.c.
 > 
 > cppfiles.c
 >   388       /* Use mmap if the file is big enough to be worth it (controlled
 >   389   by MMAP_THRESHOLD) and if we can safely count on there being
 >   390   at least one readable NUL byte after the end of the file's
 >   391   contents.  This is true for all tested operating systems when
 >   392   the file size is not an exact multiple of the page size.  */
 > - 393       if (size / pagesize >= MMAP_THRESHOLD
 >   394    && (size % pagesize) != 0)
 >   395  {
 > - 396    buf = (U_CHAR *) mmap (0, size, PROT_READ, MAP_PRIVATE, inc->fd,
 > 0);
 > - 397    if (buf == (U_CHAR *)-1)
 >   398      goto perror_fail;
 > - 399    inc->mapped = 1;
 > - 400  }
 >   401       else
 >   402 #endif
 
 Cool, this is useful, thanks.
 
 > (gdb) x /s buf + 46170
 > 0x83a5445a:  "ED_ATEXIT */\n\n#endif /* L_exit */\n"
 > 
 > (gdb) x /100xb buf + 46170
 > 0x83a5445a: 0x45 0x44 0x5f 0x41 0x54 0x45 0x58 0x49
 > 0x83a54462: 0x54 0x20 0x2a 0x2f 0x0a 0x0a 0x23 0x65
 > 0x83a5446a: 0x6e 0x64 0x69 0x66 0x20 0x2f 0x2a 0x20
 > 0x83a54472: 0x4c 0x5f 0x65 0x78 0x69 0x74 0x20 0x2a
 > 0x83a5447a: 0x2f 0x0a 0xc0 0xc0 0xc0 0x00 0xc0 0xc0
 > 0x83a54482: 0xc0 0x00 0xc0 0xc0 0xc0 0x00 0xc0 0xc0
 > 0x83a5448a: 0xc0 0x00 0xc0 0xc0 0xc0 0x00 0xc0 0xc0
 > 0x83a54492: 0xc0 0x00 0xc0 0xc0 0xc0 0x00 0xc0 0xc0
 > 0x83a5449a: 0xc0 0x00 0x00 0x00 0x00 0x00 0x00 0x00
 > 0x83a544a2: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
 > 0x83a544aa: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
 > 0x83a544b2: 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00
 > 0x83a544ba: 0x00 0x00 0x00 0x00
 
 Weird.  The bytes after EOF are a mixture of NULs and 0xc0.  Is 0xc0
 of special significance in Windows?  Is your version of cygwin the
 latest?  I recall some talk about mmap bugs in cygwin.
 
 I guess that we have to disable mmap() on cygwin, or at least on
 specific versions.  Do you have any better ideas Zack?
 
 Neil.


             reply	other threads:[~2001-12-20 18:36 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-12-20 10:36 Neil Booth [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-06-19  4:26 neil
2001-12-21 23:36 Zack Weinberg
2001-12-21 10:56 Neil Booth
2001-12-21  9:26 Christopher Faylor
2001-12-21  6:46 Werner Tuchan
2001-12-20 11:16 Neil Booth
2001-12-20 11:06 Zack Weinberg
2001-12-20  6:46 Werner Tuchan
2001-12-19 16:20 neil
2001-12-18  3:56 tuwn

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=20011220183600.20035.qmail@sources.redhat.com \
    --to=neil@daikokuya.demon.co.uk \
    --cc=gcc-prs@gcc.gnu.org \
    --cc=nobody@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).