19 Apr, 2008

7 commits

  • Add the security= boot parameter. This is done to avoid LSM
    registration clashes in case of more than one bult-in module.

    User can choose a security module to enable at boot. If no
    security= boot parameter is specified, only the first LSM
    asking for registration will be loaded. An invalid security
    module name will be treated as if no module has been chosen.

    LSM modules must check now if they are allowed to register
    by calling security_module_enable(ops) first. Modify SELinux
    and SMACK to do so.

    Do not let SMACK register smackfs if it was not chosen on
    boot. Smackfs assumes that smack hooks are registered and
    the initial task security setup (swapper->security) is done.

    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris

    Ahmed S. Darwish
     
  • Rename the se_str and se_rule audit fields elements to
    lsm_str and lsm_rule to avoid confusion.

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris

    Ahmed S. Darwish
     
  • Setup the new Audit LSM hooks for SELinux.
    Remove the now redundant exported SELinux Audit interface.

    Audit: Export 'audit_krule' and 'audit_field' to the public
    since their internals are needed by the implementation of the
    new LSM hook 'audit_rule_known'.

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris

    Ahmed S. Darwish
     
  • Introduce a generic Audit interface for security modules
    by adding the following new LSM hooks:

    audit_rule_init(field, op, rulestr, lsmrule)
    audit_rule_known(krule)
    audit_rule_match(secid, field, op, rule, actx)
    audit_rule_free(rule)

    Those hooks are only available if CONFIG_AUDIT is enabled.

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris
    Reviewed-by: Paul Moore

    Ahmed S. Darwish
     
  • Remove the following exported SELinux interfaces:
    selinux_get_inode_sid(inode, sid)
    selinux_get_ipc_sid(ipcp, sid)
    selinux_get_task_sid(tsk, sid)
    selinux_sid_to_string(sid, ctx, len)

    They can be substitued with the following generic equivalents
    respectively:
    new LSM hook, inode_getsecid(inode, secid)
    new LSM hook, ipc_getsecid*(ipcp, secid)
    LSM hook, task_getsecid(tsk, secid)
    LSM hook, sid_to_secctx(sid, ctx, len)

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris
    Reviewed-by: Paul Moore

    Ahmed S. Darwish
     
  • Setup the new inode_getsecid and ipc_getsecid() LSM hooks
    for SELinux.

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris
    Reviewed-by: Paul Moore

    Ahmed S. Darwish
     
  • Introduce inode_getsecid(inode, secid) and ipc_getsecid(ipcp, secid)
    LSM hooks. These hooks will be used instead of similar exported
    SELinux interfaces.

    Let {inode,ipc,task}_getsecid hooks set the secid to 0 by default
    if CONFIG_SECURITY is not defined or if the hook is set to
    NULL (dummy). This is done to notify the caller that no valid
    secid exists.

    Signed-off-by: Casey Schaufler
    Signed-off-by: Ahmed S. Darwish
    Acked-by: James Morris
    Reviewed-by: Paul Moore

    Ahmed S. Darwish
     

18 Apr, 2008

15 commits

  • Got burned by setting the proposed default of 65536
    across all Debian archs.

    Thus proposing to be more specific on which archs you may
    set this. Also propose a value for arm and friends that
    doesn't break sshd.

    Reword to mention working archs ia64 and ppc64 too.

    Signed-off-by: maximilian attems
    Cc: Martin Michlmayr
    Cc: Gordon Farquharson
    Acked-by: Eric Paris
    Signed-off-by: James Morris

    maximilian attems
     
  • Thank you, git.

    Signed-off-by: James Morris

    James Morris
     
  • Much like we added a network node cache, this patch adds a network port
    cache. The design is taken almost completely from the network node cache
    which in turn was taken from the network interface cache. The basic idea is
    to cache entries in a hash table based on protocol/port information. The
    hash function only takes the port number into account since the number of
    different protocols in use at any one time is expected to be relatively
    small.

    Signed-off-by: Paul Moore
    Acked-by: Stephen Smalley
    Signed-off-by: James Morris

    Paul Moore
     
  • Convert the strings used for mount options into #defines rather than
    retyping the string throughout the SELinux code.

    Signed-off-by: Eric Paris
    Acked-by: Stephen Smalley
    Signed-off-by: James Morris

    Eric Paris
     
  • Every file should include the headers containing the externs for its global
    code.

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

    Adrian Bunk
     
  • Introduce the concept of a permissive type. A new ebitmap is introduced to
    the policy database which indicates if a given type has the permissive bit
    set or not. This bit is tested for the scontext of any denial. The bit is
    meaningless on types which only appear as the target of a decision and never
    the source. A domain running with a permissive type will be allowed to
    perform any action similarly to when the system is globally set permissive.

    Signed-off-by: Eric Paris
    Acked-by: Stephen Smalley
    Signed-off-by: James Morris

    Eric Paris
     
  • This changes checks related to ptrace to get rid of the ptrace_sid tracking.
    It's good to disentangle the security model from the ptrace implementation
    internals. It's sufficient to check against the SID of the ptracer at the
    time a tracee attempts a transition.

    Signed-off-by: Roland McGrath
    Acked-by: Stephen Smalley
    Signed-off-by: James Morris

    Roland McGrath
     
  • This patch turns the case where we have a call into avc_has_perm with no
    requested permissions into a BUG_ON. All callers to this should be in
    the kernel and thus should be a function we need to fix if we ever hit
    this. The /selinux/access permission checking it done directly in the
    security server and not through the avc, so those requests which we
    cannot control from userspace should not be able to trigger this BUG_ON.

    Signed-off-by: Eric Paris
    Acked-by: Stephen D. Smalley
    Signed-off-by: James Morris

    Eric Paris
     
  • ERROR: "(foo*)" should be "(foo *)"
    #168: FILE: security/selinux/hooks.c:2656:
    + "%s, rc=%d\n", __func__, (char*)value, -rc);

    total: 1 errors, 0 warnings, 195 lines checked

    ./patches/security-replace-remaining-__function__-occurences.patch has style problems, please review. If any of these errors
    are false positives report them to the maintainer, see
    CHECKPATCH in MAINTAINERS.

    Please run checkpatch prior to sending patches

    Cc: Harvey Harrison
    Cc: James Morris
    Cc: Stephen Smalley
    Signed-off-by: Andrew Morton
    Signed-off-by: James Morris

    Andrew Morton
     
  • __FUNCTION__ is gcc-specific, use __func__

    Signed-off-by: Harvey Harrison
    Cc: James Morris
    Cc: Stephen Smalley
    Signed-off-by: Andrew Morton
    Signed-off-by: James Morris

    Harvey Harrison
     
  • Adds a new open permission inside SELinux when 'opening' a file. The idea
    is that opening a file and reading/writing to that file are not the same
    thing. Its different if a program had its stdout redirected to /tmp/output
    than if the program tried to directly open /tmp/output. This should allow
    policy writers to more liberally give read/write permissions across the
    policy while still blocking many design and programing flaws SELinux is so
    good at catching today.

    Signed-off-by: Eric Paris
    Acked-by: Stephen Smalley
    Reviewed-by: Paul Moore
    Signed-off-by: James Morris

    Eric Paris
     
  • Every file should include the headers containing the externs for its
    global code.

    Signed-off-by: Adrian Bunk
    Acked-by: Paul Moore
    Signed-off-by: James Morris

    Adrian Bunk
     
  • Replace "security:" prefixes in printk messages with "SELinux"
    to help users identify the source of the messages. Also fix a
    couple of minor formatting issues.

    Signed-off-by: James Morris

    James Morris
     
  • Remove unused backpoiters from security objects.

    Signed-off-by: James Morris

    James Morris
     
  • The RCU/spinlock locking approach for the nlbl_state in the sk_security_struct
    was almost certainly overkill. This patch removes both the RCU and spinlock
    locking, relying on the existing socket locks to handle the case of multiple
    writers. This change also makes several code reductions possible.

    Less locking, less code - it's a Good Thing.

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

    Paul Moore
     

