09 May, 2007

2 commits

  • Remove includes of where it is not used/needed.
    Suggested by Al Viro.

    Builds cleanly on x86_64, i386, alpha, ia64, powerpc, sparc,
    sparc64, and arm (all 59 defconfigs).

    Signed-off-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Randy Dunlap
     
  • While researching the tty layer pid leaks I found a weird case in selinux when
    we drop a controlling tty because of inadequate permissions we don't do the
    normal hangup processing. Which is a problem if it happens the session leader
    has exec'd something that can no longer access the tty.

    We already have code in the kernel to handle this case in the form of the
    TIOCNOTTY ioctl. So this patch factors out a helper function that is the
    essence of that ioctl and calls it from the selinux code.

    This removes the inconsistency in handling dropping of a controlling tty and
    who knows it might even make some part of user space happy because it received
    a SIGHUP it was expecting.

    In addition since this removes the last user of proc_set_tty outside of
    tty_io.c proc_set_tty is made static and removed from tty.h

    Signed-off-by: Eric W. Biederman
    Acked-by: Alan Cox
    Cc: James Morris
    Cc: Stephen Smalley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     

03 May, 2007

1 commit


28 Apr, 2007

1 commit

  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6:
    selinux: preserve boolean values across policy reloads
    selinux: change numbering of boolean directory inodes in selinuxfs
    selinux: remove unused enumeration constant from selinuxfs
    selinux: explicitly number all selinuxfs inodes
    selinux: export initial SID contexts via selinuxfs
    selinux: remove userland security class and permission definitions
    SELinux: move security_skb_extlbl_sid() out of the security server
    MAINTAINERS: update selinux entry
    SELinux: rename selinux_netlabel.h to netlabel.h
    SELinux: extract the NetLabel SELinux support from the security server
    NetLabel: convert a BUG_ON in the CIPSO code to a runtime check
    NetLabel: cleanup and document CIPSO constants

    Linus Torvalds
     

27 Apr, 2007

1 commit

  • Export the keyring key type definition and document its availability.

    Add alternative types into the key's type_data union to make it more useful.
    Not all users necessarily want to use it as a list_head (AF_RXRPC doesn't, for
    example), so make it clear that it can be used in other ways.

    Signed-off-by: David Howells
    Signed-off-by: David S. Miller

    David Howells
     

26 Apr, 2007

13 commits


15 Mar, 2007

1 commit


27 Feb, 2007

