From a3a4751ae8f4875fd9b8883f3d21debfa85c2a77 Mon Sep 17 00:00:00 2001 From: Jacob Wang Date: Fri, 28 Feb 2025 09:42:14 +0800 Subject: [PATCH 1/4] [CVE]update to emacs-27.2-11.1.src.rpm to #IBPKU0 update to emacs-27.2-11.1.src.rpm for CVE-2025-1244 Project: TC2024080204 Signed-off-by: Jacob Wang --- 1001-emacs-add-sw.patch | 86 ------------------- dist | 2 +- ...man-el-shell-injection-vulnerability.patch | 57 ++++++++++++ emacs.spec | 70 +++++---------- 4 files changed, 81 insertions(+), 134 deletions(-) delete mode 100644 1001-emacs-add-sw.patch create mode 100644 emacs-man-el-shell-injection-vulnerability.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 89c1faf..6358205 100644 --- a/dist +++ b/dist @@ -1 +1 @@ -an9 +an9_5 diff --git a/emacs-man-el-shell-injection-vulnerability.patch b/emacs-man-el-shell-injection-vulnerability.patch new file mode 100644 index 0000000..584d9ff --- /dev/null +++ b/emacs-man-el-shell-injection-vulnerability.patch @@ -0,0 +1,57 @@ +From 820f0793f0b46448928905552726c1f1b999062f Mon Sep 17 00:00:00 2001 +From: Xi Lu +Date: Tue, 10 Oct 2023 22:20:05 +0800 +Subject: Fix man.el shell injection vulnerability + +* lisp/man.el (Man-translate-references): Fix shell injection +vulnerability. (Bug#66390) +* test/lisp/man-tests.el (man-tests-Man-translate-references): New +test. +--- + lisp/man.el | 6 +++++- + test/lisp/man-tests.el | 12 ++++++++++++ + 2 files changed, 17 insertions(+), 1 deletion(-) + +diff --git a/lisp/man.el b/lisp/man.el +index 55cb938..d963964 100644 +--- a/lisp/man.el ++++ b/lisp/man.el +@@ -761,7 +761,11 @@ and the `Man-section-translations-alist' variables)." + (setq name (match-string 2 ref) + section (match-string 1 ref)))) + (if (string= name "") +- ref ; Return the reference as is ++ ;; see Bug#66390 ++ (mapconcat 'identity ++ (mapcar #'shell-quote-argument ++ (split-string ref "\\s-+")) ++ " ") ; Return the reference as is + (if Man-downcase-section-letters-flag + (setq section (downcase section))) + (while slist +diff --git a/test/lisp/man-tests.el b/test/lisp/man-tests.el +index 140482e..11f5f80 100644 +--- a/test/lisp/man-tests.el ++++ b/test/lisp/man-tests.el +@@ -161,6 +161,18 @@ DESCRIPTION + (let ((button (button-at (match-beginning 0)))) + (should (and button (eq 'Man-xref-header-file (button-type button)))))))))) + ++(ert-deftest man-tests-Man-translate-references () ++ (should (equal (Man-translate-references "basename") ++ "basename")) ++ (should (equal (Man-translate-references "basename(3)") ++ "3 basename")) ++ (should (equal (Man-translate-references "basename(3v)") ++ "3v basename")) ++ (should (equal (Man-translate-references ";id") ++ "\\;id")) ++ (should (equal (Man-translate-references "-k basename") ++ "-k basename"))) ++ + (provide 'man-tests) + + ;;; man-tests.el ends here +-- +cgit v1.1 + diff --git a/emacs.spec b/emacs.spec index aa8000f..a9df8fa 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: 10%{anolis_release}%{?dist} +Release: 11%{?dist}.1 License: GPLv3+ and CC0-1.0 URL: http://www.gnu.org/software/emacs/ Source0: https://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz @@ -38,11 +37,8 @@ Patch10: emacs-consider-org-file-contents-unsafe.patch Patch11: emacs-mark-contents-untrusted.patch Patch12: emacs-latex-preview.patch Patch13: emacs-org-link-expand-abbrev-unsafe-elisp.patch +Patch14: emacs-man-el-shell-injection-vulnerability.patch BuildRequires: gcc -# Add by Anolis -Patch1001: 1001-emacs-add-sw.patch -# End of Anolis - BuildRequires: atk-devel BuildRequires: cairo-devel BuildRequires: freetype-devel @@ -104,9 +100,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 @@ -199,36 +192,24 @@ 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 -%patch1 -p1 -b .spellchecker -%patch2 -p1 -b .system-crypto-policies -%patch3 -p1 -b .glibc2.34 -%patch4 -p1 -b .ctags-local-command-execute-vulnerability -%patch5 -p1 -b .64KB-page-size-for-pdump -%patch6 -p1 -b .etags-local-command-injection-vulnerability -%patch7 -p1 -b .htmlfontify-command-injection-vulnerability -%patch8 -p1 -b .ruby-mode-local-command-injection-vulnerability -%patch9 -p1 -b .ob-latex-command-injection-vulnerability -%patch10 -p1 -b .consider-org-file-contents-unsafe -%patch11 -p1 -b .mark-contents-untrusted -%patch12 -p1 -b .latex-preview -%patch13 -p1 -b .org-link-expand-abbrev-unsafe-elisp - -%ifarch loongarch64 -%_update_config_guess -%_update_config_sub -%endif +%patch -P 1 -p1 -b .spellchecker +%patch -P 2 -p1 -b .system-crypto-policies +%patch -P 3 -p1 -b .glibc2.34 +%patch -P 4 -p1 -b .ctags-local-command-execute-vulnerability +%patch -P 5 -p1 -b .64KB-page-size-for-pdump +%patch -P 6 -p1 -b .etags-local-command-injection-vulnerability +%patch -P 7 -p1 -b .htmlfontify-command-injection-vulnerability +%patch -P 8 -p1 -b .ruby-mode-local-command-injection-vulnerability +%patch -P 9 -p1 -b .ob-latex-command-injection-vulnerability +%patch -P 10 -p1 -b .consider-org-file-contents-unsafe +%patch -P 11 -p1 -b .mark-contents-untrusted +%patch -P 12 -p1 -b .latex-preview +%patch -P 13 -p1 -b .org-link-expand-abbrev-unsafe-elisp +%patch -P 14 -p1 -b .man-el-shell-injection-vulnerability autoconf # We prefer our emacs.desktop file @@ -272,11 +253,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 @@ -495,6 +471,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 @@ -522,14 +499,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 -* Fri Nov 15 2024 Xiaoping Liu - 1:27.2-10.0.1 -- Add doc sub package -- update config.sub and config.guess for loongarch64 (Jingyun Hua) -- cherry-pick `add sw patch #349896d0a48b80b530cfa5cc2bd1fc4ceff68e42`. (nijie@wxiat.com) +* 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) + +* Wed Feb 19 2025 Jacek Migacz - 1:27.2-11 +- Fix man.el shell injection vulnerability (RHEL-79025) * Fri Mar 15 2024 Jacek Migacz - 1:27.2-10 - Disable xwidgets (RHEL-14551) -- Gitee From d85939f06856d1eda9d0930034d905519c0f1676 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 a9df8fa..b822649 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: 11%{?dist}.1 +Release: 11%{anolis_release}%{?dist}.1 License: GPLv3+ and CC0-1.0 URL: http://www.gnu.org/software/emacs/ Source0: https://ftp.gnu.org/gnu/emacs/emacs-%{version}.tar.xz @@ -100,6 +101,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 @@ -192,6 +196,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 @@ -471,7 +483,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 @@ -499,7 +510,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 +* Fri Feb 28 2025 Xiaoping Liu - 1:27.2-11.0.1.1 +- Add doc sub package + * 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) -- Gitee From a198e3d854ea1fd8989129312176bc322e3d5cb3 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 b822649..8d0287e 100644 --- a/emacs.spec +++ b/emacs.spec @@ -222,6 +222,11 @@ Doc pages for %{name}. %patch -P 12 -p1 -b .latex-preview %patch -P 13 -p1 -b .org-link-expand-abbrev-unsafe-elisp %patch -P 14 -p1 -b .man-el-shell-injection-vulnerability + +%ifarch loongarch64 +%_update_config_guess +%_update_config_sub +%endif autoconf # We prefer our emacs.desktop file @@ -516,6 +521,7 @@ rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg %changelog * Fri Feb 28 2025 Xiaoping Liu - 1:27.2-11.0.1.1 - Add doc sub package +- update config.sub and config.guess for loongarch64 (Jingyun Hua) * Mon Feb 24 2025 Jacek Migacz - 1:27.2-11.el9_5.1 - Fix man.el shell injection vulnerability (RHEL-79021) -- Gitee From 52e862374319598b142c6e80f4003b74d64fcdfc 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 8d0287e..8cdaef8 100644 --- a/emacs.spec +++ b/emacs.spec @@ -40,6 +40,10 @@ Patch12: emacs-latex-preview.patch Patch13: emacs-org-link-expand-abbrev-unsafe-elisp.patch Patch14: emacs-man-el-shell-injection-vulnerability.patch BuildRequires: gcc +# Add by Anolis +Patch1001: 1001-emacs-add-sw.patch +# End of Anolis + BuildRequires: atk-devel BuildRequires: cairo-devel BuildRequires: freetype-devel @@ -270,6 +274,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 @@ -522,6 +531,7 @@ rm %{buildroot}%{_datadir}/icons/hicolor/scalable/mimetypes/emacs-document23.svg * Fri Feb 28 2025 Xiaoping Liu - 1:27.2-11.0.1.1 - Add doc sub package - update config.sub and config.guess for loongarch64 (Jingyun Hua) +- cherry-pick `add sw patch #349896d0a48b80b530cfa5cc2bd1fc4ceff68e42`. (nijie@wxiat.com) * Mon Feb 24 2025 Jacek Migacz - 1:27.2-11.el9_5.1 - Fix man.el shell injection vulnerability (RHEL-79021) -- Gitee