qemu-patch-raspberry4/tests
Richard W.M. Jones 3d212b41e9 nbd/server: Add --selinux-label option
Under SELinux, Unix domain sockets have two labels.  One is on the
disk and can be set with commands such as chcon(1).  There is a
different label stored in memory (called the process label).  This can
only be set by the process creating the socket.  When using SELinux +
SVirt and wanting qemu to be able to connect to a qemu-nbd instance,
you must set both labels correctly first.

For qemu-nbd the options to set the second label are awkward.  You can
create the socket in a wrapper program and then exec into qemu-nbd.
Or you could try something with LD_PRELOAD.

This commit adds the ability to set the label straightforwardly on the
command line, via the new --selinux-label flag.  (The name of the flag
is the same as the equivalent nbdkit option.)

A worked example showing how to use the new option can be found in
this bug: https://bugzilla.redhat.com/show_bug.cgi?id=1984938

Fixes: https://bugzilla.redhat.com/show_bug.cgi?id=1984938
Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>

[eblake: rebase to configure changes, reject --selinux-label if it is
not compiled in or not used on a Unix socket]
Note that we may relax some of these restrictions at a later date,
such as making it possible to label a TCP socket, although it may be
smarter to do so as a generic QMP action rather than more one-off
command lines in qemu-nbd.
Signed-off-by: Eric Blake <eblake@redhat.com>
Message-Id: <20211115202944.615966-1-eblake@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
[eblake: adjust meson output as suggested by thuth]
Signed-off-by: Eric Blake <eblake@redhat.com>
2021-11-16 10:16:38 -06:00
..
avocado tests/avocado: Remove p7zip binary availability check 2021-11-08 17:00:22 +01:00
bench tests: Move benchmarks into a separate folder 2021-03-12 15:46:30 +01:00
data tests: bios-tables-test update expected blobs 2021-11-15 09:44:46 -05:00
decode decodetree: Extend argument set syntax to allow types 2021-05-01 11:45:35 -07:00
docker nbd/server: Add --selinux-label option 2021-11-16 10:16:38 -06:00
fp tests/fp: Enable more tests 2021-06-03 14:09:03 -07:00
guest-debug chardev: do not use short form boolean options in non-QemuOpts character device descriptions 2021-02-25 15:41:53 +01:00
image-fuzzer image-fuzzer: Use OSerror.strerror instead of tuple subscript 2019-11-05 16:36:11 +01:00
include tests: add missing generated sources to testqapi 2020-10-17 10:45:50 -04:00
keys tests/vm: Add Haiku test based on their vagrant images 2020-11-17 09:45:24 +01:00
migration tests/migration: fix unix socket migration 2021-07-14 14:15:52 +01:00
multiboot Remove superfluous .gitignore files 2020-10-13 12:48:17 +02:00
perf/block/qcow2 tests/perf: Test lseek influence on qcow2 block-status 2019-06-04 15:20:41 +02:00
plugin tests/plugins: extend the insn plugin to track opcode sizes 2021-11-04 10:32:01 +00:00
qapi-schema meson: drop sphinx_extn_depends 2021-11-08 12:27:23 +04:00
qemu-iotests Block layer patches 2021-11-03 00:32:56 -04:00
qtest tests: bios-tables-test update expected blobs 2021-11-15 09:44:46 -05:00
rocker
tcg Testing, gdbstub and plugin updates for 6.2 2021-11-04 08:33:46 -04:00
tsan tests/docker: Added docker build support for TSan. 2020-06-16 14:49:05 +01:00
uefi-test-tools Remove superfluous .gitignore files 2020-10-13 12:48:17 +02:00
unit tests/unit/test-smp-parse: Explicit MachineClass name 2021-11-15 21:49:16 +01:00
vm tests/vm/openbsd: Update to release 7.0 2021-11-04 10:32:01 +00:00
vmstate-static-checker-data hw: Replace anti-social QOM type names 2021-03-19 15:18:43 +01:00
Makefile.include tests/acceptance: rename tests acceptance to tests avocado 2021-11-08 17:00:22 +01:00
check-block.sh iotests: rewrite check into python 2021-01-27 20:53:14 +01:00
dbus-vmstate-daemon.sh tests: add dbus-vmstate-test 2020-01-06 18:41:32 +04:00
meson.build python, iotests: remove socket_scm_helper 2021-10-12 12:22:11 -04:00
requirements.txt acceptance tests: bump Avocado version to 88.1 2021-06-01 16:21:21 -04:00
test-qht-par.c
vhost-user-bridge.c tests/vhost-user-bridge.c: Fix typo in help message 2021-09-04 17:34:05 -04:00