13 Jun, 2017

1 commit

  • This patch is based on a discussion generated by an earlier patch
    from Tetsuo Handa:

    * https://marc.info/?t=149035659300001&r=1&w=2

    The double free problem involves the mnt_opts field of the
    security_mnt_opts struct, selinux_parse_opts_str() frees the memory
    on error, but doesn't set the field to NULL so if the caller later
    attempts to call security_free_mnt_opts() we trigger the problem.

    In order to play it safe we change selinux_parse_opts_str() to call
    security_free_mnt_opts() on error instead of free'ing the memory
    directly. This should ensure that everything is handled correctly,
    regardless of what the caller may do.

    Fixes: e0007529893c1c06 ("LSM/SELinux: Interfaces to allow FS to control mount options")
    Cc: stable@vger.kernel.org
    Cc: Tetsuo Handa
    Reported-by: Dmitry Vyukov
    Signed-off-by: Paul Moore
    Signed-off-by: James Morris

    Paul Moore
     

09 Jun, 2017

20 commits

  • If a key's refcount is dropped to zero between key_lookup() peeking at
    the refcount and subsequently attempting to increment it, refcount_inc()
    will see a zero refcount. Here, refcount_inc() will WARN_ONCE(), and
    will *not* increment the refcount, which will remain zero.

    Once key_lookup() drops key_serial_lock, it is possible for the key to
    be freed behind our back.

    This patch uses refcount_inc_not_zero() to perform the peek and increment
    atomically.

    Fixes: fff292914d3a2f1e ("security, keys: convert key.usage from atomic_t to refcount_t")
    Signed-off-by: Mark Rutland
    Signed-off-by: David Howells
    Cc: David Windsor
    Cc: Elena Reshetova
    Cc: Hans Liljestrand
    Cc: James Morris
    Cc: Kees Cook
    Cc: Peter Zijlstra
    Signed-off-by: James Morris

    Mark Rutland
     
  • The initial Diffie-Hellman computation made direct use of the MPI
    library because the crypto module did not support DH at the time. Now
    that KPP is implemented, KEYCTL_DH_COMPUTE should use it to get rid of
    duplicate code and leverage possible hardware acceleration.

    This fixes an issue whereby the input to the KDF computation would
    include additional uninitialized memory when the result of the
    Diffie-Hellman computation was shorter than the input prime number.

    Signed-off-by: Mat Martineau
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Mat Martineau
     
  • Accessing a 'u8[4]' through a '__be32 *' violates alignment rules. Just
    make the counter a __be32 instead.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Acked-by: Stephan Mueller
    Signed-off-by: James Morris

    Eric Biggers
     
  • If userspace called KEYCTL_DH_COMPUTE with kdf_params containing NULL
    otherinfo but nonzero otherinfolen, the kernel would allocate a buffer
    for the otherinfo, then feed it into the KDF without initializing it.
    Fix this by always doing the copy from userspace (which will fail with
    EFAULT in this scenario).

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Acked-by: Stephan Mueller
    Signed-off-by: James Morris

    Eric Biggers
     
  • Requesting "digest_null" in the keyctl_kdf_params caused an infinite
    loop in kdf_ctr() because the "null" hash has a digest size of 0. Fix
    it by rejecting hash algorithms with a digest size of 0.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Acked-by: Stephan Mueller
    Signed-off-by: James Morris

    Eric Biggers
     
  • While a 'struct key' itself normally does not contain sensitive
    information, Documentation/security/keys.txt actually encourages this:

    "Having a payload is not required; and the payload can, in fact,
    just be a value stored in the struct key itself."

    In case someone has taken this advice, or will take this advice in the
    future, zero the key structure before freeing it. We might as well, and
    as a bonus this could make it a bit more difficult for an adversary to
    determine which keys have recently been in use.

    This is safe because the key_jar cache does not use a constructor.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • As the previous patch did for encrypted-keys, zero sensitive any
    potentially sensitive data related to the "trusted" key type before it
    is freed. Notably, we were not zeroing the tpm_buf structures in which
    the actual key is stored for TPM seal and unseal, nor were we zeroing
    the trusted_key_payload in certain error paths.

    Cc: Mimi Zohar
    Cc: David Safford
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • For keys of type "encrypted", consistently zero sensitive key material
    before freeing it. This was already being done for the decrypted
    payloads of encrypted keys, but not for the master key and the keys
    derived from the master key.

    Out of an abundance of caution and because it is trivial to do so, also
    zero buffers containing the key payload in encrypted form, although
    depending on how the encrypted-keys feature is used such information
    does not necessarily need to be kept secret.

    Cc: Mimi Zohar
    Cc: David Safford
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • Zero the payloads of user and logon keys before freeing them. This
    prevents sensitive key material from being kept around in the slab
    caches after a key is released.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • Before returning from add_key() or one of the keyctl() commands that
    takes in a key payload, zero the temporary buffer that was allocated to
    hold the key payload copied from userspace. This may contain sensitive
    key material that should not be kept around in the slab caches.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • key_update() freed the key_preparsed_payload even if it was not
    initialized first. This would cause a crash if userspace called
    keyctl_update() on a key with type like "asymmetric" that has a
    ->preparse() method but not an ->update() method. Possibly it could
    even be triggered for other key types by racing with keyctl_setperm() to
    make the KEY_NEED_WRITE check fail (the permission was already checked,
    so normally it wouldn't fail there).

    Reproducer with key type "asymmetric", given a valid cert.der:

    keyctl new_session
    keyid=$(keyctl padd asymmetric desc @s < cert.der)
    keyctl setperm $keyid 0x3f000000
    keyctl update $keyid data

    [ 150.686666] BUG: unable to handle kernel NULL pointer dereference at 0000000000000001
    [ 150.687601] IP: asymmetric_key_free_kids+0x12/0x30
    [ 150.688139] PGD 38a3d067
    [ 150.688141] PUD 3b3de067
    [ 150.688447] PMD 0
    [ 150.688745]
    [ 150.689160] Oops: 0000 [#1] SMP
    [ 150.689455] Modules linked in:
    [ 150.689769] CPU: 1 PID: 2478 Comm: keyctl Not tainted 4.11.0-rc4-xfstests-00187-ga9f6b6b8cd2f #742
    [ 150.690916] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.10.2-20170228_101828-anatol 04/01/2014
    [ 150.692199] task: ffff88003b30c480 task.stack: ffffc90000350000
    [ 150.692952] RIP: 0010:asymmetric_key_free_kids+0x12/0x30
    [ 150.693556] RSP: 0018:ffffc90000353e58 EFLAGS: 00010202
    [ 150.694142] RAX: 0000000000000000 RBX: 0000000000000001 RCX: 0000000000000004
    [ 150.694845] RDX: ffffffff81ee3920 RSI: ffff88003d4b0700 RDI: 0000000000000001
    [ 150.697569] RBP: ffffc90000353e60 R08: ffff88003d5d2140 R09: 0000000000000000
    [ 150.702483] R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001
    [ 150.707393] R13: 0000000000000004 R14: ffff880038a4d2d8 R15: 000000000040411f
    [ 150.709720] FS: 00007fcbcee35700(0000) GS:ffff88003fd00000(0000) knlGS:0000000000000000
    [ 150.711504] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
    [ 150.712733] CR2: 0000000000000001 CR3: 0000000039eab000 CR4: 00000000003406e0
    [ 150.714487] Call Trace:
    [ 150.714975] asymmetric_key_free_preparse+0x2f/0x40
    [ 150.715907] key_update+0xf7/0x140
    [ 150.716560] ? key_default_cmp+0x20/0x20
    [ 150.717319] keyctl_update_key+0xb0/0xe0
    [ 150.718066] SyS_keyctl+0x109/0x130
    [ 150.718663] entry_SYSCALL_64_fastpath+0x1f/0xc2
    [ 150.719440] RIP: 0033:0x7fcbce75ff19
    [ 150.719926] RSP: 002b:00007ffd5d167088 EFLAGS: 00000206 ORIG_RAX: 00000000000000fa
    [ 150.720918] RAX: ffffffffffffffda RBX: 0000000000404d80 RCX: 00007fcbce75ff19
    [ 150.721874] RDX: 00007ffd5d16785e RSI: 000000002866cd36 RDI: 0000000000000002
    [ 150.722827] RBP: 0000000000000006 R08: 000000002866cd36 R09: 00007ffd5d16785e
    [ 150.723781] R10: 0000000000000004 R11: 0000000000000206 R12: 0000000000404d80
    [ 150.724650] R13: 00007ffd5d16784d R14: 00007ffd5d167238 R15: 000000000040411f
    [ 150.725447] Code: 83 c4 08 31 c0 5b 41 5c 41 5d 41 5e 41 5f 5d c3 66 0f 1f 84 00 00 00 00 00 0f 1f 44 00 00 48 85 ff 74 23 55 48 89 e5 53 48 89 fb 8b 3f e8 06 21 c5 ff 48 8b 7b 08 e8 fd 20 c5 ff 48 89 df e8
    [ 150.727489] RIP: asymmetric_key_free_kids+0x12/0x30 RSP: ffffc90000353e58
    [ 150.728117] CR2: 0000000000000001
    [ 150.728430] ---[ end trace f7f8fe1da2d5ae8d ]---

    Fixes: 4d8c0250b841 ("KEYS: Call ->free_preparse() even after ->preparse() returns an error")
    Cc: stable@vger.kernel.org # 3.17+
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • sys_add_key() and the KEYCTL_UPDATE operation of sys_keyctl() allowed a
    NULL payload with nonzero length to be passed to the key type's
    ->preparse(), ->instantiate(), and/or ->update() methods. Various key
    types including asymmetric, cifs.idmap, cifs.spnego, and pkcs7_test did
    not handle this case, allowing an unprivileged user to trivially cause a
    NULL pointer dereference (kernel oops) if one of these key types was
    present. Fix it by doing the copy_from_user() when 'plen' is nonzero
    rather than when '_payload' is non-NULL, causing the syscall to fail
    with EFAULT as expected when an invalid buffer is specified.

    Cc: stable@vger.kernel.org # 2.6.10+
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • MACs should, in general, be compared using crypto_memneq() to prevent
    timing attacks.

    Cc: Mimi Zohar
    Cc: Herbert Xu
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • The encrypted-keys module was using a single global HMAC transform,
    which could be rekeyed by multiple threads concurrently operating on
    different keys, causing incorrect HMAC values to be calculated. Fix
    this by allocating a new HMAC transform whenever we need to calculate a
    HMAC. Also simplify things a bit by allocating the shash_desc's using
    SHASH_DESC_ON_STACK() for both the HMAC and unkeyed hashes.

    The following script reproduces the bug:

    keyctl new_session
    keyctl add user master "abcdefghijklmnop" @s
    for i in $(seq 2); do
    (
    set -e
    for j in $(seq 1000); do
    keyid=$(keyctl add encrypted desc$i "new user:master 25" @s)
    datablob="$(keyctl pipe $keyid)"
    keyctl unlink $keyid > /dev/null
    keyid=$(keyctl add encrypted desc$i "load $datablob" @s)
    keyctl unlink $keyid > /dev/null
    done
    ) &
    done

    Output with bug:

    [ 439.691094] encrypted_key: bad hmac (-22)
    add_key: Invalid argument
    add_key: Invalid argument

    Cc: Mimi Zohar
    Cc: Herbert Xu
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • With the 'encrypted' key type it was possible for userspace to provide a
    data blob ending with a master key description shorter than expected,
    e.g. 'keyctl add encrypted desc "new x" @s'. When validating such a
    master key description, validate_master_desc() could read beyond the end
    of the buffer. Fix this by using strncmp() instead of memcmp(). [Also
    clean up the code to deduplicate some logic.]

    Cc: Mimi Zohar
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • Since v4.9, the crypto API cannot (normally) be used to encrypt/decrypt
    stack buffers because the stack may be virtually mapped. Fix this for
    the padding buffers in encrypted-keys by using ZERO_PAGE for the
    encryption padding and by allocating a temporary heap buffer for the
    decryption padding.

    Tested with CONFIG_DEBUG_SG=y:
    keyctl new_session
    keyctl add user master "abcdefghijklmnop" @s
    keyid=$(keyctl add encrypted desc "new user:master 25" @s)
    datablob="$(keyctl pipe $keyid)"
    keyctl unlink $keyid
    keyid=$(keyctl add encrypted desc "load $datablob" @s)
    datablob2="$(keyctl pipe $keyid)"
    [ "$datablob" = "$datablob2" ] && echo "Success!"

    Cc: Andy Lutomirski
    Cc: Herbert Xu
    Cc: Mimi Zohar
    Cc: stable@vger.kernel.org # 4.9+
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • In join_session_keyring(), if install_session_keyring_to_cred() were to
    fail, we would leak the keyring reference, just like in the bug fixed by
    commit 23567fd052a9 ("KEYS: Fix keyring ref leak in
    join_session_keyring()"). Fortunately this cannot happen currently, but
    we really should be more careful. Do this by adding and using a new
    error label at which the keyring reference is dropped.

    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Eric Biggers
     
  • Omit an extra message for a memory allocation failure in this function.

    This issue was detected by using the Coccinelle software.

    Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf
    Signed-off-by: Markus Elfring
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Markus Elfring
     
  • With the new standardized functions, we can replace all ACCESS_ONCE()
    calls across relevant security/keyrings/.

    ACCESS_ONCE() does not work reliably on non-scalar types. For example
    gcc 4.6 and 4.7 might remove the volatile tag for such accesses during
    the SRA (scalar replacement of aggregates) step:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145

    Update the new calls regardless of if it is a scalar type, this is
    cleaner than having three alternatives.

    Signed-off-by: Davidlohr Bueso
    Signed-off-by: David Howells
    Signed-off-by: James Morris

    Davidlohr Bueso
     
  • CONFIG_KEYS_COMPAT is defined in arch-specific Kconfigs and is missing for
    several 64-bit architectures : mips, parisc, tile.

    At the moment and for those architectures, calling in 32-bit userspace the
    keyctl syscall would return an ENOSYS error.

    This patch moves the CONFIG_KEYS_COMPAT option to security/keys/Kconfig, to
    make sure the compatibility wrapper is registered by default for any 64-bit
    architecture as long as it is configured with CONFIG_COMPAT.

    [DH: Modified to remove arm64 compat enablement also as requested by Eric
    Biggers]

    Signed-off-by: Bilal Amarni
    Signed-off-by: David Howells
    Reviewed-by: Arnd Bergmann
    cc: Eric Biggers
    Signed-off-by: James Morris

    Bilal Amarni
     

10 May, 2017

1 commit

  • Pull misc vfs updates from Al Viro:
    "Assorted bits and pieces from various people. No common topic in this
    pile, sorry"

    * 'work.misc' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs:
    fs/affs: add rename exchange
    fs/affs: add rename2 to prepare multiple methods
    Make stat/lstat/fstatat pass AT_NO_AUTOMOUNT to vfs_statx()
    fs: don't set *REFERENCED on single use objects
    fs: compat: Remove warning from COMPATIBLE_IOCTL
    remove pointless extern of atime_need_update_rcu()
    fs: completely ignore unknown open flags
    fs: add a VALID_OPEN_FLAGS
    fs: remove _submit_bh()
    fs: constify tree_descr arrays passed to simple_fill_super()
    fs: drop duplicate header percpu-rwsem.h
    fs/affs: bugfix: Write files greater than page size on OFS
    fs/affs: bugfix: enable writes on OFS disks
    fs/affs: remove node generation check
    fs/affs: import amigaffs.h
    fs/affs: bugfix: make symbolic links work again

    Linus Torvalds
     

09 May, 2017

3 commits

  • CURRENT_TIME macro is not y2038 safe on 32 bit systems.

    The patch replaces all the uses of CURRENT_TIME by current_time().

    This is also in preparation for the patch that transitions vfs
    timestamps to use 64 bit time and hence make them y2038 safe.
    current_time() is also planned to be transitioned to y2038 safe behavior
    along with this change.

    CURRENT_TIME macro will be deleted before merging the aforementioned
    change.

    Link: http://lkml.kernel.org/r/1491613030-11599-11-git-send-email-deepa.kernel@gmail.com
    Signed-off-by: Deepa Dinamani
    Acked-by: John Johansen
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Deepa Dinamani
     
  • There are many code paths opencoding kvmalloc. Let's use the helper
    instead. The main difference to kvmalloc is that those users are
    usually not considering all the aspects of the memory allocator. E.g.
    allocation requests
    Reviewed-by: Boris Ostrovsky # Xen bits
    Acked-by: Kees Cook
    Acked-by: Vlastimil Babka
    Acked-by: Andreas Dilger # Lustre
    Acked-by: Christian Borntraeger # KVM/s390
    Acked-by: Dan Williams # nvdim
    Acked-by: David Sterba # btrfs
    Acked-by: Ilya Dryomov # Ceph
    Acked-by: Tariq Toukan # mlx4
    Acked-by: Leon Romanovsky # mlx5
    Cc: Martin Schwidefsky
    Cc: Heiko Carstens
    Cc: Herbert Xu
    Cc: Anton Vorontsov
    Cc: Colin Cross
    Cc: Tony Luck
    Cc: "Rafael J. Wysocki"
    Cc: Ben Skeggs
    Cc: Kent Overstreet
    Cc: Santosh Raspatur
    Cc: Hariprasad S
    Cc: Yishai Hadas
    Cc: Oleg Drokin
    Cc: "Yan, Zheng"
    Cc: Alexander Viro
    Cc: Alexei Starovoitov
    Cc: Eric Dumazet
    Cc: David Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Hocko
     
  • Patch series "kvmalloc", v5.

    There are many open coded kmalloc with vmalloc fallback instances in the
    tree. Most of them are not careful enough or simply do not care about
    the underlying semantic of the kmalloc/page allocator which means that
    a) some vmalloc fallbacks are basically unreachable because the kmalloc
    part will keep retrying until it succeeds b) the page allocator can
    invoke a really disruptive steps like the OOM killer to move forward
    which doesn't sound appropriate when we consider that the vmalloc
    fallback is available.

    As it can be seen implementing kvmalloc requires quite an intimate
    knowledge if the page allocator and the memory reclaim internals which
    strongly suggests that a helper should be implemented in the memory
    subsystem proper.

    Most callers, I could find, have been converted to use the helper
    instead. This is patch 6. There are some more relying on __GFP_REPEAT
    in the networking stack which I have converted as well and Eric Dumazet
    was not opposed [2] to convert them as well.

    [1] http://lkml.kernel.org/r/20170130094940.13546-1-mhocko@kernel.org
    [2] http://lkml.kernel.org/r/1485273626.16328.301.camel@edumazet-glaptop3.roam.corp.google.com

    This patch (of 9):

    Using kmalloc with the vmalloc fallback for larger allocations is a
    common pattern in the kernel code. Yet we do not have any common helper
    for that and so users have invented their own helpers. Some of them are
    really creative when doing so. Let's just add kv[mz]alloc and make sure
    it is implemented properly. This implementation makes sure to not make
    a large memory pressure for > PAGE_SZE requests (__GFP_NORETRY) and also
    to not warn about allocation failures. This also rules out the OOM
    killer as the vmalloc is a more approapriate fallback than a disruptive
    user visible action.

    This patch also changes some existing users and removes helpers which
    are specific for them. In some cases this is not possible (e.g.
    ext4_kvmalloc, libcfs_kvzalloc) because those seems to be broken and
    require GFP_NO{FS,IO} context which is not vmalloc compatible in general
    (note that the page table allocation is GFP_KERNEL). Those need to be
    fixed separately.

    While we are at it, document that __vmalloc{_node} about unsupported gfp
    mask because there seems to be a lot of confusion out there.
    kvmalloc_node will warn about GFP_KERNEL incompatible (which are not
    superset) flags to catch new abusers. Existing ones would have to die
    slowly.

    [sfr@canb.auug.org.au: f2fs fixup]
    Link: http://lkml.kernel.org/r/20170320163735.332e64b7@canb.auug.org.au
    Link: http://lkml.kernel.org/r/20170306103032.2540-2-mhocko@kernel.org
    Signed-off-by: Michal Hocko
    Signed-off-by: Stephen Rothwell
    Reviewed-by: Andreas Dilger [ext4 part]
    Acked-by: Vlastimil Babka
    Cc: John Hubbard
    Cc: David Miller
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Michal Hocko
     

03 May, 2017

3 commits

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

    IMA:
    - provide ">" and " of git://git.kernel.org/pub/scm/linux/kernel/git/jmorris/linux-security: (98 commits)
    tpm: Fix reference count to main device
    tpm_tis: convert to using locality callbacks
    tpm: fix handling of the TPM 2.0 event logs
    tpm_crb: remove a cruft constant
    keys: select CONFIG_CRYPTO when selecting DH / KDF
    apparmor: Make path_max parameter readonly
    apparmor: fix parameters so that the permission test is bypassed at boot
    apparmor: fix invalid reference to index variable of iterator line 836
    apparmor: use SHASH_DESC_ON_STACK
    security/apparmor/lsm.c: set debug messages
    apparmor: fix boolreturn.cocci warnings
    Smack: Use GFP_KERNEL for smk_netlbl_mls().
    smack: fix double free in smack_parse_opts_str()
    KEYS: add SP800-56A KDF support for DH
    KEYS: Keyring asymmetric key restrict method with chaining
    KEYS: Restrict asymmetric key linkage using a specific keychain
    KEYS: Add a lookup_restriction function for the asymmetric key type
    KEYS: Add KEYCTL_RESTRICT_KEYRING
    KEYS: Consistent ordering for __key_link_begin and restrict check
    KEYS: Add an optional lookup_restriction hook to key_type
    ...

    Linus Torvalds
     
  • Pull networking updates from David Millar:
    "Here are some highlights from the 2065 networking commits that
    happened this development cycle:

    1) XDP support for IXGBE (John Fastabend) and thunderx (Sunil Kowuri)

    2) Add a generic XDP driver, so that anyone can test XDP even if they
    lack a networking device whose driver has explicit XDP support
    (me).

    3) Sparc64 now has an eBPF JIT too (me)

    4) Add a BPF program testing framework via BPF_PROG_TEST_RUN (Alexei
    Starovoitov)

    5) Make netfitler network namespace teardown less expensive (Florian
    Westphal)

    6) Add symmetric hashing support to nft_hash (Laura Garcia Liebana)

    7) Implement NAPI and GRO in netvsc driver (Stephen Hemminger)

    8) Support TC flower offload statistics in mlxsw (Arkadi Sharshevsky)

    9) Multiqueue support in stmmac driver (Joao Pinto)

    10) Remove TCP timewait recycling, it never really could possibly work
    well in the real world and timestamp randomization really zaps any
    hint of usability this feature had (Soheil Hassas Yeganeh)

    11) Support level3 vs level4 ECMP route hashing in ipv4 (Nikolay
    Aleksandrov)

    12) Add socket busy poll support to epoll (Sridhar Samudrala)

    13) Netlink extended ACK support (Johannes Berg, Pablo Neira Ayuso,
    and several others)

    14) IPSEC hw offload infrastructure (Steffen Klassert)"

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next: (2065 commits)
    tipc: refactor function tipc_sk_recv_stream()
    tipc: refactor function tipc_sk_recvmsg()
    net: thunderx: Optimize page recycling for XDP
    net: thunderx: Support for XDP header adjustment
    net: thunderx: Add support for XDP_TX
    net: thunderx: Add support for XDP_DROP
    net: thunderx: Add basic XDP support
    net: thunderx: Cleanup receive buffer allocation
    net: thunderx: Optimize CQE_TX handling
    net: thunderx: Optimize RBDR descriptor handling
    net: thunderx: Support for page recycling
    ipx: call ipxitf_put() in ioctl error path
    net: sched: add helpers to handle extended actions
    qed*: Fix issues in the ptp filter config implementation.
    qede: Fix concurrency issue in PTP Tx path processing.
    stmmac: Add support for SIMATIC IOT2000 platform
    net: hns: fix ethtool_get_strings overflow in hns driver
    tcp: fix wraparound issue in tcp_lp
    bpf, arm64: fix jit branch offset related to ldimm64
    bpf, arm64: implement jiting of BPF_XADD
    ...

    Linus Torvalds
     
  • Pull documentation update from Jonathan Corbet:
    "A reasonably busy cycle for documentation this time around. There is a
    new guide for user-space API documents, rather sparsely populated at
    the moment, but it's a start. Markus improved the infrastructure for
    converting diagrams. Mauro has converted much of the USB documentation
    over to RST. Plus the usual set of fixes, improvements, and tweaks.

    There's a bit more than the usual amount of reaching out of
    Documentation/ to fix comments elsewhere in the tree; I have acks for
    those where I could get them"

    * tag 'docs-4.12' of git://git.lwn.net/linux: (74 commits)
    docs: Fix a couple typos
    docs: Fix a spelling error in vfio-mediated-device.txt
    docs: Fix a spelling error in ioctl-number.txt
    MAINTAINERS: update file entry for HSI subsystem
    Documentation: allow installing man pages to a user defined directory
    Doc/PM: Sync with intel_powerclamp code behavior
    zr364xx.rst: usb/devices is now at /sys/kernel/debug/
    usb.rst: move documentation from proc_usb_info.txt to USB ReST book
    convert philips.txt to ReST and add to media docs
    docs-rst: usb: update old usbfs-related documentation
    arm: Documentation: update a path name
    docs: process/4.Coding.rst: Fix a couple of document refs
    docs-rst: fix usb cross-references
    usb: gadget.h: be consistent at kernel doc macros
    usb: composite.h: fix two warnings when building docs
    usb: get rid of some ReST doc build errors
    usb.rst: get rid of some Sphinx errors
    usb/URB.txt: convert to ReST and update it
    usb/persist.txt: convert to ReST and add to driver-api book
    usb/hotplug.txt: convert to ReST and add to driver-api book
    ...

    Linus Torvalds
     

02 May, 2017

1 commit

  • Pull uaccess unification updates from Al Viro:
    "This is the uaccess unification pile. It's _not_ the end of uaccess
    work, but the next batch of that will go into the next cycle. This one
    mostly takes copy_from_user() and friends out of arch/* and gets the
    zero-padding behaviour in sync for all architectures.

    Dealing with the nocache/writethrough mess is for the next cycle;
    fortunately, that's x86-only. Same for cleanups in iov_iter.c (I am
    sold on access_ok() in there, BTW; just not in this pile), same for
    reducing __copy_... callsites, strn*... stuff, etc. - there will be a
    pile about as large as this one in the next merge window.

    This one sat in -next for weeks. -3KLoC"

    * 'work.uaccess' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs: (96 commits)
    HAVE_ARCH_HARDENED_USERCOPY is unconditional now
    CONFIG_ARCH_HAS_RAW_COPY_USER is unconditional now
    m32r: switch to RAW_COPY_USER
    hexagon: switch to RAW_COPY_USER
    microblaze: switch to RAW_COPY_USER
    get rid of padding, switch to RAW_COPY_USER
    ia64: get rid of copy_in_user()
    ia64: sanitize __access_ok()
    ia64: get rid of 'segment' argument of __do_{get,put}_user()
    ia64: get rid of 'segment' argument of __{get,put}_user_check()
    ia64: add extable.h
    powerpc: get rid of zeroing, switch to RAW_COPY_USER
    esas2r: don't open-code memdup_user()
    alpha: fix stack smashing in old_adjtimex(2)
    don't open-code kernel_setsockopt()
    mips: switch to RAW_COPY_USER
    mips: get rid of tail-zeroing in primitives
    mips: make copy_from_user() zero tail explicitly
    mips: clean and reorder the forest of macros...
    mips: consolidate __invoke_... wrappers
    ...

    Linus Torvalds
     

27 Apr, 2017

2 commits


22 Apr, 2017

1 commit



18 Apr, 2017

4 commits

  • This fixes CVE-2017-7472.

    Running the following program as an unprivileged user exhausts kernel
    memory by leaking thread keyrings:

    #include

    int main()
    {
    for (;;)
    keyctl_set_reqkey_keyring(KEY_REQKEY_DEFL_THREAD_KEYRING);
    }

    Fix it by only creating a new thread keyring if there wasn't one before.
    To make things more consistent, make install_thread_keyring_to_cred()
    and install_process_keyring_to_cred() both return 0 if the corresponding
    keyring is already present.

    Fixes: d84f4f992cbd ("CRED: Inaugurate COW credentials")
    Cc: stable@vger.kernel.org # 2.6.29+
    Signed-off-by: Eric Biggers
    Signed-off-by: David Howells

    Eric Biggers
     
  • This fixes CVE-2017-6951.

    Userspace should not be able to do things with the "dead" key type as it
    doesn't have some of the helper functions set upon it that the kernel
    needs. Attempting to use it may cause the kernel to crash.

    Fix this by changing the name of the type to ".dead" so that it's rejected
    up front on userspace syscalls by key_get_type_from_user().

    Though this doesn't seem to affect recent kernels, it does affect older
    ones, certainly those prior to:

    commit c06cfb08b88dfbe13be44a69ae2fdc3a7c902d81
    Author: David Howells
    Date: Tue Sep 16 17:36:06 2014 +0100
    KEYS: Remove key_type::match in favour of overriding default by match_preparse

    which went in before 3.18-rc1.

    Signed-off-by: David Howells
    cc: stable@vger.kernel.org

    David Howells
     
  • This fixes CVE-2016-9604.

    Keyrings whose name begin with a '.' are special internal keyrings and so
    userspace isn't allowed to create keyrings by this name to prevent
    shadowing. However, the patch that added the guard didn't fix
    KEYCTL_JOIN_SESSION_KEYRING. Not only can that create dot-named keyrings,
    it can also subscribe to them as a session keyring if they grant SEARCH
    permission to the user.

    This, for example, allows a root process to set .builtin_trusted_keys as
    its session keyring, at which point it has full access because now the
    possessor permissions are added. This permits root to add extra public
    keys, thereby bypassing module verification.

    This also affects kexec and IMA.

    This can be tested by (as root):

    keyctl session .builtin_trusted_keys
    keyctl add user a a @s
    keyctl list @s

    which on my test box gives me:

    2 keys in keyring:
    180010936: ---lswrv 0 0 asymmetric: Build time autogenerated kernel key: ae3d4a31b82daa8e1a75b49dc2bba949fd992a05
    801382539: --alswrv 0 0 user: a

    Fix this by rejecting names beginning with a '.' in the keyctl.

    Signed-off-by: David Howells
    Acked-by: Mimi Zohar
    cc: linux-ima-devel@lists.sourceforge.net
    cc: stable@vger.kernel.org

    David Howells
     
  • …dhowells/linux-fs into next

    James Morris
     

12 Apr, 2017

1 commit