diff options
Diffstat (limited to 'security/selinux')
-rw-r--r-- | security/selinux/avc.c | 169 | ||||
-rw-r--r-- | security/selinux/hooks.c | 308 | ||||
-rw-r--r-- | security/selinux/include/av_perm_to_string.h | 2 | ||||
-rw-r--r-- | security/selinux/include/av_permissions.h | 2 | ||||
-rw-r--r-- | security/selinux/include/objsec.h | 2 | ||||
-rw-r--r-- | security/selinux/include/security.h | 9 | ||||
-rw-r--r-- | security/selinux/nlmsgtab.c | 2 | ||||
-rw-r--r-- | security/selinux/selinuxfs.c | 2 | ||||
-rw-r--r-- | security/selinux/ss/services.c | 2 |
9 files changed, 216 insertions, 282 deletions
diff --git a/security/selinux/avc.c b/security/selinux/avc.c index eb41f43e2772..7f9b5fac8779 100644 --- a/security/selinux/avc.c +++ b/security/selinux/avc.c | |||
@@ -88,17 +88,16 @@ struct avc_entry { | |||
88 | u32 tsid; | 88 | u32 tsid; |
89 | u16 tclass; | 89 | u16 tclass; |
90 | struct av_decision avd; | 90 | struct av_decision avd; |
91 | atomic_t used; /* used recently */ | ||
92 | }; | 91 | }; |
93 | 92 | ||
94 | struct avc_node { | 93 | struct avc_node { |
95 | struct avc_entry ae; | 94 | struct avc_entry ae; |
96 | struct list_head list; | 95 | struct hlist_node list; /* anchored in avc_cache->slots[i] */ |
97 | struct rcu_head rhead; | 96 | struct rcu_head rhead; |
98 | }; | 97 | }; |
99 | 98 | ||
100 | struct avc_cache { | 99 | struct avc_cache { |
101 | struct list_head slots[AVC_CACHE_SLOTS]; | 100 | struct hlist_head slots[AVC_CACHE_SLOTS]; /* head for avc_node->list */ |
102 | spinlock_t slots_lock[AVC_CACHE_SLOTS]; /* lock for writes */ | 101 | spinlock_t slots_lock[AVC_CACHE_SLOTS]; /* lock for writes */ |
103 | atomic_t lru_hint; /* LRU hint for reclaim scan */ | 102 | atomic_t lru_hint; /* LRU hint for reclaim scan */ |
104 | atomic_t active_nodes; | 103 | atomic_t active_nodes; |
@@ -234,7 +233,7 @@ void __init avc_init(void) | |||
234 | int i; | 233 | int i; |
235 | 234 | ||
236 | for (i = 0; i < AVC_CACHE_SLOTS; i++) { | 235 | for (i = 0; i < AVC_CACHE_SLOTS; i++) { |
237 | INIT_LIST_HEAD(&avc_cache.slots[i]); | 236 | INIT_HLIST_HEAD(&avc_cache.slots[i]); |
238 | spin_lock_init(&avc_cache.slots_lock[i]); | 237 | spin_lock_init(&avc_cache.slots_lock[i]); |
239 | } | 238 | } |
240 | atomic_set(&avc_cache.active_nodes, 0); | 239 | atomic_set(&avc_cache.active_nodes, 0); |
@@ -250,16 +249,20 @@ int avc_get_hash_stats(char *page) | |||
250 | { | 249 | { |
251 | int i, chain_len, max_chain_len, slots_used; | 250 | int i, chain_len, max_chain_len, slots_used; |
252 | struct avc_node *node; | 251 | struct avc_node *node; |
252 | struct hlist_head *head; | ||
253 | 253 | ||
254 | rcu_read_lock(); | 254 | rcu_read_lock(); |
255 | 255 | ||
256 | slots_used = 0; | 256 | slots_used = 0; |
257 | max_chain_len = 0; | 257 | max_chain_len = 0; |
258 | for (i = 0; i < AVC_CACHE_SLOTS; i++) { | 258 | for (i = 0; i < AVC_CACHE_SLOTS; i++) { |
259 | if (!list_empty(&avc_cache.slots[i])) { | 259 | head = &avc_cache.slots[i]; |
260 | if (!hlist_empty(head)) { | ||
261 | struct hlist_node *next; | ||
262 | |||
260 | slots_used++; | 263 | slots_used++; |
261 | chain_len = 0; | 264 | chain_len = 0; |
262 | list_for_each_entry_rcu(node, &avc_cache.slots[i], list) | 265 | hlist_for_each_entry_rcu(node, next, head, list) |
263 | chain_len++; | 266 | chain_len++; |
264 | if (chain_len > max_chain_len) | 267 | if (chain_len > max_chain_len) |
265 | max_chain_len = chain_len; | 268 | max_chain_len = chain_len; |
@@ -283,7 +286,7 @@ static void avc_node_free(struct rcu_head *rhead) | |||
283 | 286 | ||
284 | static void avc_node_delete(struct avc_node *node) | 287 | static void avc_node_delete(struct avc_node *node) |
285 | { | 288 | { |
286 | list_del_rcu(&node->list); | 289 | hlist_del_rcu(&node->list); |
287 | call_rcu(&node->rhead, avc_node_free); | 290 | call_rcu(&node->rhead, avc_node_free); |
288 | atomic_dec(&avc_cache.active_nodes); | 291 | atomic_dec(&avc_cache.active_nodes); |
289 | } | 292 | } |
@@ -297,7 +300,7 @@ static void avc_node_kill(struct avc_node *node) | |||
297 | 300 | ||
298 | static void avc_node_replace(struct avc_node *new, struct avc_node *old) | 301 | static void avc_node_replace(struct avc_node *new, struct avc_node *old) |
299 | { | 302 | { |
300 | list_replace_rcu(&old->list, &new->list); | 303 | hlist_replace_rcu(&old->list, &new->list); |
301 | call_rcu(&old->rhead, avc_node_free); | 304 | call_rcu(&old->rhead, avc_node_free); |
302 | atomic_dec(&avc_cache.active_nodes); | 305 | atomic_dec(&avc_cache.active_nodes); |
303 | } | 306 | } |
@@ -307,29 +310,31 @@ static inline int avc_reclaim_node(void) | |||
307 | struct avc_node *node; | 310 | struct avc_node *node; |
308 | int hvalue, try, ecx; | 311 | int hvalue, try, ecx; |
309 | unsigned long flags; | 312 | unsigned long flags; |
313 | struct hlist_head *head; | ||
314 | struct hlist_node *next; | ||
315 | spinlock_t *lock; | ||
310 | 316 | ||
311 | for (try = 0, ecx = 0; try < AVC_CACHE_SLOTS; try++) { | 317 | for (try = 0, ecx = 0; try < AVC_CACHE_SLOTS; try++) { |
312 | hvalue = atomic_inc_return(&avc_cache.lru_hint) & (AVC_CACHE_SLOTS - 1); | 318 | hvalue = atomic_inc_return(&avc_cache.lru_hint) & (AVC_CACHE_SLOTS - 1); |
319 | head = &avc_cache.slots[hvalue]; | ||
320 | lock = &avc_cache.slots_lock[hvalue]; | ||
313 | 321 | ||
314 | if (!spin_trylock_irqsave(&avc_cache.slots_lock[hvalue], flags)) | 322 | if (!spin_trylock_irqsave(lock, flags)) |
315 | continue; | 323 | continue; |
316 | 324 | ||
317 | rcu_read_lock(); | 325 | rcu_read_lock(); |
318 | list_for_each_entry(node, &avc_cache.slots[hvalue], list) { | 326 | hlist_for_each_entry(node, next, head, list) { |
319 | if (atomic_dec_and_test(&node->ae.used)) { | 327 | avc_node_delete(node); |
320 | /* Recently Unused */ | 328 | avc_cache_stats_incr(reclaims); |
321 | avc_node_delete(node); | 329 | ecx++; |
322 | avc_cache_stats_incr(reclaims); | 330 | if (ecx >= AVC_CACHE_RECLAIM) { |
323 | ecx++; | 331 | rcu_read_unlock(); |
324 | if (ecx >= AVC_CACHE_RECLAIM) { | 332 | spin_unlock_irqrestore(lock, flags); |
325 | rcu_read_unlock(); | 333 | goto out; |
326 | spin_unlock_irqrestore(&avc_cache.slots_lock[hvalue], flags); | ||
327 | goto out; | ||
328 | } | ||
329 | } | 334 | } |
330 | } | 335 | } |
331 | rcu_read_unlock(); | 336 | rcu_read_unlock(); |
332 | spin_unlock_irqrestore(&avc_cache.slots_lock[hvalue], flags); | 337 | spin_unlock_irqrestore(lock, flags); |
333 | } | 338 | } |
334 | out: | 339 | out: |
335 | return ecx; | 340 | return ecx; |
@@ -344,8 +349,7 @@ static struct avc_node *avc_alloc_node(void) | |||
344 | goto out; | 349 | goto out; |
345 | 350 | ||
346 | INIT_RCU_HEAD(&node->rhead); | 351 | INIT_RCU_HEAD(&node->rhead); |
347 | INIT_LIST_HEAD(&node->list); | 352 | INIT_HLIST_NODE(&node->list); |
348 | atomic_set(&node->ae.used, 1); | ||
349 | avc_cache_stats_incr(allocations); | 353 | avc_cache_stats_incr(allocations); |
350 | 354 | ||
351 | if (atomic_inc_return(&avc_cache.active_nodes) > avc_cache_threshold) | 355 | if (atomic_inc_return(&avc_cache.active_nodes) > avc_cache_threshold) |
@@ -355,21 +359,24 @@ out: | |||
355 | return node; | 359 | return node; |
356 | } | 360 | } |
357 | 361 | ||
358 | static void avc_node_populate(struct avc_node *node, u32 ssid, u32 tsid, u16 tclass, struct avc_entry *ae) | 362 | static void avc_node_populate(struct avc_node *node, u32 ssid, u32 tsid, u16 tclass, struct av_decision *avd) |
359 | { | 363 | { |
360 | node->ae.ssid = ssid; | 364 | node->ae.ssid = ssid; |
361 | node->ae.tsid = tsid; | 365 | node->ae.tsid = tsid; |
362 | node->ae.tclass = tclass; | 366 | node->ae.tclass = tclass; |
363 | memcpy(&node->ae.avd, &ae->avd, sizeof(node->ae.avd)); | 367 | memcpy(&node->ae.avd, avd, sizeof(node->ae.avd)); |
364 | } | 368 | } |
365 | 369 | ||
366 | static inline struct avc_node *avc_search_node(u32 ssid, u32 tsid, u16 tclass) | 370 | static inline struct avc_node *avc_search_node(u32 ssid, u32 tsid, u16 tclass) |
367 | { | 371 | { |
368 | struct avc_node *node, *ret = NULL; | 372 | struct avc_node *node, *ret = NULL; |
369 | int hvalue; | 373 | int hvalue; |
374 | struct hlist_head *head; | ||
375 | struct hlist_node *next; | ||
370 | 376 | ||
371 | hvalue = avc_hash(ssid, tsid, tclass); | 377 | hvalue = avc_hash(ssid, tsid, tclass); |
372 | list_for_each_entry_rcu(node, &avc_cache.slots[hvalue], list) { | 378 | head = &avc_cache.slots[hvalue]; |
379 | hlist_for_each_entry_rcu(node, next, head, list) { | ||
373 | if (ssid == node->ae.ssid && | 380 | if (ssid == node->ae.ssid && |
374 | tclass == node->ae.tclass && | 381 | tclass == node->ae.tclass && |
375 | tsid == node->ae.tsid) { | 382 | tsid == node->ae.tsid) { |
@@ -378,15 +385,6 @@ static inline struct avc_node *avc_search_node(u32 ssid, u32 tsid, u16 tclass) | |||
378 | } | 385 | } |
379 | } | 386 | } |
380 | 387 | ||
381 | if (ret == NULL) { | ||
382 | /* cache miss */ | ||
383 | goto out; | ||
384 | } | ||
385 | |||
386 | /* cache hit */ | ||
387 | if (atomic_read(&ret->ae.used) != 1) | ||
388 | atomic_set(&ret->ae.used, 1); | ||
389 | out: | ||
390 | return ret; | 388 | return ret; |
391 | } | 389 | } |
392 | 390 | ||
@@ -395,30 +393,25 @@ out: | |||
395 | * @ssid: source security identifier | 393 | * @ssid: source security identifier |
396 | * @tsid: target security identifier | 394 | * @tsid: target security identifier |
397 | * @tclass: target security class | 395 | * @tclass: target security class |
398 | * @requested: requested permissions, interpreted based on @tclass | ||
399 | * | 396 | * |
400 | * Look up an AVC entry that is valid for the | 397 | * Look up an AVC entry that is valid for the |
401 | * @requested permissions between the SID pair | ||
402 | * (@ssid, @tsid), interpreting the permissions | 398 | * (@ssid, @tsid), interpreting the permissions |
403 | * based on @tclass. If a valid AVC entry exists, | 399 | * based on @tclass. If a valid AVC entry exists, |
404 | * then this function return the avc_node. | 400 | * then this function return the avc_node. |
405 | * Otherwise, this function returns NULL. | 401 | * Otherwise, this function returns NULL. |
406 | */ | 402 | */ |
407 | static struct avc_node *avc_lookup(u32 ssid, u32 tsid, u16 tclass, u32 requested) | 403 | static struct avc_node *avc_lookup(u32 ssid, u32 tsid, u16 tclass) |
408 | { | 404 | { |
409 | struct avc_node *node; | 405 | struct avc_node *node; |
410 | 406 | ||
411 | avc_cache_stats_incr(lookups); | 407 | avc_cache_stats_incr(lookups); |
412 | node = avc_search_node(ssid, tsid, tclass); | 408 | node = avc_search_node(ssid, tsid, tclass); |
413 | 409 | ||
414 | if (node && ((node->ae.avd.decided & requested) == requested)) { | 410 | if (node) |
415 | avc_cache_stats_incr(hits); | 411 | avc_cache_stats_incr(hits); |
416 | goto out; | 412 | else |
417 | } | 413 | avc_cache_stats_incr(misses); |
418 | 414 | ||
419 | node = NULL; | ||
420 | avc_cache_stats_incr(misses); | ||
421 | out: | ||
422 | return node; | 415 | return node; |
423 | } | 416 | } |
424 | 417 | ||
@@ -449,34 +442,41 @@ static int avc_latest_notif_update(int seqno, int is_insert) | |||
449 | * @ssid: source security identifier | 442 | * @ssid: source security identifier |
450 | * @tsid: target security identifier | 443 | * @tsid: target security identifier |
451 | * @tclass: target security class | 444 | * @tclass: target security class |
452 | * @ae: AVC entry | 445 | * @avd: resulting av decision |
453 | * | 446 | * |
454 | * Insert an AVC entry for the SID pair | 447 | * Insert an AVC entry for the SID pair |
455 | * (@ssid, @tsid) and class @tclass. | 448 | * (@ssid, @tsid) and class @tclass. |
456 | * The access vectors and the sequence number are | 449 | * The access vectors and the sequence number are |
457 | * normally provided by the security server in | 450 | * normally provided by the security server in |
458 | * response to a security_compute_av() call. If the | 451 | * response to a security_compute_av() call. If the |
459 | * sequence number @ae->avd.seqno is not less than the latest | 452 | * sequence number @avd->seqno is not less than the latest |
460 | * revocation notification, then the function copies | 453 | * revocation notification, then the function copies |
461 | * the access vectors into a cache entry, returns | 454 | * the access vectors into a cache entry, returns |
462 | * avc_node inserted. Otherwise, this function returns NULL. | 455 | * avc_node inserted. Otherwise, this function returns NULL. |
463 | */ | 456 | */ |
464 | static struct avc_node *avc_insert(u32 ssid, u32 tsid, u16 tclass, struct avc_entry *ae) | 457 | static struct avc_node *avc_insert(u32 ssid, u32 tsid, u16 tclass, struct av_decision *avd) |
465 | { | 458 | { |
466 | struct avc_node *pos, *node = NULL; | 459 | struct avc_node *pos, *node = NULL; |
467 | int hvalue; | 460 | int hvalue; |
468 | unsigned long flag; | 461 | unsigned long flag; |
469 | 462 | ||
470 | if (avc_latest_notif_update(ae->avd.seqno, 1)) | 463 | if (avc_latest_notif_update(avd->seqno, 1)) |
471 | goto out; | 464 | goto out; |
472 | 465 | ||
473 | node = avc_alloc_node(); | 466 | node = avc_alloc_node(); |
474 | if (node) { | 467 | if (node) { |
468 | struct hlist_head *head; | ||
469 | struct hlist_node *next; | ||
470 | spinlock_t *lock; | ||
471 | |||
475 | hvalue = avc_hash(ssid, tsid, tclass); | 472 | hvalue = avc_hash(ssid, tsid, tclass); |
476 | avc_node_populate(node, ssid, tsid, tclass, ae); | 473 | avc_node_populate(node, ssid, tsid, tclass, avd); |
474 | |||
475 | head = &avc_cache.slots[hvalue]; | ||
476 | lock = &avc_cache.slots_lock[hvalue]; | ||
477 | 477 | ||
478 | spin_lock_irqsave(&avc_cache.slots_lock[hvalue], flag); | 478 | spin_lock_irqsave(lock, flag); |
479 | list_for_each_entry(pos, &avc_cache.slots[hvalue], list) { | 479 | hlist_for_each_entry(pos, next, head, list) { |
480 | if (pos->ae.ssid == ssid && | 480 | if (pos->ae.ssid == ssid && |
481 | pos->ae.tsid == tsid && | 481 | pos->ae.tsid == tsid && |
482 | pos->ae.tclass == tclass) { | 482 | pos->ae.tclass == tclass) { |
@@ -484,9 +484,9 @@ static struct avc_node *avc_insert(u32 ssid, u32 tsid, u16 tclass, struct avc_en | |||
484 | goto found; | 484 | goto found; |
485 | } | 485 | } |
486 | } | 486 | } |
487 | list_add_rcu(&node->list, &avc_cache.slots[hvalue]); | 487 | hlist_add_head_rcu(&node->list, head); |
488 | found: | 488 | found: |
489 | spin_unlock_irqrestore(&avc_cache.slots_lock[hvalue], flag); | 489 | spin_unlock_irqrestore(lock, flag); |
490 | } | 490 | } |
491 | out: | 491 | out: |
492 | return node; | 492 | return node; |
@@ -742,17 +742,22 @@ static inline int avc_sidcmp(u32 x, u32 y) | |||
742 | * @event : Updating event | 742 | * @event : Updating event |
743 | * @perms : Permission mask bits | 743 | * @perms : Permission mask bits |
744 | * @ssid,@tsid,@tclass : identifier of an AVC entry | 744 | * @ssid,@tsid,@tclass : identifier of an AVC entry |
745 | * @seqno : sequence number when decision was made | ||
745 | * | 746 | * |
746 | * if a valid AVC entry doesn't exist,this function returns -ENOENT. | 747 | * if a valid AVC entry doesn't exist,this function returns -ENOENT. |
747 | * if kmalloc() called internal returns NULL, this function returns -ENOMEM. | 748 | * if kmalloc() called internal returns NULL, this function returns -ENOMEM. |
748 | * otherwise, this function update the AVC entry. The original AVC-entry object | 749 | * otherwise, this function update the AVC entry. The original AVC-entry object |
749 | * will release later by RCU. | 750 | * will release later by RCU. |
750 | */ | 751 | */ |
751 | static int avc_update_node(u32 event, u32 perms, u32 ssid, u32 tsid, u16 tclass) | 752 | static int avc_update_node(u32 event, u32 perms, u32 ssid, u32 tsid, u16 tclass, |
753 | u32 seqno) | ||
752 | { | 754 | { |
753 | int hvalue, rc = 0; | 755 | int hvalue, rc = 0; |
754 | unsigned long flag; | 756 | unsigned long flag; |
755 | struct avc_node *pos, *node, *orig = NULL; | 757 | struct avc_node *pos, *node, *orig = NULL; |
758 | struct hlist_head *head; | ||
759 | struct hlist_node *next; | ||
760 | spinlock_t *lock; | ||
756 | 761 | ||
757 | node = avc_alloc_node(); | 762 | node = avc_alloc_node(); |
758 | if (!node) { | 763 | if (!node) { |
@@ -762,12 +767,17 @@ static int avc_update_node(u32 event, u32 perms, u32 ssid, u32 tsid, u16 tclass) | |||
762 | 767 | ||
763 | /* Lock the target slot */ | 768 | /* Lock the target slot */ |
764 | hvalue = avc_hash(ssid, tsid, tclass); | 769 | hvalue = avc_hash(ssid, tsid, tclass); |
765 | spin_lock_irqsave(&avc_cache.slots_lock[hvalue], flag); | ||
766 | 770 | ||
767 | list_for_each_entry(pos, &avc_cache.slots[hvalue], list) { | 771 | head = &avc_cache.slots[hvalue]; |
772 | lock = &avc_cache.slots_lock[hvalue]; | ||
773 | |||
774 | spin_lock_irqsave(lock, flag); | ||
775 | |||
776 | hlist_for_each_entry(pos, next, head, list) { | ||
768 | if (ssid == pos->ae.ssid && | 777 | if (ssid == pos->ae.ssid && |
769 | tsid == pos->ae.tsid && | 778 | tsid == pos->ae.tsid && |
770 | tclass == pos->ae.tclass){ | 779 | tclass == pos->ae.tclass && |
780 | seqno == pos->ae.avd.seqno){ | ||
771 | orig = pos; | 781 | orig = pos; |
772 | break; | 782 | break; |
773 | } | 783 | } |
@@ -783,7 +793,7 @@ static int avc_update_node(u32 event, u32 perms, u32 ssid, u32 tsid, u16 tclass) | |||
783 | * Copy and replace original node. | 793 | * Copy and replace original node. |
784 | */ | 794 | */ |
785 | 795 | ||
786 | avc_node_populate(node, ssid, tsid, tclass, &orig->ae); | 796 | avc_node_populate(node, ssid, tsid, tclass, &orig->ae.avd); |
787 | 797 | ||
788 | switch (event) { | 798 | switch (event) { |
789 | case AVC_CALLBACK_GRANT: | 799 | case AVC_CALLBACK_GRANT: |
@@ -808,7 +818,7 @@ static int avc_update_node(u32 event, u32 perms, u32 ssid, u32 tsid, u16 tclass) | |||
808 | } | 818 | } |
809 | avc_node_replace(node, orig); | 819 | avc_node_replace(node, orig); |
810 | out_unlock: | 820 | out_unlock: |
811 | spin_unlock_irqrestore(&avc_cache.slots_lock[hvalue], flag); | 821 | spin_unlock_irqrestore(lock, flag); |
812 | out: | 822 | out: |
813 | return rc; | 823 | return rc; |
814 | } | 824 | } |
@@ -823,18 +833,24 @@ int avc_ss_reset(u32 seqno) | |||
823 | int i, rc = 0, tmprc; | 833 | int i, rc = 0, tmprc; |
824 | unsigned long flag; | 834 | unsigned long flag; |
825 | struct avc_node *node; | 835 | struct avc_node *node; |
836 | struct hlist_head *head; | ||
837 | struct hlist_node *next; | ||
838 | spinlock_t *lock; | ||
826 | 839 | ||
827 | for (i = 0; i < AVC_CACHE_SLOTS; i++) { | 840 | for (i = 0; i < AVC_CACHE_SLOTS; i++) { |
828 | spin_lock_irqsave(&avc_cache.slots_lock[i], flag); | 841 | head = &avc_cache.slots[i]; |
842 | lock = &avc_cache.slots_lock[i]; | ||
843 | |||
844 | spin_lock_irqsave(lock, flag); | ||
829 | /* | 845 | /* |
830 | * With preemptable RCU, the outer spinlock does not | 846 | * With preemptable RCU, the outer spinlock does not |
831 | * prevent RCU grace periods from ending. | 847 | * prevent RCU grace periods from ending. |
832 | */ | 848 | */ |
833 | rcu_read_lock(); | 849 | rcu_read_lock(); |
834 | list_for_each_entry(node, &avc_cache.slots[i], list) | 850 | hlist_for_each_entry(node, next, head, list) |
835 | avc_node_delete(node); | 851 | avc_node_delete(node); |
836 | rcu_read_unlock(); | 852 | rcu_read_unlock(); |
837 | spin_unlock_irqrestore(&avc_cache.slots_lock[i], flag); | 853 | spin_unlock_irqrestore(lock, flag); |
838 | } | 854 | } |
839 | 855 | ||
840 | for (c = avc_callbacks; c; c = c->next) { | 856 | for (c = avc_callbacks; c; c = c->next) { |
@@ -875,10 +891,10 @@ int avc_ss_reset(u32 seqno) | |||
875 | int avc_has_perm_noaudit(u32 ssid, u32 tsid, | 891 | int avc_has_perm_noaudit(u32 ssid, u32 tsid, |
876 | u16 tclass, u32 requested, | 892 | u16 tclass, u32 requested, |
877 | unsigned flags, | 893 | unsigned flags, |
878 | struct av_decision *avd) | 894 | struct av_decision *in_avd) |
879 | { | 895 | { |
880 | struct avc_node *node; | 896 | struct avc_node *node; |
881 | struct avc_entry entry, *p_ae; | 897 | struct av_decision avd_entry, *avd; |
882 | int rc = 0; | 898 | int rc = 0; |
883 | u32 denied; | 899 | u32 denied; |
884 | 900 | ||
@@ -886,29 +902,34 @@ int avc_has_perm_noaudit(u32 ssid, u32 tsid, | |||
886 | 902 | ||
887 | rcu_read_lock(); | 903 | rcu_read_lock(); |
888 | 904 | ||
889 | node = avc_lookup(ssid, tsid, tclass, requested); | 905 | node = avc_lookup(ssid, tsid, tclass); |
890 | if (!node) { | 906 | if (!node) { |
891 | rcu_read_unlock(); | 907 | rcu_read_unlock(); |
892 | rc = security_compute_av(ssid, tsid, tclass, requested, &entry.avd); | 908 | |
909 | if (in_avd) | ||
910 | avd = in_avd; | ||
911 | else | ||
912 | avd = &avd_entry; | ||
913 | |||
914 | rc = security_compute_av(ssid, tsid, tclass, requested, avd); | ||
893 | if (rc) | 915 | if (rc) |
894 | goto out; | 916 | goto out; |
895 | rcu_read_lock(); | 917 | rcu_read_lock(); |
896 | node = avc_insert(ssid, tsid, tclass, &entry); | 918 | node = avc_insert(ssid, tsid, tclass, avd); |
919 | } else { | ||
920 | if (in_avd) | ||
921 | memcpy(in_avd, &node->ae.avd, sizeof(*in_avd)); | ||
922 | avd = &node->ae.avd; | ||
897 | } | 923 | } |
898 | 924 | ||
899 | p_ae = node ? &node->ae : &entry; | 925 | denied = requested & ~(avd->allowed); |
900 | |||
901 | if (avd) | ||
902 | memcpy(avd, &p_ae->avd, sizeof(*avd)); | ||
903 | |||
904 | denied = requested & ~(p_ae->avd.allowed); | ||
905 | 926 | ||
906 | if (denied) { | 927 | if (denied) { |
907 | if (flags & AVC_STRICT) | 928 | if (flags & AVC_STRICT) |
908 | rc = -EACCES; | 929 | rc = -EACCES; |
909 | else if (!selinux_enforcing || security_permissive_sid(ssid)) | 930 | else if (!selinux_enforcing || security_permissive_sid(ssid)) |
910 | avc_update_node(AVC_CALLBACK_GRANT, requested, ssid, | 931 | avc_update_node(AVC_CALLBACK_GRANT, requested, ssid, |
911 | tsid, tclass); | 932 | tsid, tclass, avd->seqno); |
912 | else | 933 | else |
913 | rc = -EACCES; | 934 | rc = -EACCES; |
914 | } | 935 | } |
diff --git a/security/selinux/hooks.c b/security/selinux/hooks.c index 00815973d412..7c52ba243c64 100644 --- a/security/selinux/hooks.c +++ b/security/selinux/hooks.c | |||
@@ -89,7 +89,7 @@ | |||
89 | #define XATTR_SELINUX_SUFFIX "selinux" | 89 | #define XATTR_SELINUX_SUFFIX "selinux" |
90 | #define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX | 90 | #define XATTR_NAME_SELINUX XATTR_SECURITY_PREFIX XATTR_SELINUX_SUFFIX |
91 | 91 | ||
92 | #define NUM_SEL_MNT_OPTS 4 | 92 | #define NUM_SEL_MNT_OPTS 5 |
93 | 93 | ||
94 | extern unsigned int policydb_loaded_version; | 94 | extern unsigned int policydb_loaded_version; |
95 | extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); | 95 | extern int selinux_nlmsg_lookup(u16 sclass, u16 nlmsg_type, u32 *perm); |
@@ -353,6 +353,7 @@ enum { | |||
353 | Opt_fscontext = 2, | 353 | Opt_fscontext = 2, |
354 | Opt_defcontext = 3, | 354 | Opt_defcontext = 3, |
355 | Opt_rootcontext = 4, | 355 | Opt_rootcontext = 4, |
356 | Opt_labelsupport = 5, | ||
356 | }; | 357 | }; |
357 | 358 | ||
358 | static const match_table_t tokens = { | 359 | static const match_table_t tokens = { |
@@ -360,6 +361,7 @@ static const match_table_t tokens = { | |||
360 | {Opt_fscontext, FSCONTEXT_STR "%s"}, | 361 | {Opt_fscontext, FSCONTEXT_STR "%s"}, |
361 | {Opt_defcontext, DEFCONTEXT_STR "%s"}, | 362 | {Opt_defcontext, DEFCONTEXT_STR "%s"}, |
362 | {Opt_rootcontext, ROOTCONTEXT_STR "%s"}, | 363 | {Opt_rootcontext, ROOTCONTEXT_STR "%s"}, |
364 | {Opt_labelsupport, LABELSUPP_STR}, | ||
363 | {Opt_error, NULL}, | 365 | {Opt_error, NULL}, |
364 | }; | 366 | }; |
365 | 367 | ||
@@ -431,7 +433,7 @@ static int sb_finish_set_opts(struct super_block *sb) | |||
431 | } | 433 | } |
432 | } | 434 | } |
433 | 435 | ||
434 | sbsec->initialized = 1; | 436 | sbsec->flags |= (SE_SBINITIALIZED | SE_SBLABELSUPP); |
435 | 437 | ||
436 | if (sbsec->behavior > ARRAY_SIZE(labeling_behaviors)) | 438 | if (sbsec->behavior > ARRAY_SIZE(labeling_behaviors)) |
437 | printk(KERN_ERR "SELinux: initialized (dev %s, type %s), unknown behavior\n", | 439 | printk(KERN_ERR "SELinux: initialized (dev %s, type %s), unknown behavior\n", |
@@ -441,6 +443,12 @@ static int sb_finish_set_opts(struct super_block *sb) | |||
441 | sb->s_id, sb->s_type->name, | 443 | sb->s_id, sb->s_type->name, |
442 | labeling_behaviors[sbsec->behavior-1]); | 444 | labeling_behaviors[sbsec->behavior-1]); |
443 | 445 | ||
446 | if (sbsec->behavior == SECURITY_FS_USE_GENFS || | ||
447 | sbsec->behavior == SECURITY_FS_USE_MNTPOINT || | ||
448 | sbsec->behavior == SECURITY_FS_USE_NONE || | ||
449 | sbsec->behavior > ARRAY_SIZE(labeling_behaviors)) | ||
450 | sbsec->flags &= ~SE_SBLABELSUPP; | ||
451 | |||
444 | /* Initialize the root inode. */ | 452 | /* Initialize the root inode. */ |
445 | rc = inode_doinit_with_dentry(root_inode, root); | 453 | rc = inode_doinit_with_dentry(root_inode, root); |
446 | 454 | ||
@@ -487,23 +495,22 @@ static int selinux_get_mnt_opts(const struct super_block *sb, | |||
487 | 495 | ||
488 | security_init_mnt_opts(opts); | 496 | security_init_mnt_opts(opts); |
489 | 497 | ||
490 | if (!sbsec->initialized) | 498 | if (!(sbsec->flags & SE_SBINITIALIZED)) |
491 | return -EINVAL; | 499 | return -EINVAL; |
492 | 500 | ||
493 | if (!ss_initialized) | 501 | if (!ss_initialized) |
494 | return -EINVAL; | 502 | return -EINVAL; |
495 | 503 | ||
496 | /* | 504 | tmp = sbsec->flags & SE_MNTMASK; |
497 | * if we ever use sbsec flags for anything other than tracking mount | ||
498 | * settings this is going to need a mask | ||
499 | */ | ||
500 | tmp = sbsec->flags; | ||
501 | /* count the number of mount options for this sb */ | 505 | /* count the number of mount options for this sb */ |
502 | for (i = 0; i < 8; i++) { | 506 | for (i = 0; i < 8; i++) { |
503 | if (tmp & 0x01) | 507 | if (tmp & 0x01) |
504 | opts->num_mnt_opts++; | 508 | opts->num_mnt_opts++; |
505 | tmp >>= 1; | 509 | tmp >>= 1; |
506 | } | 510 | } |
511 | /* Check if the Label support flag is set */ | ||
512 | if (sbsec->flags & SE_SBLABELSUPP) | ||
513 | opts->num_mnt_opts++; | ||
507 | 514 | ||
508 | opts->mnt_opts = kcalloc(opts->num_mnt_opts, sizeof(char *), GFP_ATOMIC); | 515 | opts->mnt_opts = kcalloc(opts->num_mnt_opts, sizeof(char *), GFP_ATOMIC); |
509 | if (!opts->mnt_opts) { | 516 | if (!opts->mnt_opts) { |
@@ -549,6 +556,10 @@ static int selinux_get_mnt_opts(const struct super_block *sb, | |||
549 | opts->mnt_opts[i] = context; | 556 | opts->mnt_opts[i] = context; |
550 | opts->mnt_opts_flags[i++] = ROOTCONTEXT_MNT; | 557 | opts->mnt_opts_flags[i++] = ROOTCONTEXT_MNT; |
551 | } | 558 | } |
559 | if (sbsec->flags & SE_SBLABELSUPP) { | ||
560 | opts->mnt_opts[i] = NULL; | ||
561 | opts->mnt_opts_flags[i++] = SE_SBLABELSUPP; | ||
562 | } | ||
552 | 563 | ||
553 | BUG_ON(i != opts->num_mnt_opts); | 564 | BUG_ON(i != opts->num_mnt_opts); |
554 | 565 | ||
@@ -562,8 +573,10 @@ out_free: | |||
562 | static int bad_option(struct superblock_security_struct *sbsec, char flag, | 573 | static int bad_option(struct superblock_security_struct *sbsec, char flag, |
563 | u32 old_sid, u32 new_sid) | 574 | u32 old_sid, u32 new_sid) |
564 | { | 575 | { |
576 | char mnt_flags = sbsec->flags & SE_MNTMASK; | ||
577 | |||
565 | /* check if the old mount command had the same options */ | 578 | /* check if the old mount command had the same options */ |
566 | if (sbsec->initialized) | 579 | if (sbsec->flags & SE_SBINITIALIZED) |
567 | if (!(sbsec->flags & flag) || | 580 | if (!(sbsec->flags & flag) || |
568 | (old_sid != new_sid)) | 581 | (old_sid != new_sid)) |
569 | return 1; | 582 | return 1; |
@@ -571,8 +584,8 @@ static int bad_option(struct superblock_security_struct *sbsec, char flag, | |||
571 | /* check if we were passed the same options twice, | 584 | /* check if we were passed the same options twice, |
572 | * aka someone passed context=a,context=b | 585 | * aka someone passed context=a,context=b |
573 | */ | 586 | */ |
574 | if (!sbsec->initialized) | 587 | if (!(sbsec->flags & SE_SBINITIALIZED)) |
575 | if (sbsec->flags & flag) | 588 | if (mnt_flags & flag) |
576 | return 1; | 589 | return 1; |
577 | return 0; | 590 | return 0; |
578 | } | 591 | } |
@@ -626,7 +639,7 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
626 | * this sb does not set any security options. (The first options | 639 | * this sb does not set any security options. (The first options |
627 | * will be used for both mounts) | 640 | * will be used for both mounts) |
628 | */ | 641 | */ |
629 | if (sbsec->initialized && (sb->s_type->fs_flags & FS_BINARY_MOUNTDATA) | 642 | if ((sbsec->flags & SE_SBINITIALIZED) && (sb->s_type->fs_flags & FS_BINARY_MOUNTDATA) |
630 | && (num_opts == 0)) | 643 | && (num_opts == 0)) |
631 | goto out; | 644 | goto out; |
632 | 645 | ||
@@ -637,6 +650,9 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
637 | */ | 650 | */ |
638 | for (i = 0; i < num_opts; i++) { | 651 | for (i = 0; i < num_opts; i++) { |
639 | u32 sid; | 652 | u32 sid; |
653 | |||
654 | if (flags[i] == SE_SBLABELSUPP) | ||
655 | continue; | ||
640 | rc = security_context_to_sid(mount_options[i], | 656 | rc = security_context_to_sid(mount_options[i], |
641 | strlen(mount_options[i]), &sid); | 657 | strlen(mount_options[i]), &sid); |
642 | if (rc) { | 658 | if (rc) { |
@@ -690,19 +706,19 @@ static int selinux_set_mnt_opts(struct super_block *sb, | |||
690 | } | 706 | } |
691 | } | 707 | } |
692 | 708 | ||
693 | if (sbsec->initialized) { | 709 | if (sbsec->flags & SE_SBINITIALIZED) { |
694 | /* previously mounted with options, but not on this attempt? */ | 710 | /* previously mounted with options, but not on this attempt? */ |
695 | if (sbsec->flags && !num_opts) | 711 | if ((sbsec->flags & SE_MNTMASK) && !num_opts) |
696 | goto out_double_mount; | 712 | goto out_double_mount; |
697 | rc = 0; | 713 | rc = 0; |
698 | goto out; | 714 | goto out; |
699 | } | 715 | } |
700 | 716 | ||
701 | if (strcmp(sb->s_type->name, "proc") == 0) | 717 | if (strcmp(sb->s_type->name, "proc") == 0) |
702 | sbsec->proc = 1; | 718 | sbsec->flags |= SE_SBPROC; |
703 | 719 | ||
704 | /* Determine the labeling behavior to use for this filesystem type. */ | 720 | /* Determine the labeling behavior to use for this filesystem type. */ |
705 | rc = security_fs_use(sbsec->proc ? "proc" : sb->s_type->name, &sbsec->behavior, &sbsec->sid); | 721 | rc = security_fs_use((sbsec->flags & SE_SBPROC) ? "proc" : sb->s_type->name, &sbsec->behavior, &sbsec->sid); |
706 | if (rc) { | 722 | if (rc) { |
707 | printk(KERN_WARNING "%s: security_fs_use(%s) returned %d\n", | 723 | printk(KERN_WARNING "%s: security_fs_use(%s) returned %d\n", |
708 | __func__, sb->s_type->name, rc); | 724 | __func__, sb->s_type->name, rc); |
@@ -806,10 +822,10 @@ static void selinux_sb_clone_mnt_opts(const struct super_block *oldsb, | |||
806 | } | 822 | } |
807 | 823 | ||
808 | /* how can we clone if the old one wasn't set up?? */ | 824 | /* how can we clone if the old one wasn't set up?? */ |
809 | BUG_ON(!oldsbsec->initialized); | 825 | BUG_ON(!(oldsbsec->flags & SE_SBINITIALIZED)); |
810 | 826 | ||
811 | /* if fs is reusing a sb, just let its options stand... */ | 827 | /* if fs is reusing a sb, just let its options stand... */ |
812 | if (newsbsec->initialized) | 828 | if (newsbsec->flags & SE_SBINITIALIZED) |
813 | return; | 829 | return; |
814 | 830 | ||
815 | mutex_lock(&newsbsec->lock); | 831 | mutex_lock(&newsbsec->lock); |
@@ -917,7 +933,8 @@ static int selinux_parse_opts_str(char *options, | |||
917 | goto out_err; | 933 | goto out_err; |
918 | } | 934 | } |
919 | break; | 935 | break; |
920 | 936 | case Opt_labelsupport: | |
937 | break; | ||
921 | default: | 938 | default: |
922 | rc = -EINVAL; | 939 | rc = -EINVAL; |
923 | printk(KERN_WARNING "SELinux: unknown mount option\n"); | 940 | printk(KERN_WARNING "SELinux: unknown mount option\n"); |
@@ -999,7 +1016,12 @@ static void selinux_write_opts(struct seq_file *m, | |||
999 | char *prefix; | 1016 | char *prefix; |
1000 | 1017 | ||
1001 | for (i = 0; i < opts->num_mnt_opts; i++) { | 1018 | for (i = 0; i < opts->num_mnt_opts; i++) { |
1002 | char *has_comma = strchr(opts->mnt_opts[i], ','); | 1019 | char *has_comma; |
1020 | |||
1021 | if (opts->mnt_opts[i]) | ||
1022 | has_comma = strchr(opts->mnt_opts[i], ','); | ||
1023 | else | ||
1024 | has_comma = NULL; | ||
1003 | 1025 | ||
1004 | switch (opts->mnt_opts_flags[i]) { | 1026 | switch (opts->mnt_opts_flags[i]) { |
1005 | case CONTEXT_MNT: | 1027 | case CONTEXT_MNT: |
@@ -1014,6 +1036,10 @@ static void selinux_write_opts(struct seq_file *m, | |||
1014 | case DEFCONTEXT_MNT: | 1036 | case DEFCONTEXT_MNT: |
1015 | prefix = DEFCONTEXT_STR; | 1037 | prefix = DEFCONTEXT_STR; |
1016 | break; | 1038 | break; |
1039 | case SE_SBLABELSUPP: | ||
1040 | seq_putc(m, ','); | ||
1041 | seq_puts(m, LABELSUPP_STR); | ||
1042 | continue; | ||
1017 | default: | 1043 | default: |
1018 | BUG(); | 1044 | BUG(); |
1019 | }; | 1045 | }; |
@@ -1209,7 +1235,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1209 | goto out_unlock; | 1235 | goto out_unlock; |
1210 | 1236 | ||
1211 | sbsec = inode->i_sb->s_security; | 1237 | sbsec = inode->i_sb->s_security; |
1212 | if (!sbsec->initialized) { | 1238 | if (!(sbsec->flags & SE_SBINITIALIZED)) { |
1213 | /* Defer initialization until selinux_complete_init, | 1239 | /* Defer initialization until selinux_complete_init, |
1214 | after the initial policy is loaded and the security | 1240 | after the initial policy is loaded and the security |
1215 | server is ready to handle calls. */ | 1241 | server is ready to handle calls. */ |
@@ -1237,19 +1263,26 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1237 | dentry = d_find_alias(inode); | 1263 | dentry = d_find_alias(inode); |
1238 | } | 1264 | } |
1239 | if (!dentry) { | 1265 | if (!dentry) { |
1240 | printk(KERN_WARNING "SELinux: %s: no dentry for dev=%s " | 1266 | /* |
1241 | "ino=%ld\n", __func__, inode->i_sb->s_id, | 1267 | * this is can be hit on boot when a file is accessed |
1242 | inode->i_ino); | 1268 | * before the policy is loaded. When we load policy we |
1269 | * may find inodes that have no dentry on the | ||
1270 | * sbsec->isec_head list. No reason to complain as these | ||
1271 | * will get fixed up the next time we go through | ||
1272 | * inode_doinit with a dentry, before these inodes could | ||
1273 | * be used again by userspace. | ||
1274 | */ | ||
1243 | goto out_unlock; | 1275 | goto out_unlock; |
1244 | } | 1276 | } |
1245 | 1277 | ||
1246 | len = INITCONTEXTLEN; | 1278 | len = INITCONTEXTLEN; |
1247 | context = kmalloc(len, GFP_NOFS); | 1279 | context = kmalloc(len+1, GFP_NOFS); |
1248 | if (!context) { | 1280 | if (!context) { |
1249 | rc = -ENOMEM; | 1281 | rc = -ENOMEM; |
1250 | dput(dentry); | 1282 | dput(dentry); |
1251 | goto out_unlock; | 1283 | goto out_unlock; |
1252 | } | 1284 | } |
1285 | context[len] = '\0'; | ||
1253 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, | 1286 | rc = inode->i_op->getxattr(dentry, XATTR_NAME_SELINUX, |
1254 | context, len); | 1287 | context, len); |
1255 | if (rc == -ERANGE) { | 1288 | if (rc == -ERANGE) { |
@@ -1262,12 +1295,13 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1262 | } | 1295 | } |
1263 | kfree(context); | 1296 | kfree(context); |
1264 | len = rc; | 1297 | len = rc; |
1265 | context = kmalloc(len, GFP_NOFS); | 1298 | context = kmalloc(len+1, GFP_NOFS); |
1266 | if (!context) { | 1299 | if (!context) { |
1267 | rc = -ENOMEM; | 1300 | rc = -ENOMEM; |
1268 | dput(dentry); | 1301 | dput(dentry); |
1269 | goto out_unlock; | 1302 | goto out_unlock; |
1270 | } | 1303 | } |
1304 | context[len] = '\0'; | ||
1271 | rc = inode->i_op->getxattr(dentry, | 1305 | rc = inode->i_op->getxattr(dentry, |
1272 | XATTR_NAME_SELINUX, | 1306 | XATTR_NAME_SELINUX, |
1273 | context, len); | 1307 | context, len); |
@@ -1289,10 +1323,19 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1289 | sbsec->def_sid, | 1323 | sbsec->def_sid, |
1290 | GFP_NOFS); | 1324 | GFP_NOFS); |
1291 | if (rc) { | 1325 | if (rc) { |
1292 | printk(KERN_WARNING "SELinux: %s: context_to_sid(%s) " | 1326 | char *dev = inode->i_sb->s_id; |
1293 | "returned %d for dev=%s ino=%ld\n", | 1327 | unsigned long ino = inode->i_ino; |
1294 | __func__, context, -rc, | 1328 | |
1295 | inode->i_sb->s_id, inode->i_ino); | 1329 | if (rc == -EINVAL) { |
1330 | if (printk_ratelimit()) | ||
1331 | printk(KERN_NOTICE "SELinux: inode=%lu on dev=%s was found to have an invalid " | ||
1332 | "context=%s. This indicates you may need to relabel the inode or the " | ||
1333 | "filesystem in question.\n", ino, dev, context); | ||
1334 | } else { | ||
1335 | printk(KERN_WARNING "SELinux: %s: context_to_sid(%s) " | ||
1336 | "returned %d for dev=%s ino=%ld\n", | ||
1337 | __func__, context, -rc, dev, ino); | ||
1338 | } | ||
1296 | kfree(context); | 1339 | kfree(context); |
1297 | /* Leave with the unlabeled SID */ | 1340 | /* Leave with the unlabeled SID */ |
1298 | rc = 0; | 1341 | rc = 0; |
@@ -1326,7 +1369,7 @@ static int inode_doinit_with_dentry(struct inode *inode, struct dentry *opt_dent | |||
1326 | /* Default to the fs superblock SID. */ | 1369 | /* Default to the fs superblock SID. */ |
1327 | isec->sid = sbsec->sid; | 1370 | isec->sid = sbsec->sid; |
1328 | 1371 | ||
1329 | if (sbsec->proc && !S_ISLNK(inode->i_mode)) { | 1372 | if ((sbsec->flags & SE_SBPROC) && !S_ISLNK(inode->i_mode)) { |
1330 | struct proc_inode *proci = PROC_I(inode); | 1373 | struct proc_inode *proci = PROC_I(inode); |
1331 | if (proci->pde) { | 1374 | if (proci->pde) { |
1332 | isec->sclass = inode_mode_to_security_class(inode->i_mode); | 1375 | isec->sclass = inode_mode_to_security_class(inode->i_mode); |
@@ -1587,7 +1630,7 @@ static int may_create(struct inode *dir, | |||
1587 | if (rc) | 1630 | if (rc) |
1588 | return rc; | 1631 | return rc; |
1589 | 1632 | ||
1590 | if (!newsid || sbsec->behavior == SECURITY_FS_USE_MNTPOINT) { | 1633 | if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { |
1591 | rc = security_transition_sid(sid, dsec->sid, tclass, &newsid); | 1634 | rc = security_transition_sid(sid, dsec->sid, tclass, &newsid); |
1592 | if (rc) | 1635 | if (rc) |
1593 | return rc; | 1636 | return rc; |
@@ -1801,6 +1844,8 @@ static inline u32 open_file_to_av(struct file *file) | |||
1801 | av |= FIFO_FILE__OPEN; | 1844 | av |= FIFO_FILE__OPEN; |
1802 | else if (S_ISDIR(mode)) | 1845 | else if (S_ISDIR(mode)) |
1803 | av |= DIR__OPEN; | 1846 | av |= DIR__OPEN; |
1847 | else if (S_ISSOCK(mode)) | ||
1848 | av |= SOCK_FILE__OPEN; | ||
1804 | else | 1849 | else |
1805 | printk(KERN_ERR "SELinux: WARNING: inside %s with " | 1850 | printk(KERN_ERR "SELinux: WARNING: inside %s with " |
1806 | "unknown mode:%o\n", __func__, mode); | 1851 | "unknown mode:%o\n", __func__, mode); |
@@ -1815,7 +1860,7 @@ static int selinux_ptrace_may_access(struct task_struct *child, | |||
1815 | { | 1860 | { |
1816 | int rc; | 1861 | int rc; |
1817 | 1862 | ||
1818 | rc = secondary_ops->ptrace_may_access(child, mode); | 1863 | rc = cap_ptrace_may_access(child, mode); |
1819 | if (rc) | 1864 | if (rc) |
1820 | return rc; | 1865 | return rc; |
1821 | 1866 | ||
@@ -1832,7 +1877,7 @@ static int selinux_ptrace_traceme(struct task_struct *parent) | |||
1832 | { | 1877 | { |
1833 | int rc; | 1878 | int rc; |
1834 | 1879 | ||
1835 | rc = secondary_ops->ptrace_traceme(parent); | 1880 | rc = cap_ptrace_traceme(parent); |
1836 | if (rc) | 1881 | if (rc) |
1837 | return rc; | 1882 | return rc; |
1838 | 1883 | ||
@@ -1848,7 +1893,7 @@ static int selinux_capget(struct task_struct *target, kernel_cap_t *effective, | |||
1848 | if (error) | 1893 | if (error) |
1849 | return error; | 1894 | return error; |
1850 | 1895 | ||
1851 | return secondary_ops->capget(target, effective, inheritable, permitted); | 1896 | return cap_capget(target, effective, inheritable, permitted); |
1852 | } | 1897 | } |
1853 | 1898 | ||
1854 | static int selinux_capset(struct cred *new, const struct cred *old, | 1899 | static int selinux_capset(struct cred *new, const struct cred *old, |
@@ -1858,7 +1903,7 @@ static int selinux_capset(struct cred *new, const struct cred *old, | |||
1858 | { | 1903 | { |
1859 | int error; | 1904 | int error; |
1860 | 1905 | ||
1861 | error = secondary_ops->capset(new, old, | 1906 | error = cap_capset(new, old, |
1862 | effective, inheritable, permitted); | 1907 | effective, inheritable, permitted); |
1863 | if (error) | 1908 | if (error) |
1864 | return error; | 1909 | return error; |
@@ -1866,12 +1911,22 @@ static int selinux_capset(struct cred *new, const struct cred *old, | |||
1866 | return cred_has_perm(old, new, PROCESS__SETCAP); | 1911 | return cred_has_perm(old, new, PROCESS__SETCAP); |
1867 | } | 1912 | } |
1868 | 1913 | ||
1914 | /* | ||
1915 | * (This comment used to live with the selinux_task_setuid hook, | ||
1916 | * which was removed). | ||
1917 | * | ||
1918 | * Since setuid only affects the current process, and since the SELinux | ||
1919 | * controls are not based on the Linux identity attributes, SELinux does not | ||
1920 | * need to control this operation. However, SELinux does control the use of | ||
1921 | * the CAP_SETUID and CAP_SETGID capabilities using the capable hook. | ||
1922 | */ | ||
1923 | |||
1869 | static int selinux_capable(struct task_struct *tsk, const struct cred *cred, | 1924 | static int selinux_capable(struct task_struct *tsk, const struct cred *cred, |
1870 | int cap, int audit) | 1925 | int cap, int audit) |
1871 | { | 1926 | { |
1872 | int rc; | 1927 | int rc; |
1873 | 1928 | ||
1874 | rc = secondary_ops->capable(tsk, cred, cap, audit); | 1929 | rc = cap_capable(tsk, cred, cap, audit); |
1875 | if (rc) | 1930 | if (rc) |
1876 | return rc; | 1931 | return rc; |
1877 | 1932 | ||
@@ -1997,7 +2052,7 @@ static int selinux_syslog(int type) | |||
1997 | { | 2052 | { |
1998 | int rc; | 2053 | int rc; |
1999 | 2054 | ||
2000 | rc = secondary_ops->syslog(type); | 2055 | rc = cap_syslog(type); |
2001 | if (rc) | 2056 | if (rc) |
2002 | return rc; | 2057 | return rc; |
2003 | 2058 | ||
@@ -2028,10 +2083,6 @@ static int selinux_syslog(int type) | |||
2028 | * mapping. 0 means there is enough memory for the allocation to | 2083 | * mapping. 0 means there is enough memory for the allocation to |
2029 | * succeed and -ENOMEM implies there is not. | 2084 | * succeed and -ENOMEM implies there is not. |
2030 | * | 2085 | * |
2031 | * Note that secondary_ops->capable and task_has_perm_noaudit return 0 | ||
2032 | * if the capability is granted, but __vm_enough_memory requires 1 if | ||
2033 | * the capability is granted. | ||
2034 | * | ||
2035 | * Do not audit the selinux permission check, as this is applied to all | 2086 | * Do not audit the selinux permission check, as this is applied to all |
2036 | * processes that allocate mappings. | 2087 | * processes that allocate mappings. |
2037 | */ | 2088 | */ |
@@ -2058,7 +2109,7 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
2058 | struct inode *inode = bprm->file->f_path.dentry->d_inode; | 2109 | struct inode *inode = bprm->file->f_path.dentry->d_inode; |
2059 | int rc; | 2110 | int rc; |
2060 | 2111 | ||
2061 | rc = secondary_ops->bprm_set_creds(bprm); | 2112 | rc = cap_bprm_set_creds(bprm); |
2062 | if (rc) | 2113 | if (rc) |
2063 | return rc; | 2114 | return rc; |
2064 | 2115 | ||
@@ -2156,11 +2207,6 @@ static int selinux_bprm_set_creds(struct linux_binprm *bprm) | |||
2156 | return 0; | 2207 | return 0; |
2157 | } | 2208 | } |
2158 | 2209 | ||
2159 | static int selinux_bprm_check_security(struct linux_binprm *bprm) | ||
2160 | { | ||
2161 | return secondary_ops->bprm_check_security(bprm); | ||
2162 | } | ||
2163 | |||
2164 | static int selinux_bprm_secureexec(struct linux_binprm *bprm) | 2210 | static int selinux_bprm_secureexec(struct linux_binprm *bprm) |
2165 | { | 2211 | { |
2166 | const struct cred *cred = current_cred(); | 2212 | const struct cred *cred = current_cred(); |
@@ -2180,7 +2226,7 @@ static int selinux_bprm_secureexec(struct linux_binprm *bprm) | |||
2180 | PROCESS__NOATSECURE, NULL); | 2226 | PROCESS__NOATSECURE, NULL); |
2181 | } | 2227 | } |
2182 | 2228 | ||
2183 | return (atsecure || secondary_ops->bprm_secureexec(bprm)); | 2229 | return (atsecure || cap_bprm_secureexec(bprm)); |
2184 | } | 2230 | } |
2185 | 2231 | ||
2186 | extern struct vfsmount *selinuxfs_mount; | 2232 | extern struct vfsmount *selinuxfs_mount; |
@@ -2290,8 +2336,6 @@ static void selinux_bprm_committing_creds(struct linux_binprm *bprm) | |||
2290 | struct rlimit *rlim, *initrlim; | 2336 | struct rlimit *rlim, *initrlim; |
2291 | int rc, i; | 2337 | int rc, i; |
2292 | 2338 | ||
2293 | secondary_ops->bprm_committing_creds(bprm); | ||
2294 | |||
2295 | new_tsec = bprm->cred->security; | 2339 | new_tsec = bprm->cred->security; |
2296 | if (new_tsec->sid == new_tsec->osid) | 2340 | if (new_tsec->sid == new_tsec->osid) |
2297 | return; | 2341 | return; |
@@ -2337,8 +2381,6 @@ static void selinux_bprm_committed_creds(struct linux_binprm *bprm) | |||
2337 | int rc, i; | 2381 | int rc, i; |
2338 | unsigned long flags; | 2382 | unsigned long flags; |
2339 | 2383 | ||
2340 | secondary_ops->bprm_committed_creds(bprm); | ||
2341 | |||
2342 | osid = tsec->osid; | 2384 | osid = tsec->osid; |
2343 | sid = tsec->sid; | 2385 | sid = tsec->sid; |
2344 | 2386 | ||
@@ -2400,7 +2442,8 @@ static inline int selinux_option(char *option, int len) | |||
2400 | return (match_prefix(CONTEXT_STR, sizeof(CONTEXT_STR)-1, option, len) || | 2442 | return (match_prefix(CONTEXT_STR, sizeof(CONTEXT_STR)-1, option, len) || |
2401 | match_prefix(FSCONTEXT_STR, sizeof(FSCONTEXT_STR)-1, option, len) || | 2443 | match_prefix(FSCONTEXT_STR, sizeof(FSCONTEXT_STR)-1, option, len) || |
2402 | match_prefix(DEFCONTEXT_STR, sizeof(DEFCONTEXT_STR)-1, option, len) || | 2444 | match_prefix(DEFCONTEXT_STR, sizeof(DEFCONTEXT_STR)-1, option, len) || |
2403 | match_prefix(ROOTCONTEXT_STR, sizeof(ROOTCONTEXT_STR)-1, option, len)); | 2445 | match_prefix(ROOTCONTEXT_STR, sizeof(ROOTCONTEXT_STR)-1, option, len) || |
2446 | match_prefix(LABELSUPP_STR, sizeof(LABELSUPP_STR)-1, option, len)); | ||
2404 | } | 2447 | } |
2405 | 2448 | ||
2406 | static inline void take_option(char **to, char *from, int *first, int len) | 2449 | static inline void take_option(char **to, char *from, int *first, int len) |
@@ -2513,11 +2556,6 @@ static int selinux_mount(char *dev_name, | |||
2513 | void *data) | 2556 | void *data) |
2514 | { | 2557 | { |
2515 | const struct cred *cred = current_cred(); | 2558 | const struct cred *cred = current_cred(); |
2516 | int rc; | ||
2517 | |||
2518 | rc = secondary_ops->sb_mount(dev_name, path, type, flags, data); | ||
2519 | if (rc) | ||
2520 | return rc; | ||
2521 | 2559 | ||
2522 | if (flags & MS_REMOUNT) | 2560 | if (flags & MS_REMOUNT) |
2523 | return superblock_has_perm(cred, path->mnt->mnt_sb, | 2561 | return superblock_has_perm(cred, path->mnt->mnt_sb, |
@@ -2530,11 +2568,6 @@ static int selinux_mount(char *dev_name, | |||
2530 | static int selinux_umount(struct vfsmount *mnt, int flags) | 2568 | static int selinux_umount(struct vfsmount *mnt, int flags) |
2531 | { | 2569 | { |
2532 | const struct cred *cred = current_cred(); | 2570 | const struct cred *cred = current_cred(); |
2533 | int rc; | ||
2534 | |||
2535 | rc = secondary_ops->sb_umount(mnt, flags); | ||
2536 | if (rc) | ||
2537 | return rc; | ||
2538 | 2571 | ||
2539 | return superblock_has_perm(cred, mnt->mnt_sb, | 2572 | return superblock_has_perm(cred, mnt->mnt_sb, |
2540 | FILESYSTEM__UNMOUNT, NULL); | 2573 | FILESYSTEM__UNMOUNT, NULL); |
@@ -2570,7 +2603,7 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir, | |||
2570 | sid = tsec->sid; | 2603 | sid = tsec->sid; |
2571 | newsid = tsec->create_sid; | 2604 | newsid = tsec->create_sid; |
2572 | 2605 | ||
2573 | if (!newsid || sbsec->behavior == SECURITY_FS_USE_MNTPOINT) { | 2606 | if (!newsid || !(sbsec->flags & SE_SBLABELSUPP)) { |
2574 | rc = security_transition_sid(sid, dsec->sid, | 2607 | rc = security_transition_sid(sid, dsec->sid, |
2575 | inode_mode_to_security_class(inode->i_mode), | 2608 | inode_mode_to_security_class(inode->i_mode), |
2576 | &newsid); | 2609 | &newsid); |
@@ -2585,14 +2618,14 @@ static int selinux_inode_init_security(struct inode *inode, struct inode *dir, | |||
2585 | } | 2618 | } |
2586 | 2619 | ||
2587 | /* Possibly defer initialization to selinux_complete_init. */ | 2620 | /* Possibly defer initialization to selinux_complete_init. */ |
2588 | if (sbsec->initialized) { | 2621 | if (sbsec->flags & SE_SBINITIALIZED) { |
2589 | struct inode_security_struct *isec = inode->i_security; | 2622 | struct inode_security_struct *isec = inode->i_security; |
2590 | isec->sclass = inode_mode_to_security_class(inode->i_mode); | 2623 | isec->sclass = inode_mode_to_security_class(inode->i_mode); |
2591 | isec->sid = newsid; | 2624 | isec->sid = newsid; |
2592 | isec->initialized = 1; | 2625 | isec->initialized = 1; |
2593 | } | 2626 | } |
2594 | 2627 | ||
2595 | if (!ss_initialized || sbsec->behavior == SECURITY_FS_USE_MNTPOINT) | 2628 | if (!ss_initialized || !(sbsec->flags & SE_SBLABELSUPP)) |
2596 | return -EOPNOTSUPP; | 2629 | return -EOPNOTSUPP; |
2597 | 2630 | ||
2598 | if (name) { | 2631 | if (name) { |
@@ -2622,21 +2655,11 @@ static int selinux_inode_create(struct inode *dir, struct dentry *dentry, int ma | |||
2622 | 2655 | ||
2623 | static int selinux_inode_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry) | 2656 | static int selinux_inode_link(struct dentry *old_dentry, struct inode *dir, struct dentry *new_dentry) |
2624 | { | 2657 | { |
2625 | int rc; | ||
2626 | |||
2627 | rc = secondary_ops->inode_link(old_dentry, dir, new_dentry); | ||
2628 | if (rc) | ||
2629 | return rc; | ||
2630 | return may_link(dir, old_dentry, MAY_LINK); | 2658 | return may_link(dir, old_dentry, MAY_LINK); |
2631 | } | 2659 | } |
2632 | 2660 | ||
2633 | static int selinux_inode_unlink(struct inode *dir, struct dentry *dentry) | 2661 | static int selinux_inode_unlink(struct inode *dir, struct dentry *dentry) |
2634 | { | 2662 | { |
2635 | int rc; | ||
2636 | |||
2637 | rc = secondary_ops->inode_unlink(dir, dentry); | ||
2638 | if (rc) | ||
2639 | return rc; | ||
2640 | return may_link(dir, dentry, MAY_UNLINK); | 2663 | return may_link(dir, dentry, MAY_UNLINK); |
2641 | } | 2664 | } |
2642 | 2665 | ||
@@ -2657,12 +2680,6 @@ static int selinux_inode_rmdir(struct inode *dir, struct dentry *dentry) | |||
2657 | 2680 | ||
2658 | static int selinux_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) | 2681 | static int selinux_inode_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t dev) |
2659 | { | 2682 | { |
2660 | int rc; | ||
2661 | |||
2662 | rc = secondary_ops->inode_mknod(dir, dentry, mode, dev); | ||
2663 | if (rc) | ||
2664 | return rc; | ||
2665 | |||
2666 | return may_create(dir, dentry, inode_mode_to_security_class(mode)); | 2683 | return may_create(dir, dentry, inode_mode_to_security_class(mode)); |
2667 | } | 2684 | } |
2668 | 2685 | ||
@@ -2682,22 +2699,13 @@ static int selinux_inode_readlink(struct dentry *dentry) | |||
2682 | static int selinux_inode_follow_link(struct dentry *dentry, struct nameidata *nameidata) | 2699 | static int selinux_inode_follow_link(struct dentry *dentry, struct nameidata *nameidata) |
2683 | { | 2700 | { |
2684 | const struct cred *cred = current_cred(); | 2701 | const struct cred *cred = current_cred(); |
2685 | int rc; | ||
2686 | 2702 | ||
2687 | rc = secondary_ops->inode_follow_link(dentry, nameidata); | ||
2688 | if (rc) | ||
2689 | return rc; | ||
2690 | return dentry_has_perm(cred, NULL, dentry, FILE__READ); | 2703 | return dentry_has_perm(cred, NULL, dentry, FILE__READ); |
2691 | } | 2704 | } |
2692 | 2705 | ||
2693 | static int selinux_inode_permission(struct inode *inode, int mask) | 2706 | static int selinux_inode_permission(struct inode *inode, int mask) |
2694 | { | 2707 | { |
2695 | const struct cred *cred = current_cred(); | 2708 | const struct cred *cred = current_cred(); |
2696 | int rc; | ||
2697 | |||
2698 | rc = secondary_ops->inode_permission(inode, mask); | ||
2699 | if (rc) | ||
2700 | return rc; | ||
2701 | 2709 | ||
2702 | if (!mask) { | 2710 | if (!mask) { |
2703 | /* No permission to check. Existence test. */ | 2711 | /* No permission to check. Existence test. */ |
@@ -2711,11 +2719,6 @@ static int selinux_inode_permission(struct inode *inode, int mask) | |||
2711 | static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) | 2719 | static int selinux_inode_setattr(struct dentry *dentry, struct iattr *iattr) |
2712 | { | 2720 | { |
2713 | const struct cred *cred = current_cred(); | 2721 | const struct cred *cred = current_cred(); |
2714 | int rc; | ||
2715 | |||
2716 | rc = secondary_ops->inode_setattr(dentry, iattr); | ||
2717 | if (rc) | ||
2718 | return rc; | ||
2719 | 2722 | ||
2720 | if (iattr->ia_valid & ATTR_FORCE) | 2723 | if (iattr->ia_valid & ATTR_FORCE) |
2721 | return 0; | 2724 | return 0; |
@@ -2769,7 +2772,7 @@ static int selinux_inode_setxattr(struct dentry *dentry, const char *name, | |||
2769 | return selinux_inode_setotherxattr(dentry, name); | 2772 | return selinux_inode_setotherxattr(dentry, name); |
2770 | 2773 | ||
2771 | sbsec = inode->i_sb->s_security; | 2774 | sbsec = inode->i_sb->s_security; |
2772 | if (sbsec->behavior == SECURITY_FS_USE_MNTPOINT) | 2775 | if (!(sbsec->flags & SE_SBLABELSUPP)) |
2773 | return -EOPNOTSUPP; | 2776 | return -EOPNOTSUPP; |
2774 | 2777 | ||
2775 | if (!is_owner_or_cap(inode)) | 2778 | if (!is_owner_or_cap(inode)) |
@@ -2931,16 +2934,6 @@ static int selinux_inode_listsecurity(struct inode *inode, char *buffer, size_t | |||
2931 | return len; | 2934 | return len; |
2932 | } | 2935 | } |
2933 | 2936 | ||
2934 | static int selinux_inode_need_killpriv(struct dentry *dentry) | ||
2935 | { | ||
2936 | return secondary_ops->inode_need_killpriv(dentry); | ||
2937 | } | ||
2938 | |||
2939 | static int selinux_inode_killpriv(struct dentry *dentry) | ||
2940 | { | ||
2941 | return secondary_ops->inode_killpriv(dentry); | ||
2942 | } | ||
2943 | |||
2944 | static void selinux_inode_getsecid(const struct inode *inode, u32 *secid) | 2937 | static void selinux_inode_getsecid(const struct inode *inode, u32 *secid) |
2945 | { | 2938 | { |
2946 | struct inode_security_struct *isec = inode->i_security; | 2939 | struct inode_security_struct *isec = inode->i_security; |
@@ -3078,18 +3071,13 @@ static int selinux_file_mprotect(struct vm_area_struct *vma, | |||
3078 | unsigned long prot) | 3071 | unsigned long prot) |
3079 | { | 3072 | { |
3080 | const struct cred *cred = current_cred(); | 3073 | const struct cred *cred = current_cred(); |
3081 | int rc; | ||
3082 | |||
3083 | rc = secondary_ops->file_mprotect(vma, reqprot, prot); | ||
3084 | if (rc) | ||
3085 | return rc; | ||
3086 | 3074 | ||
3087 | if (selinux_checkreqprot) | 3075 | if (selinux_checkreqprot) |
3088 | prot = reqprot; | 3076 | prot = reqprot; |
3089 | 3077 | ||
3090 | #ifndef CONFIG_PPC32 | 3078 | #ifndef CONFIG_PPC32 |
3091 | if ((prot & PROT_EXEC) && !(vma->vm_flags & VM_EXEC)) { | 3079 | if ((prot & PROT_EXEC) && !(vma->vm_flags & VM_EXEC)) { |
3092 | rc = 0; | 3080 | int rc = 0; |
3093 | if (vma->vm_start >= vma->vm_mm->start_brk && | 3081 | if (vma->vm_start >= vma->vm_mm->start_brk && |
3094 | vma->vm_end <= vma->vm_mm->brk) { | 3082 | vma->vm_end <= vma->vm_mm->brk) { |
3095 | rc = cred_has_perm(cred, cred, PROCESS__EXECHEAP); | 3083 | rc = cred_has_perm(cred, cred, PROCESS__EXECHEAP); |
@@ -3239,12 +3227,6 @@ static int selinux_dentry_open(struct file *file, const struct cred *cred) | |||
3239 | 3227 | ||
3240 | static int selinux_task_create(unsigned long clone_flags) | 3228 | static int selinux_task_create(unsigned long clone_flags) |
3241 | { | 3229 | { |
3242 | int rc; | ||
3243 | |||
3244 | rc = secondary_ops->task_create(clone_flags); | ||
3245 | if (rc) | ||
3246 | return rc; | ||
3247 | |||
3248 | return current_has_perm(current, PROCESS__FORK); | 3230 | return current_has_perm(current, PROCESS__FORK); |
3249 | } | 3231 | } |
3250 | 3232 | ||
@@ -3278,14 +3260,6 @@ static int selinux_cred_prepare(struct cred *new, const struct cred *old, | |||
3278 | } | 3260 | } |
3279 | 3261 | ||
3280 | /* | 3262 | /* |
3281 | * commit new credentials | ||
3282 | */ | ||
3283 | static void selinux_cred_commit(struct cred *new, const struct cred *old) | ||
3284 | { | ||
3285 | secondary_ops->cred_commit(new, old); | ||
3286 | } | ||
3287 | |||
3288 | /* | ||
3289 | * set the security data for a kernel service | 3263 | * set the security data for a kernel service |
3290 | * - all the creation contexts are set to unlabelled | 3264 | * - all the creation contexts are set to unlabelled |
3291 | */ | 3265 | */ |
@@ -3329,29 +3303,6 @@ static int selinux_kernel_create_files_as(struct cred *new, struct inode *inode) | |||
3329 | return 0; | 3303 | return 0; |
3330 | } | 3304 | } |
3331 | 3305 | ||
3332 | static int selinux_task_setuid(uid_t id0, uid_t id1, uid_t id2, int flags) | ||
3333 | { | ||
3334 | /* Since setuid only affects the current process, and | ||
3335 | since the SELinux controls are not based on the Linux | ||
3336 | identity attributes, SELinux does not need to control | ||
3337 | this operation. However, SELinux does control the use | ||
3338 | of the CAP_SETUID and CAP_SETGID capabilities using the | ||
3339 | capable hook. */ | ||
3340 | return 0; | ||
3341 | } | ||
3342 | |||
3343 | static int selinux_task_fix_setuid(struct cred *new, const struct cred *old, | ||
3344 | int flags) | ||
3345 | { | ||
3346 | return secondary_ops->task_fix_setuid(new, old, flags); | ||
3347 | } | ||
3348 | |||
3349 | static int selinux_task_setgid(gid_t id0, gid_t id1, gid_t id2, int flags) | ||
3350 | { | ||
3351 | /* See the comment for setuid above. */ | ||
3352 | return 0; | ||
3353 | } | ||
3354 | |||
3355 | static int selinux_task_setpgid(struct task_struct *p, pid_t pgid) | 3306 | static int selinux_task_setpgid(struct task_struct *p, pid_t pgid) |
3356 | { | 3307 | { |
3357 | return current_has_perm(p, PROCESS__SETPGID); | 3308 | return current_has_perm(p, PROCESS__SETPGID); |
@@ -3372,17 +3323,11 @@ static void selinux_task_getsecid(struct task_struct *p, u32 *secid) | |||
3372 | *secid = task_sid(p); | 3323 | *secid = task_sid(p); |
3373 | } | 3324 | } |
3374 | 3325 | ||
3375 | static int selinux_task_setgroups(struct group_info *group_info) | ||
3376 | { | ||
3377 | /* See the comment for setuid above. */ | ||
3378 | return 0; | ||
3379 | } | ||
3380 | |||
3381 | static int selinux_task_setnice(struct task_struct *p, int nice) | 3326 | static int selinux_task_setnice(struct task_struct *p, int nice) |
3382 | { | 3327 | { |
3383 | int rc; | 3328 | int rc; |
3384 | 3329 | ||
3385 | rc = secondary_ops->task_setnice(p, nice); | 3330 | rc = cap_task_setnice(p, nice); |
3386 | if (rc) | 3331 | if (rc) |
3387 | return rc; | 3332 | return rc; |
3388 | 3333 | ||
@@ -3393,7 +3338,7 @@ static int selinux_task_setioprio(struct task_struct *p, int ioprio) | |||
3393 | { | 3338 | { |
3394 | int rc; | 3339 | int rc; |
3395 | 3340 | ||
3396 | rc = secondary_ops->task_setioprio(p, ioprio); | 3341 | rc = cap_task_setioprio(p, ioprio); |
3397 | if (rc) | 3342 | if (rc) |
3398 | return rc; | 3343 | return rc; |
3399 | 3344 | ||
@@ -3408,11 +3353,6 @@ static int selinux_task_getioprio(struct task_struct *p) | |||
3408 | static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim) | 3353 | static int selinux_task_setrlimit(unsigned int resource, struct rlimit *new_rlim) |
3409 | { | 3354 | { |
3410 | struct rlimit *old_rlim = current->signal->rlim + resource; | 3355 | struct rlimit *old_rlim = current->signal->rlim + resource; |
3411 | int rc; | ||
3412 | |||
3413 | rc = secondary_ops->task_setrlimit(resource, new_rlim); | ||
3414 | if (rc) | ||
3415 | return rc; | ||
3416 | 3356 | ||
3417 | /* Control the ability to change the hard limit (whether | 3357 | /* Control the ability to change the hard limit (whether |
3418 | lowering or raising it), so that the hard limit can | 3358 | lowering or raising it), so that the hard limit can |
@@ -3428,7 +3368,7 @@ static int selinux_task_setscheduler(struct task_struct *p, int policy, struct s | |||
3428 | { | 3368 | { |
3429 | int rc; | 3369 | int rc; |
3430 | 3370 | ||
3431 | rc = secondary_ops->task_setscheduler(p, policy, lp); | 3371 | rc = cap_task_setscheduler(p, policy, lp); |
3432 | if (rc) | 3372 | if (rc) |
3433 | return rc; | 3373 | return rc; |
3434 | 3374 | ||
@@ -3451,10 +3391,6 @@ static int selinux_task_kill(struct task_struct *p, struct siginfo *info, | |||
3451 | u32 perm; | 3391 | u32 perm; |
3452 | int rc; | 3392 | int rc; |
3453 | 3393 | ||
3454 | rc = secondary_ops->task_kill(p, info, sig, secid); | ||
3455 | if (rc) | ||
3456 | return rc; | ||
3457 | |||
3458 | if (!sig) | 3394 | if (!sig) |
3459 | perm = PROCESS__SIGNULL; /* null signal; existence test */ | 3395 | perm = PROCESS__SIGNULL; /* null signal; existence test */ |
3460 | else | 3396 | else |
@@ -3467,18 +3403,6 @@ static int selinux_task_kill(struct task_struct *p, struct siginfo *info, | |||
3467 | return rc; | 3403 | return rc; |
3468 | } | 3404 | } |
3469 | 3405 | ||
3470 | static int selinux_task_prctl(int option, | ||
3471 | unsigned long arg2, | ||
3472 | unsigned long arg3, | ||
3473 | unsigned long arg4, | ||
3474 | unsigned long arg5) | ||
3475 | { | ||
3476 | /* The current prctl operations do not appear to require | ||
3477 | any SELinux controls since they merely observe or modify | ||
3478 | the state of the current process. */ | ||
3479 | return secondary_ops->task_prctl(option, arg2, arg3, arg4, arg5); | ||
3480 | } | ||
3481 | |||
3482 | static int selinux_task_wait(struct task_struct *p) | 3406 | static int selinux_task_wait(struct task_struct *p) |
3483 | { | 3407 | { |
3484 | return task_has_perm(p, current, PROCESS__SIGCHLD); | 3408 | return task_has_perm(p, current, PROCESS__SIGCHLD); |
@@ -4047,10 +3971,6 @@ static int selinux_socket_unix_stream_connect(struct socket *sock, | |||
4047 | struct avc_audit_data ad; | 3971 | struct avc_audit_data ad; |
4048 | int err; | 3972 | int err; |
4049 | 3973 | ||
4050 | err = secondary_ops->unix_stream_connect(sock, other, newsk); | ||
4051 | if (err) | ||
4052 | return err; | ||
4053 | |||
4054 | isec = SOCK_INODE(sock)->i_security; | 3974 | isec = SOCK_INODE(sock)->i_security; |
4055 | other_isec = SOCK_INODE(other)->i_security; | 3975 | other_isec = SOCK_INODE(other)->i_security; |
4056 | 3976 | ||
@@ -4844,7 +4764,7 @@ static int selinux_netlink_send(struct sock *sk, struct sk_buff *skb) | |||
4844 | { | 4764 | { |
4845 | int err; | 4765 | int err; |
4846 | 4766 | ||
4847 | err = secondary_ops->netlink_send(sk, skb); | 4767 | err = cap_netlink_send(sk, skb); |
4848 | if (err) | 4768 | if (err) |
4849 | return err; | 4769 | return err; |
4850 | 4770 | ||
@@ -4859,7 +4779,7 @@ static int selinux_netlink_recv(struct sk_buff *skb, int capability) | |||
4859 | int err; | 4779 | int err; |
4860 | struct avc_audit_data ad; | 4780 | struct avc_audit_data ad; |
4861 | 4781 | ||
4862 | err = secondary_ops->netlink_recv(skb, capability); | 4782 | err = cap_netlink_recv(skb, capability); |
4863 | if (err) | 4783 | if (err) |
4864 | return err; | 4784 | return err; |
4865 | 4785 | ||
@@ -5167,11 +5087,6 @@ static int selinux_shm_shmat(struct shmid_kernel *shp, | |||
5167 | char __user *shmaddr, int shmflg) | 5087 | char __user *shmaddr, int shmflg) |
5168 | { | 5088 | { |
5169 | u32 perms; | 5089 | u32 perms; |
5170 | int rc; | ||
5171 | |||
5172 | rc = secondary_ops->shm_shmat(shp, shmaddr, shmflg); | ||
5173 | if (rc) | ||
5174 | return rc; | ||
5175 | 5090 | ||
5176 | if (shmflg & SHM_RDONLY) | 5091 | if (shmflg & SHM_RDONLY) |
5177 | perms = SHM__READ; | 5092 | perms = SHM__READ; |
@@ -5581,7 +5496,6 @@ static struct security_operations selinux_ops = { | |||
5581 | .netlink_recv = selinux_netlink_recv, | 5496 | .netlink_recv = selinux_netlink_recv, |
5582 | 5497 | ||
5583 | .bprm_set_creds = selinux_bprm_set_creds, | 5498 | .bprm_set_creds = selinux_bprm_set_creds, |
5584 | .bprm_check_security = selinux_bprm_check_security, | ||
5585 | .bprm_committing_creds = selinux_bprm_committing_creds, | 5499 | .bprm_committing_creds = selinux_bprm_committing_creds, |
5586 | .bprm_committed_creds = selinux_bprm_committed_creds, | 5500 | .bprm_committed_creds = selinux_bprm_committed_creds, |
5587 | .bprm_secureexec = selinux_bprm_secureexec, | 5501 | .bprm_secureexec = selinux_bprm_secureexec, |
@@ -5623,8 +5537,6 @@ static struct security_operations selinux_ops = { | |||
5623 | .inode_getsecurity = selinux_inode_getsecurity, | 5537 | .inode_getsecurity = selinux_inode_getsecurity, |
5624 | .inode_setsecurity = selinux_inode_setsecurity, | 5538 | .inode_setsecurity = selinux_inode_setsecurity, |
5625 | .inode_listsecurity = selinux_inode_listsecurity, | 5539 | .inode_listsecurity = selinux_inode_listsecurity, |
5626 | .inode_need_killpriv = selinux_inode_need_killpriv, | ||
5627 | .inode_killpriv = selinux_inode_killpriv, | ||
5628 | .inode_getsecid = selinux_inode_getsecid, | 5540 | .inode_getsecid = selinux_inode_getsecid, |
5629 | 5541 | ||
5630 | .file_permission = selinux_file_permission, | 5542 | .file_permission = selinux_file_permission, |
@@ -5644,17 +5556,12 @@ static struct security_operations selinux_ops = { | |||
5644 | .task_create = selinux_task_create, | 5556 | .task_create = selinux_task_create, |
5645 | .cred_free = selinux_cred_free, | 5557 | .cred_free = selinux_cred_free, |
5646 | .cred_prepare = selinux_cred_prepare, | 5558 | .cred_prepare = selinux_cred_prepare, |
5647 | .cred_commit = selinux_cred_commit, | ||
5648 | .kernel_act_as = selinux_kernel_act_as, | 5559 | .kernel_act_as = selinux_kernel_act_as, |
5649 | .kernel_create_files_as = selinux_kernel_create_files_as, | 5560 | .kernel_create_files_as = selinux_kernel_create_files_as, |
5650 | .task_setuid = selinux_task_setuid, | ||
5651 | .task_fix_setuid = selinux_task_fix_setuid, | ||
5652 | .task_setgid = selinux_task_setgid, | ||
5653 | .task_setpgid = selinux_task_setpgid, | 5561 | .task_setpgid = selinux_task_setpgid, |
5654 | .task_getpgid = selinux_task_getpgid, | 5562 | .task_getpgid = selinux_task_getpgid, |
5655 | .task_getsid = selinux_task_getsid, | 5563 | .task_getsid = selinux_task_getsid, |
5656 | .task_getsecid = selinux_task_getsecid, | 5564 | .task_getsecid = selinux_task_getsecid, |
5657 | .task_setgroups = selinux_task_setgroups, | ||
5658 | .task_setnice = selinux_task_setnice, | 5565 | .task_setnice = selinux_task_setnice, |
5659 | .task_setioprio = selinux_task_setioprio, | 5566 | .task_setioprio = selinux_task_setioprio, |
5660 | .task_getioprio = selinux_task_getioprio, | 5567 | .task_getioprio = selinux_task_getioprio, |
@@ -5664,7 +5571,6 @@ static struct security_operations selinux_ops = { | |||
5664 | .task_movememory = selinux_task_movememory, | 5571 | .task_movememory = selinux_task_movememory, |
5665 | .task_kill = selinux_task_kill, | 5572 | .task_kill = selinux_task_kill, |
5666 | .task_wait = selinux_task_wait, | 5573 | .task_wait = selinux_task_wait, |
5667 | .task_prctl = selinux_task_prctl, | ||
5668 | .task_to_inode = selinux_task_to_inode, | 5574 | .task_to_inode = selinux_task_to_inode, |
5669 | 5575 | ||
5670 | .ipc_permission = selinux_ipc_permission, | 5576 | .ipc_permission = selinux_ipc_permission, |
diff --git a/security/selinux/include/av_perm_to_string.h b/security/selinux/include/av_perm_to_string.h index c0c885427b91..31df1d7c1aee 100644 --- a/security/selinux/include/av_perm_to_string.h +++ b/security/selinux/include/av_perm_to_string.h | |||
@@ -24,6 +24,7 @@ | |||
24 | S_(SECCLASS_CHR_FILE, CHR_FILE__EXECMOD, "execmod") | 24 | S_(SECCLASS_CHR_FILE, CHR_FILE__EXECMOD, "execmod") |
25 | S_(SECCLASS_CHR_FILE, CHR_FILE__OPEN, "open") | 25 | S_(SECCLASS_CHR_FILE, CHR_FILE__OPEN, "open") |
26 | S_(SECCLASS_BLK_FILE, BLK_FILE__OPEN, "open") | 26 | S_(SECCLASS_BLK_FILE, BLK_FILE__OPEN, "open") |
27 | S_(SECCLASS_SOCK_FILE, SOCK_FILE__OPEN, "open") | ||
27 | S_(SECCLASS_FIFO_FILE, FIFO_FILE__OPEN, "open") | 28 | S_(SECCLASS_FIFO_FILE, FIFO_FILE__OPEN, "open") |
28 | S_(SECCLASS_FD, FD__USE, "use") | 29 | S_(SECCLASS_FD, FD__USE, "use") |
29 | S_(SECCLASS_TCP_SOCKET, TCP_SOCKET__CONNECTTO, "connectto") | 30 | S_(SECCLASS_TCP_SOCKET, TCP_SOCKET__CONNECTTO, "connectto") |
@@ -152,6 +153,7 @@ | |||
152 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE, "nlmsg_write") | 153 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE, "nlmsg_write") |
153 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_RELAY, "nlmsg_relay") | 154 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_RELAY, "nlmsg_relay") |
154 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_READPRIV, "nlmsg_readpriv") | 155 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_READPRIV, "nlmsg_readpriv") |
156 | S_(SECCLASS_NETLINK_AUDIT_SOCKET, NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT, "nlmsg_tty_audit") | ||
155 | S_(SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_READ, "nlmsg_read") | 157 | S_(SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_READ, "nlmsg_read") |
156 | S_(SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_WRITE, "nlmsg_write") | 158 | S_(SECCLASS_NETLINK_IP6FW_SOCKET, NETLINK_IP6FW_SOCKET__NLMSG_WRITE, "nlmsg_write") |
157 | S_(SECCLASS_ASSOCIATION, ASSOCIATION__SENDTO, "sendto") | 159 | S_(SECCLASS_ASSOCIATION, ASSOCIATION__SENDTO, "sendto") |
diff --git a/security/selinux/include/av_permissions.h b/security/selinux/include/av_permissions.h index 0ba79fe00e11..d645192ee950 100644 --- a/security/selinux/include/av_permissions.h +++ b/security/selinux/include/av_permissions.h | |||
@@ -174,6 +174,7 @@ | |||
174 | #define SOCK_FILE__SWAPON 0x00004000UL | 174 | #define SOCK_FILE__SWAPON 0x00004000UL |
175 | #define SOCK_FILE__QUOTAON 0x00008000UL | 175 | #define SOCK_FILE__QUOTAON 0x00008000UL |
176 | #define SOCK_FILE__MOUNTON 0x00010000UL | 176 | #define SOCK_FILE__MOUNTON 0x00010000UL |
177 | #define SOCK_FILE__OPEN 0x00020000UL | ||
177 | #define FIFO_FILE__IOCTL 0x00000001UL | 178 | #define FIFO_FILE__IOCTL 0x00000001UL |
178 | #define FIFO_FILE__READ 0x00000002UL | 179 | #define FIFO_FILE__READ 0x00000002UL |
179 | #define FIFO_FILE__WRITE 0x00000004UL | 180 | #define FIFO_FILE__WRITE 0x00000004UL |
@@ -707,6 +708,7 @@ | |||
707 | #define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL | 708 | #define NETLINK_AUDIT_SOCKET__NLMSG_WRITE 0x00800000UL |
708 | #define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL | 709 | #define NETLINK_AUDIT_SOCKET__NLMSG_RELAY 0x01000000UL |
709 | #define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL | 710 | #define NETLINK_AUDIT_SOCKET__NLMSG_READPRIV 0x02000000UL |
711 | #define NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT 0x04000000UL | ||
710 | #define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL | 712 | #define NETLINK_IP6FW_SOCKET__IOCTL 0x00000001UL |
711 | #define NETLINK_IP6FW_SOCKET__READ 0x00000002UL | 713 | #define NETLINK_IP6FW_SOCKET__READ 0x00000002UL |
712 | #define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL | 714 | #define NETLINK_IP6FW_SOCKET__WRITE 0x00000004UL |
diff --git a/security/selinux/include/objsec.h b/security/selinux/include/objsec.h index 3cc45168f674..c4e062336ef3 100644 --- a/security/selinux/include/objsec.h +++ b/security/selinux/include/objsec.h | |||
@@ -60,9 +60,7 @@ struct superblock_security_struct { | |||
60 | u32 def_sid; /* default SID for labeling */ | 60 | u32 def_sid; /* default SID for labeling */ |
61 | u32 mntpoint_sid; /* SECURITY_FS_USE_MNTPOINT context for files */ | 61 | u32 mntpoint_sid; /* SECURITY_FS_USE_MNTPOINT context for files */ |
62 | unsigned int behavior; /* labeling behavior */ | 62 | unsigned int behavior; /* labeling behavior */ |
63 | unsigned char initialized; /* initialization flag */ | ||
64 | unsigned char flags; /* which mount options were specified */ | 63 | unsigned char flags; /* which mount options were specified */ |
65 | unsigned char proc; /* proc fs */ | ||
66 | struct mutex lock; | 64 | struct mutex lock; |
67 | struct list_head isec_head; | 65 | struct list_head isec_head; |
68 | spinlock_t isec_lock; | 66 | spinlock_t isec_lock; |
diff --git a/security/selinux/include/security.h b/security/selinux/include/security.h index 72447370bc95..5c3434f7626f 100644 --- a/security/selinux/include/security.h +++ b/security/selinux/include/security.h | |||
@@ -37,15 +37,23 @@ | |||
37 | #define POLICYDB_VERSION_MAX POLICYDB_VERSION_BOUNDARY | 37 | #define POLICYDB_VERSION_MAX POLICYDB_VERSION_BOUNDARY |
38 | #endif | 38 | #endif |
39 | 39 | ||
40 | /* Mask for just the mount related flags */ | ||
41 | #define SE_MNTMASK 0x0f | ||
42 | /* Super block security struct flags for mount options */ | ||
40 | #define CONTEXT_MNT 0x01 | 43 | #define CONTEXT_MNT 0x01 |
41 | #define FSCONTEXT_MNT 0x02 | 44 | #define FSCONTEXT_MNT 0x02 |
42 | #define ROOTCONTEXT_MNT 0x04 | 45 | #define ROOTCONTEXT_MNT 0x04 |
43 | #define DEFCONTEXT_MNT 0x08 | 46 | #define DEFCONTEXT_MNT 0x08 |
47 | /* Non-mount related flags */ | ||
48 | #define SE_SBINITIALIZED 0x10 | ||
49 | #define SE_SBPROC 0x20 | ||
50 | #define SE_SBLABELSUPP 0x40 | ||
44 | 51 | ||
45 | #define CONTEXT_STR "context=" | 52 | #define CONTEXT_STR "context=" |
46 | #define FSCONTEXT_STR "fscontext=" | 53 | #define FSCONTEXT_STR "fscontext=" |
47 | #define ROOTCONTEXT_STR "rootcontext=" | 54 | #define ROOTCONTEXT_STR "rootcontext=" |
48 | #define DEFCONTEXT_STR "defcontext=" | 55 | #define DEFCONTEXT_STR "defcontext=" |
56 | #define LABELSUPP_STR "seclabel" | ||
49 | 57 | ||
50 | struct netlbl_lsm_secattr; | 58 | struct netlbl_lsm_secattr; |
51 | 59 | ||
@@ -80,7 +88,6 @@ int security_policycap_supported(unsigned int req_cap); | |||
80 | #define SEL_VEC_MAX 32 | 88 | #define SEL_VEC_MAX 32 |
81 | struct av_decision { | 89 | struct av_decision { |
82 | u32 allowed; | 90 | u32 allowed; |
83 | u32 decided; | ||
84 | u32 auditallow; | 91 | u32 auditallow; |
85 | u32 auditdeny; | 92 | u32 auditdeny; |
86 | u32 seqno; | 93 | u32 seqno; |
diff --git a/security/selinux/nlmsgtab.c b/security/selinux/nlmsgtab.c index 4ed7bab89c59..c6875fd3b9d6 100644 --- a/security/selinux/nlmsgtab.c +++ b/security/selinux/nlmsgtab.c | |||
@@ -113,7 +113,7 @@ static struct nlmsg_perm nlmsg_audit_perms[] = | |||
113 | { AUDIT_USER, NETLINK_AUDIT_SOCKET__NLMSG_RELAY }, | 113 | { AUDIT_USER, NETLINK_AUDIT_SOCKET__NLMSG_RELAY }, |
114 | { AUDIT_SIGNAL_INFO, NETLINK_AUDIT_SOCKET__NLMSG_READ }, | 114 | { AUDIT_SIGNAL_INFO, NETLINK_AUDIT_SOCKET__NLMSG_READ }, |
115 | { AUDIT_TTY_GET, NETLINK_AUDIT_SOCKET__NLMSG_READ }, | 115 | { AUDIT_TTY_GET, NETLINK_AUDIT_SOCKET__NLMSG_READ }, |
116 | { AUDIT_TTY_SET, NETLINK_AUDIT_SOCKET__NLMSG_WRITE }, | 116 | { AUDIT_TTY_SET, NETLINK_AUDIT_SOCKET__NLMSG_TTY_AUDIT }, |
117 | }; | 117 | }; |
118 | 118 | ||
119 | 119 | ||
diff --git a/security/selinux/selinuxfs.c b/security/selinux/selinuxfs.c index 01ec6d2c6b97..d3c8b982cfb0 100644 --- a/security/selinux/selinuxfs.c +++ b/security/selinux/selinuxfs.c | |||
@@ -595,7 +595,7 @@ static ssize_t sel_write_access(struct file *file, char *buf, size_t size) | |||
595 | 595 | ||
596 | length = scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, | 596 | length = scnprintf(buf, SIMPLE_TRANSACTION_LIMIT, |
597 | "%x %x %x %x %u", | 597 | "%x %x %x %x %u", |
598 | avd.allowed, avd.decided, | 598 | avd.allowed, 0xffffffff, |
599 | avd.auditallow, avd.auditdeny, | 599 | avd.auditallow, avd.auditdeny, |
600 | avd.seqno); | 600 | avd.seqno); |
601 | out2: | 601 | out2: |
diff --git a/security/selinux/ss/services.c b/security/selinux/ss/services.c index c65e4fe4a0f1..deeec6c013ae 100644 --- a/security/selinux/ss/services.c +++ b/security/selinux/ss/services.c | |||
@@ -407,7 +407,6 @@ static int context_struct_compute_av(struct context *scontext, | |||
407 | * Initialize the access vectors to the default values. | 407 | * Initialize the access vectors to the default values. |
408 | */ | 408 | */ |
409 | avd->allowed = 0; | 409 | avd->allowed = 0; |
410 | avd->decided = 0xffffffff; | ||
411 | avd->auditallow = 0; | 410 | avd->auditallow = 0; |
412 | avd->auditdeny = 0xffffffff; | 411 | avd->auditdeny = 0xffffffff; |
413 | avd->seqno = latest_granting; | 412 | avd->seqno = latest_granting; |
@@ -743,7 +742,6 @@ int security_compute_av(u32 ssid, | |||
743 | 742 | ||
744 | if (!ss_initialized) { | 743 | if (!ss_initialized) { |
745 | avd->allowed = 0xffffffff; | 744 | avd->allowed = 0xffffffff; |
746 | avd->decided = 0xffffffff; | ||
747 | avd->auditallow = 0; | 745 | avd->auditallow = 0; |
748 | avd->auditdeny = 0xffffffff; | 746 | avd->auditdeny = 0xffffffff; |
749 | avd->seqno = latest_granting; | 747 | avd->seqno = latest_granting; |