10 Apr, 2008

1 commit

  • I (wrongly) assumed that nfs_xdev_get_sb() would not ever share a superblock
    and so cloning mount options would always be correct. Turns out that isn't
    the case and we could fall over a BUG_ON() that wasn't a BUG at all. Since
    there is little we can do to reconcile different mount options this patch
    just leaves the sb alone and the first set of options wins.

    Signed-off-by: Eric Paris
    Acked-by: Stephen Smalley
    Acked-by: Trond Myklebust
    Signed-off-by: James Morris

    Eric Paris
     

08 Apr, 2008

1 commit


04 Apr, 2008

1 commit


02 Apr, 2008

1 commit

  • Handle files opened with flags 3 by checking ioctl permission.

    Default to returning FILE__IOCTL from file_to_av() if the f_mode has neither
    FMODE_READ nor FMODE_WRITE, and thus check ioctl permission on exec or
    transfer, thereby validating such descriptors early as with normal r/w
    descriptors and catching leaks of them prior to attempted usage.

    Signed-off-by: Stephen Smalley
    Acked-by: Eric Paris
    Signed-off-by: James Morris

    Stephen Smalley
     

25 Mar, 2008

1 commit

  • Older smackfs was parsing MAC rules by characters, thus a need of locking
    write sessions on open() was needed. This lock is no longer useful now since
    each rule is handled by a single write() call.

    This is also a bugfix since seq_open() was not called if an open() O_RDWR flag
    was given, leading to a seq_read() without an initialized seq_file, thus an
    Oops.

    Signed-off-by: Ahmed S. Darwish
    Reported-by: Jonathan Corbet
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ahmed S. Darwish
     

21 Mar, 2008

1 commit

  • The original justification for cap_task_kill() was as follows:

    check_kill_permission() does appropriate uid equivalence checks.
    However with file capabilities it becomes possible for an
    unprivileged user to execute a file with file capabilities
    resulting in a more privileged task with the same uid.

    However now that cap_task_kill() always returns 0 (permission
    granted) when p->uid==current->uid, the whole hook is worthless,
    and only likely to create more subtle problems in the corner cases
    where it might still be called but return -EPERM. Those cases
    are basically when uids are different but euid/suid is equivalent
    as per the check in check_kill_permission().

    One example of a still-broken application is 'at' for non-root users.

    This patch removes cap_task_kill().

    Signed-off-by: Serge Hallyn
    Acked-by: Andrew G. Morgan
    Earlier-version-tested-by: Luiz Fernando N. Capitulino
    Acked-by: Casey Schaufler
    Signed-off-by: Linus Torvalds

    Serge Hallyn
     

20 Mar, 2008

1 commit

  • In the SYSV ipc msgctl(),semctl(),shmctl() family, if the user passed *_INFO
    as the desired operation, no specific object is meant to be controlled and
    only system-wide information is returned. This leads to a NULL IPC object in
    the LSM hooks if the _INFO flag is given.

    Avoid dereferencing this NULL pointer in Smack ipc *ctl() methods.

    Signed-off-by: Ahmed S. Darwish
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ahmed S. Darwish
     

18 Mar, 2008

1 commit


14 Mar, 2008

