From cd9aabd9921cc0ee21423fd178a0f06daa037075 Mon Sep 17 00:00:00 2001 From: Jacob Wang Date: Wed, 25 Jun 2025 11:22:13 +0800 Subject: [PATCH 1/4] [CVE]update to emacs-27.2-14.2 to #ICHN2Z update to emacs-27.2-14.2 for CVE-2024-53920 Project: TC2024080204 Signed-off-by: Jacob Wang --- 1001-emacs-add-sw.patch | 86 -------------------------------------- dist | 2 +- emacs-CVE-2024-53920.patch | 12 ++---- emacs.spec | 53 +++++++---------------- 4 files changed, 19 insertions(+), 134 deletions(-) delete mode 100644 1001-emacs-add-sw.patch diff --git a/1001-emacs-add-sw.patch b/1001-emacs-add-sw.patch deleted file mode 100644 index bafdfa1..0000000 --- a/1001-emacs-add-sw.patch +++ /dev/null @@ -1,86 +0,0 @@ -From f0cc006e3b7f490ece36996dfbef46712cdaf36f Mon Sep 17 00:00:00 2001 -From: wxiat -Date: Tue, 20 Jun 2023 14:20:50 +0800 -Subject: [PATCH] add sw - -Signed-off-by: wxiat ---- - build-aux/config.guess | 8 ++++++++ - build-aux/config.sub | 1 + - configure.ac | 2 +- - src/unexelf.c | 8 +++++++- - 4 files changed, 17 insertions(+), 2 deletions(-) - -diff --git a/build-aux/config.guess b/build-aux/config.guess -index 457a63a..827cd81 100755 ---- a/build-aux/config.guess -+++ b/build-aux/config.guess -@@ -926,6 +926,14 @@ EOF - UNAME_MACHINE=aarch64_be - echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" - exit ;; -+ sw_64:Linux:*:*) -+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in -+ sw) UNAME_MACHINE=sw_64 ;; -+ esac -+ objdump --private-headers /bin/sh | grep -q ld.so.1 -+ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi -+ echo "$UNAME_MACHINE"-sunway-linux-"$LIBC" -+ exit ;; - alpha:Linux:*:*) - case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in - EV5) UNAME_MACHINE=alphaev5 ;; -diff --git a/build-aux/config.sub b/build-aux/config.sub -index 90f19bb..eb9e11d 100755 ---- a/build-aux/config.sub -+++ b/build-aux/config.sub -@@ -1159,6 +1159,7 @@ case $cpu-$vendor in - | aarch64 | aarch64_be \ - | loongarch32 | loongarch64 | loongarchx32 \ - | abacus \ -+ | sw_64 \ - | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ - | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ - | alphapca5[67] | alpha64pca5[67] \ -diff --git a/configure.ac b/configure.ac -index 0b34532..d4d637c 100644 ---- a/configure.ac -+++ b/configure.ac -@@ -703,7 +703,7 @@ case "${canonical}" in - *-apple-darwin* ) - case "${canonical}" in - *-apple-darwin[0-9].*) unported=yes ;; -- i[3456]86-* | x86_64-* | arm-* | aarch64-* ) ;; -+ i[3456]86-* | x86_64-* | arm-* | aarch64-* | sw_64-* ) ;; - * ) unported=yes ;; - esac - opsys=darwin -diff --git a/src/unexelf.c b/src/unexelf.c -index b5cded5..6c1e121 100644 ---- a/src/unexelf.c -+++ b/src/unexelf.c -@@ -120,7 +120,7 @@ typedef struct { - /* - * NetBSD does not have normal-looking user-land ELF support. - */ --# if defined __alpha__ || defined __sparc_v9__ || defined _LP64 -+# if defined __alpha__ || defined __sparc_v9__ || defined _LP64 || defined __sw_64__ - # define ELFSIZE 64 - # else - # define ELFSIZE 32 -@@ -150,6 +150,12 @@ typedef struct { - # define pHDRR HDRR * - # endif /* __alpha__ */ - -+# ifdef __sw_64__ -+# include -+# define HDRR struct ecoff_symhdr -+# define pHDRR HDRR * -+# endif /* __sw_64__ */ -+ - #ifdef __mips__ /* was in pkgsrc patches for 20.7 */ - # define SHT_MIPS_DEBUG DT_MIPS_FLAGS - # define HDRR struct Elf_Shdr --- -2.31.1 - diff --git a/dist b/dist index 6358205..1f9f8c9 100644 --- a/dist +++ b/dist @@ -1 +1 @@ -an9_5 +an9_6 diff --git a/emacs-CVE-2024-53920.patch b/emacs-CVE-2024-53920.patch index 920f93a..ed68901 100644 --- a/emacs-CVE-2024-53920.patch +++ b/emacs-CVE-2024-53920.patch @@ -126,14 +126,10 @@ "Pseudo function used internally by macroexp to delay warnings. --- emacs-27.2/lisp/files.el +++ emacs-27.2/lisp/files.el 2025-03-03 09:20:04.078645249 +0000 -@@ -591,10 +596,57 @@ buffer contents as untrusted. - (other :tag "Query" other)) - :group 'find-file) +@@ -591,6 +596,57 @@ buffer contents as untrusted. + Some modes may wish to set this to nil to prevent directory-local + settings being applied, but still respect file-local ones.") --(defvar enable-dir-local-variables t -- "Non-nil means enable use of directory-local variables. --Some modes may wish to set this to nil to prevent directory-local --settings being applied, but still respect file-local ones.") +(defcustom trusted-content nil + "List of files and directories whose content we trust. +Be extra careful here since trusting means that Emacs might execute the @@ -185,9 +181,9 @@ + (string-prefix-p tf file))) + (setq trusted t))) + trusted)))))))) - ;; This is an odd variable IMO. ;; You might wonder why it is needed, when we could just do: + ;; (set (make-local-variable 'enable-local-variables) nil) --- emacs-27.2/lisp/ielm.el +++ emacs-27.2/lisp/ielm.el 2025-03-03 09:18:41.372169725 +0000 @@ -616,7 +616,8 @@ See `inferior-emacs-lisp-mode' for detai diff --git a/emacs.spec b/emacs.spec index 2aa055f..80c90ec 100644 --- a/emacs.spec +++ b/emacs.spec @@ -1,12 +1,11 @@ %global _hardened_build 1 -%define anolis_release .0.1 # This file is encoded in UTF-8. -*- coding: utf-8 -*- Summary: GNU Emacs text editor Name: emacs Epoch: 1 Version: 27.2 -Release: 11%{anolis_release}%{?dist}.2 +Release: 14%{?dist}.2 License: GPLv3+ and CC0-1.0 URL: http://www.gnu.org/software/emacs/ Source0: https://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz @@ -41,10 +40,6 @@ Patch13: emacs-org-link-expand-abbrev-unsafe-elisp.patch Patch14: emacs-man-el-shell-injection-vulnerability.patch Patch15: emacs-CVE-2024-53920.patch BuildRequires: gcc -# Add by Anolis -Patch1001: 1001-emacs-add-sw.patch -# End of Anolis - BuildRequires: atk-devel BuildRequires: cairo-devel BuildRequires: freetype-devel @@ -106,9 +101,6 @@ Requires(posttrans): %{_sbindir}/alternatives Requires: emacs-common = %{epoch}:%{version}-%{release} Provides: emacs(bin) = %{epoch}:%{version}-%{release} -Requires: glibc -Provides: /usr/bin/emacs - %define site_lisp %{_datadir}/emacs/site-lisp %define site_start_d %{site_lisp}/site-start.d %define bytecompargs -batch --no-init-file --no-site-file -f batch-byte-compile @@ -201,14 +193,6 @@ Summary: Development header files for Emacs %description devel Development header files for Emacs. -%package doc -Summary: Documents for %{name} -BuildArch: noarch -Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} - -%description doc -Doc pages for %{name}. - %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %setup -q @@ -228,11 +212,6 @@ Doc pages for %{name}. %patch -P 13 -p1 -b .org-link-expand-abbrev-unsafe-elisp %patch -P 14 -p1 -b .man-el-shell-injection-vulnerability %patch -P 15 -p1 -b .CVE-2024-53920 - -%ifarch loongarch64 -%_update_config_guess -%_update_config_sub -%endif autoconf # We prefer our emacs.desktop file @@ -276,11 +255,6 @@ ln -s ../../%{name}/%{version}/etc/NEWS doc %build -%ifarch sw_64 -%_update_config_sub -%_update_config_guess -%endif - export CFLAGS="-DMAIL_USE_LOCKF %{build_cflags}" %set_build_flags @@ -499,6 +473,7 @@ rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg %config(noreplace) %{_sysconfdir}/skel/.emacs %{_rpmconfigdir}/macros.d/macros.emacs %license etc/COPYING +%doc doc/NEWS BUGS README %{_bindir}/ebrowse %{_bindir}/emacsclient %{_bindir}/etags.emacs @@ -526,21 +501,21 @@ rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg %files devel %{_includedir}/emacs-module.h -%files doc -%doc doc/NEWS BUGS README - %changelog -* Tue May 13 2025 Xiaoping Liu - 1:27.2-11.0.1.2 -- Add doc sub package -- update config.sub and config.guess for loongarch64 (Jingyun Hua) -- cherry-pick `add sw patch #349896d0a48b80b530cfa5cc2bd1fc4ceff68e42`. (nijie@wxiat.com) +* Wed May 21 2025 Jacek Migacz - 1:27.2-14.el9_6.2 +- Restore definition of variable "enable-dir-local-variables" (RHEL-92653) + +* Tue May 06 2025 Jacek Migacz - 1:27.2-14.el9_6.1 +- Bump Z-stream release + +* Mon Apr 28 2025 Jacek Migacz - 1:27.2-14 +- Fix arbitrary code execution via Lisp macro expansion (RHEL-69399) -* Mon May 05 2025 Jacek Migacz - 1:27.2-11.el9_5.2 -- Fix arbitrary code execution via Lisp macro expansion (RHEL-69395) +* Mon Feb 24 2025 Jacek Migacz - 1:27.2-13 +- Bump release -* Mon Feb 24 2025 Jacek Migacz - 1:27.2-11.el9_5.1 -- Fix man.el shell injection vulnerability (RHEL-79021) -- Eliminate use of obsolete patch syntax (RHEL-80450) +* Mon Feb 24 2025 Jacek Migacz - 1:27.2-12 +- Eliminate use of obsolete patch syntax (RHEL-80443) * Wed Feb 19 2025 Jacek Migacz - 1:27.2-11 - Fix man.el shell injection vulnerability (RHEL-79025) -- Gitee From ebf5a29943dd7f7ca4e00202dfe6dd16471e9e48 Mon Sep 17 00:00:00 2001 From: liuxiaoping Date: Mon, 28 Nov 2022 17:48:47 +0800 Subject: [PATCH 2/4] spec: add doc sub package --- emacs.spec | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/emacs.spec b/emacs.spec index 80c90ec..d2a5ddc 100644 --- a/emacs.spec +++ b/emacs.spec @@ -1,11 +1,12 @@ %global _hardened_build 1 +%define anolis_release .0.1 # This file is encoded in UTF-8. -*- coding: utf-8 -*- Summary: GNU Emacs text editor Name: emacs Epoch: 1 Version: 27.2 -Release: 14%{?dist}.2 +Release: 14%{anolis_release}%{?dist}.2 License: GPLv3+ and CC0-1.0 URL: http://www.gnu.org/software/emacs/ Source0: https://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz @@ -101,6 +102,9 @@ Requires(posttrans): %{_sbindir}/alternatives Requires: emacs-common = %{epoch}:%{version}-%{release} Provides: emacs(bin) = %{epoch}:%{version}-%{release} +Requires: glibc +Provides: /usr/bin/emacs + %define site_lisp %{_datadir}/emacs/site-lisp %define site_start_d %{site_lisp}/site-start.d %define bytecompargs -batch --no-init-file --no-site-file -f batch-byte-compile @@ -193,6 +197,14 @@ Summary: Development header files for Emacs %description devel Development header files for Emacs. +%package doc +Summary: Documents for %{name} +BuildArch: noarch +Requires: %{name} = %{?epoch:%{epoch}:}%{version}-%{release} + +%description doc +Doc pages for %{name}. + %prep %{gpgverify} --keyring='%{SOURCE2}' --signature='%{SOURCE1}' --data='%{SOURCE0}' %setup -q @@ -473,7 +485,6 @@ rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg %config(noreplace) %{_sysconfdir}/skel/.emacs %{_rpmconfigdir}/macros.d/macros.emacs %license etc/COPYING -%doc doc/NEWS BUGS README %{_bindir}/ebrowse %{_bindir}/emacsclient %{_bindir}/etags.emacs @@ -501,7 +512,13 @@ rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg %files devel %{_includedir}/emacs-module.h +%files doc +%doc doc/NEWS BUGS README + %changelog +* Wed Jun 25 2025 Xiaoping Liu - 1:27.2-14.0.1.2 +- Add doc sub package + * Wed May 21 2025 Jacek Migacz - 1:27.2-14.el9_6.2 - Restore definition of variable "enable-dir-local-variables" (RHEL-92653) -- Gitee From 8b06b081b67d8494356f29510fdea261093c3c53 Mon Sep 17 00:00:00 2001 From: Jingyun Hua Date: Tue, 18 Jul 2023 07:34:48 +0000 Subject: [PATCH 3/4] build:support loongarch64 platform --- emacs.spec | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/emacs.spec b/emacs.spec index d2a5ddc..877fd2a 100644 --- a/emacs.spec +++ b/emacs.spec @@ -224,6 +224,11 @@ Doc pages for %{name}. %patch -P 13 -p1 -b .org-link-expand-abbrev-unsafe-elisp %patch -P 14 -p1 -b .man-el-shell-injection-vulnerability %patch -P 15 -p1 -b .CVE-2024-53920 + +%ifarch loongarch64 +%_update_config_guess +%_update_config_sub +%endif autoconf # We prefer our emacs.desktop file @@ -518,6 +523,7 @@ rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg %changelog * Wed Jun 25 2025 Xiaoping Liu - 1:27.2-14.0.1.2 - Add doc sub package +- update config.sub and config.guess for loongarch64 (Jingyun Hua) * Wed May 21 2025 Jacek Migacz - 1:27.2-14.el9_6.2 - Restore definition of variable "enable-dir-local-variables" (RHEL-92653) -- Gitee From a4948f24875f1897d5e375594e4cb8933c1cb812 Mon Sep 17 00:00:00 2001 From: wxiat Date: Tue, 20 Jun 2023 14:24:31 +0800 Subject: [PATCH 4/4] cherry-pick `add sw patch #349896d0a48b80b530cfa5cc2bd1fc4ceff68e42`. Signed-off-by: wxiat Signed-off-by: Weisson --- 1001-emacs-add-sw.patch | 86 +++++++++++++++++++++++++++++++++++++++++ emacs.spec | 10 +++++ 2 files changed, 96 insertions(+) create mode 100644 1001-emacs-add-sw.patch diff --git a/1001-emacs-add-sw.patch b/1001-emacs-add-sw.patch new file mode 100644 index 0000000..bafdfa1 --- /dev/null +++ b/1001-emacs-add-sw.patch @@ -0,0 +1,86 @@ +From f0cc006e3b7f490ece36996dfbef46712cdaf36f Mon Sep 17 00:00:00 2001 +From: wxiat +Date: Tue, 20 Jun 2023 14:20:50 +0800 +Subject: [PATCH] add sw + +Signed-off-by: wxiat +--- + build-aux/config.guess | 8 ++++++++ + build-aux/config.sub | 1 + + configure.ac | 2 +- + src/unexelf.c | 8 +++++++- + 4 files changed, 17 insertions(+), 2 deletions(-) + +diff --git a/build-aux/config.guess b/build-aux/config.guess +index 457a63a..827cd81 100755 +--- a/build-aux/config.guess ++++ b/build-aux/config.guess +@@ -926,6 +926,14 @@ EOF + UNAME_MACHINE=aarch64_be + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; ++ sw_64:Linux:*:*) ++ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in ++ sw) UNAME_MACHINE=sw_64 ;; ++ esac ++ objdump --private-headers /bin/sh | grep -q ld.so.1 ++ if test "$?" = 0 ; then LIBC=gnulibc1 ; fi ++ echo "$UNAME_MACHINE"-sunway-linux-"$LIBC" ++ exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; +diff --git a/build-aux/config.sub b/build-aux/config.sub +index 90f19bb..eb9e11d 100755 +--- a/build-aux/config.sub ++++ b/build-aux/config.sub +@@ -1159,6 +1159,7 @@ case $cpu-$vendor in + | aarch64 | aarch64_be \ + | loongarch32 | loongarch64 | loongarchx32 \ + | abacus \ ++ | sw_64 \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] \ + | alphapca5[67] | alpha64pca5[67] \ +diff --git a/configure.ac b/configure.ac +index 0b34532..d4d637c 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -703,7 +703,7 @@ case "${canonical}" in + *-apple-darwin* ) + case "${canonical}" in + *-apple-darwin[0-9].*) unported=yes ;; +- i[3456]86-* | x86_64-* | arm-* | aarch64-* ) ;; ++ i[3456]86-* | x86_64-* | arm-* | aarch64-* | sw_64-* ) ;; + * ) unported=yes ;; + esac + opsys=darwin +diff --git a/src/unexelf.c b/src/unexelf.c +index b5cded5..6c1e121 100644 +--- a/src/unexelf.c ++++ b/src/unexelf.c +@@ -120,7 +120,7 @@ typedef struct { + /* + * NetBSD does not have normal-looking user-land ELF support. + */ +-# if defined __alpha__ || defined __sparc_v9__ || defined _LP64 ++# if defined __alpha__ || defined __sparc_v9__ || defined _LP64 || defined __sw_64__ + # define ELFSIZE 64 + # else + # define ELFSIZE 32 +@@ -150,6 +150,12 @@ typedef struct { + # define pHDRR HDRR * + # endif /* __alpha__ */ + ++# ifdef __sw_64__ ++# include ++# define HDRR struct ecoff_symhdr ++# define pHDRR HDRR * ++# endif /* __sw_64__ */ ++ + #ifdef __mips__ /* was in pkgsrc patches for 20.7 */ + # define SHT_MIPS_DEBUG DT_MIPS_FLAGS + # define HDRR struct Elf_Shdr +-- +2.31.1 + diff --git a/emacs.spec b/emacs.spec index 877fd2a..9fc07ef 100644 --- a/emacs.spec +++ b/emacs.spec @@ -41,6 +41,10 @@ Patch13: emacs-org-link-expand-abbrev-unsafe-elisp.patch Patch14: emacs-man-el-shell-injection-vulnerability.patch Patch15: emacs-CVE-2024-53920.patch BuildRequires: gcc +# Add by Anolis +Patch1001: 1001-emacs-add-sw.patch +# End of Anolis + BuildRequires: atk-devel BuildRequires: cairo-devel BuildRequires: freetype-devel @@ -272,6 +276,11 @@ ln -s ../../%{name}/%{version}/etc/NEWS doc %build +%ifarch sw_64 +%_update_config_sub +%_update_config_guess +%endif + export CFLAGS="-DMAIL_USE_LOCKF %{build_cflags}" %set_build_flags @@ -524,6 +533,7 @@ rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg * Wed Jun 25 2025 Xiaoping Liu - 1:27.2-14.0.1.2 - Add doc sub package - update config.sub and config.guess for loongarch64 (Jingyun Hua) +- cherry-pick `add sw patch #349896d0a48b80b530cfa5cc2bd1fc4ceff68e42`. (nijie@wxiat.com) * Wed May 21 2025 Jacek Migacz - 1:27.2-14.el9_6.2 - Restore definition of variable "enable-dir-local-variables" (RHEL-92653) -- Gitee