16 Apr, 2015

1 commit


12 Apr, 2015

2 commits


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
     

16 Feb, 2015

1 commit

  • Pull char / misc patches from Greg KH:
    "Here's the big char/misc driver update for 3.20-rc1.

    Lots of little things in here, all described in the changelog.
    Nothing major or unusual, except maybe the binder selinux stuff, which
    was all acked by the proper selinux people and they thought it best to
    come through this tree.

    All of this has been in linux-next with no reported issues for a while"

    * tag 'char-misc-3.20-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (90 commits)
    coresight: fix function etm_writel_cp14() parameter order
    coresight-etm: remove check for unknown Kconfig macro
    coresight: fixing CPU hwid lookup in device tree
    coresight: remove the unnecessary function coresight_is_bit_set()
    coresight: fix the debug AMBA bus name
    coresight: remove the extra spaces
    coresight: fix the link between orphan connection and newly added device
    coresight: remove the unnecessary replicator property
    coresight: fix the replicator subtype value
    pdfdocs: Fix 'make pdfdocs' failure for 'uio-howto.tmpl'
    mcb: Fix error path of mcb_pci_probe
    virtio/console: verify device has config space
    ti-st: clean up data types (fix harmless memory corruption)
    mei: me: release hw from reset only during the reset flow
    mei: mask interrupt set bit on clean reset bit
    extcon: max77693: Constify struct regmap_config
    extcon: adc-jack: Release IIO channel on driver remove
    extcon: Remove duplicated include from extcon-class.c
    Drivers: hv: vmbus: hv_process_timer_expiration() can be static
    Drivers: hv: vmbus: serialize Offer and Rescind offer
    ...

    Linus Torvalds
     

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
     

21 Jan, 2015

1 commit

  • Since "BDI: Provide backing device capability information [try #3]" the
    backing_dev_info structure also provides flags for the kind of mmap
    operation available in a nommu environment, which is entirely unrelated
    to it's original purpose.

    Introduce a new nommu-only file operation to provide this information to
    the nommu mmap code instead. Splitting this from the backing_dev_info
    structure allows to remove lots of backing_dev_info instance that aren't
    otherwise needed, and entirely gets rid of the concept of providing a
    backing_dev_info for a character device. It also removes the need for
    the mtd_inodefs filesystem.

    Signed-off-by: Christoph Hellwig
    Reviewed-by: Tejun Heo
    Acked-by: Brian Norris
    Signed-off-by: Jens Axboe

    Christoph Hellwig
     

10 Sep, 2014

1 commit


26 Jul, 2014

2 commits

  • The "security: introduce kernel_fw_from_file hook" patch defined a
    new security hook to evaluate any loaded firmware that wasn't built
    into the kernel.

    This patch defines ima_fw_from_file(), which is called from the new
    security hook, to measure and/or appraise the loaded firmware's
    integrity.

    Signed-off-by: Mimi Zohar
    Signed-off-by: Kees Cook

    Mimi Zohar
     
  • 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
     

24 Jun, 2014

1 commit


14 Apr, 2014

1 commit


01 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
     

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
     

09 Jun, 2013

4 commits

  • The existing NFSv4 xattr handlers do not accept xattr calls to the security
    namespace. This patch extends these handlers to accept xattrs from the security
    namespace in addition to the default NFSv4 ACL namespace.

    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 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
     

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

2 commits

  • With the addition of the new kernel module syscall, which defines two
    arguments - a file descriptor to the kernel module and a pointer to a NULL
    terminated string of module arguments - it is now possible to measure and
    appraise kernel modules like any other file on the file system.

    This patch adds support to measure and appraise kernel modules in an
    extensible and consistent manner.

    To support filesystems without extended attribute support, additional
    patches could pass the signature as the first parameter.

    Signed-off-by: Mimi Zohar
    Signed-off-by: Rusty Russell

    Mimi Zohar
     
  • 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


03 Oct, 2012

