16 Apr, 2015

1 commit

  • Pull networking updates from David Miller:

    1) Add BQL support to via-rhine, from Tino Reichardt.

    2) Integrate SWITCHDEV layer support into the DSA layer, so DSA drivers
    can support hw switch offloading. From Floria Fainelli.

    3) Allow 'ip address' commands to initiate multicast group join/leave,
    from Madhu Challa.

    4) Many ipv4 FIB lookup optimizations from Alexander Duyck.

    5) Support EBPF in cls_bpf classifier and act_bpf action, from Daniel
    Borkmann.

    6) Remove the ugly compat support in ARP for ugly layers like ax25,
    rose, etc. And use this to clean up the neigh layer, then use it to
    implement MPLS support. All from Eric Biederman.

    7) Support L3 forwarding offloading in switches, from Scott Feldman.

    8) Collapse the LOCAL and MAIN ipv4 FIB tables when possible, to speed
    up route lookups even further. From Alexander Duyck.

    9) Many improvements and bug fixes to the rhashtable implementation,
    from Herbert Xu and Thomas Graf. In particular, in the case where
    an rhashtable user bulk adds a large number of items into an empty
    table, we expand the table much more sanely.

    10) Don't make the tcp_metrics hash table per-namespace, from Eric
    Biederman.

    11) Extend EBPF to access SKB fields, from Alexei Starovoitov.

    12) Split out new connection request sockets so that they can be
    established in the main hash table. Much less false sharing since
    hash lookups go direct to the request sockets instead of having to
    go first to the listener then to the request socks hashed
    underneath. From Eric Dumazet.

    13) Add async I/O support for crytpo AF_ALG sockets, from Tadeusz Struk.

    14) Support stable privacy address generation for RFC7217 in IPV6. From
    Hannes Frederic Sowa.

    15) Hash network namespace into IP frag IDs, also from Hannes Frederic
    Sowa.

    16) Convert PTP get/set methods to use 64-bit time, from Richard
    Cochran.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (1816 commits)
    fm10k: Bump driver version to 0.15.2
    fm10k: corrected VF multicast update
    fm10k: mbx_update_max_size does not drop all oversized messages
    fm10k: reset head instead of calling update_max_size
    fm10k: renamed mbx_tx_dropped to mbx_tx_oversized
    fm10k: update xcast mode before synchronizing multicast addresses
    fm10k: start service timer on probe
    fm10k: fix function header comment
    fm10k: comment next_vf_mbx flow
    fm10k: don't handle mailbox events in iov_event path and always process mailbox
    fm10k: use separate workqueue for fm10k driver
    fm10k: Set PF queues to unlimited bandwidth during virtualization
    fm10k: expose tx_timeout_count as an ethtool stat
    fm10k: only increment tx_timeout_count in Tx hang path
    fm10k: remove extraneous "Reset interface" message
    fm10k: separate PF only stats so that VF does not display them
    fm10k: use hw->mac.max_queues for stats
    fm10k: only show actual queues, not the maximum in hardware
    fm10k: allow creation of VLAN on default vid
    fm10k: fix unused warnings
    ...

    Linus Torvalds
     

12 Apr, 2015

1 commit


21 Mar, 2015

1 commit

  • This reverts commit ca10b9e9a8ca7342ee07065289cbe74ac128c169.

    No longer needed after commit eb8895debe1baba41fcb62c78a16f0c63c21662a
    ("tcp: tcp_make_synack() should use sock_wmalloc")

    When under SYNFLOOD, we build lot of SYNACK and hit false sharing
    because of multiple modifications done on sk_listener->sk_wmem_alloc

    Since tcp_make_synack() uses sock_wmalloc(), there is no need
    to call skb_set_owner_w() again, as this adds two atomic operations.

    Signed-off-by: Eric Dumazet
    Signed-off-by: David S. Miller

    Eric Dumazet
     

26 Jan, 2015

