From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#58327: 29.0.50; Missing staticpro for old_selected_window in window.c Date: Thu, 06 Oct 2022 07:16:29 +0200 Message-ID: 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="8992"; mail-complaints-to="usenet@ciao.gmane.io" To: 58327@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Oct 06 07:17:25 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 1ogJG9-0002DJ-6S for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Oct 2022 07:17:25 +0200 Original-Received: from localhost ([::1]:50324 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ogJG8-0000sx-AW for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 06 Oct 2022 01:17:24 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:55134) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogJFq-0000sV-2l for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2022 01:17:06 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:59458) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogJFm-0002B7-Of for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2022 01:17:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1ogJFm-0001Rd-By for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2022 01:17:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Oct 2022 05:17:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 58327 X-GNU-PR-Package: emacs X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16650334015520 (code B ref -1); Thu, 06 Oct 2022 05:17:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Oct 2022 05:16:41 +0000 Original-Received: from localhost ([127.0.0.1]:58536 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogJFR-0001Qy-8e for submit@debbugs.gnu.org; Thu, 06 Oct 2022 01:16:41 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:45078) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ogJFP-0001Qq-Ll for submit@debbugs.gnu.org; Thu, 06 Oct 2022 01:16:40 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:46640) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ogJFO-0000jd-04 for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2022 01:16:38 -0400 Original-Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]:40744) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1ogJFL-00025w-9b for bug-gnu-emacs@gnu.org; Thu, 06 Oct 2022 01:16:37 -0400 Original-Received: by mail-ej1-x62f.google.com with SMTP id r17so2046473eja.7 for ; Wed, 05 Oct 2022 22:16:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date; bh=IJKsl5aCpcfwqaltmWhQUNmszb4t2SD0P5ieVrZ6XMo=; b=Qq2fG/kCHt4M4TxVU9qbjowSnvno3ulFFxZiaXvOv86ruB/QoK4CGGRBL8eNrmOT8x NKjh0qr3XnH9I+952/XHz2rCLCQS4H5mytFgshSfu6DEUJ7OritNxPVkdVJ0nkTsp4ZX khCpIS6lVcEjYaiGo1FQ9Hh8CTAWDtpx8SKuFa5L75cSm4KwnmxtQ0CvjZq+q4LpNfhQ YImh3Lr06coX6TgYYvhXujIa8lNUE/SePPT0R0NHuBBqIRLk+2cyQqmk3Ip/Phu2ulcq Uwi4O+KB6jEwsPXJCC9vC9QK6LdpTUF68ZVZxSOLA0f/daBkvbh9A/EusSxoHO81q2jw VUpg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date; bh=IJKsl5aCpcfwqaltmWhQUNmszb4t2SD0P5ieVrZ6XMo=; b=MYwGllMdkxrkSqUhXGmzp5m/e5Yuekd3PKZWqKjD6l8nCC5dNVUGfoy8V7lWkM236h 1tlfc1KcbTqIg8GjNxALJ5XJsE7J2ze0nxavt9dUPluX8ZeY7CIvaPVsSeAJNAMfN0iY y8Cf4dXx2H+eydNl67p8LPiqneSZLtPnS6oH+7BTbefMSwZxFura1SUAG0XfJE0bA+hD 2lUcy0B1pEfzV+f8f7P+sAY0RoRYRTnkUgoro2p8BDELKtPhSflzBCju0B9pl6x4ODWT JMKq4Jt3YzVXPPqNyTE/cKMOgwyAojDcoT7Yef2Iqr51WEvvqGmp2IswYHC8N3MFQ/ZB o0AA== X-Gm-Message-State: ACrzQf0NX6YoEEdZgL7HoDdtkqnQTjL2x3jHRPr8z956nMYbw8vs2/tD f7K4DaDFmTNHhQXvr0fg9mJslKwyjLr67Q== X-Google-Smtp-Source: AMsMyM6LpmU+yUX8K5gW1tODUgnHBtBYL/Q69a/Ip3eGlFCHw6ubuMTCyBs4E6rM/p4rkJ/vtXXkug== X-Received: by 2002:a17:907:3d8b:b0:78d:3c3e:ce0d with SMTP id he11-20020a1709073d8b00b0078d3c3ece0dmr2488573ejc.476.1665033391471; Wed, 05 Oct 2022 22:16:31 -0700 (PDT) Original-Received: from Mini.fritz.box (pd9e36a85.dip0.t-ipconnect.de. [217.227.106.133]) by smtp.gmail.com with ESMTPSA id j18-20020a17090623f200b0077f20a722dfsm9689480ejg.165.2022.10.05.22.16.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 22:16:30 -0700 (PDT) Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=gerd.moellmann@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action 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:244589 Archived-At: This was found while investigating bug#58024. Since this is not directly related to bug#58024, and to make sure it's not forgotten, I'm submitting this report separately. Below is a copy a mail describing the problem. From: Po Lu Subject: bug#58042: 29.0.50; ASAN use-after-free in re_match_2_internal To: Gerd M=C3=B6llmann Cc: Eli Zaretskii , 58042@debbugs.gnu.org, Alan Third Date: Wed, 05 Oct 2022 20:48:25 +0800 (16 hours, 20 minutes, 2 seconds ago) Resent-From: Po Lu Gerd M=C3=B6llmann writes: > I don't get an abort, but the ASAN error again Interesting. > =3D=3D67682=3D=3DERROR: AddressSanitizer: heap-use-after-free on address = 0x000107130d00 at pc 0x0001002a481c bp 0x00016fdcc3c0 sp 0x00016fdcc3b8 > READ of size 8 at 0x000107130d00 thread T0 > #0 0x1002a4818 in PSEUDOVECTORP lisp.h:1110 > #1 0x1002a4888 in SYMBOL_WITH_POS_P lisp.h:1122 > #2 0x10025a338 in EQ lisp.h:1342 > #3 0x100280eb0 in run_window_change_functions window.c:3964 > #4 0x1000f18c4 in redisplay_internal xdisp.c:16600 > #5 0x100107bf8 in redisplay xdisp.c:16111 > #6 0x10089364c in -[EmacsView layoutSublayersOfLayer:] nsterm.m:8661 > #7 0x1900a9624 in CA::Layer::layout_if_needed(CA::Transaction*)+0x224= (QuartzCore:arm64e+0x20624) > #8 0x1901f661c in CA::Context::commit_transaction(CA::Transaction*, > double, double*)+0x1c0 (QuartzCore:arm6 > > frame #8: 0x0000000100280eb4 emacs`run_window_change_functions at window.= c:3964:7 > 3961 (de-)selected as its frame's or the globally selected > 3962 window. */ > 3963 if (((frame_selected_change > -> 3964 && (EQ (window, old_selected_window) > 3965 || EQ (window, selected_window))) > 3966 || (frame_selected_window_change > 3967 && (EQ (window, FRAME_OLD_SELECTED_WINDOW (f)) > > (lldb) p window > (Lisp_Object) $18 =3D 0x00000001071c2935 (struct window *) $23 =3D 0x0000= 0001071c2930 > (lldb) p old_selected_window > (Lisp_Object) $24 =3D 0x0000000107130d05 (struct Lisp_Vector *) $28 =3D 0= x0000000107130d00 > > old_selected_window looks strange. It's a global that is not > staticpro'd Isn't old_selected_window supposed to be kept in sync with FRAME_OLD_SELECTED_WINDOW in old_selected_frame, with the latter being removed once it is deleted? Would someone who knows the window code well please take a look at this? The proposed fix was From: Gerd M=C3=B6llmann Subject: bug#58042: 29.0.50; ASAN use-after-free in re_match_2_internal=20 To: Po Lu Cc: Eli Zaretskii , 58042@debbugs.gnu.org, Alan Third Date: Wed, 05 Oct 2022 14:38:24 +0200 (16 hours, 37 minutes, 19 seconds ago) Resent-From: Gerd M=C3=B6llmann Gerd M=C3=B6llmann writes: > old_selected_window looks strange. It's a global that is not > staticpro'd And with this it works again: diff --git a/src/window.c b/src/window.c index 12a212a85a..da80fabe33 100644 --- a/src/window.c +++ b/src/window.c @@ -8213,6 +8213,8 @@ init_window_once (void) =20 minibuf_selected_window =3D Qnil; staticpro (&minibuf_selected_window); + old_selected_window =3D Qnil; + staticpro (&old_selected_window); =20 pdumper_do_now_and_after_late_load (init_window_once_for_pdumper); }