Compare commits

...

18 Commits
master ... f23

Author SHA1 Message Date
Panu Matilainen 1909522bd9 Rebase to 4.13.0 final 2016-11-03 15:00:12 +02:00
Lubos Kardos c2b0fdbd21 - Fix sigsegv in stringFormat()
- Resolves: #1316903
- Fix reading rpmtd behind its size in formatValue()
- Resolves: #1316896
2016-04-25 15:40:44 +02:00
Lubos Kardos abb875c8bf - Remove size limit when expanding macros
- Resolves: #1303034
2016-02-26 16:37:31 +01:00
Lubos Kardos b5cf42e0f1 - Revert using %%configure, it causes problems
- Temporary set %%_gnu macro explictly, just for one build
- Resolves: #1303265
- Harden rpm package again, previous attempt had to be reverted
- Related: #1289734
2016-02-02 11:40:38 +01:00
Lubos Kardos 50c480f80a - Use %%configure macro, harden rpm package
- Resolves: #1289734
2016-01-29 17:17:30 +01:00
Lubos Kardos 79603b940d - Fix recursive calling of rpmdeps tool
- Resolves: #1297557
2016-01-15 16:45:19 +01:00
Lubos Kardos f5dbe0f5c2 - Fix not chrooting transaction file triggers 2016-01-15 15:19:25 +01:00
Lubos Kardos eb83c4215c - Fix crash when parsing corrupted RPM file
- Resolves: #1273360
2015-11-20 13:54:34 +01:00
Lubos Kardos 2f396c1ab4 - Ignore SIGPIPE signals during execucton of scriptlets
- Resolves: #1264198
2015-11-09 09:30:52 +01:00
Lubos Kardos 17475305ec - Fix SIGSEGV in case of old unsupported gpg keys
- Resolves: #1277464
2015-11-06 13:58:53 +01:00
Jaromir Capik ff5589a250 Adding STAGE2 bootstrap recipe 2015-11-04 16:38:57 +01:00
Florian Festi cc67df556e - Fix selinux plugin for permissive mode 2015-10-12 15:41:51 +02:00
Florian Festi 60fdb4313c - Fix new rich dependency syntax 2015-09-07 17:08:13 +02:00
Florian Festi 4d4e424c40 - Remove compat-librpm3 hack 2015-09-07 17:07:38 +02:00
Kalev Lember 1d80a1520c compat-librpm3: Explicitly conflict with older rpm-libs
Add explicit conflicts as they both ship the same files.
2015-09-05 22:25:38 +02:00
Kalev Lember c4734bdd15 Add a temporary compat-librpm3 subpackage
This makes it possible to go on with the F23 rpm update without needing
to rebuild all the dependant packages. In particular, grub2 is difficult
to get rebuilt as there's nobody around on the weekend who can build
packages that require secure boot signing.
2015-09-05 22:14:36 +02:00
Florian Festi b99f2d0a63 Update to rpm-4.13.0-rc1
Merge branch 'master' into f23
2015-09-03 14:25:32 +02:00
Florian Festi 139d6c733e - Add support for MIPS platform
- Resolves: #1242786
2015-07-15 10:09:50 +02:00
9 changed files with 92 additions and 661 deletions

1
.gitignore vendored
View File

@ -20,3 +20,4 @@
/rpm-4.12.0.1.tar.bz2
/rpm-4.12.90.tar.bz2
/rpm-4.13.0-rc1.tar.bz2
/rpm-4.13.0.tar.bz2

34
STAGE2-rpm Normal file
View File

@ -0,0 +1,34 @@
#requires popt
#requires nss-softokn
#requires nss
#requires file
#requires libarchive
#requires libdb4
#requires redhat-rpm-config
#requires lua
#requires autoconf
#requires pkgconfig
(cd $SRC/rpm-*/ && autoreconf -vif)
mcd $BUILDDIR/rpm
$SRC/rpm-*/configure $TCONFIGARGS \
--build=${TARGET} \
--host=${TARGET} \
--target=${TARGET} \
CPPFLAGS="-I/usr/include/nspr -I/usr/include/nss3 -DPACKAGE -DPACKAGE_VERSION" \
--libdir=/usr/lib${SUFFIX} \
--with-external-db \
--disable-static \
--with-lua \
--localstatedir=/var
make $J
make $J install
mkdir -p /etc/rpm
mkdir -p /var/lib/rpm
rpm --initdb

