distcc: update to 3.4.
This commit is contained in:
parent
46ce787b63
commit
747c3088f2
4 changed files with 145 additions and 10 deletions
|
@ -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;
|
15
srcpkgs/distcc/patches/gcc-10.patch
Normal file
15
srcpkgs/distcc/patches/gcc-10.patch
Normal file
|
@ -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" };
|
55
srcpkgs/distcc/patches/python-3.9.patch
Normal file
55
srcpkgs/distcc/patches/python-3.9.patch
Normal file
|
@ -0,0 +1,55 @@
|
|||
From 83e030a852daf1d4d8c906e46f86375d421b781e Mon Sep 17 00:00:00 2001
|
||||
From: hephooey <hephooey@users.noreply.github.com>
|
||||
Date: Sun, 15 Jan 2023 15:43:50 -0500
|
||||
Subject: [PATCH] Replace int with Py_ssize_t for distcc pump extension
|
||||
|
||||
Defining PY_SSIZE_T_CLEAN is required since python 3.10, and I have to
|
||||
modify the type of length to match it. Otherwise functions like
|
||||
OsPathExists will always return False.
|
||||
|
||||
The PY_SSIZE_T_CLEAN macro is supported at least back to python 3.5
|
||||
according to docs.python.org, that is why I included it without any
|
||||
python version conditions
|
||||
---
|
||||
.../c_extensions/distcc_pump_c_extensions_module.c | 7 ++++---
|
||||
1 file changed, 4 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/include_server/c_extensions/distcc_pump_c_extensions_module.c b/include_server/c_extensions/distcc_pump_c_extensions_module.c
|
||||
index 763dd425..a4c6e9eb 100644
|
||||
--- a/include_server/c_extensions/distcc_pump_c_extensions_module.c
|
||||
+++ b/include_server/c_extensions/distcc_pump_c_extensions_module.c
|
||||
@@ -21,6 +21,7 @@
|
||||
/* distcc_pump_c_extensions_module.c -- Python bindings for distcc-pump
|
||||
* extensions */
|
||||
|
||||
+#define PY_SSIZE_T_CLEAN
|
||||
#include "Python.h"
|
||||
|
||||
static const char *version = ".01";
|
||||
@@ -56,7 +57,7 @@ static PyObject *
|
||||
CompressLzo1xAlloc(PyObject *dummy, PyObject *args) {
|
||||
PyObject *string_object;
|
||||
const char *in_buf;
|
||||
- int in_len;
|
||||
+ Py_ssize_t in_len;
|
||||
char *out_buf;
|
||||
size_t out_len;
|
||||
UNUSED(dummy);
|
||||
@@ -241,7 +242,7 @@ static /* const */ char OsPathExists_doc__[] =
|
||||
static PyObject *
|
||||
OsPathExists(PyObject *dummy, PyObject *args) {
|
||||
const char *in;
|
||||
- int len;
|
||||
+ Py_ssize_t len;
|
||||
int res;
|
||||
|
||||
struct stat buf;
|
||||
@@ -275,7 +276,7 @@ static /* const */ char OsPathIsFile_doc__[] =
|
||||
static PyObject *
|
||||
OsPathIsFile(PyObject *dummy, PyObject *args) {
|
||||
const char *in;
|
||||
- int len;
|
||||
+ Py_ssize_t len;
|
||||
int res;
|
||||
|
||||
struct stat buf;
|
|
@ -1,23 +1,23 @@
|
|||
# Template file for 'distcc'
|
||||
pkgname=distcc
|
||||
version=3.3.3
|
||||
revision=7
|
||||
version=3.4
|
||||
revision=1
|
||||
build_style=gnu-configure
|
||||
configure_args="--disable-Werror"
|
||||
conf_files="
|
||||
/etc/distcc/hosts
|
||||
/etc/distcc/clients.allow"
|
||||
/etc/distcc/hosts
|
||||
/etc/distcc/clients.allow"
|
||||
hostmakedepends="automake libtool pkg-config which"
|
||||
makedepends="binutils-devel popt-devel avahi-libs-devel"
|
||||
checkdepends="procps-ng"
|
||||
short_desc="Distributed compilation for faster C/C++ builds"
|
||||
maintainer="Orphaned <orphan@voidlinux.org>"
|
||||
license="GPL-2.0-or-later"
|
||||
homepage="https://distcc.github.io"
|
||||
distfiles="https://github.com/distcc/distcc/releases/download/v${version}/distcc-${version}.tar.gz"
|
||||
checksum=bead25471d5a53ecfdf8f065a6fe48901c14d5008956c318c700e56bc87bf0bc
|
||||
conflicts="chroot-distcc>=0"
|
||||
checksum=2b99edda9dad9dbf283933a02eace6de7423fe5650daa4a728c950e5cd37bd7d
|
||||
|
||||
CFLAGS="-fcommon"
|
||||
disable_parallel_check=yes
|
||||
|
||||
subpackages=" "
|
||||
|
||||
|
@ -43,13 +43,13 @@ post_install() {
|
|||
|
||||
# cc wrappers
|
||||
vmkdir usr/lib/distcc/bin
|
||||
for f in gcc cc c++ g++ clang clang++; do
|
||||
for f in gcc cc c++ g++ clang clang++ cpp; do
|
||||
ln -sfr ${DESTDIR}/usr/bin/distcc ${DESTDIR}/usr/lib/distcc/bin/${f}
|
||||
done
|
||||
# cross-gcc wrappers
|
||||
for x in arm-linux-gnueabi arm-linux-gnueabihf armv7l-linux-gnueabihf \
|
||||
arm-linux-musleabihf armv7l-linux-musleabihf; do
|
||||
for f in gcc cc c++ g++; do
|
||||
arm-linux-musleabihf armv7l-linux-musleabihf aarch64-linux-gnu aarch64-linux-musl; do
|
||||
for f in gcc cc c++ g++ cpp; do
|
||||
ln -sfr ${DESTDIR}/usr/bin/distcc ${DESTDIR}/usr/lib/distcc/bin/${x}-${f}
|
||||
done
|
||||
done
|
||||
|
|
Loading…
Add table
Reference in a new issue