1 commit

  • Add security hooks to the binder and implement the hooks for SELinux.
    The security hooks enable security modules such as SELinux to implement
    controls over binder IPC. The security hooks include support for
    controlling what process can become the binder context manager
    (binder_set_context_mgr), controlling the ability of a process
    to invoke a binder transaction/IPC to another process (binder_transaction),
    controlling the ability of a process to transfer a binder reference to
    another process (binder_transfer_binder), and controlling the ability
    of a process to transfer an open file to another process (binder_transfer_file).

    These hooks have been included in the Android kernel trees since Android 4.3.

    (Updated to reflect upstream relocation and changes to the binder driver,
    changes to the LSM audit data structures, coding style cleanups, and
    to add inline documentation for the hooks).

    Signed-off-by: Stephen Smalley
    Acked-by: Nick Kralevich
    Acked-by: Jeffrey Vander Stoep
    Signed-off-by: Greg Kroah-Hartman

    Stephen Smalley
     

10 Sep, 2014

1 commit


26 Jul, 2014

1 commit

  • In order to validate the contents of firmware being loaded, there must be
    a hook to evaluate any loaded firmware that wasn't built into the kernel
    itself. Without this, there is a risk that a root user could load malicious
    firmware designed to mount an attack against kernel memory (e.g. via DMA).

    Signed-off-by: Kees Cook
    Reviewed-by: Takashi Iwai

    Kees Cook
     

14 Apr, 2014

2 commits


15 Mar, 2014

1 commit

  • Move the flags representing required permission to linux/key.h as the perm
    parameter of security_key_permission() is in terms of them - and not the
    permissions mask flags used in key->perm.

    Whilst we're at it:

    (1) Rename them to be KEY_NEED_xxx rather than KEY_xxx to avoid collisions
    with symbols in uapi/linux/input.h.

    (2) Don't use key_perm_t for a mask of required permissions, but rather limit
    it to the permissions mask attached to the key and arguments related
    directly to that.

    Signed-off-by: David Howells
    Tested-by: Dmitry Kasatkin

    David Howells
     

10 Mar, 2014

1 commit

  • security_xfrm_policy_alloc can be called in atomic context so the
    allocation should be done with GFP_ATOMIC. Add an argument to let the
    callers choose the appropriate way. In order to do so a gfp argument
    needs to be added to the method xfrm_policy_alloc_security in struct
    security_operations and to the internal function
    selinux_xfrm_alloc_user. After that switch to GFP_ATOMIC in the atomic
    callers and leave GFP_KERNEL as before for the rest.
    The path that needed the gfp argument addition is:
    security_xfrm_policy_alloc -> security_ops.xfrm_policy_alloc_security ->
    all users of xfrm_policy_alloc_security (e.g. selinux_xfrm_policy_alloc) ->
    selinux_xfrm_alloc_user (here the allocation used to be GFP_KERNEL only)

    Now adding a gfp argument to selinux_xfrm_alloc_user requires us to also
    add it to security_context_to_sid which is used inside and prior to this
    patch did only GFP_KERNEL allocation. So add gfp argument to
    security_context_to_sid and adjust all of its callers as well.

    CC: Paul Moore
    CC: Dave Jones
    CC: Steffen Klassert
    CC: Fan Du
    CC: David S. Miller
    CC: LSM list
    CC: SELinux list

    Signed-off-by: Nikolay Aleksandrov
    Acked-by: Paul Moore
    Signed-off-by: Steffen Klassert

    Nikolay Aleksandrov
     

07 Mar, 2014

1 commit

  • Currently, cap_dentry_init_security returns 0 without actually
    initializing the security label. This confuses its only caller
    (nfs4_label_init_security) which expects an error in that situation, and
    causes it to end up sending out junk onto the wire instead of simply
    suppressing the label in the attributes sent.

    When CONFIG_SECURITY is disabled, security_dentry_init_security returns
    -EOPNOTSUPP. Have cap_dentry_init_security do the same.

    Signed-off-by: Jeff Layton
    Acked-by: Serge E. Hallyn
    Signed-off-by: James Morris

    Jeff Layton
     

