sys-apps/file: Sync with gentoo

It's from gentoo commit 18fcd439557ad7bead7db8e9113adfdc820652e9.
This commit is contained in:
Krzesimir Nowak 2021-11-30 18:00:29 +01:00
parent a499f7ae73
commit 81a660af13
17 changed files with 219 additions and 364 deletions

View File

@ -1,3 +1,2 @@
DIST file-5.37.tar.gz 887682 BLAKE2B c5635e5de879af31cbef1c988275ab8620133909d146769b27a2f8eefa90871fad5fa75e66b9e1d77a6261e5d6dec315fb5a8ad587d8c214eaa0bc2e5a929fe7 SHA512 bf153c15aebdd00329806231d20f295077b8b99efd0181d01279bcf3734a1718567df38cf75bc929eb8015ac98d29bb4bf1228d7ece8bfdfe14dd976391dd06d
DIST file-5.38.tar.gz 932528 BLAKE2B 08d8d56e2e1b6a0c9fb0caed89ca6145bf683ecc52a639c036ded01b913e7eea75d9235851a2fbd410cbc9b929c26579b06fe1d54fb73817c951bef3544bc345 SHA512 9eeeba69cbc9f0c00a0bdf9eaf60c73a4a709e797068f109d85c1ef2a19c8b0e012ecd73714f03cbb1770dfa717e8a661ad746b644cc030cafbfb1f7aac35a40
DIST file-5.39.tar.gz 954266 BLAKE2B 4d6d9a6317961e0a2aa391f502b0be8bbb40ede57c3470230d91aaf9ce5d35bcaceb32d551ca5a391fc8c40b64517fdb996833a8b1ca47ced7e92e9e545d2682 SHA512 9cf1a7b769c56eb6f5b25c66ce85fa1300128396e445b2e53dbbd8951e5da973a7a07c4ef9f7ebd1fe945d47bdaf2cd9ef09bd2be6c217a0bcb907d9449835e6
DIST file-5.40.tar.gz 1004214 BLAKE2B 4e15a1ca62fe7c03c90b0e509dc899b87f4474f758ad3d08172b3d838dc3f7c2954ba1074eeeeb3da8c04b8df84eff2b8cdf3177da334a926914429df67f60bf SHA512 3b70df75fa4c9050d55b1ffdc28e5f3c8b8ef7d4efd1a06bf53f113b676d81114a85aae56e0897d32b53716662d64ad18ab251ca8c92c6405c69eb758bb99afb
DIST file-5.41.tar.gz 1064097 BLAKE2B 56fe8a58d9497bb1bfe3ed6b3ce5df70dd27cc308eb0cfdac8e91ba81c733a96aa622c120ac59079986c6d84901c6f2d82fa24f698d481d7f77e6cfdd432d648 SHA512 bbf2d8e39450b31d0ba8d76d202790fea953775657f942f06e6dc9091798d4a395f7205e542388e4a25b6a4506d07f36c5c4da37cfce0734133e9203a3b00654

View File

