Skip to content

Commit 3aae0fa

Browse files
committed
Define security policy for DSP FastRPC daemons
Create unified policy module xdsprpcd with attribute-based approach covering all DSP daemon domains (ADSP, CDSP, GDSP, SDSP) and required permissions for FastRPC device access, DMA operations, and system integration. - xdsprpcd.fc: Label DSP daemon executables with respective exec_t types - xdsprpcd.if: Define interface file describing all DSP daemons Source: https://github.com/qualcomm/fastrpc.git - xdsprpcd.te: Define xdsprpcd_domain attribute and daemon domains with permissions: * Unix datagram socket creation and sendto for logging * FastRPC device access via dev_read_secure_fastrpc() and dev_read_fastrpc() interfaces * DMA heap device access (/dev/dma_heap/*) via dev_rw_dma_dev() * Sysfs reading for device tree model information * Configuration file reading from /usr/share/qcom/ * Directory watching (inotify) for /dev, /usr/lib, and /usr/share * Runtime directory search and syslog messaging * Localization file access The policy uses attribute-based approach for clean abstraction and maintainability, with provision for daemon-specific rules when needed. Signed-off-by: Vinayak Katoch <vkatoch@qti.qualcomm.com>
1 parent 9ada104 commit 3aae0fa

3 files changed

Lines changed: 100 additions & 0 deletions

File tree

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/usr/bin/adsprpcd -- gen_context(system_u:object_r:adsprpcd_exec_t,s0)
2+
/usr/bin/cdsprpcd -- gen_context(system_u:object_r:cdsprpcd_exec_t,s0)
3+
/usr/bin/gdsprpcd -- gen_context(system_u:object_r:gdsprpcd_exec_t,s0)
4+
/usr/bin/sdsprpcd -- gen_context(system_u:object_r:sdsprpcd_exec_t,s0)
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
## <summary>Qualcomm DSP FastRPC daemons</summary>
2+
##
3+
## <desc>
4+
## <p>
5+
## Consolidated policy module for Qualcomm DSP FastRPC daemons.
6+
## These daemons establish connections to various DSP processors:
7+
## </p>
8+
## <ul>
9+
## <li>adsprpcd - ADSP daemon</li>
10+
## <li>cdsprpcd - CDSP daemon</li>
11+
## <li>gdsprpcd - GDSP daemon</li>
12+
## <li>sdsprpcd - SDSP daemon</li>
13+
## </ul>
14+
## <p>
15+
## Source: https://github.com/qualcomm/fastrpc.git
16+
## </p>
17+
## </desc>
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
policy_module(xdsprpcd)
2+
3+
########################################
4+
#
5+
# Declarations
6+
#
7+
8+
## <desc>
9+
## <p>
10+
## Consolidated policy for Qualcomm DSP FastRPC daemons.
11+
## Covers ADSP, CDSP, GDSP, and SDSP daemon processes.
12+
## </p>
13+
## </desc>
14+
15+
attribute xdsprpcd_domain;
16+
17+
type adsprpcd_t;
18+
type adsprpcd_exec_t;
19+
init_daemon_domain(adsprpcd_t, adsprpcd_exec_t)
20+
typeattribute adsprpcd_t xdsprpcd_domain;
21+
22+
type cdsprpcd_t;
23+
type cdsprpcd_exec_t;
24+
init_daemon_domain(cdsprpcd_t, cdsprpcd_exec_t)
25+
typeattribute cdsprpcd_t xdsprpcd_domain;
26+
27+
type gdsprpcd_t;
28+
type gdsprpcd_exec_t;
29+
init_daemon_domain(gdsprpcd_t, gdsprpcd_exec_t)
30+
typeattribute gdsprpcd_t xdsprpcd_domain;
31+
32+
type sdsprpcd_t;
33+
type sdsprpcd_exec_t;
34+
init_daemon_domain(sdsprpcd_t, sdsprpcd_exec_t)
35+
typeattribute sdsprpcd_t xdsprpcd_domain;
36+
37+
########################################
38+
#
39+
# xdsprpcd_domain local policy
40+
#
41+
42+
allow xdsprpcd_domain self:unix_dgram_socket { create_socket_perms sendto };
43+
44+
dev_read_fastrpc(xdsprpcd_domain)
45+
dev_read_secure_fastrpc(xdsprpcd_domain)
46+
dev_read_sysfs(xdsprpcd_domain)
47+
dev_rw_dma_dev(xdsprpcd_domain)
48+
dev_watch_dev_dirs(xdsprpcd_domain)
49+
50+
files_read_usr_files(xdsprpcd_domain)
51+
files_watch_usr_dirs(xdsprpcd_domain)
52+
53+
init_search_runtime(xdsprpcd_domain)
54+
55+
libs_watch_shared_libs_dirs(xdsprpcd_domain)
56+
57+
logging_send_syslog_msg(xdsprpcd_domain)
58+
59+
miscfiles_read_localization(xdsprpcd_domain)
60+
61+
########################################
62+
#
63+
# Daemon-specific policy
64+
#
65+
# Add daemon-specific permissions below if needed in the future.
66+
# Example:
67+
#
68+
# # ADSP-specific policy
69+
# allow adsprpcd_t some_type:some_class { some_permission };
70+
#
71+
# # CDSP-specific policy
72+
# allow cdsprpcd_t some_type:some_class { some_permission };
73+
#
74+
# # GDSP-specific policy
75+
# allow gdsprpcd_t some_type:some_class { some_permission };
76+
#
77+
# # SDSP-specific policy
78+
# allow sdsprpcd_t some_type:some_class { some_permission };
79+
#

0 commit comments

Comments
 (0)