From: Robert Pluim <rpluim@gmail.com>
To: Stefan Kangas <stefankangas@gmail.com>
Cc: 66098@debbugs.gnu.org, Paul Eggert <eggert@cs.ucla.edu>
Subject: bug#66098: Crash in itree.c on macOS with incomplete backtrace
Date: Tue, 19 Sep 2023 12:09:24 +0200 [thread overview]
Message-ID: <87jzsmiiej.fsf@gmail.com> (raw)
In-Reply-To: <87o7hyikiv.fsf@gmail.com> (Robert Pluim's message of "Tue, 19 Sep 2023 11:23:36 +0200")
>>>>> On Tue, 19 Sep 2023 11:23:36 +0200, Robert Pluim <rpluim@gmail.com> said:
>>>>> On Tue, 19 Sep 2023 01:47:41 -0700, Stefan Kangas <stefankangas@gmail.com> said:
Stefan> After rebuilding from master yesterday, I've started seeing frequent
Stefan> crashes (several times a day) on macOS. Thus, I re-built with all the
Stefan> debug flags to investigate, and was able to get Emacs to crash almost
Stefan> immediately after start, with the command `M-x notmuch'.
Stefan> I'm not able to get much of a backtrace (see below). Could it be that
Stefan> the stack got corrupted somehow? I've left the gdb session of the
Stefan> crashed process open in case anyone has any ideas. Is valgrind the best
Stefan> tool for digging further, or are there any other tricks I can try?
Robert> Does valgrind run on macOS these days? Iʼd start by adding
Robert> '-fsanitize=address' to your CFLAGS.
Which I just tried, and it gave me
==22145==ERROR: AddressSanitizer: stack-buffer-underflow on address 0x00016dcc4540 at pc 0x000105924ee0 bp 0x00016dcc4090 sp 0x00016dcc3850
READ of size 8 at 0x00016dcc4540 thread T0
#0 0x105924edc in __asan_memcpy+0x1a4 (libclang_rt.asan_osx_dynamic.dylib:arm64e+0x40edc) (BuildId: f0a7ac5c49bc3abc851181b6f92b308a32000000200000000100000000000b00)
#1 0x1022d388c in vadd_to_log xdisp.c:11821
#2 0x1022d32b4 in add_to_log xdisp.c:11798
Which I fixed like this:
diff --git a/src/xdisp.c b/src/xdisp.c
index 2944f3964e8..f1980c4f20c 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -11808,7 +11808,7 @@ vadd_to_log (char const *format, va_list ap)
eassert (nargs <= ARRAYELTS (args));
AUTO_STRING (args0, format);
args[0] = args0;
- for (ptrdiff_t i = 1; i <= nargs; i++)
+ for (ptrdiff_t i = 1; i < nargs; i++)
args[i] = va_arg (ap, Lisp_Object);
Lisp_Object msg = Qnil;
msg = Fformat_message (nargs, args);
Given that this code has been like this since 2015, please sanity
check the patch whilst I up my caffeine levels :-)
Robert
--
next prev parent reply other threads:[~2023-09-19 10:09 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-19 8:47 bug#66098: Crash in itree.c on macOS with incomplete backtrace Stefan Kangas
2023-09-19 9:23 ` Robert Pluim
2023-09-19 10:09 ` Robert Pluim [this message]
2023-09-20 8:08 ` Paul Eggert
2023-09-20 8:22 ` Robert Pluim
2023-09-22 10:58 ` Stefan Kangas
2023-09-22 12:07 ` Robert Pluim
2023-09-23 13:02 ` Stefan Kangas
2023-09-25 8:36 ` Robert Pluim
2023-09-19 11:24 ` Eli Zaretskii
2023-09-22 10:51 ` Stefan Kangas
2023-09-22 12:36 ` Eli Zaretskii
2023-09-22 12:46 ` Robert Pluim
2023-09-23 11:56 ` Stefan Kangas
2023-09-23 12:42 ` Eli Zaretskii
2023-09-24 10:55 ` Stefan Kangas
2023-09-24 12:10 ` Eli Zaretskii
2023-09-24 12:25 ` Stefan Kangas
2023-09-24 21:01 ` Stefan Kangas
2023-09-25 3:38 ` Gerd Möllmann
2023-09-19 11:42 ` Gerd Möllmann
2023-09-19 12:21 ` Gerd Möllmann
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=87jzsmiiej.fsf@gmail.com \
--to=rpluim@gmail.com \
--cc=66098@debbugs.gnu.org \
--cc=eggert@cs.ucla.edu \
--cc=stefankangas@gmail.com \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.