1. 14 2月, 2009 1 次提交
  2. 05 1月, 2009 1 次提交
  3. 10 10月, 2008 2 次提交
  4. 04 10月, 2008 2 次提交
    • P
      selinux: Fix an uninitialized variable BUG/panic in selinux_secattr_to_sid() · 3040a6d5
      Paul Moore 提交于
      At some point during the 2.6.27 development cycle two new fields were added
      to the SELinux context structure, a string pointer and a length field.  The
      code in selinux_secattr_to_sid() was not modified and as a result these two
      fields were left uninitialized which could result in erratic behavior,
      including kernel panics, when NetLabel is used.  This patch fixes the
      problem by fully initializing the context in selinux_secattr_to_sid() before
      use and reducing the level of direct context manipulation done to help
      prevent future problems.
      
      Please apply this to the 2.6.27-rcX release stream.
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      3040a6d5
    • P
      selinux: Fix an uninitialized variable BUG/panic in selinux_secattr_to_sid() · 81990fbd
      Paul Moore 提交于
      At some point during the 2.6.27 development cycle two new fields were added
      to the SELinux context structure, a string pointer and a length field.  The
      code in selinux_secattr_to_sid() was not modified and as a result these two
      fields were left uninitialized which could result in erratic behavior,
      including kernel panics, when NetLabel is used.  This patch fixes the
      problem by fully initializing the context in selinux_secattr_to_sid() before
      use and reducing the level of direct context manipulation done to help
      prevent future problems.
      
      Please apply this to the 2.6.27-rcX release stream.
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      81990fbd
  5. 04 9月, 2008 1 次提交
  6. 28 8月, 2008 1 次提交
    • K
      SELinux: add boundary support and thread context assignment · d9250dea
      KaiGai Kohei 提交于
      The purpose of this patch is to assign per-thread security context
      under a constraint. It enables multi-threaded server application
      to kick a request handler with its fair security context, and
      helps some of userspace object managers to handle user's request.
      
      When we assign a per-thread security context, it must not have wider
      permissions than the original one. Because a multi-threaded process
      shares a single local memory, an arbitary per-thread security context
      also means another thread can easily refer violated information.
      
      The constraint on a per-thread security context requires a new domain
      has to be equal or weaker than its original one, when it tries to assign
      a per-thread security context.
      
      Bounds relationship between two types is a way to ensure a domain can
      never have wider permission than its bounds. We can define it in two
      explicit or implicit ways.
      
      The first way is using new TYPEBOUNDS statement. It enables to define
      a boundary of types explicitly. The other one expand the concept of
      existing named based hierarchy. If we defines a type with "." separated
      name like "httpd_t.php", toolchain implicitly set its bounds on "httpd_t".
      
      This feature requires a new policy version.
      The 24th version (POLICYDB_VERSION_BOUNDARY) enables to ship them into
      kernel space, and the following patch enables to handle it.
      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>
      d9250dea
  7. 15 8月, 2008 1 次提交
  8. 15 7月, 2008 1 次提交
  9. 14 7月, 2008 10 次提交
    • E
      SELinux: allow fstype unknown to policy to use xattrs if present · 811f3799
      Eric Paris 提交于
      Currently if a FS is mounted for which SELinux policy does not define an
      fs_use_* that FS will either be genfs labeled or not labeled at all.
      This decision is based on the existence of a genfscon rule in policy and
      is irrespective of the capabilities of the filesystem itself.  This
      patch allows the kernel to check if the filesystem supports security
      xattrs and if so will use those if there is no fs_use_* rule in policy.
      An fstype with a no fs_use_* rule but with a genfs rule will use xattrs
      if available and will follow the genfs rule.
      
      This can be particularly interesting for things like ecryptfs which
      actually overlays a real underlying FS.  If we define excryptfs in
      policy to use xattrs we will likely get this wrong at times, so with
      this path we just don't need to define it!
      
      Overlay ecryptfs on top of NFS with no xattr support:
      SELinux: initialized (dev ecryptfs, type ecryptfs), uses genfs_contexts
      Overlay ecryptfs on top of ext4 with xattr support:
      SELinux: initialized (dev ecryptfs, type ecryptfs), uses xattr
      
      It is also useful as the kernel adds new FS we don't need to add them in
      policy if they support xattrs and that is how we want to handle them.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      811f3799
    • E
      SELinux: more user friendly unknown handling printk · 6cbe2706
      Eric Paris 提交于
      I've gotten complaints and reports about people not understanding the
      meaning of the current unknown class/perm handling the kernel emits on
      every policy load.  Hopefully this will make make it clear to everyone
      the meaning of the message and won't waste a printk the user won't care
      about anyway on systems where the kernel and the policy agree on
      everything.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      6cbe2706
    • S
      selinux: change handling of invalid classes (Was: Re: 2.6.26-rc5-mm1 selinux whine) · 22df4adb
      Stephen Smalley 提交于
      On Mon, 2008-06-09 at 01:24 -0700, Andrew Morton wrote:
      > Getting a few of these with FC5:
      >
      > SELinux: context_struct_compute_av:  unrecognized class 69
      > SELinux: context_struct_compute_av:  unrecognized class 69
      >
      > one came out when I logged in.
      >
      > No other symptoms, yet.
      
      Change handling of invalid classes by SELinux, reporting class values
      unknown to the kernel as errors (w/ ratelimit applied) and handling
      class values unknown to policy as normal denials.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Acked-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      22df4adb
    • E
      SELinux: drop load_mutex in security_load_policy · 89abd0ac
      Eric Paris 提交于
      We used to protect against races of policy load in security_load_policy
      by using the load_mutex.  Since then we have added a new mutex,
      sel_mutex, in sel_write_load() which is always held across all calls to
      security_load_policy we are covered and can safely just drop this one.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      89abd0ac
    • E
      SELinux: fix off by 1 reference of class_to_string in context_struct_compute_av · cea78dc4
      Eric Paris 提交于
      The class_to_string array is referenced by tclass.  My code mistakenly
      was using tclass - 1.  If the proceeding class is a userspace class
      rather than kernel class this may cause a denial/EINVAL even if unknown
      handling is set to allow.  The bug shouldn't be allowing excess
      privileges since those are given based on the contents of another array
      which should be correctly referenced.
      
      At this point in time its pretty unlikely this is going to cause
      problems.  The most recently added kernel classes which could be
      affected are association, dccp_socket, and peer.  Its pretty unlikely
      any policy with handle_unknown=allow doesn't have association and
      dccp_socket undefined (they've been around longer than unknown handling)
      and peer is conditionalized on a policy cap which should only be defined
      if that class exists in policy.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      cea78dc4
    • J
      SELinux: open code load_mutex · 972ccac2
      James Morris 提交于
      Open code load_mutex as suggested by Andrew Morton.
      Signed-off-by: NJames Morris <jmorris@namei.org>
      972ccac2
    • J
      SELinux: open code policy_rwlock · 0804d113
      James Morris 提交于
      Open code policy_rwlock, as suggested by Andrew Morton.
      Signed-off-by: NJames Morris <jmorris@namei.org>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      0804d113
    • E
      SELinux: keep the code clean formating and syntax · f5269710
      Eric Paris 提交于
      Formatting and syntax changes
      
      whitespace, tabs to spaces, trailing space
      put open { on same line as struct def
      remove unneeded {} after if statements
      change printk("Lu") to printk("llu")
      convert asm/uaccess.h to linux/uaacess.h includes
      remove unnecessary asm/bug.h includes
      convert all users of simple_strtol to strict_strtol
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      f5269710
    • S
      SELinux: fix sleeping allocation in security_context_to_sid · 9a59daa0
      Stephen Smalley 提交于
      Fix a sleeping function called from invalid context bug by moving allocation
      to the callers prior to taking the policy rdlock.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      9a59daa0
    • 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
  10. 30 4月, 2008 2 次提交
  11. 29 4月, 2008 1 次提交
  12. 21 4月, 2008 2 次提交
  13. 19 4月, 2008 1 次提交
  14. 18 4月, 2008 6 次提交
  15. 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
  16. 08 4月, 2008 1 次提交
  17. 06 2月, 2008 1 次提交
  18. 02 2月, 2008 2 次提交
  19. 01 2月, 2008 1 次提交
  20. 30 1月, 2008 2 次提交