Skip to content

Commit

Permalink
Merge pull request #134 from crazy-max/e2e-tini
Browse files Browse the repository at this point in the history
pass SUBREAPER to prctl patch and new desktop flavor
  • Loading branch information
crazy-max authored Nov 30, 2023
2 parents dcea4ed + 17af746 commit 035ddb0
Show file tree
Hide file tree
Showing 4 changed files with 97 additions and 7 deletions.
35 changes: 28 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ on:
branches:
- master
pull_request:
branches:
- master

env:
REPO_SLUG: tonistiigi/binfmt
Expand All @@ -29,6 +27,7 @@ jobs:
target:
- mainline
- buildkit
- desktop
steps:
-
name: Checkout
Expand Down Expand Up @@ -85,6 +84,7 @@ jobs:
target:
- mainline
- buildkit
- desktop
steps:
-
name: Checkout
Expand Down Expand Up @@ -138,14 +138,22 @@ jobs:
strategy:
fail-fast: false
matrix:
target:
- mainline
- desktop
dockerfile:
- pip-youtube-dl
- webpack
platform:
- linux/arm/v7
include:
- dockerfile: ejabberd
- target: mainline
dockerfile: ejabberd
platform: linux/arm64
- target: desktop
dockerfile: tini
platform: linux/arm64
run: true
steps:
-
name: Checkout
Expand All @@ -154,14 +162,14 @@ jobs:
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
-
name: Load mainline for testing
name: Load for testing
uses: docker/bake-action@v2
with:
targets: mainline
targets: ${{ matrix.target }}
load: true
set: |
*.cache-from=type=gha,scope=${{ env.CACHE_GHA_SCOPE }}-mainline
mainline.tags=tonistiigi/binfmt:test
*.cache-from=type=gha,scope=${{ env.CACHE_GHA_SCOPE }}-${{ matrix.target }}
*.tags=tonistiigi/binfmt:test
-
name: Set up QEMU
run: |
Expand All @@ -172,6 +180,18 @@ jobs:
working-directory: test/dockerfiles/${{ matrix.dockerfile }}
run: |
docker buildx build --platform ${{ matrix.platform }} --output type=cacheonly .
-
name: Load image
if: ${{ matrix.run }}
working-directory: test/dockerfiles/${{ matrix.dockerfile }}
run: |
docker buildx build --platform ${{ matrix.platform }} -t ${{ matrix.dockerfile }}:local --load .
-
name: Run
if: ${{ matrix.run }}
working-directory: test/dockerfiles/${{ matrix.dockerfile }}
run: |
docker run --rm --platform ${{ matrix.platform }} ${{ matrix.dockerfile }}:local
build:
runs-on: ubuntu-latest
Expand All @@ -185,6 +205,7 @@ jobs:
target:
- mainline
- buildkit
- desktop
steps:
-
name: Checkout
Expand Down
12 changes: 12 additions & 0 deletions docker-bake.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,18 @@ target "buildkit-test" {
tags = []
}

target "desktop" {
inherits = ["mainline"]
args = {
QEMU_PATCHES = "${QEMU_PATCHES},subreaper-prctl"
}
cache-from = ["${REPO}:desktop-master"]
}

target "desktop-all" {
inherits = ["desktop", "all-arch"]
}

target "archive" {
inherits = ["mainline"]
target = "archive"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
From fb2d9448acae73a193aede5b6c966e2e578987e6 Mon Sep 17 00:00:00 2001
From: CrazyMax <crazy-max@users.noreply.github.com>
Date: Thu, 11 May 2023 18:23:03 +0200
Subject: [PATCH] linux-user: pass SUBREAPER to prctl

Reaper status can be aquired by using prctl() with
PR_*_CHILD_SUBREAPER on linux. Signal will be delivered
to every descendant process.

Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
---
linux-user/syscall.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/linux-user/syscall.c b/linux-user/syscall.c
index b8a75f35d2..4c66d9fe37 100644
--- a/linux-user/syscall.c
+++ b/linux-user/syscall.c
@@ -6548,11 +6548,11 @@ static abi_long do_prctl(CPUArchState *env, abi_long option, abi_long arg2,
case PR_SET_NO_NEW_PRIVS:
case PR_GET_IO_FLUSHER:
case PR_SET_IO_FLUSHER:
+ case PR_GET_CHILD_SUBREAPER:
+ case PR_SET_CHILD_SUBREAPER:
/* Some prctl options have no pointer arguments and we can pass on. */
return get_errno(prctl(option, arg2, arg3, arg4, arg5));

- case PR_GET_CHILD_SUBREAPER:
- case PR_SET_CHILD_SUBREAPER:
case PR_GET_SPECULATION_CTRL:
case PR_SET_SPECULATION_CTRL:
case PR_GET_TID_ADDRESS:
--
2.34.0

22 changes: 22 additions & 0 deletions test/dockerfiles/tini/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# syntax=docker/dockerfile:1

ARG TINI_VERSION="v0.19.0"

FROM alpine:3.17
RUN apk add --no-cache file wget
ARG TINI_VERSION
ARG TARGETPLATFORM
RUN <<EOT
TINI_ARCH=$(case ${TARGETPLATFORM} in
"linux/amd64") echo "amd64" ;;
"linux/arm/v6") echo "armel" ;;
"linux/arm/v7") echo "armhf" ;;
"linux/arm64") echo "arm64" ;;
"linux/ppc64le") echo "ppc64le" ;;
"linux/s390x") echo "390x" ;;
*) echo "" ;; esac)
wget -q "https://github.com/krallin/tini/releases/download/${TINI_VERSION}/tini-static-${TINI_ARCH}" -qO /tini
chmod +x /tini
file /tini
EOT
CMD [ "/tini", "-s", "--", "uname", "-a" ]

0 comments on commit 035ddb0

Please sign in to comment.