From df26c7469c1f2af2e643d43e2e32a6c9142e4885 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Wed, 11 Jan 2023 11:44:03 +0000 Subject: gentoo auto-resync : 11:01:2023 - 11:44:03 --- sys-apps/install-xattr/Manifest | 7 ++- ...stall-xattr-avoid-accessing-empty-storage.patch | 46 ++++++++++++++++++++ .../0002-install-xattr-fix-small-memory-leak.patch | 50 ++++++++++++++++++++++ sys-apps/install-xattr/install-xattr-0.8-r1.ebuild | 48 +++++++++++++++++++++ sys-apps/install-xattr/install-xattr-0.8.ebuild | 2 +- sys-apps/install-xattr/install-xattr-9999.ebuild | 23 +++++----- 6 files changed, 162 insertions(+), 14 deletions(-) create mode 100644 sys-apps/install-xattr/files/0.8/0001-install-xattr-avoid-accessing-empty-storage.patch create mode 100644 sys-apps/install-xattr/files/0.8/0002-install-xattr-fix-small-memory-leak.patch create mode 100644 sys-apps/install-xattr/install-xattr-0.8-r1.ebuild (limited to 'sys-apps/install-xattr') diff --git a/sys-apps/install-xattr/Manifest b/sys-apps/install-xattr/Manifest index 30dc00d7d06f..e3fd88c4b78c 100644 --- a/sys-apps/install-xattr/Manifest +++ b/sys-apps/install-xattr/Manifest @@ -1,4 +1,7 @@ +AUX 0.8/0001-install-xattr-avoid-accessing-empty-storage.patch 1493 BLAKE2B e0e2fc6beb906cae339275dfede7188bf95170f4efecfdeea8cc8aa65ecca7f353694120f123799f536fb5bb91e35f9d5c77fdd092f3768e22d8f26d1e8abdd2 SHA512 0df1f97066e3f9f5479c996d307b48039332bf555e2c8d4b64572d60fa4ac8f47d442c6be5ceb8281a11c47bba4d6f3bf204fd3434b04884cef6d43ef2193a35 +AUX 0.8/0002-install-xattr-fix-small-memory-leak.patch 2235 BLAKE2B 7149e3180ffddd658b20ba9e45593a4cee0f3610e26b28497a1e4f639b476e797f60f962cae573233fdbc1040b281301b6d4e3cc43875bec6a1ed739f6f82f42 SHA512 2ad58f650b8026dea0d32dee911d66438d5a7b13bea290b050f6e932496d35ff58189ba89a52d7b761589bba2865a58d3720eed7206d8199959b11750877ab30 DIST install-xattr-0.8.tar.bz2 16359 BLAKE2B 25c483211ea6d01f46d9739fd3f1327e543e8b986a252d97e8b012ff6169a9b6430dc0ab7c184bf04c6665182c242eb37f7059d2d23cecececea723bde74cb56 SHA512 3af95a724d95286854767fe28679b024de8d257ce2d21addecbd40906e10bf48cfd4263609c6c2f436c6a807e91d24118110fda041091fadbefd848c892af778 -EBUILD install-xattr-0.8.ebuild 1006 BLAKE2B 90eecf926ae3b82c957c6d961f37819e6a425320433ec8056e2270dc5394485940b549740e06bc935760417994a504052e0e1ebba016081abff8087a1b5401a9 SHA512 28aad2eb15ac7d13ef468e3feb0e456fec5caeedac2b758d5670e854cd2269ae6da88c1d8ddfed9826b37fa979e88b71a2cd539d6870520778e1c1b22c9007ea -EBUILD install-xattr-9999.ebuild 1007 BLAKE2B ad60a837a7388bb01f7c0e7af39ff536973143c9f75281952e45629345e11690d63cd1649032ce1f55448e6dbe56ba506ddb489175f1265cbf41fca55eeba589 SHA512 ce4545fee470b395c9d7b6df65f9bfdccff526e1de3a64976f45717713b6053c5bcf93fd9661642ac6ca294dcc49ba5d2a82e41b731f9faf93949964e2c57025 +EBUILD install-xattr-0.8-r1.ebuild 1018 BLAKE2B 7c3d247e86156a8f3fcf50556070d45e254632093be8d7dbe0f8c95b9b80ecde112dfd3d0dfc7beec6171ab8e23675fd27eba8e5f6e988e95cb993f9bbd1d7e8 SHA512 c483f8eb22102de8c875e58d3a7bb7e1e533ef4e1bfd382278597eb1aa649d5c5d45678203393077db3cfe30f0eef8f2ffe494f959ec71255a8d7c8c975b2a15 +EBUILD install-xattr-0.8.ebuild 1006 BLAKE2B ed568765285654f323b5d38b324c0da6c2cabf2c450c2fc7d9a31dec5a876adcb0275de1448c80bbce4619d259f6dd95e4aad376f196d2a41a97072ac345275e SHA512 0819e998357e972c89dfcb7257e155348df4aa854cbcfc4dfea01f4411ca8c1a607c0f14a1e8c55a676210d0b639935b6eaeca2c9ae0e0edb5d069614acf9506 +EBUILD install-xattr-9999.ebuild 971 BLAKE2B e9725d58e099850e6ca3b151e23a258c7dc680d115a7ec9be86edbac32cf3d5e4875713383da9438e7d3ce15a25d80560042c2c816ed9503dcd7004ebe34bc4c SHA512 94a6020f4baa8a123f2d97393fc5c2d55226211427f2d7f220f77cb1d713ad6c9d1aa7413cd137542bbc7308909d8686aa95a9e2b91ae294475078d815257b68 MISC metadata.xml 331 BLAKE2B e3b7ee18d397a8cf60b49d5c4eca33441306f8fcc993db82f5448ff157e0a2fbaf2c68aad458ee7fedec0bc88d0227ef179303b413e016f99b37da250e065226 SHA512 cf38b01cf7b8c471b1983a1906a95bbf1f492f4a94e4d8beb7802b72f9ad3ee365efd4971f16301acc0bb5ca8786ed5346cb218300ed12ddf4d1b98cbb77cadf diff --git a/sys-apps/install-xattr/files/0.8/0001-install-xattr-avoid-accessing-empty-storage.patch b/sys-apps/install-xattr/files/0.8/0001-install-xattr-avoid-accessing-empty-storage.patch new file mode 100644 index 000000000000..b77f74635e48 --- /dev/null +++ b/sys-apps/install-xattr/files/0.8/0001-install-xattr-avoid-accessing-empty-storage.patch @@ -0,0 +1,46 @@ +https://github.com/gentoo/elfix/pull/3 + +From 2a0dffbf0080dc74f82910a74f051d835cfd653f Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Fri, 6 Jan 2023 03:06:50 +0000 +Subject: [PATCH 1/2] install-xattr: avoid accessing empty storage + +UBSAN reports: +``` +install-xattr.c:124:16: runtime error: load of address 0x55555556d440 with insufficient space for an object of type 'char' +0x55555556d440: note: pointer points here + 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 61 00 00 00 + ^ + #0 0x555555557a27 in copyxattr /home/sam/git/elfix//install-xattr.c:124 + #1 0x555555556a4d in main /home/sam/git/elfix//install-xattr.c:410 + #2 0x7ffff77c864f (/usr/lib64/libc.so.6+0x2364f) + #3 0x7ffff77c8708 in __libc_start_main (/usr/lib64/libc.so.6+0x23708) + #4 0x555555557114 in _start (/home/sam/git/elfix//install-xattr+0x3114) +``` + +Triggered with: +``` +mkdir /tmp/a +touch /tmp/foo +./install-xattr -c /tmp/foo /tmp/foo2 /tmp/a +``` + +I don't see this with Clang or < GCC 12, but I do with GCC 13 (13.0.0_pre20230101 p5); +I suspect it's because of object-size improvements. + +Signed-off-by: Sam James +--- a/install-xattr.c ++++ b/install-xattr.c +@@ -119,6 +119,10 @@ copyxattr(const char *source, const char *target) + lxattr = xmalloc(lsize); + xlistxattr(source, lxattr, lsize); + ++ /* There's no xattrs at all. */ ++ if (lsize == 0) ++ return; ++ + i = 0; + while (1) { + while (lxattr[i++] == 0) +-- +2.39.0 diff --git a/sys-apps/install-xattr/files/0.8/0002-install-xattr-fix-small-memory-leak.patch b/sys-apps/install-xattr/files/0.8/0002-install-xattr-fix-small-memory-leak.patch new file mode 100644 index 000000000000..91c9d8885b9e --- /dev/null +++ b/sys-apps/install-xattr/files/0.8/0002-install-xattr-fix-small-memory-leak.patch @@ -0,0 +1,50 @@ +https://github.com/gentoo/elfix/pull/3 + +From 776afeae92d2afd3340cd753abc58ccd8daba48f Mon Sep 17 00:00:00 2001 +From: Sam James +Date: Fri, 6 Jan 2023 06:39:30 +0000 +Subject: [PATCH 2/2] install-xattr: fix small memory leak + +There's another with strdup/malloc but it gets a bit messier +to fix so let's leave that for now (this is mostly about correctness +anyway, as the runtime of install-xattr is very small): +``` +Direct leak of 4097 byte(s) in 1 object(s) allocated from: + #0 0x7f4a2c22e257 in __interceptor_malloc /usr/src/debug/sys-devel/gcc-13.0.0_pre20230101/gcc-13-20230101/libsanitizer/asan/asan_malloc_linux.cpp:69 + #1 0x7f4a2c1d2b40 in __interceptor_realpath /usr/src/debug/sys-devel/gcc-13.0.0_pre20230101/gcc-13-20230101/libsanitizer/sanitizer_common/sanitizer_common_interceptors.inc:3904 + #2 0x55da3adf5629 in realpath /usr/include/bits/stdlib.h:42 + #3 0x55da3adf5629 in main /home/sam/git/elfix/install-xattr.c:252 +``` + +Signed-off-by: Sam James +--- a/install-xattr.c ++++ b/install-xattr.c +@@ -248,7 +248,6 @@ main(int argc, char* argv[]) + char *target = NULL; /* the target file or directory */ + char *path; /* path to the target file */ + +- char *mypath = realpath("/proc/self/exe", NULL); /* path to argv[0] */ + char *install; /* path to the system install */ + + struct stat s; /* test if a file is a regular file or a directory */ +@@ -353,7 +352,9 @@ main(int argc, char* argv[]) + case -1: + err(1, "fork() failed"); + +- case 0: ++ case 0: { ++ char *mypath = realpath("/proc/self/exe", NULL); /* path to argv[0] */ ++ + /* find system install avoiding mypath and portage_helper_path! */ + if (portage_helper_path) + portage_helper_canpath = realpath(portage_helper_path, NULL); +@@ -363,6 +364,7 @@ main(int argc, char* argv[]) + argv[0] = install; /* so coreutils' lib/program.c behaves */ + execv(install, argv); /* The kernel will free(install). */ + err(1, "execv() failed"); ++ } + + default: + wait(&status); +-- +2.39.0 diff --git a/sys-apps/install-xattr/install-xattr-0.8-r1.ebuild b/sys-apps/install-xattr/install-xattr-0.8-r1.ebuild new file mode 100644 index 000000000000..057386422bd1 --- /dev/null +++ b/sys-apps/install-xattr/install-xattr-0.8-r1.ebuild @@ -0,0 +1,48 @@ +# Copyright 1999-2023 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +DESCRIPTION="Wrapper to coreutils install to preserve Filesystem Extended Attributes" +HOMEPAGE="https://dev.gentoo.org/~blueness/install-xattr/" + +inherit flag-o-matic toolchain-funcs + +if [[ ${PV} == "9999" ]] ; then + EGIT_REPO_URI="https://anongit.gentoo.org/git/proj/elfix.git" + inherit git-r3 +else + SRC_URI="https://dev.gentoo.org/~blueness/install-xattr/${P}.tar.bz2" + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + S="${WORKDIR}"/${PN} +fi + +LICENSE="GPL-3" +SLOT="0" + +PATCHES=( + # Backports from master, drop on next release + "${FILESDIR}"/${PV} +) + +src_prepare() { + default + + tc-export CC + append-lfs-flags +} + +src_compile() { + if [[ ${PV} == "9999" ]] ; then + cd "${WORKDIR}/${P}/misc/${PN}" || die + fi + default +} + +src_install() { + if [[ ${PV} == "9999" ]] ; then + cd "${WORKDIR}/${P}/misc/${PN}" || die + fi + + emake DESTDIR="${ED}" install +} diff --git a/sys-apps/install-xattr/install-xattr-0.8.ebuild b/sys-apps/install-xattr/install-xattr-0.8.ebuild index 734046b5f3d7..d1df396b8af3 100644 --- a/sys-apps/install-xattr/install-xattr-0.8.ebuild +++ b/sys-apps/install-xattr/install-xattr-0.8.ebuild @@ -1,4 +1,4 @@ -# Copyright 1999-2022 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 EAPI=7 diff --git a/sys-apps/install-xattr/install-xattr-9999.ebuild b/sys-apps/install-xattr/install-xattr-9999.ebuild index 44b01b811bb3..bef83b301b9f 100644 --- a/sys-apps/install-xattr/install-xattr-9999.ebuild +++ b/sys-apps/install-xattr/install-xattr-9999.ebuild @@ -1,9 +1,9 @@ -# Copyright 1999-2020 Gentoo Authors +# Copyright 1999-2023 Gentoo Authors # Distributed under the terms of the GNU General Public License v2 -EAPI=7 +EAPI=8 -DESCRIPTION="Wrapper to coreutil's install to preserve Filesystem Extended Attributes" +DESCRIPTION="Wrapper to coreutils install to preserve Filesystem Extended Attributes" HOMEPAGE="https://dev.gentoo.org/~blueness/install-xattr/" inherit flag-o-matic toolchain-funcs @@ -13,17 +13,22 @@ if [[ ${PV} == "9999" ]] ; then inherit git-r3 else SRC_URI="https://dev.gentoo.org/~blueness/install-xattr/${P}.tar.bz2" - KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" - S=${WORKDIR}/${PN} + KEYWORDS="~alpha ~amd64 ~arm ~arm64 ~hppa ~ia64 ~loong ~m68k ~mips ~ppc ~ppc64 ~riscv ~s390 ~sparc ~x86" + S="${WORKDIR}"/${PN} fi LICENSE="GPL-3" SLOT="0" +PATCHES=( + "${FILESDIR}"/${PV} +) + src_prepare() { default + tc-export CC - append-cppflags "-D_FILE_OFFSET_BITS=64" + append-lfs-flags } src_compile() { @@ -37,10 +42,6 @@ src_install() { if [[ ${PV} == "9999" ]] ; then cd "${WORKDIR}/${P}/misc/${PN}" || die fi - DESTDIR=${ED} emake install -} -# We need to fix how tests are done -src_test() { - true + emake DESTDIR="${ED}" install } -- cgit v1.2.3