22 Oct, 2013

1 commit


19 Sep, 2013

1 commit

  • Conflicts:
    security/selinux/hooks.c

    Pull Eric's existing SELinux tree as there are a number of patches in
    there that are not yet upstream. There was some minor fixup needed to
    resolve a conflict in security/selinux/hooks.c:selinux_set_mnt_opts()
    between the labeled NFS patches and Eric's security_fs_use()
    simplification patch.

    Paul Moore
     

26 Jul, 2013

1 commit

  • The xfrm_state_alloc_security() LSM hook implementation is really a
    multiplexed hook with two different behaviors depending on the
    arguments passed to it by the caller. This patch splits the LSM hook
    implementation into two new hook implementations, which match the
    LSM hooks in the rest of the kernel:

    * xfrm_state_alloc
    * xfrm_state_alloc_acquire

    Also included in this patch are the necessary changes to the SELinux
    code; no other LSMs are affected.

    Signed-off-by: Paul Moore
    Signed-off-by: Eric Paris

    Paul Moore
     

25 Jul, 2013

1 commit

  • Since everybody sets kstrdup()ed constant string to "struct xattr"->name but
    nobody modifies "struct xattr"->name , we can omit kstrdup() and its failure
    checking by constifying ->name member of "struct xattr".

    Signed-off-by: Tetsuo Handa
    Reviewed-by: Joel Becker [ocfs2]
    Acked-by: Serge E. Hallyn
    Acked-by: Casey Schaufler
    Acked-by: Mimi Zohar
    Reviewed-by: Paul Moore
    Tested-by: Paul Moore
    Acked-by: Eric Paris
    Signed-off-by: James Morris

    Tetsuo Handa
     

12 Jul, 2013

1 commit

  • Pull nfsd changes from Bruce Fields:
    "Changes this time include:

    - 4.1 enabled on the server by default: the last 4.1-specific issues
    I know of are fixed, so we're not going to find the rest of the
    bugs without more exposure.
    - Experimental support for NFSv4.2 MAC Labeling (to allow running
    selinux over NFS), from Dave Quigley.
    - Fixes for some delicate cache/upcall races that could cause rare
    server hangs; thanks to Neil Brown and Bodo Stroesser for extreme
    debugging persistence.
    - Fixes for some bugs found at the recent NFS bakeathon, mostly v4
    and v4.1-specific, but also a generic bug handling fragmented rpc
    calls"

    * 'for-3.11' of git://linux-nfs.org/~bfields/linux: (31 commits)
    nfsd4: support minorversion 1 by default
    nfsd4: allow destroy_session over destroyed session
    svcrpc: fix failures to handle -1 uid's
    sunrpc: Don't schedule an upcall on a replaced cache entry.
    net/sunrpc: xpt_auth_cache should be ignored when expired.
    sunrpc/cache: ensure items removed from cache do not have pending upcalls.
    sunrpc/cache: use cache_fresh_unlocked consistently and correctly.
    sunrpc/cache: remove races with queuing an upcall.
    nfsd4: return delegation immediately if lease fails
    nfsd4: do not throw away 4.1 lock state on last unlock
    nfsd4: delegation-based open reclaims should bypass permissions
    svcrpc: don't error out on small tcp fragment
    svcrpc: fix handling of too-short rpc's
    nfsd4: minor read_buf cleanup
    nfsd4: fix decoding of compounds across page boundaries
    nfsd4: clean up nfs4_open_delegation
    NFSD: Don't give out read delegations on creates
    nfsd4: allow client to send no cb_sec flavors
    nfsd4: fail attempts to request gss on the backchannel
    nfsd4: implement minimal SP4_MACH_CRED
    ...

    Linus Torvalds
     

09 Jun, 2013

