aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancesco Colista <fcolista@alpinelinux.org>2020-08-05 07:06:38 +0000
committerFrancesco Colista <fcolista@alpinelinux.org>2020-08-05 07:07:47 +0000
commit740a5cf92a47b2ec90a429209f270426ed0fa28c (patch)
treeb38c65532f2ffe9a70a11234086435b7113d6e93
parente58991972afb5a1d00694776f46e65df69dd1203 (diff)
downloadaports-740a5cf92a47b2ec90a429209f270426ed0fa28c.tar.gz
aports-740a5cf92a47b2ec90a429209f270426ed0fa28c.tar.bz2
aports-740a5cf92a47b2ec90a429209f270426ed0fa28c.tar.xz
main/libvirt: fix lock issues
-rw-r--r--main/libvirt/APKBUILD6
-rw-r--r--main/libvirt/libvirt-fork-usage.patch109
2 files changed, 113 insertions, 2 deletions
diff --git a/main/libvirt/APKBUILD b/main/libvirt/APKBUILD
index 73697ea2c7..3354110114 100644
--- a/main/libvirt/APKBUILD
+++ b/main/libvirt/APKBUILD
@@ -2,7 +2,7 @@
pkgname=libvirt
pkgver=6.6.0
_ver="${pkgver/_rc/-rc}"
-pkgrel=0
+pkgrel=1
pkgdesc="A virtualization API for several hypervisor and container systems"
url="https://libvirt.org/"
arch="all"
@@ -33,6 +33,7 @@ source="https://libvirt.org/sources/libvirt-$pkgver.tar.xz
virtlockd.initd
musl-fix-includes.patch
stderr-fix.patch
+ libvirt-fork-usage.patch
"
if [ "$CARCH" = "x86_64" ]; then
subpackages="$subpackages $pkgname-xen"
@@ -196,4 +197,5 @@ sha512sums="55091addcf43d3c0bdd50f9378b588351181d191272d5a19220a0babe0893c1f6e0f
36b85f473d292be8df415256d01a562131d8ae61450ba3893658090a12d589ca32215382f56f286a830b4e59ffd98fbe1d92004f2ce14ca0834451b943cd8f2f virtlogd.initd
a4c4d26e4111931acbe7594451bf963a36c8db33c64b1bc447ab4758bb92803510bebee0511d6bc16ba80c289ab6f87e74377d47bf560412f9adb9c161a206d9 virtlockd.initd
dfe042c596028125bf8548115de2922683829c4716f6b0efb8efc38518670e3e848481661b9714bb0664c1022b87e8f3c0773611fe10187b0bc588e2336ada0c musl-fix-includes.patch
-d32551d56eae2c33bab7571964f76421336967918c293cd1d18fc66626a7ead3551b5672a9e3fc3d8b7bca82cc0abb17e428ee8271d04d73bc06fd16309918b3 stderr-fix.patch"
+d32551d56eae2c33bab7571964f76421336967918c293cd1d18fc66626a7ead3551b5672a9e3fc3d8b7bca82cc0abb17e428ee8271d04d73bc06fd16309918b3 stderr-fix.patch
+ebf168ba78dacf833492a76173b0333a5985eb89d07db89eafcd9254978cbc630adc95e105cc34ef320bec2f3aefd69690d4905e73ce4c15e7506175a7508b57 libvirt-fork-usage.patch"
diff --git a/main/libvirt/libvirt-fork-usage.patch b/main/libvirt/libvirt-fork-usage.patch
new file mode 100644
index 0000000000..2cd6f27cf8
--- /dev/null
+++ b/main/libvirt/libvirt-fork-usage.patch
@@ -0,0 +1,109 @@
+diff --git a/src/util/vircommand.c b/src/util/vircommand.c
+index 76f7eb9a3d..a73fa222c6 100644
+--- a/src/util/vircommand.c
++++ b/src/util/vircommand.c
+@@ -719,18 +719,12 @@ virExec(virCommandPtr cmd)
+ goto fork_error;
+
+ if (prepareStdFd(childin, STDIN_FILENO) < 0) {
+- virReportSystemError(errno,
+- "%s", _("failed to setup stdin file handle"));
+ goto fork_error;
+ }
+ if (childout > 0 && prepareStdFd(childout, STDOUT_FILENO) < 0) {
+- virReportSystemError(errno,
+- "%s", _("failed to setup stdout file handle"));
+ goto fork_error;
+ }
+ if (childerr > 0 && prepareStdFd(childerr, STDERR_FILENO) < 0) {
+- virReportSystemError(errno,
+- "%s", _("failed to setup stderr file handle"));
+ goto fork_error;
+ }
+
+@@ -743,9 +737,6 @@ virExec(virCommandPtr cmd)
+ VIR_FORCE_CLOSE(childerr);
+ VIR_FORCE_CLOSE(null);
+
+- /* Initialize full logging for a while */
+- virLogSetFromEnv();
+-
+ if (cmd->pidfile &&
+ virPipe(pipesync) < 0)
+ goto fork_error;
+@@ -756,21 +747,15 @@ virExec(virCommandPtr cmd)
+ char c;
+
+ if (setsid() < 0) {
+- virReportSystemError(errno,
+- "%s", _("cannot become session leader"));
+ goto fork_error;
+ }
+
+ if (chdir("/") < 0) {
+- virReportSystemError(errno,
+- "%s", _("cannot change to root directory"));
+ goto fork_error;
+ }
+
+ pid = fork();
+ if (pid < 0) {
+- virReportSystemError(errno,
+- "%s", _("cannot fork child process"));
+ goto fork_error;
+ }
+
+@@ -779,8 +764,6 @@ virExec(virCommandPtr cmd)
+ * exiting. Wait here for the child to write it and signal us. */
+ if (cmd->pidfile &&
+ saferead(pipesync[0], &c, sizeof(c)) != sizeof(c)) {
+- virReportSystemError(errno, "%s",
+- _("Unable to wait for child process"));
+ _exit(EXIT_FAILURE);
+ }
+ _exit(EXIT_SUCCESS);
+@@ -804,14 +787,11 @@ virExec(virCommandPtr cmd)
+ if (pidfilefd < 0)
+ goto fork_error;
+ if (virSetInherit(pidfilefd, true) < 0) {
+- virReportSystemError(errno, "%s",
+- _("Cannot disable close-on-exec flag"));
+ goto fork_error;
+ }
+
+ c = '1';
+ if (safewrite(pipesync[1], &c, sizeof(c)) != sizeof(c)) {
+- virReportSystemError(errno, "%s", _("Unable to notify child process"));
+ goto fork_error;
+ }
+ VIR_FORCE_CLOSE(pipesync[0]);
+@@ -821,9 +801,7 @@ virExec(virCommandPtr cmd)
+ }
+
+ if (cmd->hook) {
+- VIR_DEBUG("Run hook %p %p", cmd->hook, cmd->opaque);
+ ret = cmd->hook(cmd->opaque);
+- VIR_DEBUG("Done hook %d", ret);
+ if (ret < 0)
+ goto fork_error;
+ }
+@@ -860,18 +838,12 @@ virExec(virCommandPtr cmd)
+ if (virCommandHandshakeChild(cmd) < 0)
+ goto fork_error;
+
+- /* Close logging again to ensure no FDs leak to child */
+- virLogReset();
+-
+ if (cmd->env)
+ execve(binary, cmd->args, cmd->env);
+ else
+ execv(binary, cmd->args);
+
+ ret = errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE;
+- virReportSystemError(errno,
+- _("cannot execute binary %s"),
+- cmd->args[0]);
+
+ fork_error:
+ virDispatchError(NULL);
+