chroot-distcc: update to 3.4.
This commit is contained in:
parent
d14f4f3fab
commit
46ce787b63
|
@ -0,0 +1,65 @@
|
||||||
|
commit 879b71d6e95673e58d33f6c3c341a893ee307161
|
||||||
|
Author: Alexey Sheplyakov <asheplyakov@yandex.ru>
|
||||||
|
Date: Sat Jul 10 22:18:14 2021 +0400
|
||||||
|
|
||||||
|
dcc_gcc_rewrite_fqn: avoid heap corruption
|
||||||
|
|
||||||
|
On ALT Linux I've run into the following bug:
|
||||||
|
|
||||||
|
distcc gcc -Wall -std=gnu89 -I. -O2 -o hello.o -c hello.c
|
||||||
|
free(): invalid next size (fast)
|
||||||
|
Aborted (core dumped)
|
||||||
|
|
||||||
|
Apparently dcc_gcc_rewrite writes beyond the allocated memory:
|
||||||
|
|
||||||
|
valgrind --leak-check=full -v ./distcc gcc -Wall -std=gnu89 -I. -O2 -o hello.o -c hello.c
|
||||||
|
|
||||||
|
==11382== ERROR SUMMARY: 53 errors from 5 contexts (suppressed: 0 from 0)
|
||||||
|
==11382==
|
||||||
|
==11382== 1 errors in context 1 of 5:
|
||||||
|
==11382== Invalid write of size 1
|
||||||
|
==11382== at 0x4C349D8: strcat (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
|
||||||
|
==11382== by 0x10D165: dcc_gcc_rewrite_fqn (compile.c:611)
|
||||||
|
==11382== by 0x10D4B4: dcc_build_somewhere (compile.c:725)
|
||||||
|
==11382== by 0x10DC01: dcc_build_somewhere_timed (compile.c:1014)
|
||||||
|
==11382== by 0x10E380: main (distcc.c:352)
|
||||||
|
==11382== Address 0x544e828 is 1 bytes after a block of size 23 alloc'd
|
||||||
|
==11382== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
|
||||||
|
==11382== by 0x10D087: dcc_gcc_rewrite_fqn (compile.c:588)
|
||||||
|
==11382== by 0x10D4B4: dcc_build_somewhere (compile.c:725)
|
||||||
|
==11382== by 0x10DC01: dcc_build_somewhere_timed (compile.c:1014)
|
||||||
|
==11382== by 0x10E380: main (distcc.c:352)
|
||||||
|
==11382==
|
||||||
|
==11382==
|
||||||
|
==11382== 1 errors in context 2 of 5:
|
||||||
|
==11382== Invalid write of size 1
|
||||||
|
==11382== at 0x4C349C8: strcat (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
|
||||||
|
==11382== by 0x10D165: dcc_gcc_rewrite_fqn (compile.c:611)
|
||||||
|
==11382== by 0x10D4B4: dcc_build_somewhere (compile.c:725)
|
||||||
|
==11382== by 0x10DC01: dcc_build_somewhere_timed (compile.c:1014)
|
||||||
|
==11382== by 0x10E380: main (distcc.c:352)
|
||||||
|
==11382== Address 0x544e827 is 0 bytes after a block of size 23 alloc'd
|
||||||
|
==11382== at 0x4C31B0F: malloc (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
|
||||||
|
==11382== by 0x10D087: dcc_gcc_rewrite_fqn (compile.c:588)
|
||||||
|
==11382== by 0x10D4B4: dcc_build_somewhere (compile.c:725)
|
||||||
|
==11382== by 0x10DC01: dcc_build_somewhere_timed (compile.c:1014)
|
||||||
|
==11382== by 0x10E380: main (distcc.c:352)
|
||||||
|
|
||||||
|
and ALT Linux' hardened glibc does not quite like that.
|
||||||
|
Correctly compute the `newcmd_len` to avoid the problem.
|
||||||
|
|
||||||
|
ALTBUG: #40425
|
||||||
|
|
||||||
|
diff --git a/src/compile.c b/src/compile.c
|
||||||
|
index 34964566fdd6..26d7d1821501 100644
|
||||||
|
--- a/src/compile.c
|
||||||
|
+++ b/src/compile.c
|
||||||
|
@@ -584,7 +584,7 @@ static int dcc_gcc_rewrite_fqn(char **argv)
|
||||||
|
return -ENOENT;
|
||||||
|
|
||||||
|
|
||||||
|
- newcmd_len = strlen(target_with_vendor) + 1 + strlen(argv[0] + 1);
|
||||||
|
+ newcmd_len = strlen(target_with_vendor) + 1 + strlen(argv[0]) + 1;
|
||||||
|
newcmd = malloc(newcmd_len);
|
||||||
|
if (!newcmd)
|
||||||
|
return -ENOMEM;
|
|
@ -0,0 +1,15 @@
|
||||||
|
Upstream: Should be
|
||||||
|
Reason: Fixes compilation under gcc-10 which has -fno-common
|
||||||
|
|
||||||
|
diff --git a/src/stats.c b/src/stats.c
|
||||||
|
index 35dbf7d..76bfbee 100644
|
||||||
|
--- a/src/stats.c
|
||||||
|
+++ b/src/stats.c
|
||||||
|
@@ -82,7 +82,7 @@ struct statsdata {
|
||||||
|
char compiler[MAX_FILENAME_LEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
-const char *stats_text[20] = { "TCP_ACCEPT", "REJ_BAD_REQ", "REJ_OVERLOAD",
|
||||||
|
+extern const char *stats_text[20] = { "TCP_ACCEPT", "REJ_BAD_REQ", "REJ_OVERLOAD",
|
||||||
|
"COMPILE_OK", "COMPILE_ERROR", "COMPILE_TIMEOUT", "CLI_DISCONN",
|
||||||
|
"OTHER" };
|
|
@ -1,6 +1,6 @@
|
||||||
# Template file for 'chroot-distcc'
|
# Template file for 'chroot-distcc'
|
||||||
pkgname=chroot-distcc
|
pkgname=chroot-distcc
|
||||||
version=3.3.3
|
version=3.4
|
||||||
revision=1
|
revision=1
|
||||||
bootstrap=yes
|
bootstrap=yes
|
||||||
build_style=gnu-configure
|
build_style=gnu-configure
|
||||||
|
@ -12,24 +12,15 @@ maintainer="Enno Boland <gottox@voidlinux.org>"
|
||||||
license="GPL-2.0-or-later"
|
license="GPL-2.0-or-later"
|
||||||
homepage="https://distcc.github.io"
|
homepage="https://distcc.github.io"
|
||||||
distfiles="https://github.com/distcc/distcc/releases/download/v${version}/distcc-${version}.tar.gz"
|
distfiles="https://github.com/distcc/distcc/releases/download/v${version}/distcc-${version}.tar.gz"
|
||||||
checksum=bead25471d5a53ecfdf8f065a6fe48901c14d5008956c318c700e56bc87bf0bc
|
checksum=2b99edda9dad9dbf283933a02eace6de7423fe5650daa4a728c950e5cd37bd7d
|
||||||
repository=bootstrap
|
repository=bootstrap
|
||||||
|
|
||||||
conflicts="distcc>=0"
|
conflicts="distcc>=0"
|
||||||
CFLAGS="-fcommon"
|
|
||||||
|
|
||||||
if [ "$CHROOT_READY" ]; then
|
if [ "$CHROOT_READY" ]; then
|
||||||
makedepends="binutils-devel"
|
makedepends="binutils-devel"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
pre_configure() {
|
|
||||||
# Copy files generated by package distcc running autogen.sh
|
|
||||||
# Manual update is required for every new version
|
|
||||||
cp -p "${FILESDIR}"/configure ${wrksrc}
|
|
||||||
cp -p "${FILESDIR}"/Makefile.in ${wrksrc}
|
|
||||||
cp -p "${FILESDIR}"/config.h.in ${wrksrc}/src
|
|
||||||
}
|
|
||||||
|
|
||||||
post_install() {
|
post_install() {
|
||||||
local f x
|
local f x
|
||||||
# Remove useless files.
|
# Remove useless files.
|
||||||
|
@ -39,13 +30,13 @@ post_install() {
|
||||||
|
|
||||||
# gcc wrappers
|
# gcc wrappers
|
||||||
vmkdir usr/lib/distcc/bin
|
vmkdir usr/lib/distcc/bin
|
||||||
for f in gcc cc c++ g++; do
|
for f in gcc cc c++ g++ cpp; do
|
||||||
ln -sfr ${DESTDIR}/usr/bin/distcc ${DESTDIR}/usr/lib/distcc/bin/${f}
|
ln -sfr ${DESTDIR}/usr/bin/distcc ${DESTDIR}/usr/lib/distcc/bin/${f}
|
||||||
done
|
done
|
||||||
# cross-gcc wrappers
|
# cross-gcc wrappers
|
||||||
for x in arm-linux-gnueabi arm-linux-gnueabihf armv7l-linux-gnueabihf \
|
for x in arm-linux-gnueabi arm-linux-gnueabihf armv7l-linux-gnueabihf \
|
||||||
arm-linux-musleabihf armv7l-linux-musleabihf; do
|
arm-linux-musleabihf armv7l-linux-musleabihf aarch64-linux-gnu aarch64-linux-musl; do
|
||||||
for f in gcc cc c++ g++; do
|
for f in gcc cc c++ g++ cpp; do
|
||||||
ln -sfr ${DESTDIR}/usr/bin/distcc ${DESTDIR}/usr/lib/distcc/bin/${x}-${f}
|
ln -sfr ${DESTDIR}/usr/bin/distcc ${DESTDIR}/usr/lib/distcc/bin/${x}-${f}
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue