16 Oct, 2007

1 commit


11 Oct, 2007

3 commits

  • Expansion of original idea from Denis V. Lunev

    Add robustness and locking to the local_port_range sysctl.
    1. Enforce that low < high when setting.
    2. Use seqlock to ensure atomic update.

    The locking might seem like overkill, but there are
    cases where sysadmin might want to change value in the
    middle of a DoS attack.

    Signed-off-by: Stephen Hemminger
    Signed-off-by: David S. Miller

    Stephen Hemminger
     
  • Each netlink socket will live in exactly one network namespace,
    this includes the controlling kernel sockets.

    This patch updates all of the existing netlink protocols
    to only support the initial network namespace. Request
    by clients in other namespaces will get -ECONREFUSED.
    As they would if the kernel did not have the support for
    that netlink protocol compiled in.

    As each netlink protocol is updated to be multiple network
    namespace safe it can register multiple kernel sockets
    to acquire a presence in the rest of the network namespaces.

    The implementation in af_netlink is a simple filter implementation
    at hash table insertion and hash table look up time.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     
  • Every user of the network device notifiers is either a protocol
    stack or a pseudo device. If a protocol stack that does not have
    support for multiple network namespaces receives an event for a
    device that is not in the initial network namespace it quite possibly
    can get confused and do the wrong thing.

    To avoid problems until all of the protocol stacks are converted
    this patch modifies all netdev event handlers to ignore events on
    devices that are not in the initial network namespace.

    As the rest of the code is made network namespace aware these
    checks can be removed.

    Signed-off-by: Eric W. Biederman
    Signed-off-by: David S. Miller

    Eric W. Biederman
     

20 Sep, 2007

1 commit


31 Aug, 2007

1 commit


23 Aug, 2007

1 commit

  • 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: Alan Cox
    Cc: WU Fengguang
    Cc: James Morris
    Cc: Tobias Diedrich
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Alan Cox
     

16 Aug, 2007

1 commit


02 Aug, 2007

2 commits


01 Aug, 2007

1 commit


26 Jul, 2007

1 commit


23 Jul, 2007

1 commit


22 Jul, 2007

1 commit

  • Selinux folks had been complaining about the lack of AVC_PATH
    records when audit is disabled. I must admit my stupidity - I assumed
    that avc_audit() really couldn't use audit_log_d_path() because of
    deadlocks (== could be called with dcache_lock or vfsmount_lock held).
    Shouldn't have made that assumption - it never gets called that way.
    It _is_ called under spinlocks, but not those.

    Since audit_log_d_path() uses ab->gfp_mask for allocations,
    kmalloc() in there is not a problem. IOW, the simple fix is sufficient:
    let's rip AUDIT_AVC_PATH out and simply generate pathname as part of main
    record. It's trivial to do.

    Signed-off-by: Al Viro
    Acked-by: James Morris

    Al Viro
     

20 Jul, 2007

3 commits

  • Slab destructors were no longer supported after Christoph's
    c59def9f222d44bb7e2f0a559f2906191a0862d7 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: Paul Mundt

    Paul Mundt
     
  • * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/selinux-2.6:
    SELinux: use SECINITSID_NETMSG instead of SECINITSID_UNLABELED for NetLabel
    SELinux: enable dynamic activation/deactivation of NetLabel/SELinux enforcement

    Linus Torvalds
     
  • This patch changes mm_struct.dumpable to a pair of bit flags.

    set_dumpable() converts three-value dumpable to two flags and stores it into
    lower two bits of mm_struct.flags instead of mm_struct.dumpable.
    get_dumpable() behaves in the opposite way.

    [akpm@linux-foundation.org: export set_dumpable]
    Signed-off-by: Hidehiro Kawai
    Cc: Alan Cox
    Cc: David Howells
    Cc: Hugh Dickins
    Cc: Nick Piggin
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Kawai, Hidehiro
     

19 Jul, 2007

