Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6

* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/security-testing-2.6:
tomoyo: remove "undelete domain" command.

+5 -100
+1 -6
security/tomoyo/common.c
··· 1252 1252 struct tomoyo_domain_info *domain = head->write_var1; 1253 1253 bool is_delete = false; 1254 1254 bool is_select = false; 1255 - bool is_undelete = false; 1256 1255 unsigned int profile; 1257 1256 1258 1257 if (tomoyo_str_starts(&data, TOMOYO_KEYWORD_DELETE)) 1259 1258 is_delete = true; 1260 1259 else if (tomoyo_str_starts(&data, TOMOYO_KEYWORD_SELECT)) 1261 1260 is_select = true; 1262 - else if (tomoyo_str_starts(&data, TOMOYO_KEYWORD_UNDELETE)) 1263 - is_undelete = true; 1264 1261 if (is_select && tomoyo_is_select_one(head, data)) 1265 1262 return 0; 1266 1263 /* Don't allow updating policies by non manager programs. */ ··· 1271 1274 down_read(&tomoyo_domain_list_lock); 1272 1275 domain = tomoyo_find_domain(data); 1273 1276 up_read(&tomoyo_domain_list_lock); 1274 - } else if (is_undelete) 1275 - domain = tomoyo_undelete_domain(data); 1276 - else 1277 + } else 1277 1278 domain = tomoyo_find_or_assign_new_domain(data, 0); 1278 1279 head->write_var1 = domain; 1279 1280 return 0;
+1 -7
security/tomoyo/common.h
··· 88 88 /* Name of this domain. Never NULL. */ 89 89 const struct tomoyo_path_info *domainname; 90 90 u8 profile; /* Profile number to use. */ 91 - u8 is_deleted; /* Delete flag. 92 - 0 = active. 93 - 1 = deleted but undeletable. 94 - 255 = deleted and no longer undeletable. */ 91 + bool is_deleted; /* Delete flag. */ 95 92 bool quota_warned; /* Quota warnning flag. */ 96 93 /* DOMAIN_FLAGS_*. Use tomoyo_set_domain_flag() to modify. */ 97 94 u8 flags; ··· 141 144 #define TOMOYO_KEYWORD_NO_INITIALIZE_DOMAIN "no_initialize_domain " 142 145 #define TOMOYO_KEYWORD_NO_KEEP_DOMAIN "no_keep_domain " 143 146 #define TOMOYO_KEYWORD_SELECT "select " 144 - #define TOMOYO_KEYWORD_UNDELETE "undelete " 145 147 #define TOMOYO_KEYWORD_USE_PROFILE "use_profile " 146 148 #define TOMOYO_KEYWORD_IGNORE_GLOBAL_ALLOW_READ "ignore_global_allow_read" 147 149 /* A domain definition starts with <kernel>. */ ··· 263 267 struct tomoyo_domain_info *tomoyo_find_or_assign_new_domain(const char * 264 268 domainname, 265 269 const u8 profile); 266 - /* Undelete a domain. */ 267 - struct tomoyo_domain_info *tomoyo_undelete_domain(const char *domainname); 268 270 /* Check mode for specified functionality. */ 269 271 unsigned int tomoyo_check_flags(const struct tomoyo_domain_info *domain, 270 272 const u8 index);
+3 -87
security/tomoyo/domain.c
··· 551 551 return tomoyo_update_alias_entry(data, cp, is_delete); 552 552 } 553 553 554 - /* Domain create/delete/undelete handler. */ 555 - 556 - /* #define TOMOYO_DEBUG_DOMAIN_UNDELETE */ 554 + /* Domain create/delete handler. */ 557 555 558 556 /** 559 557 * tomoyo_delete_domain - Delete a domain. ··· 569 571 tomoyo_fill_path_info(&name); 570 572 /***** EXCLUSIVE SECTION START *****/ 571 573 down_write(&tomoyo_domain_list_lock); 572 - #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE 573 - printk(KERN_DEBUG "tomoyo_delete_domain %s\n", domainname); 574 - list_for_each_entry(domain, &tomoyo_domain_list, list) { 575 - if (tomoyo_pathcmp(domain->domainname, &name)) 576 - continue; 577 - printk(KERN_DEBUG "List: %p %u\n", domain, domain->is_deleted); 578 - } 579 - #endif 580 574 /* Is there an active domain? */ 581 575 list_for_each_entry(domain, &tomoyo_domain_list, list) { 582 - struct tomoyo_domain_info *domain2; 583 576 /* Never delete tomoyo_kernel_domain */ 584 577 if (domain == &tomoyo_kernel_domain) 585 578 continue; 586 579 if (domain->is_deleted || 587 580 tomoyo_pathcmp(domain->domainname, &name)) 588 581 continue; 589 - /* Mark already deleted domains as non undeletable. */ 590 - list_for_each_entry(domain2, &tomoyo_domain_list, list) { 591 - if (!domain2->is_deleted || 592 - tomoyo_pathcmp(domain2->domainname, &name)) 593 - continue; 594 - #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE 595 - if (domain2->is_deleted != 255) 596 - printk(KERN_DEBUG 597 - "Marked %p as non undeletable\n", 598 - domain2); 599 - #endif 600 - domain2->is_deleted = 255; 601 - } 602 - /* Delete and mark active domain as undeletable. */ 603 - domain->is_deleted = 1; 604 - #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE 605 - printk(KERN_DEBUG "Marked %p as undeletable\n", domain); 606 - #endif 582 + domain->is_deleted = true; 607 583 break; 608 584 } 609 585 up_write(&tomoyo_domain_list_lock); 610 586 /***** EXCLUSIVE SECTION END *****/ 611 587 return 0; 612 - } 613 - 614 - /** 615 - * tomoyo_undelete_domain - Undelete a domain. 616 - * 617 - * @domainname: The name of domain. 618 - * 619 - * Returns pointer to "struct tomoyo_domain_info" on success, NULL otherwise. 620 - */ 621 - struct tomoyo_domain_info *tomoyo_undelete_domain(const char *domainname) 622 - { 623 - struct tomoyo_domain_info *domain; 624 - struct tomoyo_domain_info *candidate_domain = NULL; 625 - struct tomoyo_path_info name; 626 - 627 - name.name = domainname; 628 - tomoyo_fill_path_info(&name); 629 - /***** EXCLUSIVE SECTION START *****/ 630 - down_write(&tomoyo_domain_list_lock); 631 - #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE 632 - printk(KERN_DEBUG "tomoyo_undelete_domain %s\n", domainname); 633 - list_for_each_entry(domain, &tomoyo_domain_list, list) { 634 - if (tomoyo_pathcmp(domain->domainname, &name)) 635 - continue; 636 - printk(KERN_DEBUG "List: %p %u\n", domain, domain->is_deleted); 637 - } 638 - #endif 639 - list_for_each_entry(domain, &tomoyo_domain_list, list) { 640 - if (tomoyo_pathcmp(&name, domain->domainname)) 641 - continue; 642 - if (!domain->is_deleted) { 643 - /* This domain is active. I can't undelete. */ 644 - candidate_domain = NULL; 645 - #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE 646 - printk(KERN_DEBUG "%p is active. I can't undelete.\n", 647 - domain); 648 - #endif 649 - break; 650 - } 651 - /* Is this domain undeletable? */ 652 - if (domain->is_deleted == 1) 653 - candidate_domain = domain; 654 - } 655 - if (candidate_domain) { 656 - candidate_domain->is_deleted = 0; 657 - #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE 658 - printk(KERN_DEBUG "%p was undeleted.\n", candidate_domain); 659 - #endif 660 - } 661 - up_write(&tomoyo_domain_list_lock); 662 - /***** EXCLUSIVE SECTION END *****/ 663 - return candidate_domain; 664 588 } 665 589 666 590 /** ··· 631 711 /***** CRITICAL SECTION END *****/ 632 712 if (flag) 633 713 continue; 634 - #ifdef TOMOYO_DEBUG_DOMAIN_UNDELETE 635 - printk(KERN_DEBUG "Reusing %p %s\n", domain, 636 - domain->domainname->name); 637 - #endif 638 714 list_for_each_entry(ptr, &domain->acl_info_list, list) { 639 715 ptr->type |= TOMOYO_ACL_DELETED; 640 716 } ··· 638 722 domain->profile = profile; 639 723 domain->quota_warned = false; 640 724 mb(); /* Avoid out-of-order execution. */ 641 - domain->is_deleted = 0; 725 + domain->is_deleted = false; 642 726 goto out; 643 727 } 644 728 /* No memory reusable. Create using new memory. */