1 commit

  • Smackfs write() implementation does not put a higher bound on the number of
    bytes to copy from user-space. This may lead to a DOS attack if a malicious
    `count' field is given.

    Assure that given `count' is exactly the length needed for a /smack/load rule.
    In case of /smack/cipso where the length is relative, assure that `count'
    does not exceed the size needed for a buffer representing maximum possible
    number of CIPSO 2.2 categories.

    Signed-off-by: Ahmed S. Darwish
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ahmed S. Darwish
     

06 Mar, 2008

1 commit

  • Introduce new LSM interfaces to allow an FS to deal with their own mount
    options. This includes a new string parsing function exported from the
    LSM that an FS can use to get a security data blob and a new security
    data blob. This is particularly useful for an FS which uses binary
    mount data, like NFS, which does not pass strings into the vfs to be
    handled by the loaded LSM. Also fix a BUG() in both SELinux and SMACK
    when dealing with binary mount data. If the binary mount data is less
    than one page the copy_page() in security_sb_copy_data() can cause an
    illegal page fault and boom. Remove all NFSisms from the SELinux code
    since they were broken by past NFS changes.

    Signed-off-by: Eric Paris
    Acked-by: Stephen Smalley
    Acked-by: Casey Schaufler
    Signed-off-by: James Morris

    Eric Paris
     

24 Feb, 2008

2 commits

  • Update the Smack LSM to allow the registration of the capability "module"
    as a secondary LSM. Integrate the new hooks required for file based
    capabilities.

    Signed-off-by: Casey Schaufler
    Cc: Serge Hallyn
    Cc: Stephen Smalley
    Cc: Paul Moore
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Casey Schaufler
     
  • Simplify the uid equivalence check in cap_task_kill(). Anyone can kill a
    process owned by the same uid.

    Without this patch wireshark is reported to fail.

    Signed-off-by: Serge E. Hallyn
    Signed-off-by: Andrew G. Morgan
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Serge E. Hallyn
     

19 Feb, 2008

1 commit

  • Smack uses CIPSO labeling, but allows for unlabeled packets by
    specifying an "ambient" label that is applied to incoming unlabeled
    packets.

    Because the other end of the connection may dislike IP options, and ssh
    is one know application that behaves thus, it is prudent to respond in
    kind.

    This patch changes the network labeling behavior such that an outgoing
    packet that would be given a CIPSO label that matches the ambient label
    is left unlabeled. An "unlbl" domain is added and the netlabel
    defaulting mechanism invoked rather than assuming that everything is
    CIPSO. Locking has been added around changes to the ambient label as
    the mechanisms used to do so are more involved.

    Signed-off-by: Casey Schaufler
    Acked-by: Paul Moore
    Signed-off-by: Linus Torvalds

    Casey Schaufler
     

15 Feb, 2008

2 commits

  • audit_log_d_path() is a d_path() wrapper that is used by the audit code. To
    use a struct path in audit_log_d_path() I need to embed it into struct
    avc_audit_data.

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Jan Blunck
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Cc: "J. Bruce Fields"
    Cc: Neil Brown
    Cc: Stephen Smalley
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     
  • This is the central patch of a cleanup series. In most cases there is no good
    reason why someone would want to use a dentry for itself. This series reflects
    that fact and embeds a struct path into nameidata.

    Together with the other patches of this series
    - it enforced the correct order of getting/releasing the reference count on
    pairs
    - it prepares the VFS for stacking support since it is essential to have a
    struct path in every place where the stack can be traversed
    - it reduces the overall code size:

    without patch series:
    text data bss dec hex filename
    5321639 858418 715768 6895825 6938d1 vmlinux

    with patch series:
    text data bss dec hex filename
    5320026 858418 715768 6894212 693284 vmlinux

    This patch:

    Switch from nd->{dentry,mnt} to nd->path.{dentry,mnt} everywhere.

    [akpm@linux-foundation.org: coding-style fixes]
    [akpm@linux-foundation.org: fix cifs]
    [akpm@linux-foundation.org: fix smack]
    Signed-off-by: Jan Blunck
    Signed-off-by: Andreas Gruenbacher
    Acked-by: Christoph Hellwig
    Cc: Al Viro
    Cc: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jan Blunck
     

14 Feb, 2008

1 commit

  • There's a small problem with smack and NFS. A similar report was also
    sent here: http://lkml.org/lkml/2007/10/27/85

    I've also added similar checks in inode_{get/set}security(). Cheating from
    SELinux post_create_socket(), it does the same.

    [akpm@linux-foundation.org: remove uneeded BUG_ON()]
    Signed-off-by: Ahmed S. Darwish
    Acked-by: Casey Schaufler
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Ahmed S. Darwish
     

11 Feb, 2008

1 commit


08 Feb, 2008

1 commit