View File

@ -1,101 +0,0 @@
--- rpm-4.10.0/scripts/find-debuginfo.sh 2012-03-20 09:07:25.000000000 +0100
+++ rpm-4.10.0/scripts/find-debuginfo.sh.jj 2012-06-19 12:32:33.147503858 +0200
@@ -4,6 +4,8 @@
#
# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r]
# [-o debugfiles.list]
+# [--run-dwz] [--dwz-low-mem-die-limit N]
+# [--dwz-max-die-limit N]
# [[-l filelist]... [-p 'pattern'] -o debuginfo.list]
# [builddir]
#
@@ -20,6 +22,10 @@
# The -p argument is an grep -E -style regexp matching the a file name,
# and must not use anchors (^ or $).
#
+# The --run-dwz flag instructs find-debuginfo.sh to run the dwz utility
+# if available, and --dwz-low-mem-die-limit and --dwz-max-die-limit
+# provide detailed limits. See dwz(1) -l and -L option for details.
+#
# All file names in switches are relative to builddir (. if not given).
#
@@ -32,6 +38,11 @@ strip_r=false
# Barf on missing build IDs.
strict=false
+# DWZ parameters.
+run_dwz=false
+dwz_low_mem_die_limit=
+dwz_max_die_limit=
+
BUILDDIR=.
out=debugfiles.list
nout=0
@@ -40,6 +51,17 @@ while [ $# -gt 0 ]; do
--strict-build-id)
strict=true
;;
+ --run-dwz)
+ run_dwz=true
+ ;;
+ --dwz-low-mem-die-limit)
+ dwz_low_mem_die_limit=$2
+ shift
+ ;;
+ --dwz-max-die-limit)
+ dwz_max_die_limit=$2
+ shift
+ ;;
-g)
strip_g=true
;;
@@ -266,6 +288,37 @@ while read nlinks inum f; do
fi
done || exit
+# Invoke the DWARF Compressor utility.
+if $run_dwz && type dwz >/dev/null 2>&1 \
+ && [ -d "${RPM_BUILD_ROOT}/usr/lib/debug" ]; then
+ dwz_files="`cd "${RPM_BUILD_ROOT}/usr/lib/debug"; find -type f -name \*.debug`"
+ if [ -n "${dwz_files}" ]; then
+ dwz_multifile_name="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}.${RPM_ARCH}"
+ dwz_multifile_suffix=
+ dwz_multifile_idx=0
+ while [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}${dwz_multifile_suffix}" ]; do
+ let ++dwz_multifile_idx
+ dwz_multifile_suffix=".${dwz_multifile_idx}"
+ done
+ dwz_multfile_name="${dwz_multifile_name}${dwz_multifile_suffix}"
+ dwz_opts="-h -q -r -m .dwz/${dwz_multifile_name}"
+ mkdir -p "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz"
+ [ -n "${dwz_low_mem_die_limit}" ] \
+ && dwz_opts="${dwz_opts} -l ${dwz_low_mem_die_limit}"
+ [ -n "${dwz_max_die_limit}" ] \
+ && dwz_opts="${dwz_opts} -L ${dwz_max_die_limit}"
+ ( cd "${RPM_BUILD_ROOT}/usr/lib/debug" && dwz $dwz_opts $dwz_files )
+ # Remove .dwz directory if empty
+ rmdir "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz" 2>/dev/null
+ if [ -f "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" ]; then
+ id="`readelf -Wn "${RPM_BUILD_ROOT}/usr/lib/debug/.dwz/${dwz_multifile_name}" \
+ 2>/dev/null | sed -n 's/^ Build ID: \([0-9a-f]\+\)/\1/p'`"
+ [ -n "$id" ] \
+ && make_id_link "$id" "/usr/lib/debug/.dwz/${dwz_multifile_name}" .debug
+ fi
+ fi
+fi
+
# For each symlink whose target has a .debug file,
# make a .debug symlink to that file.
find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print |
--- rpm-4.10.0/macros.in 2012-03-20 09:07:25.000000000 +0100
+++ rpm-4.10.0/macros.in.jj 2012-06-19 12:32:33.147503858 +0200
@@ -176,7 +176,7 @@
# the script. See the script for details.
#
%__debug_install_post \
- %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
+ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
%{nil}
# Template for debug information sub-package.

