Received: (at 78762) by debbugs.gnu.org; 17 Jun 2025 11:17:49 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Tue Jun 17 07:17:49 2025 Received: from localhost ([127.0.0.1]:55130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uRUK4-0002RF-Ik for submit <at> debbugs.gnu.org; Tue, 17 Jun 2025 07:17:49 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:50490) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uRUK2-0002Q5-Aj for 78762 <at> debbugs.gnu.org; Tue, 17 Jun 2025 07:17:47 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1uRUJw-0002cO-51; Tue, 17 Jun 2025 07:17:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=TQjsIHJCyBddFXRv3r9r7/42VOFkv0X6/BPe/NFQ6OQ=; b=XEpJRy9TYgD7 RUZd7SHCGMecG/HEO84Ceb2HliCdoAqSqj5c7ED8Z+ywacrlU820vvnui4A7APp0WwwN0Zt9xBcOo FW/bAi/F+DSc+cb+dl+tz92nJBmttY/ZDhVHLfDJ0qCw1FgtuhBtfstA9rYlcNZQizynSZgyeOF9+ 0JUigrlLxzJRb5/D5evystv4nszD9PMbEDU2IpBXd3NhuHb0th8N4/NfgIkMDh/ZVxuEV7G9bFmhu fyG+dVRiOmJdro7c9NFMqK0dTP7SqalkcdtRyGeMzYvcW9+cPPxmKDJgLAHvuG6HqOUeMq0P93Uyn QIuvLIfqG43i1GoOpwITTA==; Date: Tue, 17 Jun 2025 14:17:34 +0300 Message-Id: <86h60eobw1.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Spencer Baugh <sbaugh@HIDDEN> In-Reply-To: <ier5xgvo6p5.fsf_-_@HIDDEN> (message from Spencer Baugh on Mon, 16 Jun 2025 14:57:26 -0400) Subject: Re: bug#78762: closed (Re: bug#78762: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log), Re: bug#78762: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log, [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log References: <86v7oyqslh.fsf@HIDDEN> <87v7p2xczj.fsf@HIDDEN> <handler.78762.D78762.17499130304321.notifdone <at> debbugs.gnu.org> <ier5xgvo6p5.fsf_-_@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78762 Cc: zach@HIDDEN, 78762 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: Spencer Baugh <sbaugh@HIDDEN> > Cc: Zach Shaftel <zach@HIDDEN>, 78762 <at> debbugs.gnu.org, Eli Zaretskii > <eliz@HIDDEN> > Date: Mon, 16 Jun 2025 14:57:26 -0400 > > > This segfault affects Emacs 30 too, so it should be backported to > emacs-30. It changes behavior (because it returns nil in some case). Emacs 29 indeed didn't crash when the bug's scenario was run, but it signaled an error, so this scenario never worked in Emacs. So on balance I'd prefer not to backport it, sorry.
bug-gnu-emacs@HIDDEN
:bug#78762
; Package emacs
.
Full text available.Received: (at 78762) by debbugs.gnu.org; 16 Jun 2025 18:57:38 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Mon Jun 16 14:57:37 2025 Received: from localhost ([127.0.0.1]:48818 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uRF1T-0003MF-L2 for submit <at> debbugs.gnu.org; Mon, 16 Jun 2025 14:57:37 -0400 Received: from mxout5.mail.janestreet.com ([64.215.233.18]:41647) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <sbaugh@HIDDEN>) id 1uRF1P-0003Kz-LE for 78762 <at> debbugs.gnu.org; Mon, 16 Jun 2025 14:57:32 -0400 From: Spencer Baugh <sbaugh@HIDDEN> To: help-debbugs@HIDDEN (GNU bug Tracking System) Subject: Re: bug#78762: closed (Re: bug#78762: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log), Re: bug#78762: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log, [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log In-Reply-To: <handler.78762.D78762.17499130304321.notifdone <at> debbugs.gnu.org> (GNU bug Tracking System's message of "Sat, 14 Jun 2025 14:58:02 +0000") References: <86v7oyqslh.fsf@HIDDEN> <87v7p2xczj.fsf@HIDDEN> <handler.78762.D78762.17499130304321.notifdone <at> debbugs.gnu.org> Date: Mon, 16 Jun 2025 14:57:26 -0400 Message-ID: <ier5xgvo6p5.fsf_-_@HIDDEN> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=janestreet.com; s=waixah; t=1750100246; bh=MdWN2IA0BcpZ0iQ/ppJx27Pl1QTXwVmI0NyRsldDzJI=; h=From:To:Cc:Subject:In-Reply-To:References:Date; b=B0C4X+XNY+5SykEFt+5dI5Bd4VqRyH/UUFRycyN9U9AVvT7gbu/vTRZcbedCN9Zo9 V+yJxNrWxx68uweuZLCpvt0pn0LEwEGKvFudqyiG/dKvZUOEOH6uO6qdDFZa4de382 Owjf3TbgIF5xMe83fPsb3BOg2eRm3mdNbHKunm93Xfke6Drx75a27iWnqMkq4ByA/p oBKB/+b8LhAdyuOOzG3aAR9GB6u9usoF+QeXLm+ENevqK4qMurTunAnEP00HXXi8kQ k4LAhNMTsRLXLUa70tDdRCLvPdNiQBBbEhU+NAzdFanMb817SedW6PApsmMHWT87ft a4FjRelVBBqcQ== X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78762 Cc: Eli Zaretskii <eliz@HIDDEN>, Zach Shaftel <zach@HIDDEN>, 78762 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) This segfault affects Emacs 30 too, so it should be backported to emacs-30.
bug-gnu-emacs@HIDDEN
:bug#78762
; Package emacs
.
Full text available.Received: (at 78762-done) by debbugs.gnu.org; 14 Jun 2025 14:57:10 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 14 10:57:10 2025 Received: from localhost ([127.0.0.1]:40225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uQSJg-00017b-K1 for submit <at> debbugs.gnu.org; Sat, 14 Jun 2025 10:57:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47690) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uQSJc-000168-KY for 78762-done <at> debbugs.gnu.org; Sat, 14 Jun 2025 10:57:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1uQSJW-0002re-UX; Sat, 14 Jun 2025 10:56:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GN9eDE7gq6iS/1mXOTgU2gAGnYP2B/SU+2JqhVc3fdQ=; b=DcL6Tkd4CY0g phFCBP0vL1jTnDBE6SCLRVHVocyT1vISGJv2SavsDxbUx49HGlYjkY8W5FGOTIrXEGGc6NEAq7r96 DewJ6JY77Kn9hON8b4cly7R9ewnDHt24PTqa29cxdLTJmtsumxZCBO3k4YQLldvHJGooJ+N1rWTNN uLrp760Ki5Srw21WaFO2xDJjtKST4tFU9LzbYysm7VCGrmFFZZiLLxKp3qlprRcCiK7gCMkzH5+G1 upb0i6ML5vTWgtlYxi59w1VrVyc5ZGJGlTVOp0YzJzydH74h4uz215UuVNLxKZUTN9miWKOp0fsXM QP7UGy52pJtoU45qEdi76Q==; Date: Sat, 14 Jun 2025 17:56:58 +0300 Message-Id: <86v7oyqslh.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: zach shaftel <zach@HIDDEN> In-Reply-To: <87zfecpezr.fsf@HIDDEN> (message from zach shaftel on Thu, 12 Jun 2025 22:11:36 -0400) Subject: Re: bug#78762: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log References: <87v7p2xczj.fsf@HIDDEN> <86ikl1h7qp.fsf@HIDDEN> <87zfecpezr.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78762-done Cc: 78762-done <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: zach shaftel <zach@HIDDEN> > Cc: 78762 <at> debbugs.gnu.org > Date: Thu, 12 Jun 2025 22:11:36 -0400 > > thank you for the feedback, a new patch is attached. let me know if i > missed anything. Thanks, installed on master, and closing the bug.
Aaron Zeng <azeng@HIDDEN>
:Eli Zaretskii <eliz@HIDDEN>
:Received: (at 78762-done) by debbugs.gnu.org; 14 Jun 2025 14:57:10 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sat Jun 14 10:57:10 2025 Received: from localhost ([127.0.0.1]:40225 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uQSJg-00017b-K1 for submit <at> debbugs.gnu.org; Sat, 14 Jun 2025 10:57:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:47690) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uQSJc-000168-KY for 78762-done <at> debbugs.gnu.org; Sat, 14 Jun 2025 10:57:05 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1uQSJW-0002re-UX; Sat, 14 Jun 2025 10:56:58 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=GN9eDE7gq6iS/1mXOTgU2gAGnYP2B/SU+2JqhVc3fdQ=; b=DcL6Tkd4CY0g phFCBP0vL1jTnDBE6SCLRVHVocyT1vISGJv2SavsDxbUx49HGlYjkY8W5FGOTIrXEGGc6NEAq7r96 DewJ6JY77Kn9hON8b4cly7R9ewnDHt24PTqa29cxdLTJmtsumxZCBO3k4YQLldvHJGooJ+N1rWTNN uLrp760Ki5Srw21WaFO2xDJjtKST4tFU9LzbYysm7VCGrmFFZZiLLxKp3qlprRcCiK7gCMkzH5+G1 upb0i6ML5vTWgtlYxi59w1VrVyc5ZGJGlTVOp0YzJzydH74h4uz215UuVNLxKZUTN9miWKOp0fsXM QP7UGy52pJtoU45qEdi76Q==; Date: Sat, 14 Jun 2025 17:56:58 +0300 Message-Id: <86v7oyqslh.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: zach shaftel <zach@HIDDEN> In-Reply-To: <87zfecpezr.fsf@HIDDEN> (message from zach shaftel on Thu, 12 Jun 2025 22:11:36 -0400) Subject: Re: bug#78762: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log References: <87v7p2xczj.fsf@HIDDEN> <86ikl1h7qp.fsf@HIDDEN> <87zfecpezr.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78762-done Cc: 78762-done <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > From: zach shaftel <zach@HIDDEN> > Cc: 78762 <at> debbugs.gnu.org > Date: Thu, 12 Jun 2025 22:11:36 -0400 > > thank you for the feedback, a new patch is attached. let me know if i > missed anything. Thanks, installed on master, and closing the bug.
Zach Shaftel <zach@HIDDEN>
:Eli Zaretskii <eliz@HIDDEN>
:Received: (at 78762) by debbugs.gnu.org; 13 Jun 2025 02:11:56 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 12 22:11:56 2025 Received: from localhost ([127.0.0.1]:34004 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uPttZ-0002tK-GW for submit <at> debbugs.gnu.org; Thu, 12 Jun 2025 22:11:56 -0400 Received: from smtp.forwardemail.net ([149.28.215.223]:20691) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <SRS0=47db=Y4=shaf.tel=zach@HIDDEN>) id 1uPttU-0002rJ-56 for 78762 <at> debbugs.gnu.org; Thu, 12 Jun 2025 22:11:51 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shaf.tel; h=Content-Type: MIME-Version: Message-ID: Date: References: In-Reply-To: Subject: Cc: To: From; q=dns/txt; s=fe-acc5b42812; t=1749780704; bh=32xxm1LI8qEy9MxST7SIgefSTqMD8ABdsWeYCSRjxeI=; b=EFDVfIORO/70j5P0LM5ZPJo+gGEqZ/XaRHB6ZTrMCo/7k/1fUmYx9qWT+UZU7vsSXZvytSTgH PTRM4Qn0ydYgB6yB+vU88+TdTRRG68mNSJZNo++fr26/irqo6GafBxUyk9GK+c2X2hGNwJV6asV uYk4xKJfNwaeTAm9dwi3oaM= X-Forward-Email-ID: 684b88dce8fc3b2af7a2b941 X-Forward-Email-Sender: rfc822; zach@HIDDEN, smtp.forwardemail.net, 149.28.215.223 X-Forward-Email-Version: 1.0.3 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@HIDDEN X-Report-Abuse: abuse@HIDDEN X-Report-Abuse-To: abuse@HIDDEN From: zach shaftel <zach@HIDDEN> To: Eli Zaretskii <eliz@HIDDEN> Subject: Re: bug#78762: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log In-Reply-To: <86ikl1h7qp.fsf@HIDDEN> References: <87v7p2xczj.fsf@HIDDEN> <86ikl1h7qp.fsf@HIDDEN> User-Agent: mu4e 1.12.10; emacs 31.0.50 Date: Thu, 12 Jun 2025 22:11:36 -0400 Message-ID: <87zfecpezr.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 78762 Cc: 78762 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -1.0 (-) --=-=-= Content-Type: text/plain thank you for the feedback, a new patch is attached. let me know if i missed anything. - zach --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=0001-Fix-segfault-in-profiler-cpu-log-and-profiler-memory.patch From b90a79d7b9845cf39a124648cc860bd7f48d858d Mon Sep 17 00:00:00 2001 From: Zach Shaftel <zach@HIDDEN> Date: Wed, 11 Jun 2025 15:37:31 -0400 Subject: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log (bug#78763) * src/profiler.c (export_log): Check if a log has been allocated first, and return nil if it hasn't. (Fprofiler_cpu_log, Fprofiler_memory_log): Doc fix. * test/src/profiler-tests.el (profiler-tests-cpu-profiler) (profiler-tests-memory-profiler): New tests. --- src/profiler.c | 13 +++++++-- test/src/profiler-tests.el | 58 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 test/src/profiler-tests.el diff --git a/src/profiler.c b/src/profiler.c index 4c88f676fbd..f3a8db69f78 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -534,7 +534,11 @@ DEFUN ("profiler-cpu-log", Fprofiler_cpu_log, Sprofiler_cpu_log, The log is a hash-table mapping backtraces to counters which represent the amount of time spent at those points. Every backtrace is a vector of functions, where the last few elements may be nil. -Before returning, a new log is allocated for future samples. */) + +If the profiler has not run since the last invocation of +`profiler-cpu-log' (or was never run at all), return nil. If the +profiler is currently running, allocate a new log for future samples +before returning. */) (void) { /* Temporarily stop profiling to avoid it interfering with our data @@ -556,6 +560,7 @@ DEFUN ("profiler-cpu-log", Fprofiler_cpu_log, Sprofiler_cpu_log, static Lisp_Object export_log (struct profiler_log *plog) { + if (!plog->log) return Qnil; log_t *log = plog->log; /* The returned hash table uses `equal' as key equivalence predicate which is more discriminating than the `function-equal' used by @@ -639,7 +644,11 @@ DEFUN ("profiler-memory-log", The log is a hash-table mapping backtraces to counters which represent the amount of memory allocated at those points. Every backtrace is a vector of functions, where the last few elements may be nil. -Before returning, a new log is allocated for future samples. */) + +If the profiler has not run since the last invocation of +`profiler-memory-log' (or was never run at all), return nil. If the +profiler is currently running, allocate a new log for future samples +before returning. */) (void) { bool prof_mem = profiler_memory_running; diff --git a/test/src/profiler-tests.el b/test/src/profiler-tests.el new file mode 100644 index 00000000000..fe50de713e2 --- /dev/null +++ b/test/src/profiler-tests.el @@ -0,0 +1,58 @@ +;;; profiler-tests.el --- tests for src/profiler.c -*- lexical-binding:t -*- + +;; Copyright (C) 2025 Free Software Foundation, Inc. + +;; This file is part of GNU Emacs. + +;; GNU Emacs is free software: you can redistribute it and/or modify +;; it under the terms of the GNU General Public License as published by +;; the Free Software Foundation, either version 3 of the License, or +;; (at your option) any later version. + +;; GNU Emacs is distributed in the hope that it will be useful, +;; but WITHOUT ANY WARRANTY; without even the implied warranty of +;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +;; GNU General Public License for more details. + +;; You should have received a copy of the GNU General Public License +;; along with GNU Emacs. If not, see <https://www.gnu.org/licenses/>. + +;;; Commentary: + +;;; Code: + +(require 'ert) + +(ert-deftest profiler-tests-memory-profiler () + (let ((was-running (profiler-memory-running-p))) + ;; do this first in case the profiler was already running + (should (eq was-running (profiler-memory-stop))) + (profiler-memory-start) + (should-error (profiler-memory-start)) + (should (profiler-memory-running-p)) + (should (hash-table-p (profiler-memory-log))) + ;; `profiler-memory-log' shouldn't terminate profiling. + (should (profiler-memory-running-p)) + (profiler-memory-stop) + (profiler-memory-log) ;flush the log + (should-not (profiler-memory-log)) + (when was-running (profiler-memory-start)))) + +(defconst profiler-tests-cpu-sampling-interval 1000000) + +(ert-deftest profiler-tests-cpu-profiler () + (skip-unless (fboundp 'profiler-cpu-start)) + (let ((was-running (profiler-cpu-running-p))) + (should (eq was-running (profiler-cpu-stop))) + (profiler-cpu-start profiler-tests-cpu-sampling-interval) + (should-error (profiler-cpu-start profiler-tests-cpu-sampling-interval)) + (should (hash-table-p (profiler-cpu-log))) + (should (profiler-cpu-running-p)) + (profiler-cpu-stop) + (profiler-cpu-log) + (should-not (profiler-cpu-log)) + (when was-running + (profiler-cpu-start (or (bound-and-true-p profiler-sampling-interval) + profiler-tests-cpu-sampling-interval))))) + +;;; profiler-tests.el ends here -- 2.49.0 --=-=-=--
bug-gnu-emacs@HIDDEN
:bug#78762
; Package emacs
.
Full text available.Eli Zaretskii <eliz@HIDDEN>
to control <at> debbugs.gnu.org
.
Full text available.Received: (at 78762) by debbugs.gnu.org; 12 Jun 2025 05:03:29 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Thu Jun 12 01:03:29 2025 Received: from localhost ([127.0.0.1]:55061 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uPa64-0002bs-1g for submit <at> debbugs.gnu.org; Thu, 12 Jun 2025 01:03:28 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:35648) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <eliz@HIDDEN>) id 1uPa61-0002bS-2W for 78762 <at> debbugs.gnu.org; Thu, 12 Jun 2025 01:03:25 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from <eliz@HIDDEN>) id 1uPa5v-000620-9d; Thu, 12 Jun 2025 01:03:19 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=fdAVT4dcncrpcDTlUhvGoGmhEk+DL3OBQOLTscmJyJE=; b=G8AYZXcgc7Ej 0Z9lZvdNloVqTw0uie3a1B4/AWyV8/UG6zwyJGs1PTGesD537g9POnlfVY9W4cdxN0HPsq8FvY+Ie AV9aoKlkYBZuHDNXRj1Tks8aBXCFz6h+kjcEg03itMlnT8KgBylDGRDZ0xvqidT4fMdtKbSsmm70Z z5FIHXNWDfM0NvXCrA0WKHwathz1kmKJahxfpDkgPQECXHk6LQItjlGICisGSbY59aK9Mk+8dG1zz Iy2iWoyiZfoUothZ/uXp4dhMXJKl+zJF7M+OgjXAWs11GwneC37ntfo0Tfwx7Bw0seZIt+jGxyfUs fUJ27rmA8+6m3UhHfmVtvg==; Date: Thu, 12 Jun 2025 08:03:10 +0300 Message-Id: <86ikl1h7qp.fsf@HIDDEN> From: Eli Zaretskii <eliz@HIDDEN> To: Zach Shaftel <zach@HIDDEN> In-Reply-To: <87v7p2xczj.fsf@HIDDEN> (bug-gnu-emacs@HIDDEN) Subject: Re: bug#78762: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log References: <87v7p2xczj.fsf@HIDDEN> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 78762 Cc: 78762 <at> debbugs.gnu.org X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -3.3 (---) > Date: Wed, 11 Jun 2025 16:03:12 -0400 > From: Zach Shaftel via "Bug reports for GNU Emacs, > the Swiss army knife of text editors" <bug-gnu-emacs@HIDDEN> > > a simple NULL dereference fix. the profiler log would be null if > profiler-*-log is called without a profiler-*-start before it, or if a > previous profiler-*-log call had flushed the log and the profiler wasn't > restarted since then. then export_log would try to read the NULL log and > segfault. > > to reproduce the bug: > emacs --batch -f profiler-cpu-log > > this patch causes profiler-cpu-log and profiler-memory-log to just > return nil if the log is null. Thanks, please see a few minor comments below. > >From 2c1b3bc8b020acbef496dd991bd08bc0f5505528 Mon Sep 17 00:00:00 2001 > From: Zach Shaftel <zach@HIDDEN> > Date: Wed, 11 Jun 2025 15:37:31 -0400 > Subject: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log > > * src/profiler.c (export_log): Check if a log has been allocated first, > and return nil if it hasn't. > (Fprofiler_cpu_log, Fprofiler_memory_log): Mention the possibly nil > result. The last sentence should say "...in the doc string." Or just "Doc fix" should be enough, since the nature of the change is clear from the diffs. Also, in the next revisions of the patch mention the bug number in the commit log message, since you now know its number. > @@ -534,7 +534,11 @@ DEFUN ("profiler-cpu-log", Fprofiler_cpu_log, Sprofiler_cpu_log, > The log is a hash-table mapping backtraces to counters which represent > the amount of time spent at those points. Every backtrace is a vector > of functions, where the last few elements may be nil. > -Before returning, a new log is allocated for future samples. */) > + > +If the profiler has not run since the last invocation of > +`profiler-cpu-log' (or was never run at all), nil is returned. If the > +profiler is currently running, a new log is allocated for future samples > +before returning. */) Please avoid passive tense as much as possible. Here, "return nil" and "allocate a new log" is shorter and more clear. > + if (plog->log == NULL) We usually prefer the C style: if (!plog->log) > + /* We haven't collected any new data, so return nil. */ > + return Qnil; No need to add comments that just describe what the code already says. Comments which explain what the code does should tell something that isn't clear by just looking at the code. > @@ -639,7 +646,11 @@ DEFUN ("profiler-memory-log", > The log is a hash-table mapping backtraces to counters which represent > the amount of memory allocated at those points. Every backtrace is a vector > of functions, where the last few elements may be nil. > -Before returning, a new log is allocated for future samples. */) > + > +If the profiler has not run since the last invocation of > +`profiler-memory-log' (or was never run at all), nil is returned. If > +the profiler is currently running, a new log is allocated for future > +samples before returning. */) Same comment as above for the other doc string. Also, can you add a test for this? Finally, the same problem exists on the emacs-30 release branch, so could you please post your next revision of the patch relative to the release branch?
bug-gnu-emacs@HIDDEN
:bug#78762
; Package emacs
.
Full text available.Received: (at submit) by debbugs.gnu.org; 11 Jun 2025 20:03:40 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Wed Jun 11 16:03:40 2025 Received: from localhost ([127.0.0.1]:51841 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1uPRfg-0006X4-4T for submit <at> debbugs.gnu.org; Wed, 11 Jun 2025 16:03:40 -0400 Received: from lists.gnu.org ([2001:470:142::17]:56112) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <SRS0=ba03=Y3=shaf.tel=zach@HIDDEN>) id 1uPRfd-0006Wp-1J for submit <at> debbugs.gnu.org; Wed, 11 Jun 2025 16:03:37 -0400 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 <SRS0=ba03=Y3=shaf.tel=zach@HIDDEN>) id 1uPRfV-0007bX-G2 for bug-gnu-emacs@HIDDEN; Wed, 11 Jun 2025 16:03:30 -0400 Received: from smtp.forwardemail.net ([121.127.44.73]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <SRS0=ba03=Y3=shaf.tel=zach@HIDDEN>) id 1uPRfR-0005Lj-S4 for bug-gnu-emacs@HIDDEN; Wed, 11 Jun 2025 16:03:28 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shaf.tel; h=Content-Type: MIME-Version: Message-ID: Date: Subject: To: From; q=dns/txt; s=fe-acc5b42812; t=1749672199; bh=cq47yB3ruDnE6qu3+MTj426muv/zuldOT2DwQ28JkLM=; b=JbM3/FofjjB6R2ONKA73RErk4oEDjW2R8L0Mh4wpxvM0KL7J63gwnmYRHI0mj1UxhgErn3NXk rEGX0/DQ0/ckyYE/PtfOLWIIrjBxM2wAEJZvmDmren5nag1la/HCrX5O641EhNGBLtqTk/HBJru f7i086GM/jYGKT+oO6JL42Y= X-Forward-Email-ID: 6849e10475444c2c8fae6b1d X-Forward-Email-Sender: rfc822; zach@HIDDEN, smtp.forwardemail.net, 121.127.44.73 X-Forward-Email-Version: 1.0.3 X-Forward-Email-Website: https://forwardemail.net X-Complaints-To: abuse@HIDDEN X-Report-Abuse: abuse@HIDDEN X-Report-Abuse-To: abuse@HIDDEN From: Zach Shaftel <zach@HIDDEN> To: bug-gnu-emacs@HIDDEN Subject: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log User-Agent: mu4e 1.12.10; emacs 31.0.50 X-Debbugs-Cc: Date: Wed, 11 Jun 2025 16:03:12 -0400 Message-ID: <87v7p2xczj.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=121.127.44.73; envelope-from=SRS0=ba03=Y3=shaf.tel=zach@HIDDEN; helo=smtp.forwardemail.net 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, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, RCVD_IN_VALIDITY_SAFE_BLOCKED=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: 0.9 (/) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.1 (/) --=-=-= Content-Type: text/plain Tags: patch a simple NULL dereference fix. the profiler log would be null if profiler-*-log is called without a profiler-*-start before it, or if a previous profiler-*-log call had flushed the log and the profiler wasn't restarted since then. then export_log would try to read the NULL log and segfault. to reproduce the bug: emacs --batch -f profiler-cpu-log this patch causes profiler-cpu-log and profiler-memory-log to just return nil if the log is null. In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.49, cairo version 1.18.4) of 2025-06-04 built on bigbox Repository revision: 680fa61b5989b84c0e19ac568be012afd8345f0c Repository branch: master System Description: Arch Linux Configured using: 'configure --with-modules --without-xwidgets --with-native-compilation --with-tree-sitter --without-gsettings --without-gconf --without-gpm --with-pgtk --without-compress-install 'CFLAGS=-mtune=native -march=native -O2 -g -fuse-ld=mold'' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Fix-segfault-in-profiler-cpu-log-and-profiler-memory.patch From 2c1b3bc8b020acbef496dd991bd08bc0f5505528 Mon Sep 17 00:00:00 2001 From: Zach Shaftel <zach@HIDDEN> Date: Wed, 11 Jun 2025 15:37:31 -0400 Subject: [PATCH] Fix segfault in profiler-cpu-log and profiler-memory-log * src/profiler.c (export_log): Check if a log has been allocated first, and return nil if it hasn't. (Fprofiler_cpu_log, Fprofiler_memory_log): Mention the possibly nil result. --- src/profiler.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/profiler.c b/src/profiler.c index 12d75012c79..816864e940e 100644 --- a/src/profiler.c +++ b/src/profiler.c @@ -534,7 +534,11 @@ DEFUN ("profiler-cpu-log", Fprofiler_cpu_log, Sprofiler_cpu_log, The log is a hash-table mapping backtraces to counters which represent the amount of time spent at those points. Every backtrace is a vector of functions, where the last few elements may be nil. -Before returning, a new log is allocated for future samples. */) + +If the profiler has not run since the last invocation of +`profiler-cpu-log' (or was never run at all), nil is returned. If the +profiler is currently running, a new log is allocated for future samples +before returning. */) (void) { /* Temporarily stop profiling to avoid it interfering with our data @@ -556,6 +560,9 @@ DEFUN ("profiler-cpu-log", Fprofiler_cpu_log, Sprofiler_cpu_log, static Lisp_Object export_log (struct profiler_log *plog) { + if (plog->log == NULL) + /* We haven't collected any new data, so return nil. */ + return Qnil; log_t *log = plog->log; /* The returned hash table uses `equal' as key equivalence predicate which is more discriminating than the `function-equal' used by @@ -639,7 +646,11 @@ DEFUN ("profiler-memory-log", The log is a hash-table mapping backtraces to counters which represent the amount of memory allocated at those points. Every backtrace is a vector of functions, where the last few elements may be nil. -Before returning, a new log is allocated for future samples. */) + +If the profiler has not run since the last invocation of +`profiler-memory-log' (or was never run at all), nil is returned. If +the profiler is currently running, a new log is allocated for future +samples before returning. */) (void) { bool prof_mem = profiler_memory_running; -- 2.49.0 --=-=-=--
Zach Shaftel <zach@HIDDEN>
:bug-gnu-emacs@HIDDEN
.
Full text available.bug-gnu-emacs@HIDDEN
:bug#78762
; Package emacs
.
Full text available.
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.