27 Apr, 2015

1 commit

  • Pull fourth vfs update from Al Viro:
    "d_inode() annotations from David Howells (sat in for-next since before
    the beginning of merge window) + four assorted fixes"

    * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    RCU pathwalk breakage when running into a symlink overmounting something
    fix I_DIO_WAKEUP definition
    direct-io: only inc/dec inode->i_dio_count for file systems
    fs/9p: fix readdir()
    VFS: assorted d_backing_inode() annotations
    VFS: fs/inode.c helpers: d_inode() annotations
    VFS: fs/cachefiles: d_backing_inode() annotations
    VFS: fs library helpers: d_inode() annotations
    VFS: assorted weird filesystems: d_inode() annotations
    VFS: normal filesystems (and lustre): d_inode() annotations
    VFS: security/: d_inode() annotations
    VFS: security/: d_backing_inode() annotations
    VFS: net/: d_inode() annotations
    VFS: net/unix: d_backing_inode() annotations
    VFS: kernel/: d_inode() annotations
    VFS: audit: d_backing_inode() annotations
    VFS: Fix up some ->d_inode accesses in the chelsio driver
    VFS: Cachefiles should perform fs modifications on the top layer only
    VFS: AF_UNIX sockets should call mknod on the top layer only

    Linus Torvalds
     

17 Apr, 2015

1 commit

  • The mm->exe_file is currently serialized with mmap_sem (shared) in order
    to both safely (1) read the file and (2) compute the realpath by calling
    tomoyo_realpath_from_path, making it an absolute overkill. Good users
    will, on the other hand, make use of the more standard get_mm_exe_file(),
    requiring only holding the mmap_sem to read the value, and relying on
    reference

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Davidlohr Bueso
    Acked-by: Tetsuo Handa
    Cc: James Morris
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Davidlohr Bueso
     

16 Apr, 2015

