From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#58042: 29.0.50; ASAN use-after-free in re_match_2_internal Date: Sun, 25 Sep 2022 11:08:18 +0300 Message-ID: <83illbnafh.fsf@gnu.org> References: <835yhcom6g.fsf@gnu.org> <831qs0okx4.fsf@gnu.org> <83mtaom0a9.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="25047"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 58042@debbugs.gnu.org To: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sun Sep 25 10:09:16 2022 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 1ocMhP-0006N8-Pi for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Sep 2022 10:09:15 +0200 Original-Received: from localhost ([::1]:50722 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ocMhO-0001dW-AY for geb-bug-gnu-emacs@m.gmane-mx.org; Sun, 25 Sep 2022 04:09:14 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:54456) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocMhD-0001d9-O8 for bug-gnu-emacs@gnu.org; Sun, 25 Sep 2022 04:09:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46741) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ocMhC-00039B-G1 for bug-gnu-emacs@gnu.org; Sun, 25 Sep 2022 04:09:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ocMhC-00030R-Aa for bug-gnu-emacs@gnu.org; Sun, 25 Sep 2022 04:09:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 25 Sep 2022 08:09:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 58042 X-GNU-PR-Package: emacs Original-Received: via spool by 58042-submit@debbugs.gnu.org id=B58042.166409331711521 (code B ref 58042); Sun, 25 Sep 2022 08:09:02 +0000 Original-Received: (at 58042) by debbugs.gnu.org; 25 Sep 2022 08:08:37 +0000 Original-Received: from localhost ([127.0.0.1]:45819 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ocMgn-0002zl-9n for submit@debbugs.gnu.org; Sun, 25 Sep 2022 04:08:37 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:36282) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ocMgl-0002zW-HG for 58042@debbugs.gnu.org; Sun, 25 Sep 2022 04:08:35 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48884) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocMgg-00036W-1h; Sun, 25 Sep 2022 04:08:30 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=Rx5eo0kYxWD05kcerBIi7wLBrehim2LvNjKx0Tnjb8U=; b=D2R98oXllncgTSdb37lz rEHHohbNWX+awUE/11NzbtmIhAZlKYJBJkDU2nkARu2UZOhi8Ys2snoZHEtVq9bds7h5FZX9v1ZDr pVI0TcLE3fmj7t3KwhWu7l3fdPdHh4S8nzFTL5RAtGjQiSUfSX7wt+o6PqlxPsR+ZOzJHnDR7f6s7 hIhKjkMnC5uv4bxVEkhtiObHq+RUcaqNI5/DBExE1VOjXvyp9T9rCR87Uq+5gegaiy4a1xD1G0e5s iT2F5H75uujAmS5aMSVVogO+tb9FuyvTBf6Didvdx0kgFJEyThDfMTx2qCFja4iALQvA0/iJ4K94y PkuJU3HqcPlP0g==; Original-Received: from [87.69.77.57] (port=2691 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ocMgf-0004PZ-8H; Sun, 25 Sep 2022 04:08:29 -0400 In-Reply-To: (message from Gerd =?UTF-8?Q?M=C3=B6llmann?= on Sun, 25 Sep 2022 09:06:59 +0200) 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" Xref: news.gmane.io gmane.emacs.bugs:243577 Archived-At: > From: Gerd Möllmann > Cc: 58042@debbugs.gnu.org > Date: Sun, 25 Sep 2022 09:06:59 +0200 > > Eli Zaretskii writes: > > > #14 0x1000f2340 in redisplay_internal xdisp.c:16523 > > #15 0x100108f34 in redisplay xdisp.c:16105 > > > > AFAIU, this says that the GC which freed the string data was caused by > > safe__call1 inside prepare_menu_bars, which was called from > > redisplay_internal. > > Ah, okay! Sorry, I didn't remember that redisplay on the stack. Please > see below. > > > Yes, but I have difficulty with the fact that GC was caused by > > redisplay, and redisplay cannot be invoked while we are in > > re_match_2_internal, AFAIK. So something else is missing here (or > > maybe I'm misinterpreting the ASAN report you posted). > > The second and third backtrace that ASAN displays (freed by, and > previously allocated) are not backtraces directly involved in the crash. > They display some history related to the pointer that causes the crash. So you are saying that the backtrace I quoted, which shows that GC that freed the string was triggered by redisplay, is NOT the GC which actually freed the particular string involved in the read-from-freed-heap? If so, where's the backtrace showing the GC that did free/relocate this particular string? IOW, I think I'm now confused wrt what exactly the ASAN data tells us. Can you perhaps help me understand that, quoting the relevant backtraces as you go? Thanks.