View File

@ -1,98 +0,0 @@
--- rpm-4.10.0/macros.in 2012-06-11 11:16:21.216952339 +0200
+++ rpm-4.10.0/macros.in.minidebug 2012-06-11 11:16:23.686912455 +0200
@@ -175,7 +175,7 @@
# the script. See the script for details.
#
%__debug_install_post \
- %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
+ %{_rpmconfigdir}/find-debuginfo.sh %{?_missing_build_ids_terminate_build:--strict-build-id} %{?_include_minidebuginfo:-m} %{?_find_debuginfo_dwz_opts} %{?_find_debuginfo_opts} "%{_builddir}/%{?buildsubdir}"\
%{nil}
# Template for debug information sub-package.
@@ -418,6 +418,12 @@ package or when debugging this package.\
#%_missing_build_ids_terminate_build 1
#
+# Include minimal debug information in build binaries.
+# Requires _enable_debug_packages.
+#
+#%_include_minidebuginfo 1
+
+#
# Use internal dependency generator rather than external helpers?
%_use_internal_dependency_generator 1
--- rpm-4.10.0/scripts/find-debuginfo.sh 2012-06-11 11:16:09.698138273 +0200
+++ rpm-4.10.0/scripts/find-debuginfo.sh.minidebug 2012-06-11 11:16:13.399078526 +0200
@@ -2,7 +2,7 @@
#find-debuginfo.sh - automagically generate debug info and file list
#for inclusion in an rpm spec file.
#
-# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r]
+# Usage: find-debuginfo.sh [--strict-build-id] [-g] [-r] [-m]
# [-o debugfiles.list]
# [--run-dwz] [--dwz-low-mem-die-limit N]
# [--dwz-max-die-limit N]
@@ -29,6 +29,9 @@ strip_g=false
# with -r arg, pass --reloc-debug-sections to eu-strip.
strip_r=false
+# with -m arg, add minimal debuginfo to binary.
+include_minidebug=false
+
# Barf on missing build IDs.
strict=false
@@ -43,6 +46,9 @@ while [ $# -gt 0 ]; do
-g)
strip_g=true
;;
+ -m)
+ include_minidebug=true
+ ;;
-o)
if [ -z "${lists[$nout]}" -a -z "${ptns[$nout]}" ]; then
out=$2
@@ -105,6 +111,32 @@ strip_to_debug()
chmod 444 "$1" || exit
}
+add_minidebug()
+{
+ local debuginfo="$1"
+ local binary="$2"
+
+ local dynsyms=`mktemp`
+ local funcsyms=`mktemp`
+ local keep_symbols=`mktemp`
+ local mini_debuginfo=`mktemp`
+
+ # Extract the dynamic symbols from the main binary, there is no need to also have these
+ # in the normal symbol table
+ nm -D "$binary" --format=posix --defined-only | awk '{ print $1 }' | sort > "$dynsyms"
+ # Extract all the text (i.e. function) symbols from the debuginfo
+ nm "$debuginfo" --format=posix --defined-only | awk '{ if ($2 == "T" || $2 == "t") print $1 }' | sort > "$funcsyms"
+ # Keep all the function symbols not already in the dynamic symbol table
+ comm -13 "$dynsyms" "$funcsyms" > "$keep_symbols"
+ # Copy the full debuginfo, keeping only a minumal set of symbols and removing some unnecessary sections
+ objcopy -S --remove-section .gdb_index --remove-section .comment --keep-symbols="$keep_symbols" "$debuginfo" "$mini_debuginfo" &> /dev/null
+ #Inject the compressed data into the .gnu_debugdata section of the original binary
+ xz "$mini_debuginfo"
+ mini_debuginfo="${mini_debuginfo}.xz"
+ objcopy --add-section .gnu_debugdata="$mini_debuginfo" "$binary"
+ rm -f "$dynsyms" "$funcsyms" "$keep_symbols" "$mini_debuginfo"
+}
+
# Make a relative symlink to $1 called $3$2
shopt -s extglob
link_relative()
@@ -260,6 +292,9 @@ while read nlinks inum f; do
chmod u-w "$f"
fi
+ # strip -g implies we have full symtab, don't add mini symtab in that case.
+ $strip_g || ($include_minidebug && add_minidebug "${debugfn}" "$f")
+
if [ -n "$id" ]; then
make_id_link "$id" "$dn/$(basename $f)"
make_id_link "$id" "/usr/lib/debug$dn/$bn" .debug