6 commits

  • Merge second patchbomb from Andrew Morton:

    - the rest of MM

    - various misc bits

    - add ability to run /sbin/reboot at reboot time

    - printk/vsprintf changes

    - fiddle with seq_printf() return value

    * akpm: (114 commits)
    parisc: remove use of seq_printf return value
    lru_cache: remove use of seq_printf return value
    tracing: remove use of seq_printf return value
    cgroup: remove use of seq_printf return value
    proc: remove use of seq_printf return value
    s390: remove use of seq_printf return value
    cris fasttimer: remove use of seq_printf return value
    cris: remove use of seq_printf return value
    openrisc: remove use of seq_printf return value
    ARM: plat-pxa: remove use of seq_printf return value
    nios2: cpuinfo: remove use of seq_printf return value
    microblaze: mb: remove use of seq_printf return value
    ipc: remove use of seq_printf return value
    rtc: remove use of seq_printf return value
    power: wakeup: remove use of seq_printf return value
    x86: mtrr: if: remove use of seq_printf return value
    linux/bitmap.h: improve BITMAP_{LAST,FIRST}_WORD_MASK
    MAINTAINERS: CREDITS: remove Stefano Brivio from B43
    .mailmap: add Ricardo Ribalda
    CREDITS: add Ricardo Ribalda Delgado
    ...

    Linus Torvalds
     
  • There are a lot of embedded systems that run most or all of their
    functionality in init, running as root:root. For these systems,
    supporting multiple users is not necessary.

    This patch adds a new symbol, CONFIG_MULTIUSER, that makes support for
    non-root users, non-root groups, and capabilities optional. It is enabled
    under CONFIG_EXPERT menu.

    When this symbol is not defined, UID and GID are zero in any possible case
    and processes always have all capabilities.

    The following syscalls are compiled out: setuid, setregid, setgid,
    setreuid, setresuid, getresuid, setresgid, getresgid, setgroups,
    getgroups, setfsuid, setfsgid, capget, capset.

    Also, groups.c is compiled out completely.

    In kernel/capability.c, capable function was moved in order to avoid
    adding two ifdef blocks.

    This change saves about 25 KB on a defconfig build. The most minimal
    kernels have total text sizes in the high hundreds of kB rather than
    low MB. (The 25k goes down a bit with allnoconfig, but not that much.

    The kernel was booted in Qemu. All the common functionalities work.
    Adding users/groups is not possible, failing with -ENOSYS.

    Bloat-o-meter output:
    add/remove: 7/87 grow/shrink: 19/397 up/down: 1675/-26325 (-24650)

    [akpm@linux-foundation.org: coding-style fixes]
    Signed-off-by: Iulia Manda
    Reviewed-by: Josh Triplett
    Acked-by: Geert Uytterhoeven
    Tested-by: Paul E. McKenney
    Reviewed-by: Paul E. McKenney
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Iulia Manda
     
  • ... except where that code acts as a filesystem driver, rather than
    working with dentries given to it.

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     
  • most of the ->d_inode uses there refer to the same inode IO would
    go to, i.e. d_backing_inode()

    Signed-off-by: David Howells
    Signed-off-by: Al Viro

    David Howells
     
  • Pull security subsystem updates from James Morris:
    "Highlights for this window:

    - improved AVC hashing for SELinux by John Brooks and Stephen Smalley

    - addition of an unconfined label to Smack

    - Smack documentation update

    - TPM driver updates"

    * 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (28 commits)
    lsm: copy comm before calling audit_log to avoid race in string printing
    tomoyo: Do not generate empty policy files
    tomoyo: Use if_changed when generating builtin-policy.h
    tomoyo: Use bin2c to generate builtin-policy.h
    selinux: increase avtab max buckets
    selinux: Use a better hash function for avtab
    selinux: convert avtab hash table to flex_array
    selinux: reconcile security_netlbl_secattr_to_sid() and mls_import_netlbl_cat()
    selinux: remove unnecessary pointer reassignment
    Smack: Updates for Smack documentation
    tpm/st33zp24/spi: Add missing device table for spi phy.
    tpm/st33zp24: Add proper wait for ordinal duration in case of irq mode
    smack: Fix gcc warning from unused smack_syslog_lock mutex in smackfs.c
    Smack: Allow an unconfined label in bringup mode
    Smack: getting the Smack security context of keys
    Smack: Assign smack_known_web as default smk_in label for kernel thread's socket
    tpm/tpm_infineon: Use struct dev_pm_ops for power management
    MAINTAINERS: Add Jason as designated reviewer for TPM
    tpm: Update KConfig text to include TPM2.0 FIFO chips
    tpm/st33zp24/dts/st33zp24-spi: Add dts documentation for st33zp24 spi phy
    ...

    Linus Torvalds
     
  • 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
     

15 Apr, 2015

2 commits

  • When task->comm is passed directly to audit_log_untrustedstring() without
    getting a copy or using the task_lock, there is a race that could happen that
    would output a NULL (\0) in the middle of the output string that would
    effectively truncate the rest of the report text after the comm= field in the
    audit log message, losing fields.

    Using get_task_comm() to get a copy while acquiring the task_lock to prevent
    this and to prevent the result from being a mixture of old and new values of
    comm would incur potentially unacceptable overhead, considering that the value
    can be influenced by userspace and therefore untrusted anyways.

    Copy the value before passing it to audit_log_untrustedstring() ensures that a
    local copy is used to calculate the length *and* subsequently printed. Even if
    this value contains a mix of old and new values, it will only calculate and
    copy up to the first NULL, preventing the rest of the audit log message being
    truncated.

    Use a second local copy of comm to avoid a race between the first and second
    calls to audit_log_untrustedstring() with comm.

    Reported-by: Tetsuo Handa
    Signed-off-by: Richard Guy Briggs
    Signed-off-by: James Morris

    Richard Guy Briggs
     
  • Pull vfs update from Al Viro:
    "Part one:

    - struct filename-related cleanups

    - saner iov_iter_init() replacements (and switching the syscalls to
    use of those)

    - ntfs switch to ->write_iter() (Anton)

    - aio cleanups and splitting iocb into common and async parts
    (Christoph)

    - assorted fixes (me, bfields, Andrew Elble)

    There's a lot more, including the completion of switchover to
    ->{read,write}_iter(), d_inode/d_backing_inode annotations, f_flags
    race fixes, etc, but that goes after #for-davem merge. David has
    pulled it, and once it's in I'll send the next vfs pull request"

    * 'for-linus-1' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (35 commits)
    sg_start_req(): use import_iovec()
    sg_start_req(): make sure that there's not too many elements in iovec
    blk_rq_map_user(): use import_single_range()
    sg_io(): use import_iovec()
    process_vm_access: switch to {compat_,}import_iovec()
    switch keyctl_instantiate_key_common() to iov_iter
    switch {compat_,}do_readv_writev() to {compat_,}import_iovec()
    aio_setup_vectored_rw(): switch to {compat_,}import_iovec()
    vmsplice_to_user(): switch to import_iovec()
    kill aio_setup_single_vector()
    aio: simplify arguments of aio_setup_..._rw()
    aio: lift iov_iter_init() into aio_setup_..._rw()
    lift iov_iter into {compat_,}do_readv_writev()
    NFS: fix BUG() crash in notify_change() with patch to chown_common()
    dcache: return -ESTALE not -EBUSY on distributed fs race
    NTFS: Version 2.1.32 - Update file write from aio_write to write_iter.
    VFS: Add iov_iter_fault_in_multipages_readable()
    drop bogus check in file_open_root()
    switch security_inode_getattr() to struct path *
    constify tomoyo_realpath_from_path()
    ...

    Linus Torvalds
     

14 Apr, 2015

1 commit


13 Apr, 2015

4 commits


12 Apr, 2015

4 commits


09 Apr, 2015

5 commits


08 Apr, 2015

3 commits

  • The Makefile automatically generates the tomoyo policy files, which are
    not removed by make clean (because they could have been provided by the
    user). Instead of generating the missing files, use /dev/null if a
    given file is not provided. Store the default exception_policy in
    exception_policy.conf.default.

    Acked-by: Tetsuo Handa
    Signed-off-by: Michal Marek

    Michal Marek
     
  • Combine the generation of builtin-policy.h into a single command and use
    if_changed, so that the file is regenerated each time the command
    changes. The next patch will make use of this.

    Acked-by: Tetsuo Handa
    Signed-off-by: Michal Marek

    Michal Marek
     
  • Simplify the Makefile by using a readily available tool instead of a
    custom sed script. The downside is that builtin-policy.h becomes
    unreadable for humans, but it is only a generated file.

    Acked-by: Tetsuo Handa
    Signed-off-by: Michal Marek

    Michal Marek
     

07 Apr, 2015

5 commits

  • Now that we can safely increase the avtab max buckets without
    triggering high order allocations and have a hash function that
    will make better use of the larger number of buckets, increase
    the max buckets to 2^16.

    Original:
    101421 entries and 2048/2048 buckets used, longest chain length 374

    With new hash function:
    101421 entries and 2048/2048 buckets used, longest chain length 81

    With increased max buckets:
    101421 entries and 31078/32768 buckets used, longest chain length 12

    Signed-off-by: Stephen Smalley
    Signed-off-by: Paul Moore

    Stephen Smalley
     
  • This function, based on murmurhash3, has much better distribution than
    the original. Using the current default of 2048 buckets, there are many
    fewer collisions:

    Before:
    101421 entries and 2048/2048 buckets used, longest chain length 374
    After:
    101421 entries and 2048/2048 buckets used, longest chain length 81

    The difference becomes much more significant when buckets are increased.
    A naive attempt to expand the current function to larger outputs doesn't
    yield any significant improvement; so this function is a prerequisite
    for increasing the bucket size.

    sds: Adapted from the original patches for libsepol to the kernel.

    Signed-off-by: John Brooks
    Signed-off-by: Stephen Smalley
    Signed-off-by: Paul Moore

    John Brooks
     
  • Previously we shrank the avtab max hash buckets to avoid
    high order memory allocations, but this causes avtab lookups to
    degenerate to very long linear searches for the Fedora policy. Convert to
    using a flex_array instead so that we can increase the buckets
    without such limitations.

    This change does not alter the max hash buckets; that is left to a
    separate follow-on change.

    Signed-off-by: Stephen Smalley
    Signed-off-by: Paul Moore

    Stephen Smalley
     
  • Move the NetLabel secattr MLS category import logic into
    mls_import_netlbl_cat() where it belongs, and use the
    mls_import_netlbl_cat() function in security_netlbl_secattr_to_sid().

    Reported-by: Rickard Strandqvist
    Signed-off-by: Paul Moore

    Paul Moore
     
  • Commit f01e1af445fa ("selinux: don't pass in NULL avd to avc_has_perm_noaudit")
    made this pointer reassignment unnecessary. Avd should continue to reference
    the stack-based copy.

    Signed-off-by: Jeff Vander Stoep
    Acked-by: Stephen Smalley
    [PM: tweaked subject line]
    Signed-off-by: Paul Moore

    Jeff Vander Stoep
     

05 Apr, 2015

1 commit


03 Apr, 2015

1 commit

  • Conflicts:
    drivers/net/usb/asix_common.c
    drivers/net/usb/sr9800.c
    drivers/net/usb/usbnet.c
    include/linux/usb/usbnet.h
    net/ipv4/tcp_ipv4.c
    net/ipv6/tcp_ipv6.c

    The TCP conflicts were overlapping changes. In 'net' we added a
    READ_ONCE() to the socket cached RX route read, whilst in 'net-next'
    Eric Dumazet touched the surrounding code dealing with how mini
    sockets are handled.

    With USB, it's a case of the same bug fix first going into net-next
    and then I cherry picked it back into net.

    Signed-off-by: David S. Miller

    David S. Miller
     

27 Mar, 2015

1 commit


26 Mar, 2015

1 commit


24 Mar, 2015

4 commits

  • In commit 00f84f3f2e9d088f06722f4351d67f5f577abe22 ("Smack: Make the
    syslog control configurable") this mutex was added, but the rest of
    the final commit never actually made use of it, resulting in:

    In file included from include/linux/mutex.h:29:0,
    from include/linux/notifier.h:13,
    from include/linux/memory_hotplug.h:6,
    from include/linux/mmzone.h:821,
    from include/linux/gfp.h:5,
    from include/linux/slab.h:14,
    from include/linux/security.h:27,
    from security/smack/smackfs.c:21:
    security/smack/smackfs.c:63:21: warning: ‘smack_syslog_lock’ defined but not used [-Wunused-variable]
    static DEFINE_MUTEX(smack_syslog_lock);
    ^

    A git grep shows no other instances/references to smack_syslog_lock.
    Delete it, assuming that the mutex addition was just a leftover from
    an earlier work in progress version of the change.

    Signed-off-by: Paul Gortmaker

    Paul Gortmaker
     
  • I have vehemently opposed adding a "permissive" mode to Smack
    for the simple reasons that it would be subject to massive abuse
    and that developers refuse to turn it off come product release.
    I still believe that this is true, and still refuse to add a
    general "permissive mode". So don't ask again.

    Bumjin Im suggested an approach that addresses most of the concerns,
    and I have implemented it here. I still believe that we'd be better
    off without this sort of thing, but it looks like this minimizes the
    abuse potential.

    Firstly, you have to configure Smack Bringup Mode. That allows
    for "release" software to be ammune from abuse. Second, only one
    label gets to be "permissive" at a time. You can use it for
    debugging, but that's about it.

    A label written to smackfs/unconfined is treated specially.
    If either the subject or object label of an access check
    matches the "unconfined" label, and the access would not
    have been allowed otherwise an audit record and a console
    message are generated. The audit record "request" string is
    marked with either "(US)" or "(UO)", to indicate that the
    request was granted because of an unconfined label. The
    fact that an inode was accessed by an unconfined label is
    remembered, and subsequent accesses to that "impure"
    object are noted in the log. The impurity is not stored in
    the filesystem, so a file mislabled as a side effect of
    using an unconfined label may still cause concern after
    a reboot.

    So, it's there, it's dangerous, but so many application
    developers seem incapable of living without it I have
    given in. I've tried to make it as safe as I can, but
    in the end it's still a chain saw.

    Signed-off-by: Casey Schaufler

    Casey Schaufler
     
  • With this commit, the LSM Smack implements the LSM
    side part of the system call keyctl with the action
    code KEYCTL_GET_SECURITY.

    It is now possible to get the context of, for example,
    the user session key using the command "keyctl security @s".

    The original patch has been modified for merge.

    Signed-off-by: José Bollo
    Signed-off-by: Casey Schaufler

    José Bollo
     
  • This change fixes the bug associated with sockets owned by kernel threads. These
    sockets, created usually by network devices' drivers tasks, received smk_in
    label from the task that created them - the "floor" label in the most cases. The
    result was that they were not able to receive data packets because of missing
    smack rules. The main reason of the access deny is that the socket smk_in label
    is placed as the object during smk check, kernel thread's capabilities are
    omitted.

    Signed-off-by: Marcin Lis

    Marcin Lis