3 commits

  • There is no way to differentiate if a text mount option is passed from user
    space or the kernel. A flags field is being added to the
    security_sb_set_mnt_opts hook to allow for in kernel security flags to be sent
    to the LSM for processing in addition to the text options received from mount.
    This patch also updated existing code to fix compilation errors.

    Acked-by: Eric Paris
    Acked-by: James Morris
    Signed-off-by: David P. Quigley
    Signed-off-by: Miguel Rodel Felipe
    Signed-off-by: Phua Eu Gene
    Signed-off-by: Khin Mi Mi Aung
    Signed-off-by: Trond Myklebust

    David Quigley
     
  • The interface to request security labels from user space is the xattr
    interface. When requesting the security label from an NFS server it is
    important to make sure the requested xattr actually is a MAC label. This allows
    us to make sure that we get the desired semantics from the attribute instead of
    something else such as capabilities or a time based LSM.

    Acked-by: Eric Paris
    Acked-by: James Morris
    Signed-off-by: Matthew N. Dodd
    Signed-off-by: Miguel Rodel Felipe
    Signed-off-by: Phua Eu Gene
    Signed-off-by: Khin Mi Mi Aung
    Signed-off-by: Trond Myklebust

    David Quigley
     
  • There is a time where we need to calculate a context without the
    inode having been created yet. To do this we take the negative dentry and
    calculate a context based on the process and the parent directory contexts.

    Acked-by: Eric Paris
    Acked-by: James Morris
    Signed-off-by: Matthew N. Dodd
    Signed-off-by: Miguel Rodel Felipe
    Signed-off-by: Phua Eu Gene
    Signed-off-by: Khin Mi Mi Aung
    Signed-off-by: Steve Dickson
    Signed-off-by: Trond Myklebust

    David Quigley
     

13 May, 2013

1 commit

  • We shouldn't be returning success from this function without also
    filling in the return values ctx and ctxlen.

    Note currently this doesn't appear to cause bugs since the only
    inode_getsecctx caller I can find is fs/sysfs/inode.c, which only calls
    this if security_inode_setsecurity succeeds. Assuming
    security_inode_setsecurity is set to cap_inode_setsecurity whenever
    inode_getsecctx is set to cap_inode_getsecctx, this function can never
    actually called.

    So I noticed this only because the server labeled NFS patches add a real
    caller.

    Acked-by: Serge E. Hallyn
    Signed-off-by: J. Bruce Fields

    J. Bruce Fields
     

01 May, 2013

1 commit

  • Pull security subsystem update from James Morris:
    "Just some minor updates across the subsystem"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security:
    ima: eliminate passing d_name.name to process_measurement()
    TPM: Retry SaveState command in suspend path
    tpm/tpm_i2c_infineon: Add small comment about return value of __i2c_transfer
    tpm/tpm_i2c_infineon.c: Add OF attributes type and name to the of_device_id table entries
    tpm_i2c_stm_st33: Remove duplicate inclusion of header files
    tpm: Add support for new Infineon I2C TPM (SLB 9645 TT 1.2 I2C)
    char/tpm: Convert struct i2c_msg initialization to C99 format
    drivers/char/tpm/tpm_ppi: use strlcpy instead of strncpy
    tpm/tpm_i2c_stm_st33: formatting and white space changes
    Smack: include magic.h in smackfs.c
    selinux: make security_sb_clone_mnt_opts return an error on context mismatch
    seccomp: allow BPF_XOR based ALU instructions.
    Fix NULL pointer dereference in smack_inode_unlink() and smack_inode_rmdir()
    Smack: add support for modification of existing rules
    smack: SMACK_MAGIC to include/uapi/linux/magic.h
    Smack: add missing support for transmute bit in smack_str_from_perm()
    Smack: prevent revoke-subject from failing when unseen label is written to it
    tomoyo: use DEFINE_SRCU() to define tomoyo_ss
    tomoyo: use DEFINE_SRCU() to define tomoyo_ss

    Linus Torvalds
     

