From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: execvy@gmail.com 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 20:53:54 +0800 Message-ID: <7ac5f2aa-d228-4393-8a70-94aa09a4a4f5@gmail.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> <877ccegfxj.fsf@protonmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="40608"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Mozilla Thunderbird To: Pip Cet , 72692@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Aug 18 14:55:33 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 1sffRV-000APr-2A for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 18 Aug 2024 14:55:33 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sffRM-0004zX-Et; Sun, 18 Aug 2024 08:55:24 -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 1sffRK-0004zO-4s for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 08:55: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 1sffRJ-0003aY-RL for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 08:55:21 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=In-Reply-To:References:From:MIME-Version:Date:To:Subject; bh=AjYJJ9cDbRWNlmRw4PoYdlrluCbXAZVBhCsoXnNWa9s=; b=Fovb34JwFrKzjrTPCMC57Dk0WSqeeE7WSVVM86JgeB8sl3wuz2Y/9YU7gv8pnHLtHnSc/bLfuOosYp6XMBlYcUVAaLfoIDZJYKMhYZN+iWpMaTW/aQLupgW26iEjnENDJrUsxVwoHsj9NhPGVvLvz0EW6NNxovaGRdxcvHwre/UTHDfu1Cdt4hUgJPAkg3LknFTRR1e0Abpg04FyjwS0NthvhWVMaFTJrGB32andfTJRwon6SfT50dAPepq0Al9jATzre2EwL5Yw2+ttNnxO28vGl+e/sck/Ul4In78XwhK/pM9J1JAWQ6adWHxomlhGgBpAGVZoYC8KRpd/uBJnIQ==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1sffRx-0005OI-ML for bug-gnu-emacs@gnu.org; Sun, 18 Aug 2024 08:56:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: execvy@gmail.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 18 Aug 2024 12:56: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.172398574820699 (code B ref 72692); Sun, 18 Aug 2024 12:56:01 +0000 Original-Received: (at 72692) by debbugs.gnu.org; 18 Aug 2024 12:55:48 +0000 Original-Received: from localhost ([127.0.0.1]:55582 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sffRj-0005Nn-BR for submit@debbugs.gnu.org; Sun, 18 Aug 2024 08:55:47 -0400 Original-Received: from mail-pf1-f195.google.com ([209.85.210.195]:61444) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1sffRh-0005NU-4k for 72692@debbugs.gnu.org; Sun, 18 Aug 2024 08:55:45 -0400 Original-Received: by mail-pf1-f195.google.com with SMTP id d2e1a72fcca58-710ece280b6so2554673b3a.2 for <72692@debbugs.gnu.org>; Sun, 18 Aug 2024 05:55:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1723985639; x=1724590439; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:references:subject:to:from :user-agent:mime-version:date:message-id:from:to:cc:subject:date :message-id:reply-to; bh=AjYJJ9cDbRWNlmRw4PoYdlrluCbXAZVBhCsoXnNWa9s=; b=QF4vzkUnozMVoC6EgYeVhKAPK1kdT5xzwr2gihnO1/oGdWZ62YSyKvPg+2rcrGeyhN On8HLY35/jDTXNJq14PmvXxQ5fdKGQmCnwiHxHBtYMxI8UovT4tC6rBt2n1B9If7HvMJ qGrKnixpvH9c4NKacw6HRyXk0zNM3zA1x9yHeDJLo/ljaxdAzbpMyIMLrdoDvzFoxc4Q 8X2vug4OgCM5wlRd87gJgOsE+OP2lfdHeK4RAo4JLJZB6fAAIS7a9C362WruMeMJscSX ITmB15GFiu0XrnTJ5TTb7yVftDWDWsIsYmy9aqJm/ddCOPx0cmTODM/cOJDMmHuPibxl w9Hg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723985639; x=1724590439; h=content-transfer-encoding:in-reply-to:references:subject:to:from :user-agent:mime-version:date:message-id:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=AjYJJ9cDbRWNlmRw4PoYdlrluCbXAZVBhCsoXnNWa9s=; b=qqvQ5oUVD5PDf2HtlbvyirX9blsH6I9Ypdg1wMeIR7CxjwDy+apOPnCdShPOXH0E3y CTFuDY7trH9eBVbN4PMNZuJVOD943bHcN0k80Nv70RvuGt1dQflRcccfgVbDyDAUwcSa esFwEJoijW65kfzQ2qdl4AGYK/V2Wv8MHFtYdy0OvGhjNt2qpP6Z9FUf04EQ6Ufa7S0B 7dJ6fYQ446jg5VraDVtw8Tw2YAomQz4vIst/kTMv+0HeUPQlAvkIUEBFOfFC/mm92AzW pERfQl5bSciu73V/I/aaBErnNqGcaGQKcGjdNSYH/pr4p+/Z3RQrhXKZXVkls5/as9og v27A== X-Forwarded-Encrypted: i=1; AJvYcCVAmAT7CDyeHkxwuQQBHQBPfPtvUlSvg3yVJ6WNlohaWCEawGCldyLg3vnC1N8gyodLnisCaxiGVI/6xT1V7VpqR7Eaaa4= X-Gm-Message-State: AOJu0YyzOZ2N3NJnFBuWMlqC3rlX7ba71QPQWtAVelHuz/mohjxTe4BZ Z66hn5I6ld6QBWvd5PDR4MZdwx03Yt0coLqvtcKTW0C8gDh0r33K X-Google-Smtp-Source: AGHT+IGsa4isLdmWSMp/OwQvvsI2q6D+fofJhjPj1Y0cEy0SCQbwubHoYLfRjiZuZrSMEe3R54T20w== X-Received: by 2002:a05:6a00:a8d:b0:70d:3777:da8e with SMTP id d2e1a72fcca58-713c4ecba62mr8510755b3a.18.1723985638380; Sun, 18 Aug 2024 05:53:58 -0700 (PDT) Original-Received: from [28.0.0.1] (144.34.182.14.16clouds.com. [144.34.182.14]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-7127af3ab4asm5208663b3a.187.2024.08.18.05.53.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 18 Aug 2024 05:53:58 -0700 (PDT) In-Reply-To: <877ccegfxj.fsf@protonmail.com> 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:290317 Archived-At: Thanks for the detailed explanation, thank you. :heart: Eval Exec On 8/18/24 8:43 PM, Pip Cet wrote: > writes: > > > It's > > ``` > > Redefine command "xbacktrace"? (y or n) [answered Y; input not from terminal] > > Redefine command "xprintbytestr"? (y or n) [answered Y; input not from terminal] > > Redefine command "xwhichsymbols"? (y or n) [answered Y; input not from terminal] > > Redefine command "hookpost-backtrace"? (y or n) [answered Y; input not from terminal] > > Redefine command "ff"? (y or n) [answered Y; input not from terminal] > > DISPLAY = :0 > > TERM = 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=fontset@entry=XIL(0), c=c@entry=127802, face=face@entry=0x13fec610, id=-1) at fontset.c:793 > > 793 rfont_def = fontset_find_font (fontset, c, face, id, 0); > > (gdb) p *face->ascii_face > > $1 = { > > lface = {XIL(0x8220), XIL(0x28bdef4), XIL(0x28bdf34), XIL(0xe340), make_fixnum(90), XIL(0xe340), XIL(0xe340), XIL(0), XIL(0), XIL(0x4417994), XIL(0x233c9c4), XIL(0), XIL(0), XIL(0), XIL(0x7f9ea6b05d63), > > XIL(0x765a8285), XIL(0), XIL(0x2aabee4), XIL(0x13500), XIL(0)}, > > id = 2, > > gc = 0x0, > > stipple = 0, > > foreground = 4288059542, > > background = 4278190080, > > underline_color = 0, > > overline_color = 0, > > strike_through_color = 0, > > box_color = 4281545523, > > font = 0x1e4370d0, > > fontset = 5, > > box_vertical_line_width = -1, > > box_horizontal_line_width = -1, > > underline_pixels_above_descent_line = 0, > > box = FACE_SIMPLE_BOX, > > underline = FACE_NO_UNDERLINE, > > use_box_color_for_shadows_p = true, > > overline_p = false, > > strike_through_p = false, > > foreground_defaulted_p = false, > > background_defaulted_p = false, > > underline_defaulted_p = false, > > overline_color_defaulted_p = false, > > strike_through_color_defaulted_p = false, > > box_color_defaulted_p = true, > > underline_at_descent_line_p = false, > > tty_bold_p = false, > > tty_italic_p = false, > > tty_reverse_p = false, > > tty_strike_through_p = false, > > colors_copied_bitwise_p = false, > > overstrike = false, > > hash = 322003229, > > next = 0x13fec610, > > prev = 0x0, > > ascii_face = 0x4d7343a0, > > extra = 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 *face) > { > /* Free fontset of FACE if it is ASCII face. */ > if (face->fontset >= 0 && face == face->ascii_face) > - free_face_fontset (f, face); > + { > + struct face_cache *cache = FRAME_FACE_CACHE (f); > + if (cache) > + { > + for (int i = 0; i < cache->used; i++) > + { > + struct face *face2 = cache->faces_by_id[i]; > + if (face2 != 0 && face2 != face && face2->fontset == face->fontset) > + { > + message ("Freeing fontset %d that's still in use!", face->fontset); > + goto dont; > + } > + } > + } > + free_face_fontset (f, face); > + } > + dont: > > #ifdef HAVE_X_WINDOWS > /* 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 > >