1 |
commit: 5a90d99532c94d6a1978b7f9fbb1704d723b87b5 |
2 |
Author: Dominick Grift <dominick.grift <AT> gmail <DOT> com> |
3 |
AuthorDate: Tue Sep 24 13:39:56 2013 +0000 |
4 |
Commit: Sven Vermeulen <swift <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 27 13:22:57 2013 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-refpolicy.git;a=commit;h=5a90d995 |
7 |
|
8 |
Initial virtio console device |
9 |
|
10 |
Also known as 'vmchannel', a transport mechanism is needed for |
11 |
communication between the host userspace and guest userspace for |
12 |
achieving things like making clipboard copy/paste work seamlessly across |
13 |
the host and guest, locking the guest screen in case the vnc session to |
14 |
the guest is closed and so on. This can be used in offline cases as |
15 |
well, for example with libguestfs to probe which file systems the guest |
16 |
uses, the apps installed, etc. |
17 |
|
18 |
Virtio-serial is just the transport protocol that will enable such |
19 |
applications to be written. It has two parts: (a) device emulation in |
20 |
qemu that presents a virtio-pci device to the guest and (b) a guest |
21 |
driver that presents a char device interface to userspace applications. |
22 |
|
23 |
Signed-off-by: Dominick Grift <dominick.grift <AT> gmail.com> |
24 |
|
25 |
--- |
26 |
policy/modules/kernel/terminal.fc | 1 + |
27 |
policy/modules/kernel/terminal.if | 19 +++++++++++++++++++ |
28 |
policy/modules/kernel/terminal.te | 4 ++++ |
29 |
3 files changed, 24 insertions(+) |
30 |
|
31 |
diff --git a/policy/modules/kernel/terminal.fc b/policy/modules/kernel/terminal.fc |
32 |
index 7d45d15..0ea25b6 100644 |
33 |
--- a/policy/modules/kernel/terminal.fc |
34 |
+++ b/policy/modules/kernel/terminal.fc |
35 |
@@ -19,6 +19,7 @@ |
36 |
/dev/slamr[0-9]+ -c gen_context(system_u:object_r:tty_device_t,s0) |
37 |
/dev/tty -c gen_context(system_u:object_r:devtty_t,s0) |
38 |
/dev/ttySG.* -c gen_context(system_u:object_r:tty_device_t,s0) |
39 |
+/dev/vport[0-9]p[0-9]+ -c gen_context(system_u:object_r:virtio_device_t,s0) |
40 |
/dev/xvc[^/]* -c gen_context(system_u:object_r:tty_device_t,s0) |
41 |
|
42 |
/dev/pty/.* -c gen_context(system_u:object_r:bsdpty_device_t,s0) |
43 |
|
44 |
diff --git a/policy/modules/kernel/terminal.if b/policy/modules/kernel/terminal.if |
45 |
index 771bce1..cbb729b 100644 |
46 |
--- a/policy/modules/kernel/terminal.if |
47 |
+++ b/policy/modules/kernel/terminal.if |
48 |
@@ -1512,3 +1512,22 @@ interface(`term_dontaudit_use_all_user_ttys',` |
49 |
refpolicywarn(`$0() is deprecated, use term_dontaudit_use_all_ttys() instead.') |
50 |
term_dontaudit_use_all_ttys($1) |
51 |
') |
52 |
+ |
53 |
+##################################### |
54 |
+## <summary> |
55 |
+## Read from and write virtio console. |
56 |
+## </summary> |
57 |
+## <param name="domain"> |
58 |
+## <summary> |
59 |
+## Domain allowed access. |
60 |
+## </summary> |
61 |
+## </param> |
62 |
+# |
63 |
+interface(`term_use_virtio_console',` |
64 |
+ gen_require(` |
65 |
+ type virtio_device_t; |
66 |
+ ') |
67 |
+ |
68 |
+ dev_list_all_dev_nodes($1) |
69 |
+ allow $1 virtio_device_t:chr_file rw_term_perms; |
70 |
+') |
71 |
|
72 |
diff --git a/policy/modules/kernel/terminal.te b/policy/modules/kernel/terminal.te |
73 |
index 224e500..a4c9998 100644 |
74 |
--- a/policy/modules/kernel/terminal.te |
75 |
+++ b/policy/modules/kernel/terminal.te |
76 |
@@ -56,3 +56,7 @@ dev_node(tty_device_t) |
77 |
# |
78 |
type usbtty_device_t, serial_device; |
79 |
dev_node(usbtty_device_t) |
80 |
+ |
81 |
+type virtio_device_t, serial_device; |
82 |
+dev_node(virtio_device_t) |
83 |
+ |