2 commits

  • 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: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     
  • Create a new NetLabel KAPI interface, netlbl_enabled(), which reports on the
    current runtime status of NetLabel based on the existing configuration. LSMs
    that make use of NetLabel, i.e. SELinux, can use this new function to determine
    if they should perform NetLabel access checks. This patch changes the
    NetLabel/SELinux glue code such that SELinux only enforces NetLabel related
    access checks when netlbl_enabled() returns true.

    At present NetLabel is considered to be enabled when there is at least one
    labeled protocol configuration present. The result is that by default NetLabel
    is considered to be disabled, however, as soon as an administrator configured
    a CIPSO DOI definition NetLabel is enabled and SELinux starts enforcing
    NetLabel related access controls - including unlabeled packet controls.

    This patch also tries to consolidate the multiple "#ifdef CONFIG_NETLABEL"
    blocks into a single block to ease future review as recommended by Linus.

    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     

18 Jul, 2007

2 commits

  • Rather than using a tri-state integer for the wait flag in
    call_usermodehelper_exec, define a proper enum, and use that. I've
    preserved the integer values so that any callers I've missed should
    still work OK.

    Signed-off-by: Jeremy Fitzhardinge
    Cc: James Bottomley
    Cc: Randy Dunlap
    Cc: Christoph Hellwig
    Cc: Andi Kleen
    Cc: Paul Mackerras
    Cc: Johannes Berg
    Cc: Ralf Baechle
    Cc: Bjorn Helgaas
    Cc: Joel Becker
    Cc: Tony Luck
    Cc: Kay Sievers
    Cc: Srivatsa Vaddagiri
    Cc: Oleg Nesterov
    Cc: David Howells

    Jeremy Fitzhardinge
     
  • 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: Satyam Sharma
    Cc: Al Viro
    Acked-by: Serge E. Hallyn
    Signed-off-by: Linus Torvalds

    Satyam Sharma
     

17 Jul, 2007

1 commit

  • Add TTY input auditing, used to audit system administrator's actions. This is
    required by various security standards such as DCID 6/3 and PCI to provide
    non-repudiation of administrator's actions and to allow a review of past
    actions if the administrator seems to overstep their duties or if the system
    becomes misconfigured for unknown reasons. These requirements do not make it
    necessary to audit TTY output as well.

    Compared to an user-space keylogger, this approach records TTY input using the
    audit subsystem, correlated with other audit events, and it is completely
    transparent to the user-space application (e.g. the console ioctls still
    work).

    TTY input auditing works on a higher level than auditing all system calls
    within the session, which would produce an overwhelming amount of mostly
    useless audit events.

    Add an "audit_tty" attribute, inherited across fork (). Data read from TTYs
    by process with the attribute is sent to the audit subsystem by the kernel.
    The audit netlink interface is extended to allow modifying the audit_tty
    attribute, and to allow sending explanatory audit events from user-space (for
    example, a shell might send an event containing the final command, after the
    interactive command-line editing and history expansion is performed, which
    might be difficult to decipher from the TTY input alone).

    Because the "audit_tty" attribute is inherited across fork (), it would be set
    e.g. for sshd restarted within an audited session. To prevent this, the
    audit_tty attribute is cleared when a process with no open TTY file
    descriptors (e.g. after daemon startup) opens a TTY.

    See https://www.redhat.com/archives/linux-audit/2007-June/msg00000.html for a
    more detailed rationale document for an older version of this patch.

    [akpm@linux-foundation.org: build fix]
    Signed-off-by: Miloslav Trmac
    Cc: Al Viro
    Cc: Alan Cox
    Cc: Paul Fulghum
    Cc: Casey Schaufler
    Cc: Steve Grubb
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Miloslav Trmac
     

14 Jul, 2007

1 commit

  • This reverts commit 9faf65fb6ee2b4e08325ba2d69e5ccf0c46453d0.

    It bit people like Michal Piotrowski:

    "My system is too secure, I can not login :)"

    because it changed how CONFIG_NETLABEL worked, and broke older SElinux
    policies.

    As a result, quoth James Morris:

    "Can you please revert this patch?

    We thought it only affected people running MLS, but it will affect others.

    Sorry for the hassle."

    Cc: James Morris
    Cc: Stephen Smalley
    Cc: Michal Piotrowski
    Cc: Paul Moore
    Signed-off-by: Linus Torvalds

    Linus Torvalds
     