View File

@ -1,395 +0,0 @@
--- rpm-4.11.1-rc1-orig/Makefile.am 2013-06-07 12:19:21.000000000 +0200
+++ rpm-4.11.1-rc1/Makefile.am 2013-06-24 18:34:06.342894002 +0200
@@ -162,6 +162,10 @@ rpmlibexec_PROGRAMS += elfdeps
elfdeps_SOURCES = tools/elfdeps.c
elfdeps_LDADD = rpmio/librpmio.la
elfdeps_LDADD += @WITH_LIBELF_LIB@ @WITH_POPT_LIB@
+
+rpmlibexec_PROGRAMS += sepdebugcrcfix
+sepdebugcrcfix_SOURCES = tools/sepdebugcrcfix.c
+sepdebugcrcfix_LDADD = @WITH_LIBELF_LIB@
endif
endif
--- rpm-4.11.1-rc1-orig/scripts/find-debuginfo.sh 2013-06-24 17:20:55.407538301 +0200
+++ rpm-4.11.1-rc1/scripts/find-debuginfo.sh 2013-06-24 18:34:41.270897302 +0200
@@ -114,10 +114,12 @@ done
LISTFILE="$BUILDDIR/$out"
SOURCEFILE="$BUILDDIR/debugsources.list"
LINKSFILE="$BUILDDIR/debuglinks.list"
+ELFBINSFILE="$BUILDDIR/elfbins.list"
> "$SOURCEFILE"
> "$LISTFILE"
> "$LINKSFILE"
+> "$ELFBINSFILE"
debugdir="${RPM_BUILD_ROOT}/usr/lib/debug"
@@ -316,6 +318,8 @@
# strip -g implies we have full symtab, don't add mini symtab in that case.
$strip_g || ($include_minidebug && add_minidebug "${debugfn}" "$f")
+
+ echo "./${f#$RPM_BUILD_ROOT}" >> "$ELFBINSFILE"
if [ -n "$id" ]; then
make_id_link "$id" "$dn/$(basename $f)"
@@ -354,6 +357,10 @@ if $run_dwz && type dwz >/dev/null 2>&1
fi
fi
+# dwz invalidates .gnu_debuglink CRC32 in the main files.
+cat "$ELFBINSFILE" |
+(cd "$RPM_BUILD_ROOT"; xargs -d '\n' /usr/lib/rpm/sepdebugcrcfix usr/lib/debug)
+
# For each symlink whose target has a .debug file,
# make a .debug symlink to that file.
find "$RPM_BUILD_ROOT" ! -path "${debugdir}/*" -type l -print |
--- rpm-4.11.1-rc1-orig/tools/sepdebugcrcfix.c 1970-01-01 01:00:00.000000000 +0100
+++ rpm-4.11.1-rc1/tools/sepdebugcrcfix.c 2013-06-24 18:31:54.927881439 +0200
@@ -0,0 +1,344 @@
+/* Copyright (C) 2013 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 of the License, 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 <http://www.gnu.org/licenses/>. */
+
+/* Version 2013-06-24. */
+
+#define _GNU_SOURCE
+#include <string.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <sys/mman.h>
+#include <endian.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <error.h>
+#include <libelf.h>
+#include <gelf.h>
+#include <bfd.h>
+
+#define _(x) x
+#define static_assert(expr) \
+ extern int never_defined_just_used_for_checking[(expr) ? 1 : -1]
+#ifndef min
+# define min(a, b) ((a) < (b) ? (a) : (b))
+#endif
+
+static_assert (sizeof (unsigned long) >= sizeof (uint32_t));
+
+typedef int bool;
+static const bool false = 0, true = 1;
+
+/* This is bfd_calc_gnu_debuglink_crc32 from bfd/opncls.c. */
+static unsigned long
+ calc_gnu_debuglink_crc32 (unsigned long crc,
+ const unsigned char *buf,
+ bfd_size_type len)
+{
+ static const unsigned long crc32_table[256] =
+ {
+ 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
+ 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
+ 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
+ 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
+ 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
+ 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
+ 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
+ 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
+ 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
+ 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
+ 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
+ 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
+ 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
+ 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
+ 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
+ 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
+ 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
+ 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
+ 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
+ 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
+ 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
+ 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
+ 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
+ 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
+ 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
+ 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
+ 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
+ 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
+ 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
+ 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
+ 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
+ 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
+ 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
+ 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
+ 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
+ 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
+ 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
+ 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
+ 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
+ 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
+ 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
+ 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
+ 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
+ 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
+ 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
+ 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
+ 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
+ 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
+ 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
+ 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
+ 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
+ 0x2d02ef8d
+ };
+ const unsigned char *end;
+
+ crc = ~crc & 0xffffffff;
+ for (end = buf + len; buf < end; ++ buf)
+ crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
+ return ~crc & 0xffffffff;
+}
+
+static size_t updated_count, matched_count, failed_count;
+
+static const char *usr_lib_debug;
+
+static bool
+crc32 (const char *fname, const char *base_fname, uint32_t *crcp)
+{
+ char *reldir = strdup (base_fname);
+ if (reldir == NULL)
+ error (1, 0, _("out of memory"));
+ char *s = reldir + strlen (reldir);
+ while (s > reldir && s[-1] != '/')
+ *--s = '\0';
+ char *debugname;
+ if (asprintf (&debugname, "%s/%s/%s", usr_lib_debug, reldir, fname) <= 0)
+ error (1, 0, _("out of memory"));
+ free (reldir);
+ int fd = open (debugname, O_RDONLY);
+ if (fd == -1)
+ {
+ error (0, errno, _("cannot open \"%s\""), debugname);
+ return false;
+ }
+ off64_t size = lseek64 (fd, 0, SEEK_END);
+ if (size == -1)
+ {
+ error (0, errno, _("cannot get size of \"%s\""), debugname);
+ return false;
+ }
+ off_t offset = 0;
+ uint32_t crc = 0;
+ void *buf = NULL;
+ while (offset < size)
+ {
+ const size_t maplen = min (0x10000, size - offset);
+ void *map = NULL;
+ if (buf == NULL)
+ {
+ map = mmap (NULL, maplen, PROT_READ, MAP_PRIVATE | MAP_POPULATE,
+ fd, offset);
+ if (map == MAP_FAILED)
+ {
+ error (0, errno, _("cannot map 0x%llx bytes at offset 0x%llx "
+ "of file \"%s\""),
+ (unsigned long long) maplen, (unsigned long long) offset,
+ debugname);
+ map = NULL;
+ }
+ }
+ if (map == NULL)
+ {
+ if (buf == NULL)
+ {
+ buf = malloc (maplen);
+ if (buf == NULL)
+ error (1, 0, _("out of memory"));
+ }
+ ssize_t got = pread (fd, buf, maplen, offset);
+ if (got != maplen)
+ {
+ error (0, errno, _("cannot read 0x%llx bytes at offset 0x%llx "
+ "of file \"%s\""),
+ (unsigned long long) maplen, (unsigned long long) offset,
+ debugname);
+ free (buf);
+ free (debugname);
+ return false;
+ }
+ }
+ crc = calc_gnu_debuglink_crc32 (crc, map ?: buf, maplen);
+ if (map && munmap (map, maplen) != 0)
+ error (1, errno, _("cannot unmap 0x%llx bytes at offset 0x%llx "
+ "of file \"%s\""),
+ (unsigned long long) maplen, (unsigned long long) offset,
+ debugname);
+ offset += maplen;
+ }
+ free (buf);
+ if (close (fd) != 0)
+ {
+ error (0, errno, _("cannot close \"%s\""), debugname);
+ free (debugname);
+ return false;
+ }
+ free (debugname);
+ *crcp = crc;
+ return true;
+}
+
+static bool
+process (Elf *elf, int fd, const char *fname)
+{
+ GElf_Ehdr ehdr_mem, *ehdr = gelf_getehdr (elf, &ehdr_mem);
+ if (ehdr == NULL)
+ {
+ error (0, 0, _("cannot get ELF header of \"%s\""), fname);
+ return false;
+ }
+ if (ehdr->e_ident[EI_DATA] != ELFDATA2LSB
+ && ehdr->e_ident[EI_DATA] != ELFDATA2MSB)
+ {
+ error (0, 0, _("invalid ELF endianity of \"%s\""), fname);
+ return false;
+ }
+ Elf_Scn *scn = NULL;
+ const char scnname[] = ".gnu_debuglink";
+ while ((scn = elf_nextscn (elf, scn)) != NULL)
+ {
+ GElf_Shdr shdr_mem, *shdr = gelf_getshdr (scn, &shdr_mem);
+ if (shdr == NULL)
+ {
+ error (0, 0, _("cannot get section # %zu in \"%s\""),
+ elf_ndxscn (scn), fname);
+ continue;
+ }
+ const char *sname = elf_strptr (elf, ehdr->e_shstrndx, shdr->sh_name);
+ if (sname == NULL)
+ {
+ error (0, 0, _("cannot get name of section # %zu in \"%s\""),
+ elf_ndxscn (scn), fname);
+ continue;
+ }
+ if (strcmp (sname, scnname) != 0)
+ continue;
+ Elf_Data *data = elf_getdata (scn, NULL);
+ if (data == NULL)
+ {
+ error (0, 0, _("cannot get data of section \"%s\" # %zu in \"%s\""),
+ scnname, elf_ndxscn (scn), fname);
+ continue;
+ }
+ if ((data->d_size & 3) != 0)
+ {
+ error (0, 0, _("invalid size of section \"%s\" # %zu in \"%s\""),
+ scnname, elf_ndxscn (scn), fname);
+ continue;
+ }
+ const uint8_t *zerop = memchr (data->d_buf, '\0', data->d_size);
+ const uint8_t *crcp = (zerop == NULL
+ ? NULL
+ : (const uint8_t *) ((uintptr_t) (zerop + 1 + 3)
+ & -4));
+ if (crcp + 4 != (uint8_t *) data->d_buf + data->d_size)
+ {
+ error (0, 0, _("invalid format of section \"%s\" # %zu in \"%s\""),
+ scnname, elf_ndxscn (scn), fname);
+ continue;
+ }
+ uint32_t had_crc_targetendian = *(const uint32_t *) crcp;
+ uint32_t had_crc = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB
+ ? le32toh (had_crc_targetendian)
+ : be32toh (had_crc_targetendian));
+ uint32_t crc;
+ if (! crc32 (data->d_buf, fname, &crc))
+ return false;
+ if (crc == had_crc)
+ {
+ matched_count++;
+ return true;
+ }
+ updated_count++;
+ off64_t seekto = (shdr->sh_offset + data->d_off
+ + (crcp - (const uint8_t *) data->d_buf));
+ uint32_t crc_targetendian = (ehdr->e_ident[EI_DATA] == ELFDATA2LSB
+ ? htole32 (crc) : htobe32 (crc));
+ ssize_t wrote = pwrite (fd, &crc_targetendian, sizeof (crc_targetendian),
+ seekto);
+ if (wrote != sizeof (crc_targetendian))
+ {
+ error (0, 0, _("cannot write new CRC to 0x%llx "
+ "inside section \"%s\" # %zu in \"%s\""),
+ (unsigned long long) seekto, scnname, elf_ndxscn (scn), fname);
+ return false;
+ }
+ return true;
+ }
+ error (0, 0, _("cannot find section \"%s\" in \"%s\""), scnname, fname);
+ return false;
+}
+
+int
+main (int argc, char **argv)
+{
+ if (argc < 2)
+ error (1, 0, _("usr/lib/debug [<relative filenames>...]"));
+ usr_lib_debug = argv[1];
+ if (elf_version (EV_CURRENT) == EV_NONE)
+ error (1, 0, _("error initializing libelf: %s"), elf_errmsg (-1));
+ for (int argi = 2; argi < argc; argi++)
+ {
+ const char *fname = argv[argi];
+ int fd = open64 (fname, O_RDWR);
+ if (fd == -1)
+ {
+ error (0, errno, _("cannot open \"%s\""), fname);
+ failed_count++;
+ continue;
+ }
+ bool failed = false;
+ Elf *elf = elf_begin (fd, ELF_C_READ_MMAP, NULL);
+ if (elf == NULL)
+ {
+ error (0, 0, _("cannot open \"%s\" as ELF: %s"), fname,
+ elf_errmsg (-1));
+ failed = true;
+ }
+ else
+ {
+ if (! process (elf, fd, fname))
+ failed = true;
+ if (elf_end (elf) != 0)
+ {
+ error (0, 0, _("cannot close \"%s\" as ELF: %s"), fname,
+ elf_errmsg (-1));
+ failed = true;
+ }
+ }
+ if (close (fd) != 0)
+ {
+ error (0, errno, _("cannot close \"%s\""), fname);
+ failed = true;
+ }
+ if (failed)
+ failed_count++;
+ }
+ printf ("%s: Updated %zu CRC32s, %zu CRC32s did match.\n", argv[0],
+ updated_count, matched_count);
+ if (failed_count)
+ printf ("%s: Failed for %zu files.\n", argv[0], failed_count);
+ return failed_count == 0 ? EXIT_SUCCESS : EXIT_FAILURE;
+}

