[lxc-devel] [distrobuilder/master] Support Arch Linux ARM
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/distrobuilder/pull/130 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === This resolves #129. From 071d0b92125f7f28e89e96699e3b1e4c1da41d64 Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Wed, 13 Feb 2019 13:05:35 +0100 Subject: [PATCH 1/3] shared: Add Arch Linux mapping Signed-off-by: Thomas Hipp --- shared/definition.go | 1 + shared/osarch.go | 7 +++ 2 files changed, 8 insertions(+) diff --git a/shared/definition.go b/shared/definition.go index 16f020e..367f13b 100644 --- a/shared/definition.go +++ b/shared/definition.go @@ -273,6 +273,7 @@ func (d *Definition) Validate() error { validMappings := []string{ "alpinelinux", + "archlinux", "centos", "debian", "gentoo", diff --git a/shared/osarch.go b/shared/osarch.go index 505c6e2..a3830ff 100644 --- a/shared/osarch.go +++ b/shared/osarch.go @@ -11,6 +11,12 @@ var alpineLinuxArchitectureNames = map[int]string{ osarch.ARCH_32BIT_ARMV7_LITTLE_ENDIAN: "armhf", } +var archLinuxArchitectureNames = map[int]string{ + osarch.ARCH_64BIT_INTEL_X86: "x86_64", + osarch.ARCH_32BIT_ARMV7_LITTLE_ENDIAN: "armv7", + osarch.ARCH_64BIT_ARMV8_LITTLE_ENDIAN: "aarch64", +} + var centosArchitectureNames = map[int]string{ osarch.ARCH_32BIT_INTEL_X86: "i386", } @@ -37,6 +43,7 @@ var gentooArchitectureNames = map[int]string{ var distroArchitecture = map[string]map[int]string{ "alpinelinux": alpineLinuxArchitectureNames, + "archlinux": archLinuxArchitectureNames, "centos": centosArchitectureNames, "debian": debianArchitectureNames, "gentoo": gentooArchitectureNames, From 1618bc5f62110b9ddd5a709c5181578d3438c4e4 Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Wed, 13 Feb 2019 13:08:14 +0100 Subject: [PATCH 2/3] sources: Support Arch Linux ARM Signed-off-by: Thomas Hipp --- sources/archlinux-http.go | 23 +-- 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/sources/archlinux-http.go b/sources/archlinux-http.go index f12ece2..86b38f2 100644 --- a/sources/archlinux-http.go +++ b/sources/archlinux-http.go @@ -27,7 +27,9 @@ func NewArchLinuxHTTP() *ArchLinuxHTTP { func (s *ArchLinuxHTTP) Run(definition shared.Definition, rootfsDir string) error { release := definition.Image.Release - if release == "" { + // Releases are only available for the x86_64 architecture. ARM only has + // a "latest" tarball. + if definition.Image.ArchitectureMapped == "x86_64" && release == "" { var err error // Get latest release @@ -37,10 +39,19 @@ func (s *ArchLinuxHTTP) Run(definition shared.Definition, rootfsDir string) erro } } - fname := fmt.Sprintf("archlinux-bootstrap-%s-%s.tar.gz", - release, definition.Image.ArchitectureMapped) - tarball := fmt.Sprintf("%s/%s/%s", definition.Source.URL, - release, fname) + var fname string + var tarball string + + if definition.Image.ArchitectureMapped == "x86_64" { + fname = fmt.Sprintf("archlinux-bootstrap-%s-%s.tar.gz", + release, definition.Image.ArchitectureMapped) + tarball = fmt.Sprintf("%s/%s/%s", definition.Source.URL, + release, fname) + } else { + fname = fmt.Sprintf("ArchLinuxARM-%s-latest.tar.gz", + definition.Image.ArchitectureMapped) + tarball = fmt.Sprintf("%s/os/%s", definition.Source.URL, fname) + } url, err := url.Parse(tarball) if err != nil { @@ -80,7 +91,7 @@ func (s *ArchLinuxHTTP) Run(definition shared.Definition, rootfsDir string) erro return err } - // Move everything inside 'root.x86_64' (which was is the tarball) to its + // Move everything inside 'root.' (which was is the tarball) to its // parent directory files, err := filepath.Glob(fmt.Sprintf("%s/*", filepath.Join(rootfsDir, "root."+definition.Image.ArchitectureMapped))) From d9aa951b845231199feea48b61f1bc76c4ac0d9d Mon Sep 17 00:00:00 2001 From: Thomas Hipp Date: Wed, 13 Feb 2019 14:29:09 +0100 Subject: [PATCH 3/3] pacman: Support Arch Linux ARM Signed-off-by: Thomas Hipp --- managers/pacman.go | 23 +-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/managers/pacman.go b/managers/pacman.go index f7cb17a..2b67c7d 100644 --- a/managers/pacman.go +++ b/managers/pacman.go @@ -4,6 +4,9 @@ import ( "fmt" "os" "path/filepath" + "runtime" + + lxd
[lxc-devel] [lxd/master] lxd: remove /proc/self/cmdline parsing
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5491 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Christian Brauner From 5e9002a3ff7026c879e2ec29d7dd0d3782ce7794 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 13 Feb 2019 23:40:52 +0100 Subject: [PATCH] lxd: remove /proc/self/cmdline parsing Signed-off-by: Christian Brauner --- lxd/main_nsexec.go | 53 +++--- 1 file changed, 12 insertions(+), 41 deletions(-) diff --git a/lxd/main_nsexec.go b/lxd/main_nsexec.go index c03a5d24f0..e78354add5 100644 --- a/lxd/main_nsexec.go +++ b/lxd/main_nsexec.go @@ -42,17 +42,10 @@ extern void forkproxy(); extern void forkuevent(); // Command line parsing and tracking -#define CMDLINE_SIZE (8 * PATH_MAX) -char cmdline_buf[CMDLINE_SIZE]; -char *cmdline_cur = NULL; -ssize_t cmdline_size = -1; +size_t cmdline_index = 0; -char* advance_arg(bool required) { - while (*cmdline_cur != 0) - cmdline_cur++; - - cmdline_cur++; - if (cmdline_size <= cmdline_cur - cmdline_buf) { +char* advance_arg(char *argv[], bool required) { + if (!argv[cmdline_index++]) { if (!required) return NULL; @@ -60,7 +53,7 @@ char* advance_arg(bool required) { _exit(1); } - return cmdline_cur; + return argv[cmdline_index]; } void error(char *msg) @@ -210,46 +203,24 @@ void attach_userns(int pid) { } } -__attribute__((constructor)) void init(void) { - int cmdline; - - // Extract arguments - cmdline = open("/proc/self/cmdline", O_RDONLY); - if (cmdline < 0) { - error("error: open"); - _exit(232); - } - - memset(cmdline_buf, 0, sizeof(cmdline_buf)); - if ((cmdline_size = read(cmdline, cmdline_buf, sizeof(cmdline_buf)-1)) < 0) { - close(cmdline); - error("error: read"); - _exit(232); - } - close(cmdline); - - // Skip the first argument (but don't fail on missing second argument) - cmdline_cur = cmdline_buf; - while (*cmdline_cur != 0) - cmdline_cur++; - cmdline_cur++; - if (cmdline_size <= cmdline_cur - cmdline_buf) { +__attribute__((constructor)) void init(int argc, char *argv[]) { + if (!argv[1]) { checkfeature(); return; } // Intercepts some subcommands - if (strcmp(cmdline_cur, "forkfile") == 0) + if (strcmp(argv[1], "forkfile") == 0) forkfile(); - else if (strcmp(cmdline_cur, "forkmount") == 0) + else if (strcmp(argv[1], "forkmount") == 0) forkmount(); - else if (strcmp(cmdline_cur, "forknet") == 0) + else if (strcmp(argv[1], "forknet") == 0) forknet(); - else if (strcmp(cmdline_cur, "forkproxy") == 0) + else if (strcmp(argv[1], "forkproxy") == 0) forkproxy(); - else if (strcmp(cmdline_cur, "forkuevent") == 0) + else if (strcmp(argv[1], "forkuevent") == 0) forkuevent(); - else if (strncmp(cmdline_cur, "-", 1) == 0 || strcmp(cmdline_cur, "daemon") == 0) + else if (strncmp(argv[1], "-", 1) == 0 || strcmp(argv[1], "daemon") == 0) checkfeature(); } */ ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxc/master] rexec: remove needless /proc/cmdline parsing
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxc/pull/2850 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Christian Brauner From 0c816b346788afa9d601766e31544fdcce67d780 Mon Sep 17 00:00:00 2001 From: Christian Brauner Date: Wed, 13 Feb 2019 23:08:11 +0100 Subject: [PATCH] rexec: remove needless /proc/cmdline parsing Signed-off-by: Christian Brauner --- src/lxc/rexec.c| 70 +++--- src/lxc/rexec.h| 2 +- src/lxc/tools/lxc_attach.c | 4 +-- 3 files changed, 8 insertions(+), 68 deletions(-) diff --git a/src/lxc/rexec.c b/src/lxc/rexec.c index 024728d85..17e1806fe 100644 --- a/src/lxc/rexec.c +++ b/src/lxc/rexec.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "config.h" #include "file_utils.h" @@ -39,58 +40,6 @@ #define LXC_MEMFD_REXEC_SEALS \ (F_SEAL_SEAL | F_SEAL_SHRINK | F_SEAL_GROW | F_SEAL_WRITE) -static int push_vargs(char *data, int data_length, char ***output) -{ - int num = 0; - char *cur = data; - - if (!data || *output) - return -1; - - *output = must_realloc(NULL, sizeof(**output)); - - while (cur < data + data_length) { - num++; - *output = must_realloc(*output, (num + 1) * sizeof(**output)); - - (*output)[num - 1] = cur; - cur += strlen(cur) + 1; - } - (*output)[num] = NULL; - return num; -} - -static int parse_exec_params(char ***argv, char ***envp) -{ - int ret; - char *cmdline = NULL, *env = NULL; - size_t cmdline_size, env_size; - - cmdline = file_to_buf("/proc/self/cmdline", _size); - if (!cmdline) - goto on_error; - - env = file_to_buf("/proc/self/environ", _size); - if (!env) - goto on_error; - - ret = push_vargs(cmdline, cmdline_size, argv); - if (ret <= 0) - goto on_error; - - ret = push_vargs(env, env_size, envp); - if (ret <= 0) - goto on_error; - - return 0; - -on_error: - free(env); - free(cmdline); - - return -1; -} - static int is_memfd(void) { int fd, saved_errno, seals; @@ -142,10 +91,9 @@ static void lxc_rexec_as_memfd(char **argv, char **envp, const char *memfd_name) errno = saved_errno; } -int lxc_rexec(const char *memfd_name) +int lxc_rexec(char *argv[], const char *memfd_name) { int ret; - char **argv = NULL, **envp = NULL; ret = is_memfd(); if (ret < 0 && ret == -ENOTRECOVERABLE) { @@ -157,15 +105,7 @@ int lxc_rexec(const char *memfd_name) return 0; } - ret = parse_exec_params(, ); - if (ret < 0) { - fprintf(stderr, - "%s - Failed to parse command line parameters\n", - strerror(errno)); - return -1; - } - - lxc_rexec_as_memfd(argv, envp, memfd_name); + lxc_rexec_as_memfd(argv, environ, memfd_name); fprintf(stderr, "%s - Failed to rexec as memfd\n", strerror(errno)); return -1; } @@ -177,9 +117,9 @@ int lxc_rexec(const char *memfd_name) * container are in the same user namespace or have set up an identity id * mapping: CVE-2019-5736. */ -__attribute__((constructor)) static void liblxc_rexec(void) +__attribute__((constructor)) static void liblxc_rexec(int argc, char *argv[]) { - if (getenv("LXC_MEMFD_REXEC") && lxc_rexec("liblxc")) { + if (getenv("LXC_MEMFD_REXEC") && lxc_rexec(argv, "liblxc")) { fprintf(stderr, "Failed to re-execute liblxc via memory file descriptor\n"); _exit(EXIT_FAILURE); } diff --git a/src/lxc/rexec.h b/src/lxc/rexec.h index 088ded932..ba612d969 100644 --- a/src/lxc/rexec.h +++ b/src/lxc/rexec.h @@ -21,6 +21,6 @@ #ifndef __LXC_REXEC_H #define __LXC_REXEC_H -extern int lxc_rexec(const char *memfd_name); +extern int lxc_rexec(char *argv[], const char *memfd_name); #endif /* __LXC_REXEC_H */ diff --git a/src/lxc/tools/lxc_attach.c b/src/lxc/tools/lxc_attach.c index d10b6ecc2..60b2ec64f 100644 --- a/src/lxc/tools/lxc_attach.c +++ b/src/lxc/tools/lxc_attach.c @@ -57,9 +57,9 @@ lxc_log_define(lxc_attach, lxc); * mapping: CVE-2019-5736. */ #ifdef ENFORCE_MEMFD_REXEC -__attribute__((constructor)) static void lxc_attach_rexec(void) +__attribute__((constructor)) static void lxc_attach_rexec(int argc, char *argv[]) { - if (!getenv("LXC_MEMFD_REXEC") && lxc_rexec("lxc-attach")) { + if (!getenv("LXC_MEMFD_REXEC") && lxc_rexec(argv, "lxc-attach")) { fprintf(stderr, "Failed to re-execute lxc-attach via memory file descriptor\n"); _exit(EXIT_FAILURE); }
[lxc-devel] [lxc/lxc] 0c816b: rexec: remove needless /proc/cmdline parsing
Branch: refs/heads/master Home: https://github.com/lxc/lxc Commit: 0c816b346788afa9d601766e31544fdcce67d780 https://github.com/lxc/lxc/commit/0c816b346788afa9d601766e31544fdcce67d780 Author: Christian Brauner Date: 2019-02-13 (Wed, 13 Feb 2019) Changed paths: M src/lxc/rexec.c M src/lxc/rexec.h M src/lxc/tools/lxc_attach.c Log Message: --- rexec: remove needless /proc/cmdline parsing Signed-off-by: Christian Brauner Commit: 257e396bed4da40af23120c8717d3294511141fd https://github.com/lxc/lxc/commit/257e396bed4da40af23120c8717d3294511141fd Author: Stéphane Graber Date: 2019-02-13 (Wed, 13 Feb 2019) Changed paths: M src/lxc/rexec.c M src/lxc/rexec.h M src/lxc/tools/lxc_attach.c Log Message: --- Merge pull request #2850 from brauner/2019-02-13/simplify_argv_parsing rexec: remove needless /proc/cmdline parsing Compare: https://github.com/lxc/lxc/compare/33257e97929e...257e396bed4d ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [lxd/master] shared/osarch: Add ArchLinux name for armv7
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/lxd/pull/5490 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === Signed-off-by: Stéphane Graber From 3a4c0d31698693a7cd92a5058a4a45b25c9bd7be Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Wed, 13 Feb 2019 14:13:55 -0500 Subject: [PATCH] shared/osarch: Add ArchLinux name for armv7 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- shared/osarch/architectures.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shared/osarch/architectures.go b/shared/osarch/architectures.go index 266d9a81c4..86680a6acf 100644 --- a/shared/osarch/architectures.go +++ b/shared/osarch/architectures.go @@ -30,7 +30,7 @@ var architectureNames = map[int]string{ var architectureAliases = map[int][]string{ ARCH_32BIT_INTEL_X86: {"i386", "386"}, ARCH_64BIT_INTEL_X86: {"amd64"}, - ARCH_32BIT_ARMV7_LITTLE_ENDIAN: {"armel", "armhf", "arm", "armhfp", "armv7a_hardfp"}, + ARCH_32BIT_ARMV7_LITTLE_ENDIAN: {"armel", "armhf", "arm", "armhfp", "armv7a_hardfp", "armv7"}, ARCH_64BIT_ARMV8_LITTLE_ENDIAN: {"arm64"}, ARCH_32BIT_POWERPC_BIG_ENDIAN:{"powerpc"}, ARCH_64BIT_POWERPC_BIG_ENDIAN:{"powerpc64", "ppc64"}, ___ lxc-devel mailing list lxc-devel@lists.linuxcontainers.org http://lists.linuxcontainers.org/listinfo/lxc-devel
[lxc-devel] [linuxcontainers.org/master] Vanilla 1.8
The following pull request was submitted through Github. It can be accessed and reviewed at: https://github.com/lxc/linuxcontainers.org/pull/344 This e-mail was sent by the LXC bot, direct replies will not reach the author unless they happen to be subscribed to this list. === Description (from pull-request) === ## Done Updated Vanilla Framework to 1.8 and updated the markup/classes where necessary. ## QA Run the site locally and click through the pages. Check functionality at all viewport sizes (especially the updated nav component) From 892d7862ea47e09355af03b834f9f96940c9ee46 Mon Sep 17 00:00:00 2001 From: deadlight Date: Tue, 18 Dec 2018 10:11:32 + Subject: [PATCH 1/7] Fix markdown requirement to <3.0.0 --- README.md| 6 +++--- requirements.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index a280184..3ff6b52 100644 --- a/README.md +++ b/README.md @@ -10,13 +10,13 @@ part is located at https://github.com/lxc/lxd-demo-server * python3 (>= 3.3) * python3-bs4 * python3-jinja2 - * python3-markdown + * python3-markdown (<3.0.0) * python3-pygments ## Generating the website ./generate - + ## Launching website within container Make sure that the container has access to the website folder that you just cloned. @@ -27,7 +27,7 @@ After generating the website(above), run these commands(Ubuntu-specific) within cd output python3 -m http.server 8777 - + You now need to obtain the IP address for the specific container. You can now navigate to the site (from the host) with the following example IP address: > 185.5.3.12:8777 diff --git a/requirements.txt b/requirements.txt index 8bcd107..766099c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,5 +1,5 @@ beautifulsoup4 jinja2 -markdown +markdown==3.0.0 pygments pyyaml From 9e7d5df0c58dce377873fcffa1d24043ce4ea128 Mon Sep 17 00:00:00 2001 From: deadlight Date: Tue, 18 Dec 2018 11:16:17 + Subject: [PATCH 2/7] Update css link to vanilla-framework 1.8.0 --- templates/common/base.tpl.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/common/base.tpl.html b/templates/common/base.tpl.html index a0d85c9..8dc2ef6 100644 --- a/templates/common/base.tpl.html +++ b/templates/common/base.tpl.html @@ -11,7 +11,7 @@ {% else %} Linux Containers {% endif %} -https://assets.ubuntu.com/v1/vanilla-framework-version-1.6.3.min.css; /> +https://assets.ubuntu.com/v1/vanilla-framework-version-1.8.0.min.css; /> From 408c6d537b9098ae4dc50a95d9cf6ad46e23cecc Mon Sep 17 00:00:00 2001 From: deadlight Date: Tue, 18 Dec 2018 11:16:43 + Subject: [PATCH 3/7] Remove override for issue fixed upstream --- static/css/local.css | 21 - 1 file changed, 21 deletions(-) diff --git a/static/css/local.css b/static/css/local.css index b16e770..624fc53 100644 --- a/static/css/local.css +++ b/static/css/local.css @@ -715,24 +715,3 @@ pre { #tryit_feedback .js-collapsable.is-hidden ~ .panel-body { display: none; } - -/* -XXX Ant: 04.12.17 This can be removed when this is fixed -https://github.com/vanilla-framework/vanilla-framework/issues/1478 -*/ -.u-align--center h1, -.u-align--center h2, -.u-align--center h3, -.u-align--center h4, -.u-align--center h5, -.u-align--center h6, -.u-align--center p, -h1.u-align--center, -h2.u-align--center, -h3.u-align--center, -h4.u-align--center, -h5.u-align--center, -h6.u-align--center, -p.u-align--center { - max-width: none; -} From 43e2208b18f57141016a31660ab5e38da45f59a4 Mon Sep 17 00:00:00 2001 From: deadlight Date: Tue, 18 Dec 2018 11:30:34 + Subject: [PATCH 4/7] Fix css formatting --- static/css/local.css | 211 +-- 1 file changed, 144 insertions(+), 67 deletions(-) diff --git a/static/css/local.css b/static/css/local.css index 624fc53..ccf3fed 100644 --- a/static/css/local.css +++ b/static/css/local.css @@ -1,17 +1,17 @@ body { -padding-top: 0 !important; + padding-top: 0 !important; } .hover-menu li { -color: #999; -cursor: auto; + color: #999; + cursor: auto; } /* paragraph anchors as generated by markdown toc */ a.headerlink { -color:inherit; -visibility:hidden; -text-decoration:none; + color:inherit; + text-decoration:none; + visibility:hidden; } h1:hover a.headerlink, h2:hover a.headerlink, @@ -20,18 +20,18 @@ h3:hover a.headerlink { } .divider { -height: 1px; -padding: 0; -margin-bottom: -10px; -border-top: 1px solid #999; + border-top: 1px solid #999; + height: 1px; + margin-bottom: -10px; + padding: 0; } .symbol { - display: inline-block; border-radius: 50%; border: 5px double white; - width: 30px; + display: inline-block; height: 30px; + width: 30px; } .symbol-empty { @@ -43,40 +43,40 @@ h3:hover a.headerlink { } .dropdown-submenu:hover .dropdown-menu { -display: block; +