@ -1,128 +0,0 @@
# Copyright 1999-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{6,7} )
DISTUTILS_OPTIONAL=1
inherit distutils-r1 libtool toolchain-funcs multilib-minimal
if [[ ${PV} == "9999" ]] ; then
EGIT_REPO_URI="https://github.com/glensc/file.git"
inherit autotools git-r3
else
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
fi
DESCRIPTION="identify a file's format by scanning binary data for patterns"
HOMEPAGE="https://www.darwinsys.com/file/"
LICENSE="BSD-2"
SLOT="0"
IUSE="python static-libs zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DEPEND="
python? (
${PYTHON_DEPS}
dev-python/setuptools[${PYTHON_USEDEP}]
)
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
RDEPEND="${DEPEND}
python? ( !dev-python/python-magic )"
PATCHES=( "${FILESDIR}"/${P}-CVE-2019-18218.patch )
src_prepare() {
default
[[ ${PV} == "9999" ]] && eautoreconf
elibtoolize
# don't let python README kill main README #60043
mv python/README.md python/README.python.md || die
sed 's@README.md@README.python.md@' -i python/setup.py || die #662090
}
multilib_src_configure() {
local myeconfargs=(
--disable-libseccomp
--enable-fsect-man5
$(use_enable static-libs static)
$(use_enable zlib)
)
ECONF_SOURCE="${S}" econf "${myeconfargs[@]}"
}
src_configure() {
# when cross-compiling, we need to build up our own file
# because people often don't keep matching host/target
# file versions #362941
if tc-is-cross-compiler && ! ROOT=/ has_version ~${CATEGORY}/${P} ; then
mkdir -p "${WORKDIR}"/build || die
cd "${WORKDIR}"/build || die
tc-export_build_env BUILD_C{C,XX}
ECONF_SOURCE="${S}" \
ac_cv_header_zlib_h=no \
ac_cv_lib_z_gzopen=no \
CHOST=${CBUILD} \
CFLAGS=${BUILD_CFLAGS} \
CXXFLAGS=${BUILD_CXXFLAGS} \
CPPFLAGS=${BUILD_CPPFLAGS} \
LDFLAGS="${BUILD_LDFLAGS} -static" \
CC=${BUILD_CC} \
CXX=${BUILD_CXX} \
econf --disable-shared --disable-libseccomp
fi
multilib-minimal_src_configure
}
multilib_src_compile() {
if multilib_is_native_abi ; then
emake
else
cd src || die
emake magic.h #586444
emake libmagic.la
fi
}
src_compile() {
if tc-is-cross-compiler && ! ROOT=/ has_version "~${CATEGORY}/${P}" ; then
emake -C "${WORKDIR}"/build/src magic.h #586444
emake -C "${WORKDIR}"/build/src file
PATH="${WORKDIR}/build/src:${PATH}"
fi
multilib-minimal_src_compile
if use python ; then
cd python || die
distutils-r1_src_compile
fi
}
multilib_src_install() {
if multilib_is_native_abi ; then
default
else
emake -C src install-{nodist_includeHEADERS,libLTLIBRARIES} DESTDIR="${D}"
fi
}
multilib_src_install_all() {
dodoc ChangeLog MAINT README
# Required for `file -C`
dodir /usr/share/misc/magic
insinto /usr/share/misc/magic
doins -r magic/Magdir/*
if use python ; then
cd python || die
distutils-r1_src_install
fi
find "${ED}" -type f -name "*.la" -delete || die
}

View File

@ -1,9 +1,9 @@
# Copyright 1999-2020 Gentoo Authors
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{6..7} )
PYTHON_COMPAT=( python3_{8..10} )
DISTUTILS_OPTIONAL=1
inherit distutils-r1 libtool toolchain-funcs multilib-minimal
@ -13,7 +13,7 @@ if [[ ${PV} == "9999" ]] ; then
inherit autotools git-r3
else
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv ~s390 sparc x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
fi
DESCRIPTION="identify a file's format by scanning binary data for patterns"
@ -21,7 +21,7 @@ HOMEPAGE="https://www.darwinsys.com/file/"
LICENSE="BSD-2"
SLOT="0"
IUSE="bzip2 lzma python static-libs zlib"
IUSE="bzip2 lzma python seccomp static-libs zlib"
REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"
DEPEND="
@ -33,18 +33,25 @@ DEPEND="
)
zlib? ( >=sys-libs/zlib-1.2.8-r1[${MULTILIB_USEDEP}] )"
RDEPEND="${DEPEND}
python? ( !dev-python/python-magic )"
python? ( !dev-python/python-magic )
seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
PATCHES=(
"${FILESDIR}"/${P}-Revert-PR-93-iaeiaeiaeiae-Do-as-the-comment-says-and.patch
"${FILESDIR}"/${P}-td-is-for-ptrdiff_t-not-for-off_t.patch
"${FILESDIR}"/${P}-The-executable-bit-is-only-set-when-DF_1_PIE-bit-is-.patch
"${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
"${FILESDIR}/file-5.40-xz_magic.patch" #784773
"${FILESDIR}/file-5.40-seccomp-faccessat.patch"
"${FILESDIR}/file-5.40-seccomp-fstatat64.patch" #784857
"${FILESDIR}/file-5.40-revert-char-count.patch" #799188
"${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet
)
src_prepare() {
default
[[ ${PV} == "9999" ]] && eautoreconf
if [[ ${PV} == 9999 ]] ; then
eautoreconf
fi
elibtoolize
# don't let python README kill main README #60043
@ -54,10 +61,10 @@ src_prepare() {
multilib_src_configure() {
local myeconfargs=(
--disable-libseccomp
--enable-fsect-man5
$(use_enable bzip2 bzlib)
$(use_enable lzma xzlib)
$(use_enable seccomp libseccomp)
$(use_enable static-libs static)
$(use_enable zlib)
)
@ -83,9 +90,9 @@ need_build_file() {
}
src_configure() {
local ECONF_SOURCE=${S}
local ECONF_SOURCE="${S}"
if need_build_file; then
if need_build_file ; then
mkdir -p "${WORKDIR}"/build || die
cd "${WORKDIR}"/build || die
build_src_configure
@ -105,7 +112,7 @@ multilib_src_compile() {
}
src_compile() {
if need_build_file; then
if need_build_file ; then
emake -C "${WORKDIR}"/build/src magic.h #586444
emake -C "${WORKDIR}"/build/src file
local -x PATH="${WORKDIR}/build/src:${PATH}"
@ -130,7 +137,6 @@ multilib_src_install_all() {
dodoc ChangeLog MAINT README
# Required for `file -C`
dodir /usr/share/misc/magic
insinto /usr/share/misc/magic
doins -r magic/Magdir/*

View File

@ -1,9 +1,9 @@
# Copyright 1999-2020 Gentoo Authors
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{6..7} )
PYTHON_COMPAT=( python3_{8..10} )
DISTUTILS_OPTIONAL=1
inherit distutils-r1 libtool toolchain-funcs multilib-minimal
@ -13,7 +13,7 @@ if [[ ${PV} == "9999" ]] ; then
inherit autotools git-r3
else
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
KEYWORDS="~alpha amd64 arm arm64 hppa ~ia64 ~m68k ~mips ppc ppc64 ~riscv s390 sparc x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
fi
DESCRIPTION="identify a file's format by scanning binary data for patterns"
@ -37,15 +37,14 @@ RDEPEND="${DEPEND}
seccomp? ( sys-libs/libseccomp[${MULTILIB_USEDEP}] )"
PATCHES=(
"${FILESDIR}/file-5.39-add-missing-termios.patch" #728416
"${FILESDIR}/file-5.39-seccomp-musl.patch"
"${FILESDIR}/file-5.39-portage-sandbox.patch" #713710 #728978
"${FILESDIR}/file-5.40-seccomp-fstatat64-musl.patch" #789336, not upstream yet
)
src_prepare() {
default
if [[ ${PV} == 9999 ]]; then
if [[ ${PV} == 9999 ]] ; then
eautoreconf
fi
@ -87,9 +86,9 @@ need_build_file() {
}
src_configure() {
local ECONF_SOURCE=${S}
local ECONF_SOURCE="${S}"
if need_build_file; then
if need_build_file ; then
mkdir -p "${WORKDIR}"/build || die
cd "${WORKDIR}"/build || die
build_src_configure
@ -109,7 +108,7 @@ multilib_src_compile() {
}
src_compile() {
if need_build_file; then
if need_build_file ; then
emake -C "${WORKDIR}"/build/src magic.h #586444
emake -C "${WORKDIR}"/build/src file
local -x PATH="${WORKDIR}/build/src:${PATH}"
@ -131,10 +130,9 @@ multilib_src_install() {
}
multilib_src_install_all() {
dodoc ChangeLog MAINT README
dodoc ChangeLog MAINT # README
# Required for `file -C`
dodir /usr/share/misc/magic
insinto /usr/share/misc/magic
doins -r magic/Magdir/*

View File

@ -1,9 +1,9 @@
# Copyright 1999-2020 Gentoo Authors
# Copyright 1999-2021 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
EAPI=7
PYTHON_COMPAT=( python3_{6..7} )
PYTHON_COMPAT=( python3_{8..10} )
DISTUTILS_OPTIONAL=1
inherit distutils-r1 libtool toolchain-funcs multilib-minimal
@ -13,7 +13,7 @@ if [[ ${PV} == "9999" ]] ; then
inherit autotools git-r3
else
SRC_URI="ftp://ftp.astron.com/pub/file/${P}.tar.gz"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~ppc-aix ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~x86-macos ~m68k-mint ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86 ~x64-cygwin ~amd64-linux ~x86-linux ~ppc-macos ~x64-macos ~sparc-solaris ~sparc64-solaris ~x64-solaris ~x86-solaris"
fi
DESCRIPTION="identify a file's format by scanning binary data for patterns"
@ -43,7 +43,7 @@ PATCHES=(
src_prepare() {
default
if [[ ${PV} == 9999 ]]; then
if [[ ${PV} == 9999 ]] ; then
eautoreconf
fi
@ -85,9 +85,9 @@ need_build_file() {
}
src_configure() {
local ECONF_SOURCE=${S}
local ECONF_SOURCE="${S}"
if need_build_file; then
if need_build_file ; then
mkdir -p "${WORKDIR}"/build || die
cd "${WORKDIR}"/build || die
build_src_configure
@ -107,7 +107,7 @@ multilib_src_compile() {
}
src_compile() {
if need_build_file; then
if need_build_file ; then
emake -C "${WORKDIR}"/build/src magic.h #586444
emake -C "${WORKDIR}"/build/src file
local -x PATH="${WORKDIR}/build/src:${PATH}"
@ -132,7 +132,6 @@ multilib_src_install_all() {
dodoc ChangeLog MAINT README
# Required for `file -C`
dodir /usr/share/misc/magic
insinto /usr/share/misc/magic
doins -r magic/Magdir/*

View File

@ -1,36 +0,0 @@
CVE-2019-18218
https://github.com/file/file/commit/46a8443f76cec4b41ec736eca396984c74664f84
--- a/src/cdf.c
+++ b/src/cdf.c
@@ -1027,8 +1027,9 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
goto out;
}
nelements = CDF_GETUINT32(q, 1);
- if (nelements == 0) {
- DPRINTF(("CDF_VECTOR with nelements == 0\n"));
+ if (nelements > CDF_ELEMENT_LIMIT || nelements == 0) {
+ DPRINTF(("CDF_VECTOR with nelements == %"
+ SIZE_T_FORMAT "u\n", nelements));
goto out;
}
slen = 2;
@@ -1070,8 +1071,6 @@ cdf_read_property_info(const cdf_stream_t *sst, const cdf_header_t *h,
goto out;
inp += nelem;
}
- DPRINTF(("nelements = %" SIZE_T_FORMAT "u\n",
- nelements));
for (j = 0; j < nelements && i < sh.sh_properties;
j++, i++)
{
--- a/src/cdf.h
+++ b/src/cdf.h
@@ -48,6 +48,7 @@
typedef int32_t cdf_secid_t;
#define CDF_LOOP_LIMIT 10000
+#define CDF_ELEMENT_LIMIT 100000
#define CDF_SECID_NULL 0
#define CDF_SECID_FREE -1

View File

@ -1,40 +0,0 @@
From c9d21a58bea2ecb2dc8876e09e471094d54a25e4 Mon Sep 17 00:00:00 2001
From: Thomas Deutschmann <whissi@gentoo.org>
Date: Mon, 13 Apr 2020 01:08:12 +0200
Subject: [PATCH 1/3] Revert "PR/93: iaeiaeiaeiae: Do as the comment says, and
count as dynamically linked"
This reverts commit 24c9c086cd7c55b7b0a003a145b32466468e2608.
Fixes misdetection of shared libraries as statically linked as
reported in bug 717264.
Bug: https://bugs.gentoo.org/717264
Signed-off-by: Thomas Deutschmann <whissi@gentoo.org>
---
src/readelf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/readelf.c b/src/readelf.c
index 40bcfab1..afec31d1 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1638,6 +1638,7 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
/* Things we can determine before we seek */
switch (xph_type) {
case PT_DYNAMIC:
+ linking_style = "dynamically";
doread = 1;
break;
case PT_NOTE:
@@ -1653,7 +1654,6 @@ dophn_exec(struct magic_set *ms, int clazz, int swap, int fd, off_t off,
}
/*FALLTHROUGH*/
case PT_INTERP:
- linking_style = "dynamically";
doread = 1;
break;
default:
--
2.26.0

View File

@ -1,29 +0,0 @@
From ed971e5e3ae79bd28697d16c8b78b693052484e4 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Wed, 12 Feb 2020 22:17:33 +0000
Subject: [PATCH 3/3] The executable bit is only set when DF_1_PIE bit is set
so it is fine.
---
magic/Magdir/elf | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/magic/Magdir/elf b/magic/Magdir/elf
index b5a2e00b..f5e1af9a 100644
--- a/magic/Magdir/elf
+++ b/magic/Magdir/elf
@@ -50,8 +50,9 @@
!:mime application/x-object
>16 leshort 2 executable,
!:mime application/x-executable
->16 leshort 3 shared object,
-!:mime application/x-sharedlib
+>16 leshort 3 ${x?pie executable:shared object},
+
+!:mime application/x-${x?pie-executable:sharedlib}
>16 leshort 4 core file,
!:mime application/x-coredump
# OS-specific
--
2.26.0

View File

@ -1,27 +0,0 @@
From c49dc91df427f89ebcf9cdec556b8fc88cdfc3c1 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Tue, 17 Dec 2019 15:27:27 +0000
Subject: [PATCH 2/3] %td is for ptrdiff_t not for off_t.
---
src/readelf.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/readelf.c b/src/readelf.c
index afec31d1..8ac3b7d6 100644
--- a/src/readelf.c
+++ b/src/readelf.c
@@ -1349,8 +1349,8 @@ doshn(struct magic_set *ms, int clazz, int swap, int fd, off_t off, int num,
name_off = xsh_offset;
if (fsize != SIZE_UNKNOWN && fsize < name_off) {
- if (file_printf(ms, ", too large section header offset %td",
- name_off) == -1)
+ if (file_printf(ms, ", too large section header offset %jd",
+ (intmax_t)name_off) == -1)
return -1;
return 0;
}
--
2.26.0

View File

@ -1,30 +0,0 @@
From 471e2c6c61ecd30ba6e304ae0444d364cfd44254 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Thu, 18 Jun 2020 16:25:12 +0000
Subject: [PATCH] PR/168: gyakovlev: Include <termios.h>
---
src/seccomp.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/seccomp.c b/src/seccomp.c
index e667adfe4..68c56485d 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
+FILE_RCSID("@(#)$File: seccomp.c,v 1.16 2020/06/18 16:25:12 christos Exp $")
#endif /* lint */
#if HAVE_LIBSECCOMP
@@ -35,6 +35,7 @@ FILE_RCSID("@(#)$File: seccomp.c,v 1.15 2020/05/30 23:56:26 christos Exp $")
#include <sys/prctl.h> /* prctl */
#include <sys/ioctl.h>
#include <sys/socket.h>
+#include <termios.h>
#include <fcntl.h>
#include <stdlib.h>
#include <errno.h>

View File

@ -1,37 +0,0 @@
From 93c91e2ba8042d499fee168e27cbd526438454c6 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Sat, 5 Sep 2020 17:20:32 +0000
Subject: [PATCH] PR/194: puchuu: Handle muslc syscalls
---
src/seccomp.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/seccomp.c b/src/seccomp.c
index 68c56485d..db9364ae4 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: seccomp.c,v 1.16 2020/06/18 16:25:12 christos Exp $")
+FILE_RCSID("@(#)$File: seccomp.c,v 1.17 2020/09/05 17:20:32 christos Exp $")
#endif /* lint */
#if HAVE_LIBSECCOMP
@@ -220,12 +220,14 @@ enable_sandbox_full(void)
ALLOW_RULE(rt_sigreturn);
ALLOW_RULE(select);
ALLOW_RULE(stat);
+ ALLOW_RULE(statx);
ALLOW_RULE(stat64);
ALLOW_RULE(sysinfo);
ALLOW_RULE(umask); // Used in file_pipe2file()
ALLOW_RULE(getpid); // Used by glibc in file_pipe2file()
ALLOW_RULE(unlink);
ALLOW_RULE(write);
+ ALLOW_RULE(writev);
#if 0

View File

@ -0,0 +1,49 @@
From c07e242e766242a44ff720c149b1bdd4924ec247 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Tue, 27 Apr 2021 19:37:14 +0000
Subject: [PATCH] Revert the fix for PR/180. It lead to PR/261. Using character
count heuristics ends up with confusing behavior, the following should not be
producing different results: echo -n xx | ./file - echo -n xy |
./file -
---
[patch backported to 5.40 release -- ulm]
src/encoding.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/src/encoding.c b/src/encoding.c
index 31d4d125..3647a481 100644
--- a/src/encoding.c
+++ b/src/encoding.c
@@ -265,9 +265,7 @@ private int \
looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
size_t *ulen) \
{ \
- size_t i, u; \
- unsigned char dist[256]; \
- memset(dist, 0, sizeof(dist)); \
+ size_t i; \
\
*ulen = 0; \
\
@@ -278,16 +276,7 @@ looks_ ## NAME(const unsigned char *buf, size_t nbytes, file_unichar_t *ubuf, \
return 0; \
\
ubuf[(*ulen)++] = buf[i]; \
- dist[buf[i]]++; \
} \
- u = 0; \
- for (i = 0; i < __arraycount(dist); i++) { \
- if (dist[i]) \
- u++; \
- } \
- if (u < 3) \
- return 0; \
-\
return 1; \
}
--
2.32.0

View File

@ -0,0 +1,34 @@
From abcd583135bb0762e6bfd0f2e06c50bea1fb3cd0 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Tue, 6 Apr 2021 22:02:17 +0000
Subject: [PATCH] On ARM64 Linux access() syscall is no longer a real syscall
to the kernel. Instead it's emulated by glibc with a new faccessat() syscall.
(Icenowy Zheng)
---
src/seccomp.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/seccomp.c b/src/seccomp.c
index 0da907ff7..81842cf5c 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -27,7 +27,7 @@
#include "file.h"
#ifndef lint
-FILE_RCSID("@(#)$File: seccomp.c,v 1.18 2021/03/14 17:01:58 christos Exp $")
+FILE_RCSID("@(#)$File: seccomp.c,v 1.19 2021/04/06 22:02:17 christos Exp $")
#endif /* lint */
#if HAVE_LIBSECCOMP
@@ -171,6 +171,9 @@ enable_sandbox_full(void)
ALLOW_RULE(dup2);
ALLOW_RULE(exit);
ALLOW_RULE(exit_group);
+#ifdef __NR_faccessat
+ ALLOW_RULE(faccessat);
+#endif
ALLOW_RULE(fcntl);
ALLOW_RULE(fcntl64);
ALLOW_RULE(fstat);

View File

@ -0,0 +1,31 @@
From 8c13923a8e17a02be0989649b2edc20124816729 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Tue, 15 Jun 2021 16:08:22 -0400
Subject: [PATCH] seccomp: undef fstatat64 to avoid build failure on musl
sys/stat.h in musl does this:
#define fstatat64 fstatat
Counteract this with an #undef.
Bug: https://bugs.gentoo.org/789336
---
src/seccomp.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/seccomp.c b/src/seccomp.c
index 3318367c..eb8b1e57 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -179,6 +179,7 @@ enable_sandbox_full(void)
ALLOW_RULE(fstat);
ALLOW_RULE(fstat64);
#ifdef __NR_fstatat64
+#undef fstatat64
ALLOW_RULE(fstatat64);
#endif
ALLOW_RULE(futex);
--
2.32.0

View File

@ -0,0 +1,29 @@
From e3d0265a147878b6c2903bcc83b9842dff68ceb4 Mon Sep 17 00:00:00 2001
From: Mike Gilbert <floppym@gentoo.org>
Date: Fri, 23 Apr 2021 15:00:42 -0400
Subject: [PATCH] seccomp: allow fstatat64
This is needed for the libsandbox LD_PRELOAD wrapper on Gentoo Linux.
Bug: https://bugs.gentoo.org/784857
---
src/seccomp.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/seccomp.c b/src/seccomp.c
index 81842cf5..43abc684 100644
--- a/src/seccomp.c
+++ b/src/seccomp.c
@@ -178,6 +178,9 @@ enable_sandbox_full(void)
ALLOW_RULE(fcntl64);
ALLOW_RULE(fstat);
ALLOW_RULE(fstat64);
+#ifdef __NR_fstatat64
+ ALLOW_RULE(fstatat64);
+#endif
ALLOW_RULE(futex);
ALLOW_RULE(getdents);
#ifdef __NR_getdents64
--
2.31.1

View File

@ -0,0 +1,37 @@
From 9b0459afab309a82aa4e46f73a4e50dd641f3d39 Mon Sep 17 00:00:00 2001
From: Christos Zoulas <christos@zoulas.com>
Date: Mon, 19 Apr 2021 17:01:45 +0000
Subject: [PATCH] PR/257: cuihao: put attributes inside the xz magic.
---
magic/Magdir/compress | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/magic/Magdir/compress b/magic/Magdir/compress
index 64d11a736..41a65738f 100644
--- a/magic/Magdir/compress
+++ b/magic/Magdir/compress
@@ -1,5 +1,5 @@
#------------------------------------------------------------------------------
-# $File: compress,v 1.80 2021/03/15 17:49:24 christos Exp $
+# $File: compress,v 1.81 2021/04/19 17:01:45 christos Exp $
# compress: file(1) magic for pure-compression formats (no archives)
#
# compress, gzip, pack, compact, huf, squeeze, crunch, freeze, yabba, etc.
@@ -265,14 +265,13 @@
# http://tukaani.org/xz/xz-file-format.txt
0 ustring \xFD7zXZ\x00 XZ compressed data, checksum
+!:strength * 2
+!:mime application/x-xz
>7 byte&0xf 0x0 NONE
>7 byte&0xf 0x1 CRC32
>7 byte&0xf 0x4 CRC64
>7 byte&0xf 0xa SHA-256
-!:strength * 2
-!:mime application/x-xz
-
# https://github.com/ckolivas/lrzip/blob/master/doc/magic.header.txt
0 string LRZI LRZIP compressed data
>4 byte x - version %d

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
<!DOCTYPE pkgmetadata SYSTEM "https://www.gentoo.org/dtd/metadata.dtd">
<pkgmetadata>
<maintainer type="project">
<email>base-system@gentoo.org</email>