xref: /aosp_15_r20/external/selinux/libsepol/tests/policies/test-linker/module1.conf (revision 2d543d20722ada2425b5bdab9d0d1d29470e7bba)
1*2d543d20SAndroid Build Coastguard Workermodule linker_test_1 1.0;
2*2d543d20SAndroid Build Coastguard Worker
3*2d543d20SAndroid Build Coastguard Workerrequire {
4*2d543d20SAndroid Build Coastguard Worker	class file { read write };
5*2d543d20SAndroid Build Coastguard Worker	class lnk_file append;
6*2d543d20SAndroid Build Coastguard Worker	role g_b_role_2;
7*2d543d20SAndroid Build Coastguard Worker	attribute g_b_attr_3;
8*2d543d20SAndroid Build Coastguard Worker	attribute g_b_attr_5;
9*2d543d20SAndroid Build Coastguard Worker	attribute o4_b_attr_1;
10*2d543d20SAndroid Build Coastguard Worker	type g_b_type_3;
11*2d543d20SAndroid Build Coastguard Worker}
12*2d543d20SAndroid Build Coastguard Worker
13*2d543d20SAndroid Build Coastguard Workertype tag_g_m1;
14*2d543d20SAndroid Build Coastguard Worker
15*2d543d20SAndroid Build Coastguard Worker#test for type in module and attr in module, added to in module
16*2d543d20SAndroid Build Coastguard Workerattribute g_m1_attr_1;
17*2d543d20SAndroid Build Coastguard Workertype g_m1_type_1, g_m1_attr_1;
18*2d543d20SAndroid Build Coastguard Workertype g_m1_type_2;
19*2d543d20SAndroid Build Coastguard Workertypeattribute g_m1_type_2 g_m1_attr_1;
20*2d543d20SAndroid Build Coastguard Worker
21*2d543d20SAndroid Build Coastguard Worker#add role in module test
22*2d543d20SAndroid Build Coastguard Workerrole g_m1_role_1;
23*2d543d20SAndroid Build Coastguard Workerrole g_m1_role_1 types g_m1_type_1;
24*2d543d20SAndroid Build Coastguard Worker
25*2d543d20SAndroid Build Coastguard Worker# test for attr declared in base, added to in module
26*2d543d20SAndroid Build Coastguard Workertype g_m1_type_3;
27*2d543d20SAndroid Build Coastguard Workertypeattribute g_m1_type_3 g_b_attr_3;
28*2d543d20SAndroid Build Coastguard Worker
29*2d543d20SAndroid Build Coastguard Worker# test for attr declared in base, added to in 2 modules
30*2d543d20SAndroid Build Coastguard Workertype g_m1_type_4;
31*2d543d20SAndroid Build Coastguard Workertypeattribute g_m1_type_4 g_b_attr_5;
32*2d543d20SAndroid Build Coastguard Worker
33*2d543d20SAndroid Build Coastguard Worker# test for attr declared in base optional, added to in module
34*2d543d20SAndroid Build Coastguard Workertype g_m1_type_5;
35*2d543d20SAndroid Build Coastguard Workertypeattribute g_m1_type_5 o4_b_attr_1;
36*2d543d20SAndroid Build Coastguard Worker
37*2d543d20SAndroid Build Coastguard Worker# test for attr declared in module, added to in base optional
38*2d543d20SAndroid Build Coastguard Workerattribute g_m1_attr_2;
39*2d543d20SAndroid Build Coastguard Worker
40*2d543d20SAndroid Build Coastguard Worker#add type to base role test
41*2d543d20SAndroid Build Coastguard Workerrole g_b_role_2 types g_m1_type_1;
42*2d543d20SAndroid Build Coastguard Workerrole g_b_role_3;
43*2d543d20SAndroid Build Coastguard Workerrole g_b_role_3 types g_m1_type_2;
44*2d543d20SAndroid Build Coastguard Worker
45*2d543d20SAndroid Build Coastguard Worker#add type to base optional role test
46*2d543d20SAndroid Build Coastguard Workerrole o1_b_role_2;
47*2d543d20SAndroid Build Coastguard Workerrole o1_b_role_2 types g_m1_type_1;
48*2d543d20SAndroid Build Coastguard Worker
49*2d543d20SAndroid Build Coastguard Worker#optional base role w/ adds in 2 modules
50*2d543d20SAndroid Build Coastguard Workerrole o4_b_role_1;
51*2d543d20SAndroid Build Coastguard Workerrole o4_b_role_1 types g_m1_type_2;
52*2d543d20SAndroid Build Coastguard Worker
53*2d543d20SAndroid Build Coastguard Worker# attr a added to in base optional, declared/added to in module, added to in other module
54*2d543d20SAndroid Build Coastguard Workerattribute g_m1_attr_3;
55*2d543d20SAndroid Build Coastguard Workertype g_m1_type_6, g_m1_attr_3;
56*2d543d20SAndroid Build Coastguard Worker
57*2d543d20SAndroid Build Coastguard Worker# attr a added to in base optional, declared/added in module , added to in other module optional
58*2d543d20SAndroid Build Coastguard Workerattribute g_m1_attr_4;
59*2d543d20SAndroid Build Coastguard Workertype g_m1_type_7, g_m1_attr_4;
60*2d543d20SAndroid Build Coastguard Worker
61*2d543d20SAndroid Build Coastguard Worker# alias tests
62*2d543d20SAndroid Build Coastguard Workertypealias g_b_type_3 alias g_m_alias_1;
63*2d543d20SAndroid Build Coastguard Worker
64*2d543d20SAndroid Build Coastguard Worker# single boolean in module
65*2d543d20SAndroid Build Coastguard Workerbool g_m1_bool_1 true;
66*2d543d20SAndroid Build Coastguard Workerif (g_m1_bool_1) {
67*2d543d20SAndroid Build Coastguard Worker	allow g_m1_type_1 g_m1_type_2 : lnk_file append;
68*2d543d20SAndroid Build Coastguard Worker}
69*2d543d20SAndroid Build Coastguard Worker
70*2d543d20SAndroid Build Coastguard Worker
71*2d543d20SAndroid Build Coastguard Workeroptional {
72*2d543d20SAndroid Build Coastguard Worker	require {
73*2d543d20SAndroid Build Coastguard Worker		type optional_type;
74*2d543d20SAndroid Build Coastguard Worker		attribute g_b_attr_4;
75*2d543d20SAndroid Build Coastguard Worker		attribute o1_b_attr_2;
76*2d543d20SAndroid Build Coastguard Worker		class lnk_file { ioctl };
77*2d543d20SAndroid Build Coastguard Worker	}
78*2d543d20SAndroid Build Coastguard Worker
79*2d543d20SAndroid Build Coastguard Worker	type tag_o1_m1;
80*2d543d20SAndroid Build Coastguard Worker
81*2d543d20SAndroid Build Coastguard Worker	attribute o1_m1_attr_1;
82*2d543d20SAndroid Build Coastguard Worker	type o1_m1_type_2, o1_m1_attr_1;
83*2d543d20SAndroid Build Coastguard Worker
84*2d543d20SAndroid Build Coastguard Worker	type o1_m1_type_1;
85*2d543d20SAndroid Build Coastguard Worker	role o1_m1_role_1;
86*2d543d20SAndroid Build Coastguard Worker	role o1_m1_role_1 types o1_m1_type_1;
87*2d543d20SAndroid Build Coastguard Worker
88*2d543d20SAndroid Build Coastguard Worker	type o1_m1_type_3;
89*2d543d20SAndroid Build Coastguard Worker	typeattribute o1_m1_type_3 g_b_attr_4;
90*2d543d20SAndroid Build Coastguard Worker
91*2d543d20SAndroid Build Coastguard Worker	type o1_m1_type_5;
92*2d543d20SAndroid Build Coastguard Worker	typeattribute o1_m1_type_5 o1_b_attr_2;
93*2d543d20SAndroid Build Coastguard Worker
94*2d543d20SAndroid Build Coastguard Worker	bool o1_m1_bool_1 false;
95*2d543d20SAndroid Build Coastguard Worker	if (o1_m1_bool_1) {
96*2d543d20SAndroid Build Coastguard Worker		allow o1_m1_type_2 o1_m1_type_1 : lnk_file ioctl;
97*2d543d20SAndroid Build Coastguard Worker	}
98*2d543d20SAndroid Build Coastguard Worker
99*2d543d20SAndroid Build Coastguard Worker}
100*2d543d20SAndroid Build Coastguard Worker
101*2d543d20SAndroid Build Coastguard Workeroptional {
102*2d543d20SAndroid Build Coastguard Worker	require {
103*2d543d20SAndroid Build Coastguard Worker		type optional_type;
104*2d543d20SAndroid Build Coastguard Worker		#role g_b_role_4; // This causes a bug where the role scope doesn't get copied into base
105*2d543d20SAndroid Build Coastguard Worker	}
106*2d543d20SAndroid Build Coastguard Worker
107*2d543d20SAndroid Build Coastguard Worker	type tag_o2_m1;
108*2d543d20SAndroid Build Coastguard Worker
109*2d543d20SAndroid Build Coastguard Worker	role g_b_role_4;
110*2d543d20SAndroid Build Coastguard Worker	role g_b_role_4 types g_m1_type_2;
111*2d543d20SAndroid Build Coastguard Worker}
112*2d543d20SAndroid Build Coastguard Worker
113*2d543d20SAndroid Build Coastguard Workeroptional {
114*2d543d20SAndroid Build Coastguard Worker	require {
115*2d543d20SAndroid Build Coastguard Worker		attribute g_b_attr_6;
116*2d543d20SAndroid Build Coastguard Worker	}
117*2d543d20SAndroid Build Coastguard Worker
118*2d543d20SAndroid Build Coastguard Worker	type tag_o3_m1;
119*2d543d20SAndroid Build Coastguard Worker
120*2d543d20SAndroid Build Coastguard Worker	type o3_m1_type_1;
121*2d543d20SAndroid Build Coastguard Worker	role o3_b_role_1;
122*2d543d20SAndroid Build Coastguard Worker        role o3_b_role_1 types o3_m1_type_1;
123*2d543d20SAndroid Build Coastguard Worker
124*2d543d20SAndroid Build Coastguard Worker	type o3_m1_type_2, g_b_attr_6;
125*2d543d20SAndroid Build Coastguard Worker
126*2d543d20SAndroid Build Coastguard Worker	attribute o3_m1_attr_1;
127*2d543d20SAndroid Build Coastguard Worker
128*2d543d20SAndroid Build Coastguard Worker	# attr a added to in base optional, declared/added in module optional, added to in other module
129*2d543d20SAndroid Build Coastguard Worker	attribute o3_m1_attr_2;
130*2d543d20SAndroid Build Coastguard Worker	type o3_m1_type_3, o3_m1_attr_2;
131*2d543d20SAndroid Build Coastguard Worker
132*2d543d20SAndroid Build Coastguard Worker}
133*2d543d20SAndroid Build Coastguard Worker
134*2d543d20SAndroid Build Coastguard Workeroptional {
135*2d543d20SAndroid Build Coastguard Worker	require {
136*2d543d20SAndroid Build Coastguard Worker		type enable_optional;
137*2d543d20SAndroid Build Coastguard Worker	}
138*2d543d20SAndroid Build Coastguard Worker	type tag_o4_m1;
139*2d543d20SAndroid Build Coastguard Worker
140*2d543d20SAndroid Build Coastguard Worker	attribute o4_m1_attr_1;
141*2d543d20SAndroid Build Coastguard Worker	type o4_m1_type_1;
142*2d543d20SAndroid Build Coastguard Worker	typeattribute o4_m1_type_1 o4_m1_attr_1;
143*2d543d20SAndroid Build Coastguard Worker
144*2d543d20SAndroid Build Coastguard Worker
145*2d543d20SAndroid Build Coastguard Worker}
146