From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#72692: Emacs 31.05 (40eecd594ac) get SIGSEGV on Linux (Linux 6.6.45 Kde Wayland) Date: Sun, 18 Aug 2024 12:43:06 +0000 Message-ID: <877ccegfxj.fsf@protonmail.com> References: <8b1c8e1f-e0b9-4049-888c-3f723e0008a9@gmail.com> <87sev2gqc7.fsf@protonmail.com> <51a90b68-3958-4d6e-bfb1-1ea5a0e8ab11@gmail.com> <87le0ugp6i.fsf@protonmail.com> <6d4a3b17-a177-4b3b-8873-50662f56e304@gmail.com> <87h6bigoo5.fsf@protonmail.com> <7be3359e-4389-4bc6-bf98-b46a2a8a711c@gmail.com> Reply-To: Pip Cet Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="37956"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 72692@debbugs.gnu.org To: execvy@gmail.com Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 18 14:43:44 2024 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1sffG3-0009iz-M2 for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Aug 2024 14:43:43 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sffFn-0002Zs-7w; Sun, 18 Aug 2024 08:43:27 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sffFi-0002Zd-FQ for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 08:43:22 -0400 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1sffFi-0001Qe-5E for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 08:43:22 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:References:In-Reply-To:From:Date:To:Subject; bh=w90/CkZYLKdQWeX+qs1bR1NdJSYufoV3fTYe5lbOQX0=; b=GiJI27JtJ5/s6NWiWSkGmsunnf72TOTWh6BAOKw7UsZPDpLErre/wtRX58U93LGlTxiP/B1LlL+5aYjLMJRo6xo+muCdsPq3XBQ+Bkpu5m0coPjQJcmSZkpsFGJ7j71lOsAesgPoSgl3zlhFKHMl5mXbks/pDcAJVDw99KmYovApIFU+xlnZmGBz/DXHZogVtroyf0T0pVaWr9XKXyERa/c77O19X8uaOJQISwzFpc80cn0jNpw6qek8zXig9iSubNReeWTG+YSz/qvLsLu9Gu6hyDCXgLv1972O9rILnKD01XjVPOO8jPKwYGy6Yb4dg2c6PUDH1R8clz9D35ExNA==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sffGL-00056H-UL for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 08:44:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Pip Cet Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Aug 2024 12:44:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 72692 X-GNU-PR-Package: emacs Original-Received: via spool by 72692-submit@debbugs.gnu.org id=B72692.172398504119601 (code B ref 72692); Sun, 18 Aug 2024 12:44:01 +0000 Original-Received: (at 72692) by debbugs.gnu.org; 18 Aug 2024 12:44:01 +0000 Original-Received: from localhost ([127.0.0.1]:55578 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sffGK-00055v-S8 for submit@debbugs.gnu.org; Sun, 18 Aug 2024 08:44:01 -0400 Original-Received: from mail-4316.protonmail.ch ([185.70.43.16]:36599) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sffGI-00055f-2h for 72692@debbugs.gnu.org; Sun, 18 Aug 2024 08:43:59 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1723984990; x=1724244190; bh=w90/CkZYLKdQWeX+qs1bR1NdJSYufoV3fTYe5lbOQX0=; h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References: Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID: Message-ID:BIMI-Selector; b=KIgmzJx8wTHsX0IlZ42udprU2mfrLGk658A5RPCAJ9FkMMAGDiR3n0+xh6mz4tYGt RNnXicGsjkQlCrS5Vi5UVzwDYLi4C2mOlCw7ix5rwF5V+ORaVxQrXsZzzJyt2Osc1W 6/iVEgs5L9/9gt09jv1IVTFh3PrXVM8rJr4d8k/M3Yc1F1oFLBrMaJuEyLLxBJ4/u8 rHDTMCY/2XBcP12YSeYCYoHQWYyyNCiKwJptytjMFy8bvgYGkIVQKuniCAAkg8kxq0 Hn3o2hNqc0rWV6fVi1S9aAei+z7+8a+Ih7i53dg9o9/MqlWAKV4ZO/SPulzLyP9gBz Yg1ygDux/VpSg== In-Reply-To: <7be3359e-4389-4bc6-bf98-b46a2a8a711c@gmail.com> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 5c61cf66b710e88ebeae9127eb97ee366cb2a6b2 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:290316 Archived-At: writes: > It's > ``` > Redefine command "xbacktrace"? (y or n) [answered Y; input not from termi= nal] > Redefine command "xprintbytestr"? (y or n) [answered Y; input not from te= rminal] > Redefine command "xwhichsymbols"? (y or n) [answered Y; input not from te= rminal] > Redefine command "hookpost-backtrace"? (y or n) [answered Y; input not fr= om terminal] > Redefine command "ff"? (y or n) [answered Y; input not from terminal] > DISPLAY =3D :0 > TERM =3D tmux-256color > Breakpoint 3 at 0x4736d9: file emacs.c, line 431. > Breakpoint 4 at 0x562640: file xterm.c, line 27093. > (gdb) frame 9 > #9 0x00000000006dd64d in fontset_font (fontset=3Dfontset@entry=3DXIL(0),= c=3Dc@entry=3D127802, face=3Dface@entry=3D0x13fec610, id=3D-1) at fontset.= c:793 > 793 rfont_def =3D fontset_find_font (fontset, c, face, id, 0); > (gdb) p *face->ascii_face > $1 =3D { > lface =3D {XIL(0x8220), XIL(0x28bdef4), XIL(0x28bdf34), XIL(0xe340), ma= ke_fixnum(90), XIL(0xe340), XIL(0xe340), XIL(0), XIL(0), XIL(0x4417994), XI= L(0x233c9c4), XIL(0), XIL(0), XIL(0), XIL(0x7f9ea6b05d63), > XIL(0x765a8285), XIL(0), XIL(0x2aabee4), XIL(0x13500), XIL(0)}, > id =3D 2, > gc =3D 0x0, > stipple =3D 0, > foreground =3D 4288059542, > background =3D 4278190080, > underline_color =3D 0, > overline_color =3D 0, > strike_through_color =3D 0, > box_color =3D 4281545523, > font =3D 0x1e4370d0, > fontset =3D 5, > box_vertical_line_width =3D -1, > box_horizontal_line_width =3D -1, > underline_pixels_above_descent_line =3D 0, > box =3D FACE_SIMPLE_BOX, > underline =3D FACE_NO_UNDERLINE, > use_box_color_for_shadows_p =3D true, > overline_p =3D false, > strike_through_p =3D false, > foreground_defaulted_p =3D false, > background_defaulted_p =3D false, > underline_defaulted_p =3D false, > overline_color_defaulted_p =3D false, > strike_through_color_defaulted_p =3D false, > box_color_defaulted_p =3D true, > underline_at_descent_line_p =3D false, > tty_bold_p =3D false, > tty_italic_p =3D false, > tty_reverse_p =3D false, > tty_strike_through_p =3D false, > colors_copied_bitwise_p =3D false, > overstrike =3D false, > hash =3D 322003229, > next =3D 0x13fec610, > prev =3D 0x0, > ascii_face =3D 0x4d7343a0, > extra =3D 0x0 > } > (gdb) > ``` Thanks. That has a different fontset, so it looks like a fontset was prematurely freed while still being referred to by a face. I think the assumption made in xfaces.c, that it's always safe to free a fontset if we're freeing the realized ASCII face, is incorrect. I can confirm that we're sometimes leaving a frame's fontset field invalid by running this code: diff --git a/src/xfaces.c b/src/xfaces.c index 684b6ccfac7..34bab822022 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -4598,7 +4598,23 @@ free_realized_face (struct frame *f, struct face *fa= ce) =09{ =09 /* Free fontset of FACE if it is ASCII face. */ =09 if (face->fontset >=3D 0 && face =3D=3D face->ascii_face) -=09 free_face_fontset (f, face); +=09 { +=09 struct face_cache *cache =3D FRAME_FACE_CACHE (f); +=09 if (cache) +=09=09{ +=09=09 for (int i =3D 0; i < cache->used; i++) +=09=09 { +=09=09 struct face *face2 =3D cache->faces_by_id[i]; +=09=09 if (face2 !=3D 0 && face2 !=3D face && face2->fontset =3D=3D f= ace->fontset) +=09=09=09{ +=09=09=09 message ("Freeing fontset %d that's still in use!", face->fonts= et); +=09=09=09 goto dont; +=09=09=09} +=09=09 } +=09=09} +=09 free_face_fontset (f, face); +=09 } +=09dont: =20 #ifdef HAVE_X_WINDOWS =09 /* This function might be called with the frame's display However, that's not a fix; it would leak fontsets, and it's slow. Will investigate further. Thanks Pip