From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Istvan Marko Newsgroups: gmane.emacs.bugs Subject: bug#61504: 29.0.60; executing byte-code from previous build causes SIGSEGV crash Date: Mon, 13 Feb 2023 22:33:54 -0800 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="10727"; mail-complaints-to="usenet@ciao.gmane.io" To: 61504@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Feb 14 07:35:16 2023 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 1pRouJ-0002b6-Lg for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 14 Feb 2023 07:35:15 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRouB-00061c-Cq; Tue, 14 Feb 2023 01:35:07 -0500 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 1pRou6-00061M-Ox for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 01:35:02 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pRou6-0002J6-EM for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 01:35:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pRou6-0003TM-8e for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 01:35:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Istvan Marko Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 14 Feb 2023 06:35:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 61504 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.167635644513268 (code B ref -1); Tue, 14 Feb 2023 06:35:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 14 Feb 2023 06:34:05 +0000 Original-Received: from localhost ([127.0.0.1]:52327 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRotA-0003Rv-MR for submit@debbugs.gnu.org; Tue, 14 Feb 2023 01:34:05 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:58386) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pRot9-0003Ro-9K for submit@debbugs.gnu.org; Tue, 14 Feb 2023 01:34:03 -0500 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 1pRot9-0005W3-2I for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 01:34:03 -0500 Original-Received: from imarko.xen.prgmr.com ([71.19.158.228]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pRot6-0000yi-Sp for bug-gnu-emacs@gnu.org; Tue, 14 Feb 2023 01:34:02 -0500 Original-Received: from localhost ([127.0.0.1] helo=zsu.kismala.com) by imarko.xen.prgmr.com with esmtp (Exim 4.94.2) (envelope-from ) id 1pRot1-000427-Dq for bug-gnu-emacs@gnu.org; Mon, 13 Feb 2023 22:33:55 -0800 Received-SPF: pass client-ip=71.19.158.228; envelope-from=mi-ebugs@kismala.com; helo=imarko.xen.prgmr.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, 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-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:255548 Archived-At: There seems to be a byte-code change between versions 0ec0a610ed226419269f519021cbe8fb2dde2ed5 (old) and a4aa32bdfff7aaf54efbacbb04b7f2b52fef92a7 (new) which causes the new version to crash with SIGSEGV when executing certain code from an .elc built using the old version. Recompiling the file with the new version causes the new .elc to work correctly. I am able to reproduce this by calling (pdf-tools-install-noverify) from the pdf-tools.elc (compiled with the older emacs version) from the pdf-tools package which is available at https://github.com/politza/pdf-tools This snippet in particular triggers the crash: (dolist (buf (buffer-list)) ;; This when check should not be necessary, but somehow dead ;; buffers are showing up here. See ;; https://github.com/vedang/pdf-tools/pull/93 (when (buffer-live-p buf) (with-current-buffer buf (when (and (not (derived-mode-p 'pdf-view-mode)) (pdf-tools-pdf-buffer-p) (buffer-file-name)) (pdf-view-mode))))) The crash happens in the pdf-tools-pdf-buffer-p function: (defun pdf-tools-pdf-buffer-p (&optional buffer) "Check if the current buffer is a PDF document. Optionally, take BUFFER as an argument and check if it is a PDF document." (save-current-buffer (when buffer (set-buffer buffer)) (save-excursion (save-restriction (widen) (goto-char 1) (looking-at "%PDF"))))) I can try to create a smaller standalone reproducer if needed. backtrace: Thread 1 "emacs" received signal SIGSEGV, Segmentation fault. 0x00001555529d17a7 in free () from /lib64/libc.so.6 (gdb) bt #0 0x00001555529d17a7 in free () from /lib64/libc.so.6 #1 0x00000000001e66bc in ?? () #2 0x00005555557693d4 in safe_free (sa_count=...) at /mnt/sdc1/tmp/emacs/src/lisp.h:5385 #3 apply_lambda (fun=0x555557654ccd, args=, count=...) at eval.c:3109 #4 0x00005555557679e6 in eval_sub (form=) at eval.c:2588 #5 0x000055555576800d in Fprogn (body=0x555557678033) at eval.c:436 #6 0x0000555555767cf2 in eval_sub (form=) at eval.c:2449 #7 0x000055555576a2b9 in internal_lisp_condition_case (var=0x927910, bodyform=0x555557677753, handlers=) at eval.c:1428 #8 0x0000555555767cf2 in eval_sub (form=) at eval.c:2449 #9 0x00005555557688bd in Fprogn (body=0x0) at eval.c:436 #10 Fif (args=) at eval.c:392 #11 Fif (args=) at eval.c:378 #12 0x0000555555767cf2 in eval_sub (form=) at eval.c:2449 #13 0x000055555576800d in Fprogn (body=0x5555576b4ee3) at eval.c:436 #14 0x0000555555767cf2 in eval_sub (form=) at eval.c:2449 #15 0x000055555576a2b9 in internal_lisp_condition_case (var=0x927910, bodyform=0x5555576ad993, handlers=) at eval.c:1428 #16 0x0000555555767cf2 in eval_sub (form=) at eval.c:2449 #17 0x000055555578f800 in readevalloop_eager_expand_eval (val=0x0, macroexpand=0xffffbffff97a1430) at /mnt/sdc1/tmp/emacs/src/lisp.h:1516 #18 0x0000555555797a7b in readevalloop (readcharfun=0x555555f7ecad, infile0=0x0, sourcename=0x55555618c784, printflag=false, unibyte=, readfun=0x0, start=0x0, end=0x0) at lread.c:2347 #19 0x0000555555798cfc in Feval_buffer (buffer=, printflag=0x0, filename=0x55555618c784, unibyte=0x0, do_allow_print=0x30) at lread.c:2420 #20 0x00005555557ab3e7 in exec_byte_code (fun=, args_template=, nargs=, args=) at bytecode.c:809 #21 0x0000555555763f63 in Ffuncall (nargs=nargs@entry=5, args=args@entry=0x7fffffffdae0) at eval.c:2995 #22 0x0000555555798a9d in call4 (arg4=0x30, arg3=0x30, arg2=0x55555618c784, arg1=0x55555618c784, fn=) at /mnt/sdc1/tmp/emacs/src/lisp.h:3269 #23 Fload (file=, noerror=0xffffbffff9503bb0, nomessage=0xffffbffff9503ab0, nosuffix=, must_suffix=) at lread.c:1484 #24 0x00005555557ab3e7 in exec_byte_code (fun=, args_template=, nargs=, args=) at bytecode.c:809 #25 0x0000555555769387 in apply_lambda (fun=0x15554f4bac2d, args=, count=...) at eval.c:3103 #26 0x00005555557679e6 in eval_sub (form=) at eval.c:2588 #27 0x000055555576a4b7 in Feval (form=0x15554f8f188b, lexical=) at eval.c:2361 #28 0x0000555555762627 in internal_condition_case (bfun=bfun@entry=0x5555556d5510 , handlers=handlers@entry=0x90, hfun=hfun@entry=0x5555556dcd10 ) at eval.c:1474 #29 0x00005555556d5ee6 in top_level_1 (ignore=ignore@entry=0x0) at keyboard.c:1141 #30 0x0000555555762581 in internal_catch (tag=tag@entry=0xffc0, func=func@entry=0x5555556d5ec0 , arg=arg@entry=0x0) at eval.c:1197 #31 0x00005555556d548f in command_loop () at keyboard.c:1101 #32 0x00005555556dc894 in recursive_edit_1 () at keyboard.c:711 #33 0x00005555556dcc1c in Frecursive_edit () at keyboard.c:794 #34 0x00005555555aa4bd in main (argc=, argv=) at emacs.c:2529 (gdb) xbacktrace "pdf-tools-install-noverify" (0x4ed262b8) "pdf-tools-install" (0xffffd120) "progn" (0xffffd2a0) "condition-case" (0xffffd400) "if" (0xffffd4e0) "progn" (0xffffd5c0) "condition-case" (0xffffd720) "eval-buffer" (0x4ed26248) "load-with-code-conversion" (0xffffdae8) "load" (0x4ed26168) "startup--load-user-init-file" (0x4ed260c0) "command-line" (0x4ed26040) "normal-top-level" (0xffffdc50) In GNU Emacs 29.0.60 (build 1, x86_64-pc-linux-gnu, GTK+ Version 3.24.34, cairo version 1.16.0) of 2023-02-13 built on foo.bar.com Repository revision: a4aa32bdfff7aaf54efbacbb04b7f2b52fef92a7 Repository branch: HEAD System Description: Gentoo/Linux Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG JSON LCMS2 LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB -- Istvan