10 Apr, 2013

1 commit

  • Commit 90ba9b1986b5ac (tcp: tcp_make_synack() can use alloc_skb())
    broke certain SELinux/NetLabel configurations by no longer correctly
    assigning the sock to the outgoing SYNACK packet.

    Cost of atomic operations on the LISTEN socket is quite big,
    and we would like it to happen only if really needed.

    This patch introduces a new security_ops->skb_owned_by() method,
    that is a void operation unless selinux is active.

    Reported-by: Miroslav Vadkerti
    Diagnosed-by: Paul Moore
    Signed-off-by: Eric Dumazet
    Cc: "David S. Miller"
    Cc: linux-security-module@vger.kernel.org
    Acked-by: James Morris
    Tested-by: Paul Moore
    Acked-by: Paul Moore
    Signed-off-by: David S. Miller

    Eric Dumazet
     

02 Apr, 2013

1 commit

  • I had the following problem reported a while back. If you mount the
    same filesystem twice using NFSv4 with different contexts, then the
    second context= option is ignored. For instance:

    # mount server:/export /mnt/test1
    # mount server:/export /mnt/test2 -o context=system_u:object_r:tmp_t:s0
    # ls -dZ /mnt/test1
    drwxrwxrwt. root root system_u:object_r:nfs_t:s0 /mnt/test1
    # ls -dZ /mnt/test2
    drwxrwxrwt. root root system_u:object_r:nfs_t:s0 /mnt/test2

    When we call into SELinux to set the context of a "cloned" superblock,
    it will currently just bail out when it notices that we're reusing an
    existing superblock. Since the existing superblock is already set up and
    presumably in use, we can't go overwriting its context with the one from
    the "original" sb. Because of this, the second context= option in this
    case cannot take effect.

    This patch fixes this by turning security_sb_clone_mnt_opts into an int
    return operation. When it finds that the "new" superblock that it has
    been handed is already set up, it checks to see whether the contexts on
    the old superblock match it. If it does, then it will just return
    success, otherwise it'll return -EBUSY and emit a printk to tell the
    admin why the second mount failed.

    Note that this patch may cause casualties. The NFSv4 code relies on
    being able to walk down to an export from the pseudoroot. If you mount
    filesystems that are nested within one another with different contexts,
    then this patch will make those mounts fail in new and "exciting" ways.

    For instance, suppose that /export is a separate filesystem on the
    server:

    # mount server:/ /mnt/test1
    # mount salusa:/export /mnt/test2 -o context=system_u:object_r:tmp_t:s0
    mount.nfs: an incorrect mount option was specified

    ...with the printk in the ring buffer. Because we *might* eventually
    walk down to /mnt/test1/export, the mount is denied due to this patch.
    The second mount needs the pseudoroot superblock, but that's already
    present with the wrong context.

    OTOH, if we mount these in the reverse order, then both mounts work,
    because the pseudoroot superblock created when mounting /export is
    discarded once that mount is done. If we then however try to walk into
    that directory, the automount fails for the similar reasons:

    # cd /mnt/test1/scratch/
    -bash: cd: /mnt/test1/scratch: Device or resource busy

    The story I've gotten from the SELinux folks that I've talked to is that
    this is desirable behavior. In SELinux-land, mounting the same data
    under different contexts is wrong -- there can be only one.

    Cc: Steve Dickson
    Cc: Stephen Smalley
    Signed-off-by: Jeff Layton
    Acked-by: Eric Paris
    Signed-off-by: James Morris

    Jeff Layton
     

15 Jan, 2013

