Fedora enables SELinux by default, which has the side effect to block
writes to host fs done through containers (docker or podman).

$ podman run -it --rm -v $(pwd):$(pwd) docker.io/debian:latest touch $(pwd)/file
touch: cannot touch '/home/user/file': Permission denied

There is a :z flag for mounts, that works with docker, but not with
podman: SELinux: relabeling of /home/user is not allowed

The right solution is to disable SELinux label confinment with
--security-opt label=disable, which works with both podman and docker.

Reported-by: John Snow <[email protected]>
Closes: 
https://lore.kernel.org/qemu-devel/CAFn=p-bxoctwnederpbl-smrpydisban2e0-mxyjws7uvcj...@mail.gmail.com/
Tested-by: John Snow <[email protected]>
Reviewed-by: Pierrick Bouvier <[email protected]>
Link: 
https://lore.kernel.org/qemu-devel/[email protected]
Signed-off-by: Pierrick Bouvier <[email protected]>
---
 tests/tcg/meson.build | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tests/tcg/meson.build b/tests/tcg/meson.build
index a5e0462732d..75f0a52fd22 100644
--- a/tests/tcg/meson.build
+++ b/tests/tcg/meson.build
@@ -277,6 +277,8 @@ foreach target, plan: tcg_tests
       mount = mount + ':' + mount
       here = meson.project_build_root()
       cc = [docker_wrapper, 'run', '--run-as-current-user', '--',
+            # SELinux blocks modification of host fs by default
+            '--security-opt', 'label=disable',
             '-w', here, '-v', here + ':' + here, '-v', mount,
             'qemu/' + cc_dockerfile, plan['cc']]
       has_cc = true
-- 
2.47.3


Reply via email to