From 9f8ca42a7c6918793382c0af91815cf3091ff31b Mon Sep 17 00:00:00 2001 From: Chunmei Xu Date: Tue, 18 Oct 2022 23:24:01 +0800 Subject: [PATCH] revert fix for CVE-2015-1197 as it causes shutdown issues refer to https://lists.gnu.org/archive/html/bug-cpio/2019-11/msg00016.html Signed-off-by: Chunmei Xu --- cpio-2.13-revert-CVE-2015-1197-fix.patch | 91 ++++++++++++++++++++++++ cpio.spec | 9 ++- 2 files changed, 98 insertions(+), 2 deletions(-) create mode 100644 cpio-2.13-revert-CVE-2015-1197-fix.patch diff --git a/cpio-2.13-revert-CVE-2015-1197-fix.patch b/cpio-2.13-revert-CVE-2015-1197-fix.patch new file mode 100644 index 0000000..1106ac7 --- /dev/null +++ b/cpio-2.13-revert-CVE-2015-1197-fix.patch @@ -0,0 +1,91 @@ +revert fix for CVE-2015-1197 as it causes shutdown issues + +revert suggested as a workaround by upstream: +https://lists.gnu.org/archive/html/bug-cpio/2019-11/msg00016.html + +--- b/src/copyin.c ++++ a/src/copyin.c +@@ -645,14 +645,13 @@ + link_name = xstrdup (file_hdr->c_tar_linkname); + } + +- cpio_safer_name_suffix (link_name, true, !no_abs_paths_flag, false); +- + res = UMASKED_SYMLINK (link_name, file_hdr->c_name, + file_hdr->c_mode); + if (res < 0 && create_dir_flag) + { + create_all_directories (file_hdr->c_name); ++ res = UMASKED_SYMLINK (link_name, file_hdr->c_name, ++ file_hdr->c_mode); +- res = UMASKED_SYMLINK (link_name, file_hdr->c_name, file_hdr->c_mode); + } + if (res < 0) + { +--- b/tests/CVE-2015-1197.at ++++ /dev/null +@@ -1,43 +0,0 @@ +-# Process this file with autom4te to create testsuite. -*- Autotest -*- +-# Copyright (C) 2009-2019 Free Software Foundation, Inc. +-# +-# This program 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, or (at your option) +-# any later version. +-# +-# This program 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 this program. If not, see . +- +-AT_SETUP([CVE-2015-1197 (--no-absolute-filenames for symlinks)]) +-AT_CHECK([ +-tempdir=$(pwd)/tmp +-mkdir $tempdir +-touch $tempdir/file +-ln -s $tempdir dir +-AT_DATA([filelist], +-[dir +-dir/file +-]) +-ln -s /tmp dir +-touch /tmp/file +-cpio -o < filelist > test.cpio +-rm dir /tmp/file +-cpio --no-absolute-filenames -iv < test.cpio +-], +-[2], +-[], +-[1 block +-cpio: Removing leading `/' from hard link targets +-dir +-cpio: dir/file: Cannot open: No such file or directory +-dir/file +-1 block +-]) +-AT_CLEANUP +- +--- b/tests/Makefile.am ++++ a/tests/Makefile.am +@@ -56,9 +56,8 @@ + symlink-long.at\ + symlink-to-stdout.at\ + version.at\ + big-block-size.at\ +- CVE-2015-1197.at\ + CVE-2019-14866.at + + TESTSUITE = $(srcdir)/testsuite + +--- b/tests/testsuite.at ++++ a/tests/testsuite.at +@@ -43,6 +43,5 @@ + m4_include([setstat04.at]) + m4_include([setstat05.at]) + m4_include([big-block-size.at]) + +-m4_include([CVE-2015-1197.at]) + m4_include([CVE-2019-14866.at]) diff --git a/cpio.spec b/cpio.spec index 25a1e22..0c5adfc 100644 --- a/cpio.spec +++ b/cpio.spec @@ -1,4 +1,4 @@ -%define anolis_release 2 +%define anolis_release 3 Summary: A GNU archiving program Name: cpio Version: 2.13 @@ -9,7 +9,8 @@ Source: ftp://ftp.gnu.org/gnu/cpio/cpio-%{version}.tar.bz2 # help2man generated manual page distributed only in RHEL/Fedora Source1: cpio.1 -Patch1: 0001-solve-the-first-defined-here-error.patch +Patch1: 0001-solve-the-first-defined-here-error.patch +Patch2: cpio-2.13-revert-CVE-2015-1197-fix.patch # We use SVR4 portable format as default. @@ -47,6 +48,7 @@ The %{name}-doc package contains documentation files for %{name}. %build +autoreconf -fi export CFLAGS="$RPM_OPT_FLAGS -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64 -D_LARGEFILE64_SOURCE -pedantic -fno-strict-aliasing -Wall $CFLAGS" %configure --with-rmt="%{_sysconfdir}/rmt" make %{?_smp_mflags} @@ -83,6 +85,9 @@ make check || { %doc AUTHORS ChangeLog NEWS README THANKS TODO %changelog +* Tue Oct 18 2022 Chunmei Xu - 2.13-3 +- revert fix for CVE-2015-1197 as it causes shutdown issues + * Sun Oct 09 2022 mgb01105731 - 2.13-2 - add doc package -- Gitee