12 Jul, 2007

10 commits

  • Remove unneeded export.

    Signed-off-by: Adrian Bunk
    Signed-off-by: James Morris

    Adrian Bunk
     
  • 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: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     
  • 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: Stephen Smalley
    Acked-by: Chris Wright
    Signed-off-by: Eric Paris
    Signed-off-by: James Morris

    Eric Paris
     
  • Inode numbers are unsigned long and so need to %lu as format string of printf.

    Signed-off-by: Tobias Oed
    Signed-off-by: James Morris

    Tobias Oed
     
  • 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: Ingo Molnar
    Signed-off-by: Stephen Smalley
    Signed-off-by: James Morris

    Stephen Smalley
     
  • During the LSPP testing we found that it was possible for
    policydb_destroy() to take 10+ seconds of kernel time to complete.
    Basically all policydb_destroy() does is walk some (possibly long) lists
    and free the memory it finds. Turning off slab debugging config options
    made the problem go away since the actual functions which took most of
    the time were (as seen by oprofile)

    > 121202 23.9879 .check_poison_obj
    > 78247 15.4864 .check_slabp

    were caused by that. So I decided to also add some voluntary schedule
    points in that code so config voluntary preempt would be enough to solve
    the problem. Something similar was done in places like
    shmem_free_pages() when we have to walk a list of memory and free it.
    This was tested by the LSPP group on the hardware which could reproduce
    the problem just loading a new policy and was found to not trigger the
    softlock detector. It takes just as much processing time, but the
    kernel doesn't spend all that time stuck doing one thing and never
    scheduling.

    Someday a better way to handle memory might make the time needed in this
    function a lot less, but this fixes the current issue as it stands
    today.

    Signed-off-by: Eric Paris
    Signed-off-by: James Morris

    Eric Paris
     
  • The structure is as follows (relative to selinuxfs root):

    /class/file/index
    /class/file/perms/read
    /class/file/perms/write
    ...

    Each class is allocated 33 inodes, 1 for the class index and 32 for
    permissions. Relative to SEL_CLASS_INO_OFFSET, the inode of the index file
    DIV 33 is the class number. The inode of the permission file % 33 is the
    index of the permission for that class.

    Signed-off-by: Christopher J. PeBenito
    Signed-off-by: James Morris

    Christopher J. PeBenito
     
  • Specify the inode counter explicitly in sel_make_dir(), rather than always
    using sel_last_ino.

    Signed-off-by: Christopher J. PeBenito
    Signed-off-by: James Morris

    Christopher J. PeBenito
     
  • sel_remove_bools() will also be used by the object class discovery, rename
    it for more general use.

    Signed-off-by: Christopher J. PeBenito
    Signed-off-by: James Morris

    Christopher J. PeBenito
     
  • Add support to the SELinux security server for obtaining a list of classes,
    and for obtaining a list of permissions for a specified class.

    Signed-off-by: Christopher J. PeBenito
    Signed-off-by: James Morris

    Christopher J. PeBenito
     

09 Jun, 2007

1 commit

  • The current NetLabel code has some redundant APIs which allow both
    "struct socket" and "struct sock" types to be used; this may have made
    sense at some point but it is wasteful now. Remove the functions that
    operate on sockets and convert the callers. Not only does this make
    the code smaller and more consistent but it pushes the locking burden
    up to the caller which can be more intelligent about the locks. Also,
    perform the same conversion (socket to sock) on the SELinux/NetLabel
    glue code where it make sense.

    Signed-off-by: Paul Moore
    Acked-by: James Morris
    Signed-off-by: David S. Miller

    Paul Moore
     

09 May, 2007

3 commits

  • Fix several typos in help text in Kconfig* files.

    Signed-off-by: David Sterba
    Signed-off-by: Adrian Bunk

    David Sterba
     
  • 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