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: Wed, 05 Oct 2022 16:37:35 +0300 Message-ID: <838rlutmqo.fsf@gnu.org> References: <83edvnv965.fsf@gnu.org> <83pmf6u76i.fsf@gnu.org> <83mtaau43p.fsf@gnu.org> <83ilkytyif.fsf@gnu.org> <877d1ewnx0.fsf@yahoo.com> <87tu4iv7w5.fsf@yahoo.com> 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="9239"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, alan@idiocy.org, 58042@debbugs.gnu.org To: Po Lu Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Wed Oct 05 15:43:37 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 1og4gS-0002HT-IP for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 15:43:36 +0200 Original-Received: from localhost ([::1]:59286 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1og4gR-0006NV-8A for geb-bug-gnu-emacs@m.gmane-mx.org; Wed, 05 Oct 2022 09:43:35 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46676) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og4b4-0001Qv-E8 for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 09:38:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:57210) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1og4b4-0006o9-5e for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 09:38:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1og4b3-0006ZF-SB for bug-gnu-emacs@gnu.org; Wed, 05 Oct 2022 09:38:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Wed, 05 Oct 2022 13:38:01 +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.166497706825219 (code B ref 58042); Wed, 05 Oct 2022 13:38:01 +0000 Original-Received: (at 58042) by debbugs.gnu.org; 5 Oct 2022 13:37:48 +0000 Original-Received: from localhost ([127.0.0.1]:56288 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1og4aq-0006Yg-K0 for submit@debbugs.gnu.org; Wed, 05 Oct 2022 09:37:48 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:51754) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1og4ap-0006YR-1N for 58042@debbugs.gnu.org; Wed, 05 Oct 2022 09:37:47 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:48326) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1og4ai-0006mM-Q4; Wed, 05 Oct 2022 09:37:40 -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=IMpkrpVbb5w9g67Dk50KC7tpjNjRAxcqPtWC9gIKwok=; b=rGN1moLhwKQRNjaW2EDE xFqYm6pxJ8KpizwD+SB1EPGwWQyyEePo4MvWctjuVX8C5P6oQmyMao+jP1xqRd3byRmxE/1hx14Dv ktUhsQoSUqew7zeQz1sjaXKECHTY77erDQzALatvkoxuNlh/PG43i/guS/8Jl7WcIHgHsCZq/pwnJ mH6M/MkAnyqgLTRzfJM17/OhlRFZp6OfT/OPQsOLdxf4ykE6RbNdr7gOGRj0k+0SeS+sr5ou3HdOo JauDjVbnAVJZWBP+4Af56e6goJZkuOTJ3WgunfGV57yiS12v6pZ80Jda0yMCNlzDM89m2Y8HQr5N1 zuoY9Ltl+Gyxqw==; Original-Received: from [87.69.77.57] (port=3670 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 1og4af-0007V9-TC; Wed, 05 Oct 2022 09:37:40 -0400 In-Reply-To: <87tu4iv7w5.fsf@yahoo.com> (message from Po Lu on Wed, 05 Oct 2022 19:15:22 +0800) 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:244533 Archived-At: > From: Po Lu > Cc: Eli Zaretskii , 58042@debbugs.gnu.org, Alan Third > > Date: Wed, 05 Oct 2022 19:15:22 +0800 > > Gerd Möllmann writes: > > > Can somone please help me understand how this works? > > > > Let's say we are in memq called for list L. Fmemq uses FOR_EACH_TAIL, > > which can call maybe_quit, which executes arbitrary Lisp, which can > > modify L. And probably similarly in another 100 places. > > > > I don't get it. > > AFAIU if it is particularly dangerous to modify L there, then input > should be blocked around Fmemq. How do you know whether it's "particularly dangerous"? We call maybe_quit in many places, basically anywhere where we have potentially long loops. It isn't just Fmemq. So if we want to prevent maybe_quit from indirectly calling arbitrary Lisp, we'd need to block_input inside probably_quit. Which means process_pending_signals will not call the read-socket hook and will not gobble input. That's bad, I think. And note that this is only problematic on macOS (AFAIU), because there the read-socket hook can trigger redisplay.