1. 23 8月, 2007 1 次提交
    • A
      fix NULL pointer dereference in __vm_enough_memory() · 34b4e4aa
      Alan Cox 提交于
      The new exec code inserts an accounted vma into an mm struct which is not
      current->mm.  The existing memory check code has a hard coded assumption
      that this does not happen as does the security code.
      
      As the correct mm is known we pass the mm to the security method and the
      helper function.  A new security test is added for the case where we need
      to pass the mm and the existing one is modified to pass current->mm to
      avoid the need to change large amounts of code.
      
      (Thanks to Tobias for fixing rejects and testing)
      Signed-off-by: NAlan Cox <alan@redhat.com>
      Cc: WU Fengguang <wfg@mail.ustc.edu.cn>
      Cc: James Morris <jmorris@redhat.com>
      Cc: Tobias Diedrich <ranma+kernel@tdiedrich.de>
      Signed-off-by: NAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      34b4e4aa
  2. 02 8月, 2007 1 次提交
  3. 20 7月, 2007 1 次提交
    • P
      mm: Remove slab destructors from kmem_cache_create(). · 20c2df83
      Paul Mundt 提交于
      Slab destructors were no longer supported after Christoph's
      c59def9f change. They've been
      BUGs for both slab and slub, and slob never supported them
      either.
      
      This rips out support for the dtor pointer from kmem_cache_create()
      completely and fixes up every single callsite in the kernel (there were
      about 224, not including the slab allocator definitions themselves,
      or the documentation references).
      Signed-off-by: NPaul Mundt <lethal@linux-sh.org>
      20c2df83
  4. 19 7月, 2007 1 次提交
    • P
      SELinux: use SECINITSID_NETMSG instead of SECINITSID_UNLABELED for NetLabel · f36158c4
      Paul Moore 提交于
      These changes will make NetLabel behave like labeled IPsec where there is an
      access check for both labeled and unlabeled packets as well as providing the
      ability to restrict domains to receiving only labeled packets when NetLabel is
      in use.  The changes to the policy are straight forward with the following
      necessary to receive labeled traffic (with SECINITSID_NETMSG defined as
      "netlabel_peer_t"):
      
       allow mydom_t netlabel_peer_t:{ tcp_socket udp_socket rawip_socket } recvfrom;
      
      The policy for unlabeled traffic would be:
      
       allow mydom_t unlabeled_t:{ tcp_socket udp_socket rawip_socket } recvfrom;
      
      These policy changes, as well as more general NetLabel support, are included in
      the latest SELinux Reference Policy release 20070629 or later.  Users who make
      use of NetLabel are strongly encouraged to upgrade their policy to avoid
      network problems.  Users who do not make use of NetLabel will not notice any
      difference.
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      f36158c4
  5. 18 7月, 2007 1 次提交
    • S
      Introduce is_owner_or_cap() to wrap CAP_FOWNER use with fsuid check · 3bd858ab
      Satyam Sharma 提交于
      Introduce is_owner_or_cap() macro in fs.h, and convert over relevant
      users to it. This is done because we want to avoid bugs in the future
      where we check for only effective fsuid of the current task against a
      file's owning uid, without simultaneously checking for CAP_FOWNER as
      well, thus violating its semantics.
      [ XFS uses special macros and structures, and in general looked ...
      untouchable, so we leave it alone -- but it has been looked over. ]
      
      The (current->fsuid != inode->i_uid) check in generic_permission() and
      exec_permission_lite() is left alone, because those operations are
      covered by CAP_DAC_OVERRIDE and CAP_DAC_READ_SEARCH. Similarly operations
      falling under the purview of CAP_CHOWN and CAP_LEASE are also left alone.
      Signed-off-by: NSatyam Sharma <ssatyam@cse.iitk.ac.in>
      Cc: Al Viro <viro@ftp.linux.org.uk>
      Acked-by: NSerge E. Hallyn <serge@hallyn.com>
      Signed-off-by: NLinus Torvalds <torvalds@linux-foundation.org>
      3bd858ab
  6. 14 7月, 2007 1 次提交
  7. 12 7月, 2007 3 次提交
    • P
      SELinux: use SECINITSID_NETMSG instead of SECINITSID_UNLABELED for NetLabel · 9faf65fb
      Paul Moore 提交于
      These changes will make NetLabel behave like labeled IPsec where there is an
      access check for both labeled and unlabeled packets as well as providing the
      ability to restrict domains to receiving only labeled packets when NetLabel
      is in use.  The changes to the policy are straight forward with the
      following necessary to receive labeled traffic (with SECINITSID_NETMSG
      defined as "netlabel_peer_t"):
      
       allow mydom_t netlabel_peer_t:{ tcp_socket udp_socket rawip_socket } recvfrom;
      
      The policy for unlabeled traffic would be:
      
       allow mydom_t unlabeled_t:{ tcp_socket udp_socket rawip_socket } recvfrom;
      
      These policy changes, as well as more general NetLabel support, are included
      in the SELinux Reference Policy SVN tree, r2352 or later.  Users who enable
      NetLabel support in the kernel are strongly encouraged to upgrade their
      policy to avoid network problems.
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      9faf65fb
    • E
      security: Protection for exploiting null dereference using mmap · ed032189
      Eric Paris 提交于
      Add a new security check on mmap operations to see if the user is attempting
      to mmap to low area of the address space.  The amount of space protected is
      indicated by the new proc tunable /proc/sys/vm/mmap_min_addr and defaults to
      0, preserving existing behavior.
      
      This patch uses a new SELinux security class "memprotect."  Policy already
      contains a number of allow rules like a_t self:process * (unconfined_t being
      one of them) which mean that putting this check in the process class (its
      best current fit) would make it useless as all user processes, which we also
      want to protect against, would be allowed. By taking the memprotect name of
      the new class it will also make it possible for us to move some of the other
      memory protect permissions out of 'process' and into the new class next time
      we bump the policy version number (which I also think is a good future idea)
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Acked-by: NChris Wright <chrisw@sous-sol.org>
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      ed032189
    • S
      SELinux: allow preemption between transition permission checks · 2c3c05db
      Stephen Smalley 提交于
      In security_get_user_sids, move the transition permission checks
      outside of the section holding the policy rdlock, and use the AVC to
      perform the checks, calling cond_resched after each one.  These
      changes should allow preemption between the individual checks and
      enable caching of the results.  It may however increase the overall
      time spent in the function in some cases, particularly in the cache
      miss case.
      
      The long term fix will be to take much of this logic to userspace by
      exporting additional state via selinuxfs, and ultimately deprecating
      and eliminating this interface from the kernel.
      Tested-by: NIngo Molnar <mingo@elte.hu>
      Signed-off-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      2c3c05db
  8. 09 5月, 2007 2 次提交
  9. 26 4月, 2007 4 次提交
  10. 15 3月, 2007 1 次提交
  11. 27 2月, 2007 1 次提交
    • E
      Reassign printk levels in selinux kernel code · fadcdb45
      Eric Paris 提交于
      Below is a patch which demotes many printk lines to KERN_DEBUG from
      KERN_INFO.  It should help stop the spamming of logs with messages in
      which users are not interested nor is there any action that users should
      take.  It also promotes some KERN_INFO to KERN_ERR such as when there
      are improper attempts to register/unregister security modules.
      
      A similar patch was discussed a while back on list:
      http://marc.theaimsgroup.com/?t=116656343500003&r=1&w=2
      This patch addresses almost all of the issues raised.  I believe the
      only advice not taken was in the demoting of messages related to
      undefined permissions and classes.
      Signed-off-by: NEric Paris <eparis@redhat.com>
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      
       security/selinux/hooks.c       |   20 ++++++++++----------
       security/selinux/ss/avtab.c    |    2 +-
       security/selinux/ss/policydb.c |    6 +++---
       security/selinux/ss/sidtab.c   |    2 +-
       4 files changed, 15 insertions(+), 15 deletions(-)
      Signed-off-by: NJames Morris <jmorris@namei.org>
      fadcdb45
  12. 15 2月, 2007 3 次提交
  13. 12 2月, 2007 2 次提交
  14. 11 12月, 2006 1 次提交
    • V
      [PATCH] fdtable: Make fdarray and fdsets equal in size · bbea9f69
      Vadim Lobanov 提交于
      Currently, each fdtable supports three dynamically-sized arrays of data: the
      fdarray and two fdsets.  The code allows the number of fds supported by the
      fdarray (fdtable->max_fds) to differ from the number of fds supported by each
      of the fdsets (fdtable->max_fdset).
      
      In practice, it is wasteful for these two sizes to differ: whenever we hit a
      limit on the smaller-capacity structure, we will reallocate the entire fdtable
      and all the dynamic arrays within it, so any delta in the memory used by the
      larger-capacity structure will never be touched at all.
      
      Rather than hogging this excess, we shouldn't even allocate it in the first
      place, and keep the capacities of the fdarray and the fdsets equal.  This
      patch removes fdtable->max_fdset.  As an added bonus, most of the supporting
      code becomes simpler.
      Signed-off-by: NVadim Lobanov <vlobanov@speakeasy.net>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Dipankar Sarma <dipankar@in.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      bbea9f69
  15. 09 12月, 2006 2 次提交
    • J
      [PATCH] struct path: convert selinux · 3d5ff529
      Josef Sipek 提交于
      Signed-off-by: NJosef Sipek <jsipek@fsl.cs.sunysb.edu>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      3d5ff529
    • P
      [PATCH] tty: ->signal->tty locking · 24ec839c
      Peter Zijlstra 提交于
      Fix the locking of signal->tty.
      
      Use ->sighand->siglock to protect ->signal->tty; this lock is already used
      by most other members of ->signal/->sighand.  And unless we are 'current'
      or the tasklist_lock is held we need ->siglock to access ->signal anyway.
      
      (NOTE: sys_unshare() is broken wrt ->sighand locking rules)
      
      Note that tty_mutex is held over tty destruction, so while holding
      tty_mutex any tty pointer remains valid.  Otherwise the lifetime of ttys
      are governed by their open file handles.  This leaves some holes for tty
      access from signal->tty (or any other non file related tty access).
      
      It solves the tty SLAB scribbles we were seeing.
      
      (NOTE: the change from group_send_sig_info to __group_send_sig_info needs to
             be examined by someone familiar with the security framework, I think
             it is safe given the SEND_SIG_PRIV from other __group_send_sig_info
             invocations)
      
      [schwidefsky@de.ibm.com: 3270 fix]
      [akpm@osdl.org: various post-viro fixes]
      Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
      Acked-by: NAlan Cox <alan@redhat.com>
      Cc: Oleg Nesterov <oleg@tv-sign.ru>
      Cc: Prarit Bhargava <prarit@redhat.com>
      Cc: Chris Wright <chrisw@sous-sol.org>
      Cc: Roland McGrath <roland@redhat.com>
      Cc: Stephen Smalley <sds@tycho.nsa.gov>
      Cc: James Morris <jmorris@namei.org>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Jeff Dike <jdike@addtoit.com>
      Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
      Cc: Jan Kara <jack@ucw.cz>
      Signed-off-by: NMartin Schwidefsky <schwidefsky@de.ibm.com>
      Signed-off-by: NAndrew Morton <akpm@osdl.org>
      Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
      24ec839c
  16. 08 12月, 2006 2 次提交
  17. 05 12月, 2006 1 次提交
  18. 03 12月, 2006 5 次提交
    • P
      SELinux: peer secid consolidation for external network labeling · 3de4bab5
      Paul Moore 提交于
      Now that labeled IPsec makes use of the peer_sid field in the
      sk_security_struct we can remove a lot of the special cases between labeled
      IPsec and NetLabel.  In addition, create a new function,
      security_skb_extlbl_sid(), which we can use in several places to get the
      security context of the packet's external label which allows us to further
      simplify the code in a few places.
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      3de4bab5
    • P
      NetLabel: SELinux cleanups · 9f2ad665
      Paul Moore 提交于
      This patch does a lot of cleanup in the SELinux NetLabel support code.  A
      summary of the changes include:
      
      * Use RCU locking for the NetLabel state variable in the skk_security_struct
        instead of using the inode_security_struct mutex.
      * Remove unnecessary parameters in selinux_netlbl_socket_post_create().
      * Rename selinux_netlbl_sk_clone_security() to
        selinux_netlbl_sk_security_clone() to better fit the other NetLabel
        sk_security functions.
      * Improvements to selinux_netlbl_inode_permission() to help reduce the cost of
        the common case.
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      9f2ad665
    • J
      [SELinux]: Add support for DCCP · 2ee92d46
      James Morris 提交于
      This patch implements SELinux kernel support for DCCP
      (http://linux-net.osdl.org/index.php/DCCP), which is similar in
      operation to TCP in terms of connected state between peers.
      
      The SELinux support for DCCP is thus modeled on existing handling of
      TCP.
      
      A new DCCP socket class is introduced, to allow protocol
      differentation.  The permissions for this class inherit all of the
      socket permissions, as well as the current TCP permissions (node_bind,
      name_bind etc). IPv4 and IPv6 are supported, although labeled
      networking is not, at this stage.
      
      Patches for SELinux userspace are at:
      http://people.redhat.com/jmorris/selinux/dccp/user/
      
      I've performed some basic testing, and it seems to be working as
      expected.  Adding policy support is similar to TCP, the only real
      difference being that it's a different protocol.
      Acked-by: NStephen Smalley <sds@tycho.nsa.gov>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      2ee92d46
    • V
      SELinux: Fix SA selection semantics · 67f83cbf
      Venkat Yekkirala 提交于
      Fix the selection of an SA for an outgoing packet to be at the same
      context as the originating socket/flow. This eliminates the SELinux
      policy's ability to use/sendto SAs with contexts other than the socket's.
      
      With this patch applied, the SELinux policy will require one or more of the
      following for a socket to be able to communicate with/without SAs:
      
      1. To enable a socket to communicate without using labeled-IPSec SAs:
      
      allow socket_t unlabeled_t:association { sendto recvfrom }
      
      2. To enable a socket to communicate with labeled-IPSec SAs:
      
      allow socket_t self:association { sendto };
      allow socket_t peer_sa_t:association { recvfrom };
      Signed-off-by: NVenkat Yekkirala <vyekkirala@TrustedCS.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      67f83cbf
    • V
      SELinux: Return correct context for SO_PEERSEC · 6b877699
      Venkat Yekkirala 提交于
      Fix SO_PEERSEC for tcp sockets to return the security context of
      the peer (as represented by the SA from the peer) as opposed to the
      SA used by the local/source socket.
      Signed-off-by: NVenkat Yekkirala <vyekkirala@TrustedCS.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      6b877699
  19. 27 11月, 2006 1 次提交
  20. 31 10月, 2006 1 次提交
    • P
      [NetLabel]: protect the CIPSOv4 socket option from setsockopt() · f8687afe
      Paul Moore 提交于
      This patch makes two changes to protect applications from either removing or
      tampering with the CIPSOv4 IP option on a socket.  The first is the requirement
      that applications have the CAP_NET_RAW capability to set an IPOPT_CIPSO option
      on a socket; this prevents untrusted applications from setting their own
      CIPSOv4 security attributes on the packets they send.  The second change is to
      SELinux and it prevents applications from setting any IPv4 options when there
      is an IPOPT_CIPSO option already present on the socket; this prevents
      applications from removing CIPSOv4 security attributes from the packets they
      send.
      Signed-off-by: NPaul Moore <paul.moore@hp.com>
      Signed-off-by: NJames Morris <jmorris@namei.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f8687afe
  21. 30 9月, 2006 2 次提交
  22. 26 9月, 2006 3 次提交