aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew J. Hesford <ajh@sideband.org>2021-01-29 04:27:49 +0000
committerAndrew J. Hesford <48421688+ahesford@users.noreply.github.com>2021-01-30 14:16:33 +0000
commit26ec8902ecffcf25e82059ef3c9890fa71bd511c (patch)
tree8eab2191e7dc8d064238546b801eac17f2c3f3a4
parent43f3ca3dbaad456bde5d2f244f32e3179efae1b5 (diff)
downloadvoid-packages-26ec8902ecffcf25e82059ef3c9890fa71bd511c.tar
void-packages-26ec8902ecffcf25e82059ef3c9890fa71bd511c.tar.gz
void-packages-26ec8902ecffcf25e82059ef3c9890fa71bd511c.tar.bz2
void-packages-26ec8902ecffcf25e82059ef3c9890fa71bd511c.tar.lz
void-packages-26ec8902ecffcf25e82059ef3c9890fa71bd511c.tar.xz
void-packages-26ec8902ecffcf25e82059ef3c9890fa71bd511c.tar.zst
void-packages-26ec8902ecffcf25e82059ef3c9890fa71bd511c.zip
lxc: update to 4.0.6.
-rw-r--r--srcpkgs/lxc/patches/fix-config-parsing.patch169
-rw-r--r--srcpkgs/lxc/patches/fix-rootfs-mount.patch27
-rw-r--r--srcpkgs/lxc/template11
3 files changed, 5 insertions, 202 deletions
diff --git a/srcpkgs/lxc/patches/fix-config-parsing.patch b/srcpkgs/lxc/patches/fix-config-parsing.patch
deleted file mode 100644
index cbb435c3e4a..00000000000
--- a/srcpkgs/lxc/patches/fix-config-parsing.patch
+++ /dev/null
@@ -1,169 +0,0 @@
-From 26dffd825842edf019bc17da24a6809ed51c048c Mon Sep 17 00:00:00 2001
-From: Christian Brauner <christian.brauner@ubuntu.com>
-Date: Mon, 16 Nov 2020 12:18:14 +0100
-Subject: [PATCH] parse: rework config parsing routine
-
-Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
----
- src/lxc/file_utils.c | 7 +++++--
- src/lxc/file_utils.h | 6 +++++-
- src/lxc/parse.c | 49 ++++++++++++++++++++++++--------------------
- 3 files changed, 37 insertions(+), 25 deletions(-)
-
-diff --git src/lxc/file_utils.c src/lxc/file_utils.c
-index fafaba354c..3b4bffb399 100644
---- src/lxc/file_utils.c
-+++ src/lxc/file_utils.c
-@@ -382,8 +382,10 @@ ssize_t lxc_sendfile_nointr(int out_fd, int in_fd, off_t *offset, size_t count)
- return ret;
- }
-
--int fd_to_fd(int from, int to)
-+ssize_t __fd_to_fd(int from, int to)
- {
-+ ssize_t total_bytes = 0;
-+
- for (;;) {
- uint8_t buf[PATH_MAX];
- uint8_t *p = buf;
-@@ -407,9 +409,10 @@ int fd_to_fd(int from, int to)
- bytes_to_write -= bytes_written;
- p += bytes_written;
- } while (bytes_to_write > 0);
-+ total_bytes += bytes_to_write;
- }
-
-- return 0;
-+ return total_bytes;
- }
-
- int fd_to_buf(int fd, char **buf, size_t *length)
-diff --git src/lxc/file_utils.h src/lxc/file_utils.h
-index ea9570dd18..11acdb3a7b 100644
---- src/lxc/file_utils.h
-+++ src/lxc/file_utils.h
-@@ -68,7 +68,11 @@ __hidden extern FILE *fopen_cloexec(const char *path, const char *mode);
- __hidden extern ssize_t lxc_sendfile_nointr(int out_fd, int in_fd, off_t *offset, size_t count);
- __hidden extern char *file_to_buf(const char *path, size_t *length);
- __hidden extern int fd_to_buf(int fd, char **buf, size_t *length);
--__hidden extern int fd_to_fd(int from, int to);
-+__hidden extern ssize_t __fd_to_fd(int from, int to);
-+static inline int fd_to_fd(int from, int to)
-+{
-+ return __fd_to_fd(from, to) >= 0;
-+}
- __hidden extern int lxc_open_dirfd(const char *dir);
- __hidden extern FILE *fdopen_cached(int fd, const char *mode, void **caller_freed_buffer);
- __hidden extern FILE *fopen_cached(const char *path, const char *mode, void **caller_freed_buffer);
-diff --git src/lxc/parse.c src/lxc/parse.c
-index 291bf3efc1..5a5b853458 100644
---- src/lxc/parse.c
-+++ src/lxc/parse.c
-@@ -5,6 +5,7 @@
- #endif
- #include <dirent.h>
- #include <errno.h>
-+#include <limits.h>
- #include <stdio.h>
- #include <stdlib.h>
- #include <string.h>
-@@ -50,11 +51,12 @@ int lxc_strmunmap(void *addr, size_t length)
-
- int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *data)
- {
-- int saved_errno;
-- ssize_t ret = -1, bytes_sent;
-- char *line;
-- int fd = -1, memfd = -1;
-+ __do_close int fd = -EBADF, memfd = -EBADF;
-+ ssize_t ret = -1;
- char *buf = NULL;
-+ struct stat st = {};
-+ ssize_t bytes;
-+ char *line;
-
- memfd = memfd_create(".lxc_config_file", MFD_CLOEXEC);
- if (memfd < 0) {
-@@ -65,8 +67,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
- goto on_error;
- }
-
-- TRACE("Failed to create in-memory file. Falling back to "
-- "temporary file");
-+ TRACE("Failed to create in-memory file. Falling back to temporary file");
- memfd = lxc_make_tmpfile(template, true);
- if (memfd < 0) {
- SYSERROR("Failed to create temporary file \"%s\"", template);
-@@ -80,10 +81,21 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
- goto on_error;
- }
-
-- /* sendfile() handles up to 2GB. No config file should be that big. */
-- bytes_sent = lxc_sendfile_nointr(memfd, fd, NULL, LXC_SENDFILE_MAX);
-- if (bytes_sent < 0) {
-- SYSERROR("Failed to sendfile \"%s\"", file);
-+ ret = fstat(fd, &st);
-+ if (ret) {
-+ SYSERROR("Failed to stat file \"%s\"", file);
-+ goto on_error;
-+ }
-+
-+ if (st.st_size > INT_MAX) {
-+ SYSERROR("Excessively large config file \"%s\"", file);
-+ goto on_error;
-+ }
-+
-+
-+ bytes = __fd_to_fd(fd, memfd);
-+ if (bytes < 0) {
-+ SYSERROR("Failed to copy config file \"%s\"", file);
- goto on_error;
- }
-
-@@ -92,7 +104,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
- SYSERROR("Failed to append zero byte");
- goto on_error;
- }
-- bytes_sent++;
-+ bytes++;
-
- ret = lseek(memfd, 0, SEEK_SET);
- if (ret < 0) {
-@@ -101,8 +113,7 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
- }
-
- ret = -1;
-- buf = mmap(NULL, bytes_sent, PROT_READ | PROT_WRITE,
-- MAP_SHARED | MAP_POPULATE, memfd, 0);
-+ buf = mmap(NULL, bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_POPULATE, memfd, 0);
- if (buf == MAP_FAILED) {
- buf = NULL;
- SYSERROR("Failed to mmap");
-@@ -117,24 +128,18 @@ int lxc_file_for_each_line_mmap(const char *file, lxc_file_cb callback, void *da
- * error.
- */
- if (ret < 0)
-- ERROR("Failed to parse config file \"%s\" at "
-- "line \"%s\"", file, line);
-+ ERROR("Failed to parse config file \"%s\" at line \"%s\"",
-+ file, line);
- break;
- }
- }
-
- on_error:
-- saved_errno = errno;
-- if (fd >= 0)
-- close(fd);
-- if (memfd >= 0)
-- close(memfd);
-- if (buf && munmap(buf, bytes_sent)) {
-+ if (buf && munmap(buf, bytes)) {
- SYSERROR("Failed to unmap");
- if (ret == 0)
- ret = -1;
- }
-- errno = saved_errno;
-
- return ret;
- }
diff --git a/srcpkgs/lxc/patches/fix-rootfs-mount.patch b/srcpkgs/lxc/patches/fix-rootfs-mount.patch
deleted file mode 100644
index f4465b6277e..00000000000
--- a/srcpkgs/lxc/patches/fix-rootfs-mount.patch
+++ /dev/null
@@ -1,27 +0,0 @@
-From 26ea5533c941baee14923dfc3edfb9c91666d245 Mon Sep 17 00:00:00 2001
-From: Christian Brauner <christian.brauner@ubuntu.com>
-Date: Mon, 14 Dec 2020 17:52:44 +0100
-Subject: [PATCH] conf: fix block-device based rootfs mounting
-
-Fixes: #3598
-Cc: stable-4.0
-Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com>
----
- src/lxc/conf.c | 4 ++++
- 1 file changed, 4 insertions(+)
-
-diff --git src/lxc/conf.c src/lxc/conf.c
-index 9f631e0c23..27f9706687 100644
---- src/lxc/conf.c
-+++ src/lxc/conf.c
-@@ -3135,6 +3135,10 @@ int lxc_setup_rootfs_prepare_root(struct lxc_conf *conf, const char *name,
- if (ret < 0)
- return log_error(-1, "Failed to bind mount container / onto itself");
-
-+ conf->rootfs.mntpt_fd = openat(-EBADF, path, O_RDONLY | O_CLOEXEC | O_DIRECTORY | O_PATH | O_NOCTTY);
-+ if (conf->rootfs.mntpt_fd < 0)
-+ return log_error_errno(-errno, errno, "Failed to open file descriptor for container rootfs");
-+
- return log_trace(0, "Bind mounted container / onto itself");
- }
-
diff --git a/srcpkgs/lxc/template b/srcpkgs/lxc/template
index 03fbeb400f5..4e74c364b8d 100644
--- a/srcpkgs/lxc/template
+++ b/srcpkgs/lxc/template
@@ -1,9 +1,7 @@
# Template file for 'lxc'
-_desc="Linux Containers"
-
pkgname=lxc
-version=4.0.5
-revision=3
+version=4.0.6
+revision=1
build_style=gnu-configure
configure_args="--enable-doc --enable-seccomp
--enable-capabilities --enable-apparmor --with-distro=none
@@ -11,12 +9,13 @@ configure_args="--enable-doc --enable-seccomp
hostmakedepends="automake libtool pkg-config docbook2x"
makedepends="libcap-devel libseccomp-devel gnutls-devel libapparmor-devel"
depends="xz wget gnupg"
+_desc="Linux Containers"
short_desc="${_desc} - utilities"
maintainer="Cameron Nemo <cnemo@tutanota.com>"
-homepage="https://linuxcontainers.org"
license="LGPL-2.1-or-later"
+homepage="https://linuxcontainers.org"
distfiles="https://linuxcontainers.org/downloads/lxc-${version}.tar.gz"
-checksum=af2cd616d5ab689e5d2305361c6571b5e632afd7eaab1754cca1670446a2e6a4
+checksum=9165dabc0bb6ef7f2fda2009aee90b20fbefe77ed8008347e9f06048eba1e463
conf_files="/etc/lxc/default.conf"
make_dirs="