all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
To: 35711@debbugs.gnu.org
Cc: Andreas Schwab <schwab@suse.de>,
	Michael Karcher <debian@mkarcher.dialup.fu-berlin.de>,
	Paul Eggert <eggert@cs.ucla.edu>
Subject: bug#35711: emacs crashes on m68k after d2f1971dd5
Date: Mon, 13 May 2019 14:15:16 +0200	[thread overview]
Message-ID: <f937020d-0922-841d-1b73-71daf7d5a5bf@physik.fu-berlin.de> (raw)

[-- Attachment #1: Type: text/plain, Size: 1714 bytes --]

Hello!

The commit [1] "Port flexible array members to GCC + valgrind" (d2f1971dd5)
broke emacs on m68k. This is because the new code aligns blocks of 1-byte
strings to 16 bit on m68k which is the default alignment on m68k.

The crash on m68k looks like this [2]:

/bin/mkdir -p ../etc
/usr/bin/make -C ../lisp update-subdirs
make[4]: Entering directory '/<<BUILDDIR>>/emacs-26.1+1/debian/build-gtk/lisp'
make[4]: Leaving directory '/<<BUILDDIR>>/emacs-26.1+1/debian/build-gtk/lisp'
./temacs --batch  --load loadup bootstrap
Loading loadup.el (source)...
Using load-path (/<<BUILDDIR>>/emacs-26.1+1/debian/build-src/lisp /<<BUILDDIR>>/emacs-26.1+1/debian/build-src/lisp/emacs-lisp /<<BUILDDIR>>/emacs-26.1+1/debian/build-src/lisp/progmodes /<<BUILDDIR>>/emacs-26.1+1/debian/build-src/lisp/language /<<BUILDDIR>>/emacs-26.1+1/debian/build-src/lisp/international /<<BUILDDIR>>/emacs-26.1+1/debian/build-src/lisp/textmodes /<<BUILDDIR>>/emacs-26.1+1/debian/build-src/lisp/vc)
Loading emacs-lisp/byte-run (source)...
Loading emacs-lisp/backquote (source)...
Loading subr (source)...
qemu: uncaught target signal 11 (Segmentation fault) - core dumped
make[3]: *** [Makefile:738: bootstrap-emacs] Segmentation fault

The attached patch by Michael Karcher fixes the problem.

Thanks,
Adrian

> [1] http://git.savannah.gnu.org/cgit/emacs.git/commit/?id=d2f1971dd570439da4198fa76603b53b072060f8
> [2] https://buildd.debian.org/status/fetch.php?pkg=emacs&arch=m68k&ver=1%3A26.1%2B1-3.2&stamp=1549253883&raw=0

-- 
 .''`.  John Paul Adrian Glaubitz
: :' :  Debian Developer - glaubitz@debian.org
`. `'   Freie Universitaet Berlin - glaubitz@physik.fu-berlin.de
  `-    GPG: 62FF 8A75 84E0 2956 9546  0006 7426 3B37 F5B5 F913

[-- Attachment #2: fix-m68k-crash.patch --]
[-- Type: text/x-patch, Size: 1065 bytes --]

--- emacs-26.1+1.orig/src/alloc.c
+++ emacs-26.1+1/src/alloc.c
@@ -1766,14 +1766,14 @@ static char const string_overrun_cookie[
 
 /* The 'max' reserves space for the nbytes union member even when NBYTES + 1 is
    less than the size of that member.  The 'max' is not needed when
-   SDATA_DATA_OFFSET is a multiple of FLEXALIGNOF (struct sdata),
-   because then the alignment code reserves enough space.  */
+   the tail padding of "struct sdata" with a single payload byte is big enough
+   to accomodate the full union "sdata". */
 
 #define SDATA_SIZE(NBYTES)				      \
      ((SDATA_DATA_OFFSET				      \
-       + (SDATA_DATA_OFFSET % FLEXALIGNOF (struct sdata) == 0 \
-	  ? NBYTES					      \
-	  : max (NBYTES, FLEXALIGNOF (struct sdata) - 1))     \
+       + (FLEXSIZEOF (struct sdata, data, 1) < sizeof (sdata) \
+	  ? max (NBYTES, sizeof (sdata) - SDATA_DATA_OFFSET - 1) \
+	  : NBYTES)                                           \
        + 1						      \
        + FLEXALIGNOF (struct sdata) - 1)		      \
       & ~(FLEXALIGNOF (struct sdata) - 1))

             reply	other threads:[~2019-05-13 12:15 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-13 12:15 John Paul Adrian Glaubitz [this message]
2019-05-13 19:47 ` bug#35711: emacs crashes on m68k after d2f1971dd5 Paul Eggert
2019-05-14  6:01   ` John Paul Adrian Glaubitz
2019-05-14  6:04     ` Paul Eggert
2019-05-14  9:10       ` John Paul Adrian Glaubitz
2019-05-14 18:10         ` Paul Eggert

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=f937020d-0922-841d-1b73-71daf7d5a5bf@physik.fu-berlin.de \
    --to=glaubitz@physik.fu-berlin.de \
    --cc=35711@debbugs.gnu.org \
    --cc=debian@mkarcher.dialup.fu-berlin.de \
    --cc=eggert@cs.ucla.edu \
    --cc=schwab@suse.de \
    /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.