summaryrefslogtreecommitdiff
path: root/rules
diff options
context:
space:
mode:
authorZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>2017-03-27 06:34:24 -0400
committerMartin Pitt <martinpitt@users.noreply.github.com>2017-03-27 12:34:24 +0200
commit5a664ca10f38dbf66c07961707dafed66382caec (patch)
tree1a3c6de7947466aa74de2a67c8d4cc5e232744a1 /rules
parentd7e228d9febd42e776750e5c801099a90ba06a6b (diff)
rules: add a rule to set /dev/kvm access mode and ownership (#5597)
Kernel default mode is 0600, but distributions change it to group kvm, mode either 0660 (e.g. Debian) or 0666 (e.g. Fedora). Both approaches have valid reasons (a stricter mode limits exposure to bugs in the kvm subsystem, a looser mode makes libvirt and other virtualization mechanisms work out of the box for unprivileged users over ssh). In Fedora the qemu package carries the relevant rule, but it's nicer to have it in systemd, so that the permissions are not dependent on the qemu package being installed. Use of packaged qemu binaries is not required to make use of /dev/kvm, e.g. it's possible to use a self-compiled qemu or some alternative. https://bugzilla.redhat.com/show_bug.cgi?id=1431876 To accomodate both approaches, add a rule to set the mode in 50-udev-default.rules, but allow the mode to be overridden with a --with-dev-kvm-mode configure rule. The default is 0660, as the (slightly) more secure option.
Diffstat (limited to 'rules')
-rw-r--r--rules/.gitignore1
-rw-r--r--rules/50-udev-default.rules.in (renamed from rules/50-udev-default.rules)2
2 files changed, 3 insertions, 0 deletions
diff --git a/rules/.gitignore b/rules/.gitignore
index 93a50ddd80..ea6e216bad 100644
--- a/rules/.gitignore
+++ b/rules/.gitignore
@@ -1 +1,2 @@
+/50-udev-default.rules
/99-systemd.rules
diff --git a/rules/50-udev-default.rules b/rules/50-udev-default.rules.in
index 3347c8cd89..064f66a976 100644
--- a/rules/50-udev-default.rules
+++ b/rules/50-udev-default.rules.in
@@ -74,6 +74,8 @@ KERNEL=="tun", MODE="0666", OPTIONS+="static_node=net/tun"
KERNEL=="fuse", MODE="0666", OPTIONS+="static_node=fuse"
+KERNEL=="kvm", GROUP="kvm", MODE="@DEV_KVM_MODE@"
+
SUBSYSTEM=="ptp", ATTR{clock_name}=="KVM virtual PTP", SYMLINK += "ptp_kvm"
LABEL="default_end"