Commit 5e7f0ef
selinux: match extended permissions to their base permissions
In commit d1d991e ("selinux: Add netlink xperm support") a new
extended permission was added ("nlmsg"). This was the second extended
permission implemented in selinux ("ioctl" being the first one).
Extended permissions are associated with a base permission. It was found
that, in the access vector cache (avc), the extended permission did not
keep track of its base permission. This is an issue for a domain that is
using both extended permissions (i.e., a domain calling ioctl() on a
netlink socket). In this case, the extended permissions were
overlapping.
Keep track of the base permission in the cache. A new field "base_perm"
is added to struct extended_perms_decision to make sure that the
extended permission refers to the correct policy permission. A new field
"base_perms" is added to struct extended_perms to quickly decide if
extended permissions apply.
While it is in theory possible to retrieve the base permission from the
access vector, the same base permission may not be mapped to the same
bit for each class (e.g., "nlmsg" is mapped to a different bit for
"netlink_route_socket" and "netlink_audit_socket"). Instead, use a
constant (AVC_EXT_IOCTL or AVC_EXT_NLMSG) provided by the caller.
Fixes: d1d991e ("selinux: Add netlink xperm support")
Signed-off-by: Thiébaud Weksteen <[email protected]>
Signed-off-by: Paul Moore <[email protected]>1 parent 900f83c commit 5e7f0ef
File tree
5 files changed
+65
-38
lines changed- security/selinux
- include
- ss
5 files changed
+65
-38
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
174 | 174 | | |
175 | 175 | | |
176 | 176 | | |
177 | | - | |
178 | | - | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
179 | 180 | | |
180 | 181 | | |
181 | 182 | | |
182 | 183 | | |
183 | | - | |
| 184 | + | |
| 185 | + | |
184 | 186 | | |
185 | 187 | | |
186 | 188 | | |
| |||
205 | 207 | | |
206 | 208 | | |
207 | 209 | | |
208 | | - | |
| 210 | + | |
209 | 211 | | |
210 | 212 | | |
211 | 213 | | |
212 | | - | |
| 214 | + | |
| 215 | + | |
213 | 216 | | |
214 | 217 | | |
215 | 218 | | |
| |||
245 | 248 | | |
246 | 249 | | |
247 | 250 | | |
| 251 | + | |
248 | 252 | | |
249 | 253 | | |
250 | 254 | | |
| |||
272 | 276 | | |
273 | 277 | | |
274 | 278 | | |
| 279 | + | |
275 | 280 | | |
276 | 281 | | |
277 | 282 | | |
| |||
357 | 362 | | |
358 | 363 | | |
359 | 364 | | |
| 365 | + | |
360 | 366 | | |
361 | 367 | | |
362 | 368 | | |
| |||
807 | 813 | | |
808 | 814 | | |
809 | 815 | | |
| 816 | + | |
810 | 817 | | |
811 | 818 | | |
812 | 819 | | |
| |||
820 | 827 | | |
821 | 828 | | |
822 | 829 | | |
823 | | - | |
824 | | - | |
825 | | - | |
826 | | - | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
827 | 833 | | |
828 | 834 | | |
829 | 835 | | |
| |||
880 | 886 | | |
881 | 887 | | |
882 | 888 | | |
883 | | - | |
| 889 | + | |
884 | 890 | | |
885 | 891 | | |
886 | 892 | | |
| |||
987 | 993 | | |
988 | 994 | | |
989 | 995 | | |
990 | | - | |
991 | | - | |
992 | | - | |
993 | | - | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
994 | 999 | | |
995 | 1000 | | |
996 | 1001 | | |
| |||
999 | 1004 | | |
1000 | 1005 | | |
1001 | 1006 | | |
1002 | | - | |
| 1007 | + | |
1003 | 1008 | | |
1004 | 1009 | | |
1005 | 1010 | | |
| |||
1012 | 1017 | | |
1013 | 1018 | | |
1014 | 1019 | | |
1015 | | - | |
| 1020 | + | |
| 1021 | + | |
1016 | 1022 | | |
1017 | 1023 | | |
1018 | 1024 | | |
| |||
1047 | 1053 | | |
1048 | 1054 | | |
1049 | 1055 | | |
1050 | | - | |
| 1056 | + | |
1051 | 1057 | | |
1052 | 1058 | | |
1053 | 1059 | | |
1054 | | - | |
| 1060 | + | |
1055 | 1061 | | |
1056 | | - | |
| 1062 | + | |
| 1063 | + | |
1057 | 1064 | | |
1058 | 1065 | | |
1059 | 1066 | | |
1060 | 1067 | | |
1061 | | - | |
1062 | | - | |
| 1068 | + | |
| 1069 | + | |
1063 | 1070 | | |
1064 | | - | |
1065 | | - | |
| 1071 | + | |
| 1072 | + | |
1066 | 1073 | | |
1067 | 1074 | | |
1068 | 1075 | | |
| |||
1075 | 1082 | | |
1076 | 1083 | | |
1077 | 1084 | | |
1078 | | - | |
1079 | | - | |
| 1085 | + | |
| 1086 | + | |
1080 | 1087 | | |
1081 | 1088 | | |
1082 | 1089 | | |
| |||
1110 | 1117 | | |
1111 | 1118 | | |
1112 | 1119 | | |
1113 | | - | |
| 1120 | + | |
1114 | 1121 | | |
1115 | 1122 | | |
1116 | 1123 | | |
| |||
1158 | 1165 | | |
1159 | 1166 | | |
1160 | 1167 | | |
1161 | | - | |
| 1168 | + | |
1162 | 1169 | | |
1163 | 1170 | | |
1164 | 1171 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3688 | 3688 | | |
3689 | 3689 | | |
3690 | 3690 | | |
3691 | | - | |
3692 | | - | |
| 3691 | + | |
| 3692 | + | |
3693 | 3693 | | |
3694 | 3694 | | |
3695 | 3695 | | |
| |||
5952 | 5952 | | |
5953 | 5953 | | |
5954 | 5954 | | |
5955 | | - | |
| 5955 | + | |
5956 | 5956 | | |
5957 | 5957 | | |
5958 | 5958 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
139 | 141 | | |
140 | | - | |
| 142 | + | |
| 143 | + | |
141 | 144 | | |
142 | 145 | | |
143 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
| 242 | + | |
242 | 243 | | |
243 | 244 | | |
244 | 245 | | |
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
248 | 249 | | |
| 250 | + | |
249 | 251 | | |
250 | 252 | | |
251 | 253 | | |
| |||
257 | 259 | | |
258 | 260 | | |
259 | 261 | | |
| 262 | + | |
260 | 263 | | |
261 | 264 | | |
262 | 265 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
582 | 582 | | |
583 | 583 | | |
584 | 584 | | |
585 | | - | |
| 585 | + | |
586 | 586 | | |
587 | 587 | | |
588 | 588 | | |
| |||
592 | 592 | | |
593 | 593 | | |
594 | 594 | | |
| 595 | + | |
595 | 596 | | |
596 | 597 | | |
597 | 598 | | |
598 | 599 | | |
599 | 600 | | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
600 | 606 | | |
| 607 | + | |
601 | 608 | | |
602 | 609 | | |
603 | 610 | | |
| |||
631 | 638 | | |
632 | 639 | | |
633 | 640 | | |
634 | | - | |
635 | | - | |
| 641 | + | |
636 | 642 | | |
637 | 643 | | |
638 | 644 | | |
| |||
969 | 975 | | |
970 | 976 | | |
971 | 977 | | |
972 | | - | |
973 | | - | |
| 978 | + | |
| 979 | + | |
974 | 980 | | |
975 | 981 | | |
976 | 982 | | |
977 | | - | |
978 | | - | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
979 | 991 | | |
980 | 992 | | |
981 | 993 | | |
| |||
1010 | 1022 | | |
1011 | 1023 | | |
1012 | 1024 | | |
| 1025 | + | |
1013 | 1026 | | |
1014 | 1027 | | |
1015 | 1028 | | |
| |||
1023 | 1036 | | |
1024 | 1037 | | |
1025 | 1038 | | |
| 1039 | + | |
1026 | 1040 | | |
1027 | 1041 | | |
1028 | 1042 | | |
| |||
0 commit comments