2 commits

  • Always initialize *scontext and *scontext_len in security_sid_to_context.

    (via http://lkml.org/lkml/2007/2/23/135)

    Signed-off-by: Stephen Smalley
    Signed-off-by: James Morris

    Stephen Smalley
     
  • 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: Eric Paris
    Acked-by: Stephen Smalley

    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: James Morris

    Eric Paris
     

15 Feb, 2007

4 commits

  • Hmmm...turns out to not be quite enough, as the /proc/sys inodes aren't truly
    private to the fs, so we can run into them in a variety of security hooks
    beyond just the inode hooks, such as security_file_permission (when reading
    and writing them via the vfs helpers), security_sb_mount (when mounting other
    filesystems on directories in proc like binfmt_misc), and deeper within the
    security module itself (as in flush_unauthorized_files upon inheritance across
    execve). So I think we have to add an IS_PRIVATE() guard within SELinux, as
    below. Note however that the use of the private flag here could be confusing,
    as these inodes are _not_ private to the fs, are exposed to userspace, and
    security modules must implement the sysctl hook to get any access control over
    them.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: Stephen Smalley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Stephen Smalley
     
  • I goofed and when reenabling the fine grained selinux labels for
    sysctls and forgot to add the "/sys" prefix before consulting
    the policy database. When computing the same path using
    proc_dir_entries we got the "/sys" for free as it was part
    of the tree, but it isn't true for clt_table trees.

    Signed-off-by: Eric W. Biederman
    Acked-by: Stephen Smalley
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     
  • It isn't needed anymore, all of the users are gone, and all of the ctl_table
    initializers have been converted to use explicit names of the fields they are
    initializing.

    [akpm@osdl.org: NTFS fix]
    Signed-off-by: Eric W. Biederman
    Acked-by: Stephen Smalley
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric W. Biederman
     
  • After Al Viro (finally) succeeded in removing the sched.h #include in module.h
    recently, it makes sense again to remove other superfluous sched.h includes.
    There are quite a lot of files which include it but don't actually need
    anything defined in there. Presumably these includes were once needed for
    macros that used to live in sched.h, but moved to other header files in the
    course of cleaning it up.

    To ease the pain, this time I did not fiddle with any header files and only
    removed #includes from .c-files, which tend to cause less trouble.

    Compile tested against 2.6.20-rc2 and 2.6.20-rc2-mm2 (with offsets) on alpha,
    arm, i386, ia64, mips, powerpc, and x86_64 with allnoconfig, defconfig,
    allmodconfig, and allyesconfig as well as a few randconfigs on x86_64 and all
    configs in arch/arm/configs on arm. I also checked that no new warnings were
    introduced by the patch (actually, some warnings are removed that were emitted
    by unnecessarily included header files).

    Signed-off-by: Tim Schmielau
    Acked-by: Russell King
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Tim Schmielau
     

13 Feb, 2007

1 commit

  • Many struct file_operations in the kernel can be "const". Marking them const
    moves these to the .rodata section, which avoids false sharing with potential
    dirty data. In addition it'll catch accidental writes at compile time to
    these shared resources.

    Signed-off-by: Arjan van de Ven
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Arjan van de Ven
     

12 Feb, 2007

2 commits


07 Feb, 2007

1 commit

  • Fix the key serial number collision avoidance code in key_alloc_serial().

    This didn't use to be so much of a problem as the key serial numbers were
    allocated from a simple incremental counter, and it would have to go through
    two billion keys before it could possibly encounter a collision. However, now
    that random numbers are used instead, collisions are much more likely.

    This is fixed by finding a hole in the rbtree where the next unused serial
    number ought to be and using that by going almost back to the top of the
    insertion routine and redoing the insertion with the new serial number rather
    than trying to be clever and attempting to work out the insertion point
    pointer directly.

    This fixes kernel BZ #7727.

    Signed-off-by: David Howells
    Signed-off-by: Linus Torvalds

    David Howells
     

27 Jan, 2007

1 commit


24 Jan, 2007

1 commit

  • Currently, old flow cache entries remain valid even after
    a reload of SELinux policy.

    This patch increments the flow cache generation id
    on policy (re)loads so that flow cache entries are
    revalidated as needed.

    Thanks to Herbet Xu for pointing this out. See:
    http://marc.theaimsgroup.com/?l=linux-netdev&m=116841378704536&w=2

    There's also a general issue as well as a solution proposed
    by David Miller for when flow_cache_genid wraps. I might be
    submitting a separate patch for that later.

    I request that this be applied to 2.6.20 since it's
    a security relevant fix.

    Signed-off-by: Venkat Yekkirala
    Signed-off-by: David S. Miller

    Venkat Yekkirala
     

09 Jan, 2007

2 commits


03 Jan, 2007

1 commit

  • do not call a sleeping lock API in an RCU read section.
    lock_sock_nested can sleep, its BH counterpart doesn't.
    selinux_netlbl_inode_permission() needs to use the BH counterpart
    unconditionally.

    Compile tested.

    From: Ingo Molnar

    added BH disabling, because this function can be called from non-atomic
    contexts too, so a naked bh_lock_sock() would be deadlock-prone.

    Boot-tested the resulting kernel.

    Signed-off-by: Parag Warudkar
    Signed-off-by: Ingo Molnar
    Signed-off-by: Linus Torvalds

    Parag Warudkar
     

11 Dec, 2006

1 commit

  • 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: Vadim Lobanov
    Cc: Christoph Hellwig
    Cc: Al Viro
    Cc: Dipankar Sarma
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Vadim Lobanov
     

09 Dec, 2006

2 commits

  • Signed-off-by: Josef Sipek
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Josef Sipek
     
  • 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: Peter Zijlstra
    Acked-by: Alan Cox
    Cc: Oleg Nesterov
    Cc: Prarit Bhargava
    Cc: Chris Wright
    Cc: Roland McGrath
    Cc: Stephen Smalley
    Cc: James Morris
    Cc: "David S. Miller"
    Cc: Jeff Dike
    Cc: Martin Schwidefsky
    Cc: Jan Kara
    Signed-off-by: Martin Schwidefsky
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     

08 Dec, 2006

3 commits

  • Name some of the remaning 'old_style_spin_init' locks

    Signed-off-by: Peter Zijlstra
    Acked-by: Ingo Molnar
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Peter Zijlstra
     
  • Signed-off-by: Eric Sesterhenn
    Signed-off-by: Alexey Dobriyan
    Acked-By: David Howells
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Eric Sesterhenn
     
  • Replace all uses of kmem_cache_t with struct kmem_cache.

    The patch was generated using the following script:

    #!/bin/sh
    #
    # Replace one string by another in all the kernel sources.
    #

    set -e

    for file in `find * -name "*.c" -o -name "*.h"|xargs grep -l $1`; do
    quilt add $file
    sed -e "1,\$s/$1/$2/g" $file >/tmp/$$
    mv /tmp/$$ $file
    quilt refresh
    done

    The script was run like this

    sh replace kmem_cache_t "struct kmem_cache"

    Signed-off-by: Christoph Lameter
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Christoph Lameter