1. 23 6月, 2006 4 次提交
    • D
      [PATCH] VFS: Permit filesystem to perform statfs with a known root dentry · 726c3342
      David Howells 提交于
      Give the statfs superblock operation a dentry pointer rather than a superblock
      pointer.
      
      This complements the get_sb() patch.  That reduced the significance of
      sb->s_root, allowing NFS to place a fake root there.  However, NFS does
      require a dentry to use as a target for the statfs operation.  This permits
      the root in the vfsmount to be used instead.
      
      linux/mount.h has been added where necessary to make allyesconfig build
      successfully.
      
      Interest has also been expressed for use with the FUSE and XFS filesystems.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      726c3342
    • D
      [PATCH] VFS: Permit filesystem to override root dentry on mount · 454e2398
      David Howells 提交于
      Extend the get_sb() filesystem operation to take an extra argument that
      permits the VFS to pass in the target vfsmount that defines the mountpoint.
      
      The filesystem is then required to manually set the superblock and root dentry
      pointers.  For most filesystems, this should be done with simple_set_mnt()
      which will set the superblock pointer and then set the root dentry to the
      superblock's s_root (as per the old default behaviour).
      
      The get_sb() op now returns an integer as there's now no need to return the
      superblock pointer.
      
      This patch permits a superblock to be implicitly shared amongst several mount
      points, such as can be done with NFS to avoid potential inode aliasing.  In
      such a case, simple_set_mnt() would not be called, and instead the mnt_root
      and mnt_sb would be set directly.
      
      The patch also makes the following changes:
      
       (*) the get_sb_*() convenience functions in the core kernel now take a vfsmount
           pointer argument and return an integer, so most filesystems have to change
           very little.
      
       (*) If one of the convenience function is not used, then get_sb() should
           normally call simple_set_mnt() to instantiate the vfsmount. This will
           always return 0, and so can be tail-called from get_sb().
      
       (*) generic_shutdown_super() now calls shrink_dcache_sb() to clean up the
           dcache upon superblock destruction rather than shrink_dcache_anon().
      
           This is required because the superblock may now have multiple trees that
           aren't actually bound to s_root, but that still need to be cleaned up. The
           currently called functions assume that the whole tree is rooted at s_root,
           and that anonymous dentries are not the roots of trees which results in
           dentries being left unculled.
      
           However, with the way NFS superblock sharing are currently set to be
           implemented, these assumptions are violated: the root of the filesystem is
           simply a dummy dentry and inode (the real inode for '/' may well be
           inaccessible), and all the vfsmounts are rooted on anonymous[*] dentries
           with child trees.
      
           [*] Anonymous until discovered from another tree.
      
       (*) The documentation has been adjusted, including the additional bit of
           changing ext2_* into foo_* in the documentation.
      
      [akpm@osdl.org: convert ipath_fs, do other stuff]
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Acked-by: NAl Viro <viro@zeniv.linux.org.uk>
      Cc: Nathan Scott <nathans@sgi.com>
      Cc: Roland Dreier <rolandd@cisco.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      454e2398
    • D
      [PATCH] Keys: Fix race between two instantiators of a key · 04c567d9
      David Howells 提交于
      Add a revocation notification method to the key type and calls it whilst
      the key's semaphore is still write-locked after setting the revocation
      flag.
      
      The patch then uses this to maintain a reference on the task_struct of the
      process that calls request_key() for as long as the authorisation key
      remains unrevoked.
      
      This fixes a potential race between two processes both of which have
      assumed the authority to instantiate a key (one may have forked the other
      for example).  The problem is that there's no locking around the check for
      revocation of the auth key and the use of the task_struct it points to, nor
      does the auth key keep a reference on the task_struct.
      
      Access to the "context" pointer in the auth key must thenceforth be done
      with the auth key semaphore held.  The revocation method is called with the
      target key semaphore held write-locked and the search of the context
      process's keyrings is done with the auth key semaphore read-locked.
      
      The check for the revocation state of the auth key just prior to searching
      it is done after the auth key is read-locked for the search.  This ensures
      that the auth key can't be revoked between the check and the search.
      
      The revocation notification method is added so that the context task_struct
      can be released as soon as instantiation happens rather than waiting for
      the auth key to be destroyed, thus avoiding the unnecessary pinning of the
      requesting process.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      04c567d9
    • M
      [PATCH] selinux: add hooks for key subsystem · d720024e
      Michael LeMay 提交于
      Introduce SELinux hooks to support the access key retention subsystem
      within the kernel.  Incorporate new flask headers from a modified version
      of the SELinux reference policy, with support for the new security class
      representing retained keys.  Extend the "key_alloc" security hook with a
      task parameter representing the intended ownership context for the key
      being allocated.  Attach security information to root's default keyrings
      within the SELinux initialization routine.
      
      Has passed David's testsuite.
      Signed-off-by: NMichael LeMay <mdlemay@epoch.ncsc.mil>
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      Acked-by: NChris Wright <chrisw@sous-sol.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      d720024e
  2. 20 6月, 2006 1 次提交
  3. 18 6月, 2006 5 次提交
    • J
      [SECMARK]: Add new packet controls to SELinux · 4e5ab4cb
      James Morris 提交于
      Add new per-packet access controls to SELinux, replacing the old
      packet controls.
      
      Packets are labeled with the iptables SECMARK and CONNSECMARK targets,
      then security policy for the packets is enforced with these controls.
      
      To allow for a smooth transition to the new controls, the old code is
      still present, but not active by default.  To restore previous
      behavior, the old controls may be activated at runtime by writing a
      '1' to /selinux/compat_net, and also via the kernel boot parameter
      selinux_compat_net.  Switching between the network control models
      requires the security load_policy permission.  The old controls will
      probably eventually be removed and any continued use is discouraged.
      
      With this patch, the new secmark controls for SElinux are disabled by
      default, so existing behavior is entirely preserved, and the user is
      not affected at all.
      
      It also provides a config option to enable the secmark controls by
      default (which can always be overridden at boot and runtime).  It is
      also noted in the kconfig help that the user will need updated
      userspace if enabling secmark controls for SELinux and that they'll
      probably need the SECMARK and CONNMARK targets, and conntrack protocol
      helpers, although such decisions are beyond the scope of kernel
      configuration.
      Signed-off-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      4e5ab4cb
    • J
      [SECMARK]: Add SELinux exports · c749b29f
      James Morris 提交于
      Add and export new functions to the in-kernel SELinux API in support of the
      new secmark-based packet controls.
      Signed-off-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c749b29f
    • J
      [SECMARK]: Add new flask definitions to SELinux · 29a395ea
      James Morris 提交于
      Secmark implements a new scheme for adding security markings to
      packets via iptables, as well as changes to SELinux to use these
      markings for security policy enforcement.  The rationale for this
      scheme is explained and discussed in detail in the original threads:
      
       http://thread.gmane.org/gmane.linux.network/34927/
       http://thread.gmane.org/gmane.linux.network/35244/
      
      Examples of policy and rulesets, as well as a full archive of patches
      for iptables and SELinux userland, may be found at:
      
      http://people.redhat.com/jmorris/selinux/secmark/
      
      The code has been tested with various compilation options and in
      several scenarios, including with 'complicated' protocols such as FTP
      and also with the new generic conntrack code with IPv6 connection
      tracking.
      
      This patch:
      
      Add support for a new object class ('packet'), and associated
      permissions ('send', 'recv', 'relabelto').  These are used to enforce
      security policy for network packets labeled with SECMARK, and for
      adding labeling rules.
      Signed-off-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      29a395ea
    • C
      [SELINUX]: add security class for appletalk sockets · 3e3ff15e
      Christopher J. PeBenito 提交于
      Add a security class for appletalk sockets so that they can be
      distinguished in SELinux policy.  Please apply.
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Acked-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3e3ff15e
    • C
      [LSM-IPsec]: SELinux Authorize · c8c05a8e
      Catherine Zhang 提交于
      This patch contains a fix for the previous patch that adds security
      contexts to IPsec policies and security associations.  In the previous
      patch, no authorization (besides the check for write permissions to
      SAD and SPD) is required to delete IPsec policies and security
      assocations with security contexts.  Thus a user authorized to change
      SAD and SPD can bypass the IPsec policy authorization by simply
      deleteing policies with security contexts.  To fix this security hole,
      an additional authorization check is added for removing security
      policies and security associations with security contexts.
      
      Note that if no security context is supplied on add or present on
      policy to be deleted, the SELinux module allows the change
      unconditionally.  The hook is called on deletion when no context is
      present, which we may want to change.  At present, I left it up to the
      module.
      
      LSM changes:
      
      The patch adds two new LSM hooks: xfrm_policy_delete and
      xfrm_state_delete.  The new hooks are necessary to authorize deletion
      of IPsec policies that have security contexts.  The existing hooks
      xfrm_policy_free and xfrm_state_free lack the context to do the
      authorization, so I decided to split authorization of deletion and
      memory management of security data, as is typical in the LSM
      interface.
      
      Use:
      
      The new delete hooks are checked when xfrm_policy or xfrm_state are
      deleted by either the xfrm_user interface (xfrm_get_policy,
      xfrm_del_sa) or the pfkey interface (pfkey_spddelete, pfkey_delete).
      
      SELinux changes:
      
      The new policy_delete and state_delete functions are added.
      Signed-off-by: NCatherine Zhang <cxzhang@watson.ibm.com>
      Signed-off-by: NTrent Jaeger <tjaeger@cse.psu.edu>
      Acked-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c8c05a8e
  4. 06 6月, 2006 1 次提交
  5. 22 5月, 2006 1 次提交
  6. 16 5月, 2006 1 次提交
  7. 04 5月, 2006 1 次提交
  8. 01 5月, 2006 4 次提交
  9. 21 4月, 2006 1 次提交
  10. 20 4月, 2006 1 次提交
  11. 11 4月, 2006 2 次提交
    • D
      [PATCH] Keys: Improve usage of memory barriers and remove IRQ disablement · 1a26feb9
      David Howells 提交于
      Remove an unnecessary memory barrier (implicit in rcu_dereference()) from
      install_session_keyring().
      
      install_session_keyring() is also rearranged a little to make it slightly
      more efficient.
      
      As install_*_keyring() may schedule (in synchronize_rcu() or
      keyring_alloc()), they may not be entered with interrupts disabled - and so
      there's no point saving the interrupt disablement state over the critical
      section.
      
      exec_keys() will also be invoked with interrupts enabled, and so that doesn't
      need to save the interrupt state either.
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      1a26feb9
    • D
      [Security] Keys: Fix oops when adding key to non-keyring · c3a9d654
      David Howells 提交于
      This fixes the problem of an oops occuring when a user attempts to add a
      key to a non-keyring key [CVE-2006-1522].
      
      The problem is that __keyring_search_one() doesn't check that the
      keyring it's been given is actually a keyring.
      
      I've fixed this problem by:
      
       (1) declaring that caller of __keyring_search_one() must guarantee that
           the keyring is a keyring; and
      
       (2) making key_create_or_update() check that the keyring is a keyring,
           and return -ENOTDIR if it isn't.
      
      This can be tested by:
      
      	keyctl add user b b `keyctl add user a a @s`
      Signed-off-by: NDavid Howells <dhowells@redhat.com>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      c3a9d654
  12. 10 4月, 2006 1 次提交
  13. 26 3月, 2006 4 次提交
  14. 24 3月, 2006 1 次提交
  15. 23 3月, 2006 1 次提交
    • D
      [PATCH] Bug fixes and cleanup for the BSD Secure Levels LSM · 6bb08da4
      Davi Arnaut 提交于
      This patch address several issues in the current BSD Secure Levels code:
      
      o plaintext_to_sha1: Missing check for a NULL return from __get_free_page
      
      o passwd_write_file: A page is leaked if the password is wrong.
      
      o fix securityfs registration order
      
      o seclvl_init is a mess and can't properly tolerate failures, failure
        path is upside down (deldif and delf should be switched)
      
      Cleanups:
      
      o plaintext_to_sha1: Use buffers passed in
      o passwd_write_file: Use kmalloc() instead of get_zeroed_page()
      o passwd_write_file: hashedPassword comparison is just memcmp
      o s/ENOSYS/EINVAL/
      o misc
      
      (akpm: after some discussion it appears that the BSD secure levels feature
      should be scheduled for removal.  But for now, let's fix these problems up).
      Signed-off-by: NDavi Arnaut <davi.arnaut@gmail.com>
      Cc: Michael Halcrow <mhalcrow@us.ibm.com>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: Stephen Smalley <sds@epoch.ncsc.mil>
      Cc: James Morris <jmorris@namei.org>
      Cc: Serge Hallyn <serue@us.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      6bb08da4
  16. 22 3月, 2006 11 次提交