git: 93d11220ce57 - main - editors/emacs: Apply a security fix from upstream

From: Ashish SHUKLA <ashish_at_FreeBSD.org>
Date: Wed, 16 Sep 2026 17:55:46 UTC
The branch main has been updated by ashish:

URL: https://cgit.FreeBSD.org/ports/commit/?id=93d11220ce575a5ab5fff7f1dc1e587631bf1ac9

commit 93d11220ce575a5ab5fff7f1dc1e587631bf1ac9
Author:     Fabian Keil <fk@fabiankeil.de>
AuthorDate: 2026-09-14 15:53:55 +0000
Commit:     Ashish SHUKLA <ashish@FreeBSD.org>
CommitDate: 2026-09-16 17:54:51 +0000

    editors/emacs: Apply a security fix from upstream
    
    Previous fix for CVE-2024-53920 was incomplete[0].
    
    [0] https://www.openwall.com/lists/oss-security/2026/09/14/1
    
    PR:             298557
    MFH:            2026Q3
    Security:       7ba6c085-1590-491a-98ce-5452646b196f
    Security:       CVE-2024-53920
---
 editors/emacs/Makefile                             |  2 +-
 .../emacs/files/patch-lisp_progmodes_flymake.el    | 53 ++++++++++++++++++++++
 2 files changed, 54 insertions(+), 1 deletion(-)

diff --git a/editors/emacs/Makefile b/editors/emacs/Makefile
index 058e2853013a..a4c5bd0db7d5 100644
--- a/editors/emacs/Makefile
+++ b/editors/emacs/Makefile
@@ -1,6 +1,6 @@
 PORTNAME=	emacs
 DISTVERSION=	31.1
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	3
 CATEGORIES=	editors
 MASTER_SITES=	GNU
diff --git a/editors/emacs/files/patch-lisp_progmodes_flymake.el b/editors/emacs/files/patch-lisp_progmodes_flymake.el
new file mode 100644
index 000000000000..c11e9aa521df
--- /dev/null
+++ b/editors/emacs/files/patch-lisp_progmodes_flymake.el
@@ -0,0 +1,53 @@
+From abc802ee2eb0b1663349ddf22a461f8e54a383fb Mon Sep 17 00:00:00 2001
+From: Stefan Monnier <monnier@iro.umontreal.ca>
+Date: Mon, 14 Sep 2026 11:30:39 +0100
+Subject: [PATCH] flymake.el: Generalize trusted-content-p check to all
+ backends
+
+Minimal safe backport of this change:
+
+    Author:     Stefan Monnier <monnier@iro.umontreal.ca>
+    AuthorDate: Fri Sep 11 21:48:55 2026 -0400
+
+      flymake.el: Generalize trusted-content-p check to all backends
+
+      Rather than have each and every backend check
+      'trusted-content-p' if it feels necessary, implement the check
+      once and forall in flymake.el and provide a wat for backends to
+      skip that test, so we replace an "opt-in" with an "opt-out"
+      that's a bit more secure by design.
+
+      * lisp/progmodes/elisp-mode.el (elisp-flymake-byte-compile):
+      Move 'trusted-content-p' to flymake.el.
+      * lisp/progmodes/flymake.el (flymake--run-backend):
+      Move 'trusted-content-p' from elisp-mode.el.
+
+      * lisp/progmodes/eglot.el (eglot-flymake-backend): Mark as safe.
+
+* lisp/progmodes/flymake.el (flymake--run-backend): Copy
+trusted-content-p check from elisp-mode.el.  Do not merge to
+master.
+---
+ lisp/progmodes/flymake.el | 9 +++++++--
+ 1 file changed, 7 insertions(+), 2 deletions(-)
+
+diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el
+index fff42696761..40761031dc2 100644
+--- lisp/progmodes/flymake.el.orig	2026-08-17 17:42:57 UTC
++++ lisp/progmodes/flymake.el
+@@ -1271,8 +1271,13 @@ with a report function."
+             (flymake--state-disabled state) nil
+             (flymake--state-reported-p state) nil))
+     (condition-case-unless-debug err
+-        (apply backend (flymake-make-report-fn backend run-token)
+-               args)
++        (if (or (trusted-content-p) (function-get backend 'flymake-always-safe))
++            (apply backend (flymake-make-report-fn backend run-token)
++                   args)
++          (message "Disabling %S in %s (untrusted content)"
++                   backend (buffer-name))
++          (user-error "Disabling %S in %s (untrusted content)"
++                      backend (buffer-name)))
+       (error
+        (flymake--disable-backend backend err)))))
+