unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Nikolay Kudryavtsev <nikolay.kudryavtsev@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: emacs-devel@gnu.org
Subject: Re: Unexec dumping results in "Segmentation fault" on Windows Msys2
Date: Thu, 15 Apr 2021 01:11:53 +0300	[thread overview]
Message-ID: <c17b93eb-e9da-fdf9-cbbf-7e5cae5885fd@gmail.com> (raw)
In-Reply-To: <83y2dycmgr.fsf@gnu.org>

Here's what I was able to gather in regards to this issue.

Whenever I'm trying to build master I get:
dumped_data_commit: memory exhausted.
Enlarge dumped_data[]!

Due to this I have to set DUMPED_HEAP_SIZE (24*1024*1024). Just 
mentioning this for completeness sake, that's not the issue here.

Segfaults are triggered by msys2 binutils version 2.36. If we try to 
debug the segfault with GDB we get this:

Thread 1 received signal SIGSEGV, Segmentation fault.
0x00007ff7c7514862 in main (argc=9, argv=0x1f815ad1860)
     at D:/Emacs/source/repo/src/emacs.c:960
960       stack_bottom = (char *) &stack_bottom_variable;

It seems like the initial bootstrap-emacs.exe is so broken that it fails 
at even the simplest things. The question I keep asking myself is, if we 
assume that it's our build environment that has some problem, why is 
unexec the only place that is harmed by it? Would it be possible to come 
up with some isolated test case that would demonstrate the problem? Then 
maybe it can be submitted to msys2 or mingw64 developers.

Now, lets downgrade binutils to version 2.35(or older), you can do that 
by grabbing the archive from here( https://repo.msys2.org/mingw/x86_64/ 
) and then calling "pacman -U  
mingw-w64-x86_64-binutils-2.35.1-3-any.pkg.tar.zst" on it. Emacs 
versions 27.2, 27.1, 26.3 and older would compile fine. But the master 
still won't. Instead of a segfault we get a more helpful Emacs crash. If 
we attach gdb to it, here's what we get:

#10 0x00007ff911ef0a9e in ntdll!KiUserExceptionDispatcher ()
    from /c/WINDOWS/SYSTEM32/ntdll.dll
#11 0x00007ff9103c43d7 in msvcrt!memmove () from 
/c/WINDOWS/System32/msvcrt.dll
#12 0x0000000400191e25 in insert_1_both (
     string=0x4506840 "(fn FILENAME)\377\377\377", nchars=13, nbytes=13,
     inherit=false, prepare=true, before_markers=false)
     at D:/Emacs/source/repo/src/insdel.c:915
#13 0x000000040024f689 in Fprin1_to_string (object=..., noescape=...)
     at D:/Emacs/source/repo/src/print.c:685
#14 0x000000040020be9a in styled_format (nargs=2, args=0xbf0720, 
message=false)
     at D:/Emacs/source/repo/src/editfns.c:3322
#15 0x000000040020b69f in Fformat (nargs=2, args=0xbf0720)
     at D:/Emacs/source/repo/src/editfns.c:3059
#16 0x000000040021b946 in eval_sub (form=...)
     at D:/Emacs/source/repo/src/eval.c:2363
#17 0x000000040021dbd0 in apply_lambda (fun=..., args=..., count=228)
     at D:/Emacs/source/repo/src/eval.c:3056

Again, memory related. Since we know that unexec works in emacs26 and 
emacs27 branches, I went for another row of bisecting and traced the 
offending commit to cddf85d256. Now this is interesting in that if 
unexec triggers a crash here, is there a way to get this to crash Emacs 
during the normal usage? Also, I have an old msys2 backup from 2017 that 
I've used for testing and I'm getting the same kind of exceptions with 
it, so I don't think we can write this master branch issue off on the 
build environment.




  reply	other threads:[~2021-04-14 22:11 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-03 20:20 Unexec dumping results in "Segmentation fault" on Windows Msys2 Nikolay Kudryavtsev
2021-04-04  7:11 ` Eli Zaretskii
2021-04-04  7:55   ` Eli Zaretskii
2021-04-04  8:41   ` Nikolay Kudryavtsev
2021-04-04 11:34     ` Eli Zaretskii
2021-04-14 22:11       ` Nikolay Kudryavtsev [this message]
2021-04-15  6:49         ` Eli Zaretskii
2021-04-15 13:07           ` Camm Maguire
2021-04-15 13:49             ` Eli Zaretskii
2021-04-15 15:47           ` Nikolay Kudryavtsev
2021-04-15 16:08             ` Eli Zaretskii
2021-04-15 19:17               ` Nikolay Kudryavtsev
2021-04-15 19:59                 ` Eli Zaretskii
2021-04-16 16:57                   ` Nikolay Kudryavtsev
2021-04-16 19:41                     ` Eli Zaretskii
2021-04-21 16:33                       ` Nikolay Kudryavtsev
2021-04-21 17:41                         ` Eli Zaretskii
2021-04-21 18:19                           ` Nikolay Kudryavtsev
2021-04-22 14:25                             ` Eli Zaretskii
2021-04-29 19:17                               ` Nikolay Kudryavtsev
2021-04-30 11:24                                 ` Eli Zaretskii
2021-05-02  9:43                                   ` Nikolay Kudryavtsev
2021-05-02 10:17                                     ` Eli Zaretskii
2021-04-22 17:22                           ` Eli Zaretskii
2021-04-22 18:59                             ` Nikolay Kudryavtsev
2021-04-22 19:13                               ` Eli Zaretskii
2021-04-22 19:26                                 ` Nikolay Kudryavtsev
2021-04-16  7:45                 ` Eli Zaretskii
2021-04-15 16:12             ` Eli Zaretskii
2021-04-15 19:45               ` Nikolay Kudryavtsev

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c17b93eb-e9da-fdf9-cbbf-7e5cae5885fd@gmail.com \
    --to=nikolay.kudryavtsev@gmail.com \
    --cc=eliz@gnu.org \
    --cc=emacs-devel@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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

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).