From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pip Cet Newsgroups: gmane.emacs.devel Subject: Re: MPS: a random backtrace while toying with gdb Date: Sun, 30 Jun 2024 13:06:29 +0000 Message-ID: <_TT3eLHz9Qo3sgDjPUpuNupK6Xb4vQLiDXsBUuGFoP8fNT61mte-VMXuckIhkPR1-fAGoRWmnppAXOuKcvN8BnOlLGmHKFwM4vgvoWOtrmc=@protonmail.com> References: <87bk3jh8bt.fsf@localhost> <86ikxqhhd7.fsf@gnu.org> <86ed8ehg6l.fsf@gnu.org> 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="27675"; mail-complaints-to="usenet@ciao.gmane.io" Cc: gerd.moellmann@gmail.com, yantar92@posteo.net, emacs-devel@gnu.org, eller.helmut@gmail.com To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Jun 30 15:13:17 2024 Return-path: Envelope-to: ged-emacs-devel@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 1sNuMm-0006xd-Oz for ged-emacs-devel@m.gmane-mx.org; Sun, 30 Jun 2024 15:13:16 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sNuM1-0003fX-CS; Sun, 30 Jun 2024 09:12:29 -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 1sNuGU-0002gV-Qb for emacs-devel@gnu.org; Sun, 30 Jun 2024 09:06:48 -0400 Original-Received: from mail-40131.protonmail.ch ([185.70.40.131]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sNuGL-0001ZG-6C; Sun, 30 Jun 2024 09:06:39 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com; s=protonmail3; t=1719752794; x=1720011994; bh=l3jtMaJrIYQiOBaJit7Ctn1+Fa+uvTUrX4P2cO6hCe0=; 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=bLsvI41d06jbphfOpH5O9rEQ2rku3U6PhQRYWJk/PuPUxNq48EvNUzxcjGgbUZfxL iGuAvbPDzuy3AWeA0P8FuuHvP/HBhZX6joWRJOXZUxmaGJAh2CQjLkr+8iORkYk3pE aDzc48fFoyIfpnvwDN9+kUkYYpSndeKeYrekpk+kTPEpk0ETToo+Ht8kFZ4KkxAl9O A06C4UY5JL4BbthcU9S3GGx0DkC41aX/9RHPAxna9CyP8z72Ll6LJxVU9NBZZj5syT ZFGL2zkL2tAl9iXqGXdl8EBzMFV84GlO0dy6ls5qsoIFMhRxazmwvbxjS8p6H5cA8s 60HNqa1dbq73g== In-Reply-To: <86ed8ehg6l.fsf@gnu.org> Feedback-ID: 112775352:user:proton X-Pm-Message-ID: 6dfcd80c8daca5c11ea6b349fe119bbbcb252ea6 Received-SPF: pass client-ip=185.70.40.131; envelope-from=pipcet@protonmail.com; helo=mail-40131.protonmail.ch 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, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Sun, 30 Jun 2024 09:12:25 -0400 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:320964 Archived-At: On Sunday, June 30th, 2024 at 10:34, Eli Zaretskii wrote: > > Date: Sun, 30 Jun 2024 10:16:42 +0000 > > From: Pip Cet pipcet@protonmail.com > > Cc: gerd.moellmann@gmail.com, yantar92@posteo.net, emacs-devel@gnu.org,= eller.helmut@gmail.com > > > > > > We could always "steal" the SIGSEGV handler and reinstall it with a= sigmask (without modifying the MPS source). My guess is that's equivalent = to what the macOS code does, essentially, by using a different class of sig= nal that blocks POSIX signals... > > > > > > And this is less "ugly" (let alone more safe) than using sigblock? > > > What am I missing? And, yes, as far as I can tell my proposed solution is safer. > > Mostly, I think, the race condition where the barrier is installed (by = MPS) some time before dflt_scan is even called (and, symmetrically, we'd un= block it too early while the barrier is still in effect). IOW, sigblock wou= ldn't work. > > > Then we should block signals earlier, e.g., in igc_alloc (and any > other place which could cause our objects moved). That would be a very expensive and error-prone way of achieving the same re= sult as simply blocking the signals while handling SIGSEGV. > > (I should point out that you've convinced me as far as SIGPROF goes. At= least for the initial stage, it makes more sense to count hits in GC (whic= h we do, with false positives, using the current scratch/igc code) than to = delay signal processing until GC is over). > > > SIGPROF is not the only one. It's the only one where I am not convinced the right thing is to simply blo= ck it using sa_sigmask. > We have other useful signals, and we > need to think about a solution that will cover most if not all of > them. I've listed the signals that came to mind a few messages ago. Those would be handled just fine by blocking all but the known-to-be-safe S= IGPROF while handling SIGSEGV. > I still cannot believe MPS doesn't have a canonical solution for these > cases. I haven't been able to find one in the docs. It still seems a simple oversi= ght in the MPS code to me that they don't simply block all signals while ha= ndling SIGSEGV, or provide an API to set the mask. Pip