View File

@ -1,16 +0,0 @@
--- rpm-4.12.0.1/lib/fsm.c.orig 2014-12-12 16:05:51.683430313 +0100
+++ rpm-4.12.0.1/lib/fsm.c 2014-12-12 16:08:28.046025597 +0100
@@ -215,7 +215,12 @@ static int expandRegular(rpmfi fi, const
FD_t wfd = NULL;
int rc = 0;
- wfd = Fopen(dest, "w.ufdio");
+ /* Create the file with 000 permissions. */
+ {
+ mode_t old_umask = umask(0777);
+ wfd = Fopen(dest, "w.ufdio");
+ umask(old_umask);
+ }
if (Ferror(wfd)) {
rc = RPMERR_OPEN_FAILED;
goto exit;

View File

@ -1,14 +0,0 @@
diff --git a/lib/cpio.c b/lib/cpio.c
index 253ff0f..600633a 100644
--- a/lib/cpio.c
+++ b/lib/cpio.c
@@ -399,6 +399,9 @@ int rpmcpioHeaderRead(rpmcpio_t cpio, char ** path, int * fx)
GET_NUM_FIELD(hdr.filesize, fsize);
GET_NUM_FIELD(hdr.namesize, nameSize);
+ if (nameSize <= 0 || nameSize > 4096) {
+ return RPMERR_BAD_HEADER;
+ }
char name[nameSize + 1];
read = Fread(name, nameSize, 1, cpio->fd);

View File

@ -18,7 +18,7 @@
%define rpmhome /usr/lib/rpm
%define rpmver 4.13.0
%define snapver rc1
#define snapver rc1
%define srcver %{rpmver}%{?snapver:-%{snapver}}
%define eggver %{rpmver}%{?snapver:_%{snapver}}
@ -57,16 +57,6 @@ Patch5: rpm-4.12.0-rpm2cpio-hack.patch
Patch302: rpm-4.7.1-geode-i686.patch
# Probably to be upstreamed in slightly different form
Patch304: rpm-4.9.1.1-ld-flags.patch
# Compressed debuginfo support (#833311)
Patch305: rpm-4.10.0-dwz-debuginfo.patch
# Minidebuginfo support (#834073)
Patch306: rpm-4.10.0-minidebuginfo.patch
# Fix CRC32 after dwz (#971119)
Patch307: rpm-4.11.1-sepdebugcrcfix.patch
# Fix race condidition where unchecked data is exposed in the file system
Patch308: rpm-4.12.0.x-CVE-2013-6435.patch
# Add check against malicious CPIO file name size
Patch309: rpm-4.12.0.x-CVE-2014-8118.patch
# Partially GPL/LGPL dual-licensed and some bits with BSD
# SourceLicense: (GPLv2+ and LGPLv2+ with exceptions) and BSD
@ -155,6 +145,8 @@ Requires: libcap%{_isa} >= 2.16
%if %{with plugins}
Requires: rpm-plugin-selinux%{_isa} = %{version}-%{release}
%endif
# Remove temporary compat-librpm3 package from F23
Obsoletes: compat-librpm3 < %{version}-%{release}
%description libs
This package contains the RPM shared libraries.
@ -312,10 +304,20 @@ ln -s db-%{bdbver} db
%endif
CPPFLAGS="$CPPFLAGS `pkg-config --cflags nss` -DLUA_COMPAT_APIINTCASTS"
CFLAGS="$RPM_OPT_FLAGS %{?sanitizer_flags} -DLUA_COMPAT_APIINTCASTS"
LDFLAGS="$LDFLAGS %{?__global_ldflags}"
export CPPFLAGS CFLAGS LDFLAGS
autoreconf -i -f
%ifarch %{arm}
%global _gnu -gnueabi
%endif
# Hardening hack taken from macro %%configure defined in redhat-rpm-config
for i in $(find . -name ltmain.sh) ; do
%{__sed} -i.backup -e 's~compiler_flags=$~compiler_flags="%{_hardened_ldflags}"~' $i
done
# Using configure macro has some unwanted side-effects on rpm platform
# setup, use the old-fashioned way for now only defining minimal paths.
./configure \
@ -552,34 +554,52 @@ exit 0
%doc doc/librpm/html/*
%changelog
* Thu Nov 03 2016 Panu Matilainen <pmatilai@redhat.com> - 4.13.0-1
- Rebase to 4.13.0 (http://rpm.org/wiki/Releases/4.13.0)
* Wed Sep 02 2015 Florian Festi <ffesti@rpm.org> - 4.13.0-0.rc1.1
* Mon Apr 25 2016 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.13
- Fix sigsegv in stringFormat() (#1316903)
- Fix reading rpmtd behind its size in formatValue() (#1316896)
* Fri Feb 26 2016 Lubos Kardos <lkardos@redhat.com> -4.13.0-0.rc1.12
- Remove size limit when expanding macros (#1303034)
* Tue Feb 02 2016 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.11
- Revert using %%configure, it causes problems
- Temporary set %%_gnu macro explictly, just for one build (#1303265)
- Harden rpm package again, previous attempt had to be reverted (#1289734)
* Fri Jan 29 2016 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.10
- Use %%configure macro, harden rpm package (#1289734)
* Fri Jan 15 2016 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.9
- Fix recursive calling of rpmdeps tool (#1297557)
* Fri Jan 15 2016 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.8
- Fix not chrooting transaction file triggers
* Fri Nov 20 2015 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.7
- Fix crash when parsing corrupted RPM file (#1273360)
* Mon Nov 09 2015 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.6
- Ignore SIGPIPE signals during execucton of scriptlets (#1264198)
* Fri Nov 06 2015 Lubos Kardos <lkardos@redhat.com> - 4.13.0-0.rc1.5
- Fix SIGSEGV in case of old unsupported gpg keys (#1277464)
* Mon Oct 12 2015 Florian Festi <ffesti@rpm.org> - 4.4.13.0-0.rc1.4
- Fix selinux plugin for permissive mode
* Mon Sep 07 2015 Florian Festi <ffesti@rpm.org> - 4.4.13.0-0.rc1.3
- Remove compat-librpm3 hack
- Fix new rich dependency syntax
* Sat Sep 05 2015 Kalev Lember <klember@redhat.com> - 4.13.0-0.rc1.2
- Add a temporary compat-librpm3 subpackage
* Thu Sep 03 2015 Florian Festi <ffesti@rpm.org> - 4.13.0-0.rc1.1
- Update to upstream rc1 release
* Mon Aug 10 2015 Lubos Kardos <lkardos@redhat.com> - 4.12.90-7
- Fix last occurence of PyString
* Thu Aug 06 2015 Lubos Kardos <lkardos@redhat.com> - 4.12.90-6
- Add --filetriggers option to show info about file triggers.
* Mon Aug 03 2015 Lubos Kardos <lkardos@redhat.com> - 4.12.90-5
- If globbing of a filename fails, try use the filename without globbing.
(#1246743)
- Modify rpmIsGlob() to be more precise and compatible with glob().
(#1246743)
* Thu Jul 30 2015 Lubos Kardos <lkardos@redhat.com> - 4.12.90-4
- Don't warn when an escaped macro is in a comment (#1224660)
* Mon Jul 27 2015 Florian Festi <ffesti@rpm.org> - 4.12.90-3
- Fix compressed patches (#1247248)
* Mon Jul 27 2015 Lubos Kardos <lkardos@redhat.com> - 4.12.90-2
- Enable braces expansion in rpmGlob() (#1246743)
* Fri Jul 24 2015 Florian Festi <ffesti@rpm.org> - 4.12.90-1
- Update to upstream alpha release
* Tue Jul 14 2015 Michal Toman <mtoman@fedoraproject.org> - 4.12.0.1-18
- Add support for MIPS platform

View File

@ -1 +1 @@
f9be5490f187bc4d9710c9fdae529e7b rpm-4.13.0-rc1.tar.bz2
f64e70c7548911da51a11651a789e30e rpm-4.13.0.tar.bz2