Skip to contentSkip to conversation

support/testing: build a glibc toolchain for docker / docker-compose tests

PATCH New Peter Korsgaard 2 participants 7 messages Feb 12, 2019

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 support/testing: build a glibc toolchain for docker / docker-compose tests

runc (which is a reverse dependency of docker-engine) is about to gain a !uclibc dependency, so move to a glibc toolchain instead.

There are currently no prebuilt x86_64 / core2 / glibc toolchains available, so instead use the internal toolchain backend to build one.

While we are at it, drop the infra.basetest.BASIC_TOOLCHAIN_CONFIG reference, as that ARM toolchain configuration doesn't make any sense for this x86-64 based test.

add docker / docker-compose tests

---
 support/testing/tests/package/test_docker_compose.py | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)
support/testing/tests/package/test_docker_compose.py +3 -10
index 8bf3ae00b5..de53a3da14 100644
@@ -4,19 +4,12 @@ import infra.basetest
 
 
 class TestDockerCompose(infra.basetest.BRTest):
-    config = infra.basetest.BASIC_TOOLCHAIN_CONFIG + \
+    config = \
         """
         BR2_x86_64=y
         BR2_x86_core2=y
-        BR2_TOOLCHAIN_EXTERNAL=y
-        BR2_TOOLCHAIN_EXTERNAL_CUSTOM=y
-        BR2_TOOLCHAIN_EXTERNAL_DOWNLOAD=y
-        BR2_TOOLCHAIN_EXTERNAL_URL="http://autobuild.buildroot.org/toolchains/tarballs/br-x86-64-core2-full-2018.05.tar.bz2"
-        BR2_TOOLCHAIN_EXTERNAL_GCC_6=y
-        BR2_TOOLCHAIN_EXTERNAL_HEADERS_4_16=y
-        BR2_TOOLCHAIN_EXTERNAL_LOCALE=y
-        # BR2_TOOLCHAIN_EXTERNAL_HAS_THREADS_DEBUG is not set
-        BR2_TOOLCHAIN_EXTERNAL_CXX=y
+        BR2_TOOLCHAIN_BUILDROOT_GLIBC=y
+        BR2_KERNEL_HEADERS_4_19=y
         BR2_SYSTEM_DHCP="eth0"
         BR2_ROOTFS_POST_BUILD_SCRIPT="{}"
         BR2_ROOTFS_POST_SCRIPT_ARGS="{}"
Signature · 1 line
2.11.0
#1 lore raw

PATCH 2/2 package/runc: add upstream security fix for CVE-2019-5736

The vulnerability allows a malicious container to (with minimal user interaction) overwrite the host runc binary and thus gain root-level code execution on the host. The level of user interaction is being able to run any command (it doesn't matter if the command is not attacker-controlled) as root within a container in either of these contexts:

* Creating a new container using an attacker-controlled image.
* Attaching (docker exec) into an existing container which the attacker had previous write access to.

For more details, see the advisory:

https://www.openwall.com/lists/oss-security/2019/02/11/2

The fix for this issue uses fexecve(3), which isn't available on uClibc, so add a dependency on !uclibc to runc and propagate to the reverse dependencies (containerd/docker-engine).

---
 package/docker-containerd/Config.in                |   5 +-
 package/docker-engine/Config.in                    |   5 +-
 ...ne-proc-self-exe-to-avoid-exposing-host-b.patch | 338 +++++++++++++++++++++
 package/runc/Config.in                             |   5 +-
 4 files changed, 347 insertions(+), 6 deletions(-)
 create mode 100644 package/runc/0001-nsenter-clone-proc-self-exe-to-avoid-exposing-host-b.patch
package/docker-containerd/Config.in +3 -2
index 851345f73e..bdb5dd7b80 100644
@@ -3,6 +3,7 @@ config BR2_PACKAGE_DOCKER_CONTAINERD
 	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_PACKAGE_TOOLCHAIN_USES_UCLIBC # runc
 	depends on BR2_USE_MMU # util-linux
 	select BR2_PACKAGE_RUNC # runtime dependency
 	select BR2_PACKAGE_UTIL_LINUX # runtime dependency
@@ -27,8 +28,8 @@ config BR2_PACKAGE_DOCKER_CONTAINERD_DRIVER_BTRFS
 
 endif
 
-comment "docker-containerd needs a toolchain w/ threads"
+comment "docker-containerd needs a glibc or musl toolchain w/ threads"
 	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
 	depends on BR2_USE_MMU
-	depends on !BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_USES_UCLIBC
package/docker-engine/Config.in +3 -2
index 2a0c130fce..3c97310484 100644
@@ -3,6 +3,7 @@ config BR2_PACKAGE_DOCKER_ENGINE
 	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC # docker-containerd -> runc
 	depends on BR2_USE_MMU # docker-containerd
 	select BR2_PACKAGE_DOCKER_CONTAINERD # runtime dependency
 	select BR2_PACKAGE_DOCKER_PROXY # runtime dependency
@@ -49,8 +50,8 @@ config BR2_PACKAGE_DOCKER_ENGINE_DRIVER_VFS
 
 endif
 
-comment "docker-engine needs a toolchain w/ threads"
+comment "docker-engine needs a glibc or musl toolchain w/ threads"
 	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
-	depends on !BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAIN_USES_UCLIBC
 	depends on BR2_USE_MMU
package/runc/0001-nsenter-clone-proc-self-exe-to-avoid-exposing-host-b.patch new file +338 -0

338 lines not on this page · raw message

package/runc/Config.in +3 -2
index fd5dee7c5b..47c850ef30 100644
@@ -3,13 +3,14 @@ config BR2_PACKAGE_RUNC
 	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS
 	depends on BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
 	depends on BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_USES_UCLIBC # no fexecve
 	help
 	  runC is a CLI tool for spawning and running containers
 	  according to the OCP specification.
 
 	  https://github.com/opencontainers/runc
 
-comment "runc needs a toolchain w/ threads"
+comment "runc needs a glibc or musl toolchain toolchain w/ threads"
 	depends on BR2_PACKAGE_HOST_GO_ARCH_SUPPORTS && \
 		BR2_PACKAGE_HOST_GO_CGO_LINKING_SUPPORTS
-	depends on !BR2_TOOLCHAIN_HAS_THREADS
+	depends on !BR2_TOOLCHAIN_HAS_THREADS || BR2_TOOLCHAN_USES_UCLIBC
Signature · 1 line
2.11.0
#3 lore raw

PATCH 1/2 support/testing: build a glibc toolchain for docker / docker-compose tests

In reply to Peter Korsgaard

Hello,

Quoted 5 lines · On Tue, 12 Feb 2019 14:15:03 +0100 Peter Korsgaard <[email protected]> wrote:

runc (which is a reverse dependency of docker-engine) is about to gain a !uclibc dependency, so move to a glibc toolchain instead.

There are currently no prebuilt x86_64 / core2 / glibc toolchains available, so instead use the internal toolchain backend to build one.

One option would be to use:

https://toolchains.bootlin.com/downloads/releases/toolchains/x86-64-core-i7/tarballs/x86-64-core-i7--glibc--stable-2018.11-1.tar.bz2

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#4 lore raw

PATCH 1/2 support/testing: build a glibc toolchain for docker / docker-compose tests

Quoted 9 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hello,

Quoted 3 lines · On Tue, 12 Feb 2019 14:15:03 +0100 Peter Korsgaard <[email protected]> wrote:

runc (which is a reverse dependency of docker-engine) is about to gain a !uclibc dependency, so move to a glibc toolchain instead.

Quoted 6 lines
Quoted 2 lines

There are currently no prebuilt x86_64 / core2 / glibc toolchains available, so instead use the internal toolchain backend to build one.

One option would be to use:

https://toolchains.bootlin.com/downloads/releases/toolchains/x86-64-core-i7/tarballs/x86-64-core-i7--glibc--stable-2018.11-1.tar.bz2

Yes, I can change it to that. Do we want to use bootlin toolchains for our tests?

Signature · 1 line
Bye, Peter Korsgaard
#5 lore raw

PATCH 1/2 support/testing: build a glibc toolchain for docker / docker-compose tests

Quoted 6 lines · On Tue, 12 Feb 2019 15:12:55 +0100 Peter Korsgaard <[email protected]> wrote:
Quoted 5 lines
Quoted 5 lines

runc (which is a reverse dependency of docker-engine) is about to gain a !uclibc dependency, so move to a glibc toolchain instead.

There are currently no prebuilt x86_64 / core2 / glibc toolchains available, so instead use the internal toolchain backend to build one.

Quoted 6 lines
Quoted 3 lines

One option would be to use:

https://toolchains.bootlin.com/downloads/releases/toolchains/x86-64-core-i7/tarballs/x86-64-core-i7--glibc--stable-2018.11-1.tar.bz2

Yes, I can change it to that. Do we want to use bootlin toolchains for our tests?

Not necessarily, I was just stating another possibility. I'm fine either way.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
#6 lore raw

PATCH 1/2 support/testing: build a glibc toolchain for docker / docker-compose tests

Quoted 13 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Quoted 8 lines · On Tue, 12 Feb 2019 15:12:55 +0100 Peter Korsgaard <[email protected]> wrote:
Quoted 7 lines
Quoted 5 lines

runc (which is a reverse dependency of docker-engine) is about to gain a !uclibc dependency, so move to a glibc toolchain instead.

There are currently no prebuilt x86_64 / core2 / glibc toolchains available, so instead use the internal toolchain backend to build one.

One option would be to use:

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

https://toolchains.bootlin.com/downloads/releases/toolchains/x86-64-core-i7/tarballs/x86-64-core-i7--glibc--stable-2018.11-1.tar.bz2

Yes, I can change it to that. Do we want to use bootlin toolchains for our tests?

Not necessarily, I was just stating another possibility. I'm fine either way.

I decided to keep it like this for now.

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 2/2 package/runc: add upstream security fix for CVE-2019-5736

In reply to Peter Korsgaard
Quoted 15 lines
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Peter" == Peter Korsgaard <[email protected]> writes:

The vulnerability allows a malicious container to (with minimal user interaction) overwrite the host runc binary and thus gain root-level code execution on the host. The level of user interaction is being able to run any command (it doesn't matter if the command is not attacker-controlled) as root within a container in either of these contexts:

* Creating a new container using an attacker-controlled image.
* Attaching (docker exec) into an existing container which the attacker had previous write access to.

For more details, see the advisory:

Quoted 7 lines

https://www.openwall.com/lists/oss-security/2019/02/11/2

The fix for this issue uses fexecve(3), which isn't available on uClibc, so add a dependency on !uclibc to runc and propagate to the reverse dependencies (containerd/docker-engine).

Committed, thanks.

Signature · 1 line
Bye, Peter Korsgaard