1. 14 7月, 2008 1 次提交
    • S
      selinux: support deferred mapping of contexts · 12b29f34
      Stephen Smalley 提交于
      Introduce SELinux support for deferred mapping of security contexts in
      the SID table upon policy reload, and use this support for inode
      security contexts when the context is not yet valid under the current
      policy.  Only processes with CAP_MAC_ADMIN + mac_admin permission in
      policy can set undefined security contexts on inodes.  Inodes with
      such undefined contexts are treated as having the unlabeled context
      until the context becomes valid upon a policy reload that defines the
      context.  Context invalidation upon policy reload also uses this
      support to save the context information in the SID table and later
      recover it upon a subsequent policy reload that defines the context
      again.
      
      This support is to enable package managers and similar programs to set
      down file contexts unknown to the system policy at the time the file
      is created in order to better support placing loadable policy modules
      in packages and to support build systems that need to create images of
      different distro releases with different policies w/o requiring all of
      the contexts to be defined or legal in the build host policy.
      
      With this patch applied, the following sequence is possible, although
      in practice it is recommended that this permission only be allowed to
      specific program domains such as the package manager.
      
      # rmdir baz
      # rm bar
      # touch bar
      # chcon -t foo_exec_t bar # foo_exec_t is not yet defined
      chcon: failed to change context of `bar' to `system_u:object_r:foo_exec_t': Invalid argument
      # mkdir -Z system_u:object_r:foo_exec_t baz
      mkdir: failed to set default file creation context to `system_u:object_r:foo_exec_t': Invalid argument
      # cat setundefined.te
      policy_module(setundefined, 1.0)
      require {
      	type unconfined_t;
      	type unlabeled_t;
      }
      files_type(unlabeled_t)
      allow unconfined_t self:capability2 mac_admin;
      # make -f /usr/share/selinux/devel/Makefile setundefined.pp
      # semodule -i setundefined.pp
      # chcon -t foo_exec_t bar # foo_exec_t is not yet defined
      # mkdir -Z system_u:object_r:foo_exec_t baz
      # ls -Zd bar baz
      -rw-r--r--  root root system_u:object_r:unlabeled_t    bar
      drwxr-xr-x  root root system_u:object_r:unlabeled_t    baz
      # cat foo.te
      policy_module(foo, 1.0)
      type foo_exec_t;
      files_type(foo_exec_t)
      # make -f /usr/share/selinux/devel/Makefile foo.pp
      # semodule -i foo.pp # defines foo_exec_t
      # ls -Zd bar baz
      -rw-r--r--  root root user_u:object_r:foo_exec_t       bar
      drwxr-xr-x  root root system_u:object_r:foo_exec_t    baz
      # semodule -r foo
      # ls -Zd bar baz
      -rw-r--r--  root root system_u:object_r:unlabeled_t    bar
      drwxr-xr-x  root root system_u:object_r:unlabeled_t    baz
      # semodule -i foo.pp
      # ls -Zd bar baz
      -rw-r--r--  root root user_u:object_r:foo_exec_t       bar
      drwxr-xr-x  root root system_u:object_r:foo_exec_t    baz
      # semodule -r setundefined foo
      # chcon -t foo_exec_t bar # no longer defined and not allowed
      chcon: failed to change context of `bar' to `system_u:object_r:foo_exec_t': Invalid argument
      # rmdir baz
      # mkdir -Z system_u:object_r:foo_exec_t baz
      mkdir: failed to set default file creation context to `system_u:object_r:foo_exec_t': Invalid argument
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      12b29f34
  2. 30 4月, 2008 2 次提交
  3. 29 4月, 2008 1 次提交
  4. 21 4月, 2008 2 次提交
  5. 19 4月, 2008 1 次提交
  6. 18 4月, 2008 6 次提交
  7. 13 4月, 2008 1 次提交
    • P
      NetLabel: Allow passing the LSM domain as a shared pointer · 00447872
      Paul Moore 提交于
      Smack doesn't have the need to create a private copy of the LSM "domain" when
      setting NetLabel security attributes like SELinux, however, the current
      NetLabel code requires a private copy of the LSM "domain".  This patches fixes
      that by letting the LSM determine how it wants to pass the domain value.
      
       * NETLBL_SECATTR_DOMAIN_CPY
         The current behavior, NetLabel assumes that the domain value is a copy and
         frees it when done
      
       * NETLBL_SECATTR_DOMAIN
         New, Smack-friendly behavior, NetLabel assumes that the domain value is a
         reference to a string managed by the LSM and does not free it when done
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Acked-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      00447872
  8. 08 4月, 2008 1 次提交
  9. 06 2月, 2008 1 次提交
  10. 02 2月, 2008 2 次提交
  11. 01 2月, 2008 1 次提交
  12. 30 1月, 2008 5 次提交
  13. 26 1月, 2008 1 次提交
  14. 22 1月, 2008 1 次提交
  15. 17 10月, 2007 2 次提交
    • K
      SELinux: improve performance when AVC misses. · 9fe79ad1
      KaiGai Kohei 提交于
      * We add ebitmap_for_each_positive_bit() which enables to walk on
        any positive bit on the given ebitmap, to improve its performance
        using common bit-operations defined in linux/bitops.h.
        In the previous version, this logic was implemented using a combination
        of ebitmap_for_each_bit() and ebitmap_node_get_bit(), but is was worse
        in performance aspect.
        This logic is most frequestly used to compute a new AVC entry,
        so this patch can improve SELinux performance when AVC misses are happen.
      * struct ebitmap_node is redefined as an array of "unsigned long", to get
        suitable for using find_next_bit() which is fasted than iteration of
        shift and logical operation, and to maximize memory usage allocated
        from general purpose slab.
      * Any ebitmap_for_each_bit() are repleced by the new implementation
        in ss/service.c and ss/mls.c. Some of related implementation are
        changed, however, there is no incompatibility with the previous
        version.
      * The width of any new line are less or equal than 80-chars.
      
      The following benchmark shows the effect of this patch, when we
      access many files which have different security context one after
      another. The number is more than /selinux/avc/cache_threshold, so
      any access always causes AVC misses.
      
            selinux-2.6      selinux-2.6-ebitmap
      AVG:   22.763 [s]          8.750 [s]
      STD:    0.265              0.019
      ------------------------------------------
      1st:   22.558 [s]          8.786 [s]
      2nd:   22.458 [s]          8.750 [s]
      3rd:   22.478 [s]          8.754 [s]
      4th:   22.724 [s]          8.745 [s]
      5th:   22.918 [s]          8.748 [s]
      6th:   22.905 [s]          8.764 [s]
      7th:   23.238 [s]          8.726 [s]
      8th:   22.822 [s]          8.729 [s]
      Signed-off-by: NKaiGai Kohei <kaigai@ak.jp.nec.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      9fe79ad1
    • E
      SELinux: policy selectable handling of unknown classes and perms · 3f12070e
      Eric Paris 提交于
      Allow policy to select, in much the same way as it selects MLS support, how
      the kernel should handle access decisions which contain either unknown
      classes or unknown permissions in known classes.  The three choices for the
      policy flags are
      
      0 - Deny unknown security access. (default)
      2 - reject loading policy if it does not contain all definitions
      4 - allow unknown security access
      
      The policy's choice is exported through 2 booleans in
      selinuxfs.  /selinux/deny_unknown and /selinux/reject_unknown.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      3f12070e
  16. 16 8月, 2007 1 次提交
  17. 01 8月, 2007 1 次提交
  18. 23 7月, 2007 1 次提交
  19. 12 7月, 2007 2 次提交
  20. 26 4月, 2007 6 次提交
  21. 27 2月, 2007 1 次提交