From ffe4dfe9cd047d9068d1bc657109cfe1b03cbf45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Filip=20Go=C5=82a=C5=9B?= Date: Fri, 22 Aug 2025 09:58:33 +0200 Subject: [PATCH] build.sh: sdk_run: Use `:Z` to relabel volumes attached to docker MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When the repository is cloned to a directory with a domain that is not accessible by containers by default (like user_home_t), the build might fail due to access denials, or just fail silently. `ausearch -m avc -ts recent -i` shows violation logs like: ``` type=AVC msg=audit(08/22/2025 09:43:42.740:641) : avc: denied { write } for pid=18611 comm=rm name=coreboot dev="dm-0" ino=85471 scontext=system_u:system_r:container_t:s0:c100,c319 tcontext=unconfined_u:object_r:user_home_t:s0 tclass=dir permissive=1 ``` - `container_t` cannot access `user_home_t`, so the access is denied. Adding `:Z` suffix to the volumes relabels them with a domain that is accessible to `container_t` in SELinux. Specifically `:Z` says that the volumes will be only accessible by this one single container, and not shared between multiple ones. This way the build.sh script can be used without issues on SELinux-enabled systems without changing SELinux enforcement mode. Source: https://docs.docker.com/engine/storage/bind-mounts/#configure-the-selinux-label Upstream-Status: Inappropriate [Dasharo downstream] Signed-off-by: Filip Gołaś --- build.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index b3dff354a65..90f5ee83f20 100755 --- a/build.sh +++ b/build.sh @@ -46,8 +46,8 @@ BUILD_TIMELESS=${BUILD_TIMELESS:-0} AIRGAP=${AIRGAP:-0} function sdk_run { - docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot \ - -v $HOME/.ssh:/home/coreboot/.ssh \ + docker run --rm -t -u $UID -v $PWD:/home/coreboot/coreboot:Z \ + -v $HOME/.ssh:/home/coreboot/.ssh:Z \ -e BUILD_TIMELESS=${BUILD_TIMELESS} \ -w /home/coreboot/coreboot ${DASHARO_SDK} \ "$@"