1 commit

  • This patch corrects some problems with LSM/SELinux that were introduced
    with the multiqueue patchset. The problem stems from the fact that the
    multiqueue work changed the relationship between the tun device and its
    associated socket; before the socket persisted for the life of the
    device, however after the multiqueue changes the socket only persisted
    for the life of the userspace connection (fd open). For non-persistent
    devices this is not an issue, but for persistent devices this can cause
    the tun device to lose its SELinux label.

    We correct this problem by adding an opaque LSM security blob to the
    tun device struct which allows us to have the LSM security state, e.g.
    SELinux labeling information, persist for the lifetime of the tun
    device. In the process we tweak the LSM hooks to work with this new
    approach to TUN device/socket labeling and introduce a new LSM hook,
    security_tun_dev_attach_queue(), to approve requests to attach to a
    TUN queue via TUNSETQUEUE.

    The SELinux code has been adjusted to match the new LSM hooks, the
    other LSMs do not make use of the LSM TUN controls. This patch makes
    use of the recently added "tun_socket:attach_queue" permission to
    restrict access to the TUNSETQUEUE operation. On older SELinux
    policies which do not define the "tun_socket:attach_queue" permission
    the access control decision for TUNSETQUEUE will be handled according
    to the SELinux policy's unknown permission setting.

    Signed-off-by: Paul Moore
    Acked-by: Eric Paris
    Tested-by: Jason Wang
    Signed-off-by: David S. Miller

    Paul Moore
     

14 Dec, 2012

1 commit

  • Now that kernel module origins can be reasoned about, provide a hook to
    the LSMs to make policy decisions about the module file. This will let
    Chrome OS enforce that loadable kernel modules can only come from its
    read-only hash-verified root filesystem. Other LSMs can, for example,
    read extended attributes for signatures, etc.

    Signed-off-by: Kees Cook
    Acked-by: Serge E. Hallyn
    Acked-by: Eric Paris
    Acked-by: Mimi Zohar
    Acked-by: James Morris
    Signed-off-by: Rusty Russell

    Kees Cook
     

12 Oct, 2012

1 commit


21 Sep, 2012

1 commit


01 Jun, 2012

1 commit


10 Apr, 2012

1 commit


10 Feb, 2012

1 commit

  • The current LSM interface to cred_free is not sufficient for allowing
    an LSM to track the life and death of a task. This patch adds the
    task_free hook so that an LSM can clean up resources on task death.

    Signed-off-by: Kees Cook
    Signed-off-by: James Morris

    Kees Cook
     

15 Jan, 2012

1 commit

  • * 'for-linus' of git://selinuxproject.org/~jmorris/linux-security:
    capabilities: remove __cap_full_set definition
    security: remove the security_netlink_recv hook as it is equivalent to capable()
    ptrace: do not audit capability check when outputing /proc/pid/stat
    capabilities: remove task_ns_* functions
    capabitlies: ns_capable can use the cap helpers rather than lsm call
    capabilities: style only - move capable below ns_capable
    capabilites: introduce new has_ns_capabilities_noaudit
    capabilities: call has_ns_capability from has_capability
    capabilities: remove all _real_ interfaces
    capabilities: introduce security_capable_noaudit
    capabilities: reverse arguments to security_capable
    capabilities: remove the task from capable LSM hook entirely
    selinux: sparse fix: fix several warnings in the security server cod
    selinux: sparse fix: fix warnings in netlink code
    selinux: sparse fix: eliminate warnings for selinuxfs
    selinux: sparse fix: declare selinux_disable() in security.h
    selinux: sparse fix: move selinux_complete_init
    selinux: sparse fix: make selinux_secmark_refcount static
    SELinux: Fix RCU deref check warning in sel_netport_insert()

    Manually fix up a semantic mis-merge wrt security_netlink_recv():

    - the interface was removed in commit fd7784615248 ("security: remove
    the security_netlink_recv hook as it is equivalent to capable()")

    - a new user of it appeared in commit a38f7907b926 ("crypto: Add
    userspace configuration API")

    causing no automatic merge conflict, but Eric Paris pointed out the
    issue.

    Linus Torvalds
     

07 Jan, 2012

1 commit


06 Jan, 2012

1 commit


04 Jan, 2012

6 commits


20 Jul, 2011

1 commit