1 |
commit: a5ee3e4cc8dcc31a8a91cda5bebe514c15c83556 |
2 |
Author: Nicolas Iooss <nicolas.iooss <AT> m4x <DOT> org> |
3 |
AuthorDate: Sun Dec 20 15:28:48 2015 +0000 |
4 |
Commit: Jason Zaman <perfinion <AT> gentoo <DOT> org> |
5 |
CommitDate: Sat Jan 30 17:02:52 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/hardened-refpolicy.git/commit/?id=a5ee3e4c |
7 |
|
8 |
Label Xorg server binary correctly on Arch Linux |
9 |
|
10 |
On Arch Linux, /usr/bin/Xorg is only a shell script which executes |
11 |
/usr/lib/xorg-server/Xorg.wrap, which is a SUID binary wrapper around |
12 |
/usr/lib/xorg-server/Xorg. |
13 |
|
14 |
Even though Xorg.wrap is not a full X server, it reads X11 configuration |
15 |
files, uses the DRM interface to detect KMS, etc. (cf. |
16 |
http://cgit.freedesktop.org/xorg/xserver/tree/hw/xfree86/xorg-wrapper.c?id=xorg-server-1.18.0 |
17 |
for more details). Therefore label it as xserver_exec_t. |
18 |
|
19 |
This makes the following AVC appear: |
20 |
|
21 |
denied { execute_no_trans } for pid=927 comm="X" |
22 |
path="/usr/lib/xorg-server/Xorg.wrap" dev="dm-0" ino=3152592 |
23 |
scontext=system_u:system_r:xserver_t |
24 |
tcontext=system_u:object_r:xserver_exec_t tclass=file |
25 |
|
26 |
Allow /usr/bin/Xorg to execute Xorg.wrap with a can_exec statement. |
27 |
|
28 |
policy/modules/services/xserver.fc | 2 ++ |
29 |
policy/modules/services/xserver.te | 3 +++ |
30 |
2 files changed, 5 insertions(+) |
31 |
|
32 |
diff --git a/policy/modules/services/xserver.fc b/policy/modules/services/xserver.fc |
33 |
index 5ef36fb..619bb9f 100644 |
34 |
--- a/policy/modules/services/xserver.fc |
35 |
+++ b/policy/modules/services/xserver.fc |
36 |
@@ -71,6 +71,8 @@ HOME_DIR/\.Xauthority.* -- gen_context(system_u:object_r:xauth_home_t,s0) |
37 |
/usr/bin/Xorg -- gen_context(system_u:object_r:xserver_exec_t,s0) |
38 |
|
39 |
/usr/lib/qt-.*/etc/settings(/.*)? gen_context(system_u:object_r:xdm_var_run_t,s0) |
40 |
+/usr/lib/xorg-server/Xorg -- gen_context(system_u:object_r:xserver_exec_t,s0) |
41 |
+/usr/lib/xorg-server/Xorg\.wrap -- gen_context(system_u:object_r:xserver_exec_t,s0) |
42 |
|
43 |
/usr/sbin/lightdm -- gen_context(system_u:object_r:xdm_exec_t,s0) |
44 |
|
45 |
|
46 |
diff --git a/policy/modules/services/xserver.te b/policy/modules/services/xserver.te |
47 |
index 82b9501..09c79bb 100644 |
48 |
--- a/policy/modules/services/xserver.te |
49 |
+++ b/policy/modules/services/xserver.te |
50 |
@@ -827,6 +827,9 @@ manage_sock_files_pattern(xserver_t, xdm_tmp_t, xdm_tmp_t) |
51 |
allow xserver_t xkb_var_lib_t:lnk_file read; |
52 |
can_exec(xserver_t, xkb_var_lib_t) |
53 |
|
54 |
+# Run Xorg.wrap |
55 |
+can_exec(xserver_t, xserver_exec_t) |
56 |
+ |
57 |
# VNC v4 module in X server |
58 |
corenet_tcp_bind_vnc_port(xserver_t) |