1 commit

  • Pull security subsystem updates from James Morris:
    "Highlights:

    - Integrity: add local fs integrity verification to detect offline
    attacks
    - Integrity: add digital signature verification
    - Simple stacking of Yama with other LSMs (per LSS discussions)
    - IBM vTPM support on ppc64
    - Add new driver for Infineon I2C TIS TPM
    - Smack: add rule revocation for subject labels"

    Fixed conflicts with the user namespace support in kernel/auditsc.c and
    security/integrity/ima/ima_policy.c.

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (39 commits)
    Documentation: Update git repository URL for Smack userland tools
    ima: change flags container data type
    Smack: setprocattr memory leak fix
    Smack: implement revoking all rules for a subject label
    Smack: remove task_wait() hook.
    ima: audit log hashes
    ima: generic IMA action flag handling
    ima: rename ima_must_appraise_or_measure
    audit: export audit_log_task_info
    tpm: fix tpm_acpi sparse warning on different address spaces
    samples/seccomp: fix 31 bit build on s390
    ima: digital signature verification support
    ima: add support for different security.ima data types
    ima: add ima_inode_setxattr/removexattr function and calls
    ima: add inode_post_setattr call
    ima: replace iint spinblock with rwlock/read_lock
    ima: allocating iint improvements
    ima: add appraise action keywords and default rules
    ima: integrity appraisal extension
    vfs: move ima_file_free before releasing the file
    ...

    Linus Torvalds
     

21 Sep, 2012

1 commit


08 Sep, 2012

1 commit

  • Based on xattr_permission comments, the restriction to modify 'security'
    xattr is left up to the underlying fs or lsm. Ensure that not just anyone
    can modify or remove 'security.ima'.

    Changelog v1:
    - Unless IMA-APPRAISE is configured, use stub ima_inode_removexattr()/setxattr()
    functions. (Moved ima_inode_removexattr()/setxattr() to ima_appraise.c)

    Changelog:
    - take i_mutex to fix locking (Dmitry Kasatkin)
    - ima_reset_appraise_flags should only be called when modifying or
    removing the 'security.ima' xattr. Requires CAP_SYS_ADMIN privilege.
    (Incorporated fix from Roberto Sassu)
    - Even if allowed to update security.ima, reset the appraisal flags,
    forcing re-appraisal.
    - Replace CAP_MAC_ADMIN with CAP_SYS_ADMIN
    - static inline ima_inode_setxattr()/ima_inode_removexattr() stubs
    - ima_protect_xattr should be static

    Signed-off-by: Mimi Zohar
    Signed-off-by: Dmitry Kasatkin

    Mimi Zohar
     

06 Sep, 2012

1 commit

  • Unconditionally call Yama when CONFIG_SECURITY_YAMA_STACKED is selected,
    no matter what LSM module is primary.

    Ubuntu and Chrome OS already carry patches to do this, and Fedora
    has voiced interest in doing this as well. Instead of having multiple
    distributions (or LSM authors) carrying these patches, just allow Yama
    to be called unconditionally when selected by the new CONFIG.

    Signed-off-by: Kees Cook
    Acked-by: Serge E. Hallyn
    Acked-by: Eric Paris
    Acked-by: John Johansen
    Signed-off-by: James Morris

    Kees Cook
     

03 Jul, 2012

1 commit

  • The security + nommu configuration presently blows up with an undefined
    reference to BDI_CAP_EXEC_MAP:

    security/security.c: In function 'mmap_prot':
    security/security.c:687:36: error: dereferencing pointer to incomplete type
    security/security.c:688:16: error: 'BDI_CAP_EXEC_MAP' undeclared (first use in this function)
    security/security.c:688:16: note: each undeclared identifier is reported only once for each function it appears in

    include backing-dev.h directly to fix it up.

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

    Paul Mundt
     

02 Jul, 2012

1 commit

  • The security + nommu configuration presently blows up with an undefined
    reference to BDI_CAP_EXEC_MAP:

    security/security.c: In function 'mmap_prot':
    security/security.c:687:36: error: dereferencing pointer to incomplete type
    security/security.c:688:16: error: 'BDI_CAP_EXEC_MAP' undeclared (first use in this function)
    security/security.c:688:16: note: each undeclared identifier is reported only once for each function it appears in

    include backing-dev.h directly to fix it up.

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

    Paul Mundt
     

01 Jun, 2012

3 commits