09 May, 2017

1 commit

  • 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
     

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 crypto updates from Herbert Xu:
    "Here is the crypto update for 4.12:

    API:
    - Add batch registration for acomp/scomp
    - Change acomp testing to non-unique compressed result
    - Extend algorithm name limit to 128 bytes
    - Require setkey before accept(2) in algif_aead

    Algorithms:
    - Add support for deflate rfc1950 (zlib)

    Drivers:
    - Add accelerated crct10dif for powerpc
    - Add crc32 in stm32
    - Add sha384/sha512 in ccp
    - Add 3des/gcm(aes) for v5 devices in ccp
    - Add Queue Interface (QI) backend support in caam
    - Add new Exynos RNG driver
    - Add ThunderX ZIP driver
    - Add driver for hardware random generator on MT7623 SoC"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6: (101 commits)
    crypto: stm32 - Fix OF module alias information
    crypto: algif_aead - Require setkey before accept(2)
    crypto: scomp - add support for deflate rfc1950 (zlib)
    crypto: scomp - allow registration of multiple scomps
    crypto: ccp - Change ISR handler method for a v5 CCP
    crypto: ccp - Change ISR handler method for a v3 CCP
    crypto: crypto4xx - rename ce_ring_contol to ce_ring_control
    crypto: testmgr - Allow ecb(cipher_null) in FIPS mode
    Revert "crypto: arm64/sha - Add constant operand modifier to ASM_EXPORT"
    crypto: ccp - Disable interrupts early on unload
    crypto: ccp - Use only the relevant interrupt bits
    hwrng: mtk - Add driver for hardware random generator on MT7623 SoC
    dt-bindings: hwrng: Add Mediatek hardware random generator bindings
    crypto: crct10dif-vpmsum - Fix missing preempt_disable()
    crypto: testmgr - replace compression known answer test
    crypto: acomp - allow registration of multiple acomps
    hwrng: n2 - Use devm_kcalloc() in n2rng_probe()
    crypto: chcr - Fix error handling related to 'chcr_alloc_shash'
    padata: get_next is never NULL
    crypto: exynos - Add new Exynos RNG driver
    ...

    Linus Torvalds
     

24 Apr, 2017

4 commits


21 Apr, 2017

2 commits


20 Apr, 2017

1 commit


19 Apr, 2017

1 commit

  • Pull crypto fixes from Herbert Xu:
    "This fixes the following problems:

    - regression in new XTS/LRW code when used with async crypto

    - long-standing bug in ahash API when used with certain algos

    - bogus memory dereference in async algif_aead with certain algos"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: algif_aead - Fix bogus request dereference in completion function
    crypto: ahash - Fix EINPROGRESS notification callback
    crypto: lrw - Fix use-after-free on EINPROGRESS
    crypto: xts - Fix use-after-free on EINPROGRESS

    Linus Torvalds
     

14 Apr, 2017

3 commits

  • This is an add-on to the previous patch that passes the extended ACK
    structure where it's already available by existing genl_info or extack
    function arguments.

    This was done with this spatch (with some manual adjustment of
    indentation):

    @@
    expression A, B, C, D, E;
    identifier fn, info;
    @@
    fn(..., struct genl_info *info, ...) {
    ...
    -nlmsg_parse(A, B, C, D, E, NULL)
    +nlmsg_parse(A, B, C, D, E, info->extack)
    ...
    }

    @@
    expression A, B, C, D, E;
    identifier fn, info;
    @@
    fn(..., struct genl_info *info, ...) {
    extack)
    ...>
    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D, E;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {
    ...
    -nlmsg_parse(A, B, C, D, E, NULL)
    +nlmsg_parse(A, B, C, D, E, extack)
    ...
    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C, D;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    @@
    expression A, B, C;
    identifier fn, extack;
    @@
    fn(..., struct netlink_ext_ack *extack, ...) {

    }

    Signed-off-by: Johannes Berg
    Reviewed-by: Jiri Pirko
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Pass the new extended ACK reporting struct to all of the generic
    netlink parsing functions. For now, pass NULL in almost all callers
    (except for some in the core.)

    Signed-off-by: Johannes Berg
    Signed-off-by: David S. Miller

    Johannes Berg
     
  • Add the base infrastructure and UAPI for netlink extended ACK
    reporting. All "manual" calls to netlink_ack() pass NULL for now and
    thus don't get extended ACK reporting.

    Big thanks goes to Pablo Neira Ayuso for not only bringing up the
    whole topic at netconf (again) but also coming up with the nlattr
    passing trick and various other ideas.

    Signed-off-by: Johannes Berg
    Reviewed-by: David Ahern
    Signed-off-by: David S. Miller

    Johannes Berg
     

10 Apr, 2017

7 commits

  • Decompress function in LZ4 library is supposed to return an error code or
    negative result. But, it returns -1 when any error is detected. Return
    error code when the library returns negative value.

    Signed-off-by: Myungho Jung
    Signed-off-by: Herbert Xu

    Myungho Jung
     
  • This patch removes the hard-coded 64-byte limit on the length
    of the algorithm name through bind(2). The address length can
    now exceed that. The user-space structure remains unchanged.
    In order to use a longer name simply extend the salg_name array
    beyond its defined 64 bytes length.

    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • This patch hard-codes CRYPTO_MAX_NAME in the user-space API to
    64, which is the current value of CRYPTO_MAX_ALG_NAME. This patch
    also replaces all remaining occurences of CRYPTO_MAX_ALG_NAME
    in the user-space API with CRYPTO_MAX_NAME.

    This way the user-space API will not be modified when we raise
    the value of CRYPTO_MAX_ALG_NAME.

    Furthermore, the code has been updated to handle names longer than
    the user-space API. They will be truncated.

    Signed-off-by: Herbert Xu
    Acked-by: Alexander Sverdlin
    Tested-by: Alexander Sverdlin

    Herbert Xu
     
  • The algif_aead completion function tries to deduce the aead_request
    from the crypto_async_request argument. This is broken because
    the API does not guarantee that the same request will be pased to
    the completion function. Only the value of req->data can be used
    in the completion function.

    This patch fixes it by storing a pointer to sk in areq and using
    that instead of passing in sk through req->data.

    Fixes: 83094e5e9e49 ("crypto: af_alg - add async support to...")
    Cc:
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • The ahash API modifies the request's callback function in order
    to clean up after itself in some corner cases (unaligned final
    and missing finup).

    When the request is complete ahash will restore the original
    callback and everything is fine. However, when the request gets
    an EBUSY on a full queue, an EINPROGRESS callback is made while
    the request is still ongoing.

    In this case the ahash API will incorrectly call its own callback.

    This patch fixes the problem by creating a temporary request
    object on the stack which is used to relay EINPROGRESS back to
    the original completion function.

    This patch also adds code to preserve the original flags value.

    Fixes: ab6bf4e5e5e4 ("crypto: hash - Fix the pointer voodoo in...")
    Cc:
    Reported-by: Sabrina Dubroca
    Tested-by: Sabrina Dubroca
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • When we get an EINPROGRESS completion in lrw, we will end up marking
    the request as done and freeing it. This then blows up when the
    request is really completed as we've already freed the memory.

    Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher")
    Cc:
    Signed-off-by: Herbert Xu

    Herbert Xu
     
  • When we get an EINPROGRESS completion in xts, we will end up marking
    the request as done and freeing it. This then blows up when the
    request is really completed as we've already freed the memory.

    Fixes: f1c131b45410 ("crypto: xts - Convert to skcipher")
    Cc:
    Reported-by: Nathan Royce
    Reported-by: Krzysztof Kozlowski
    Signed-off-by: Herbert Xu
    Tested-by: Krzysztof Kozlowski

    Herbert Xu
     

05 Apr, 2017

7 commits

  • Since the gf128mul_x_ble function used by xts.c is now defined inline
    in the header file, the XTS module no longer depends on gf128mul.
    Therefore, the 'select CRYPTO_GF128MUL' line can be safely removed.

    Signed-off-by: Ondrej Mosnacek
    Reviewd-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Ondrej Mosnáček
     
  • Currently, gf128mul_x_ble works with pointers to be128, even though it
    actually interprets the words as little-endian. Consequently, it uses
    cpu_to_le64/le64_to_cpu on fields of type __be64, which is incorrect.

    This patch fixes that by changing the function to accept pointers to
    le128 and updating all users accordingly.

    Signed-off-by: Ondrej Mosnacek
    Reviewd-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Ondrej Mosnáček
     
  • The gf128mul_x_ble function is currently defined in gf128mul.c, because
    it depends on the gf128mul_table_be multiplication table.

    However, since the function is very small and only uses two values from
    the table, it is better for it to be defined as inline function in
    gf128mul.h. That way, the function can be inlined by the compiler for
    better performance.

    For consistency, the other gf128mul_x_* functions are also moved to the
    header file. In addition, the code is rewritten to be constant-time.

    After this change, the speed of the generic 'xts(aes)' implementation
    increased from ~225 MiB/s to ~235 MiB/s (measured using 'cryptsetup
    benchmark -c aes-xts-plain64' on an Intel system with CRYPTO_AES_X86_64
    and CRYPTO_AES_NI_INTEL disabled).

    Signed-off-by: Ondrej Mosnacek
    Reviewd-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Ondrej Mosnáček
     
  • Merge the crypto tree to resolve conflict between caam changes.

    Herbert Xu
     
  • Add a restrict_link_by_key_or_keyring_chain link restriction that
    searches for signing keys in the destination keyring in addition to the
    signing key or keyring designated when the destination keyring was
    created. Userspace enables this behavior by including the "chain" option
    in the keyring restriction:

    keyctl(KEYCTL_RESTRICT_KEYRING, keyring, "asymmetric",
    "key_or_keyring::chain");

    Signed-off-by: Mat Martineau

    Mat Martineau
     
  • Adds restrict_link_by_signature_keyring(), which uses the restrict_key
    member of the provided destination_keyring data structure as the
    key or keyring to search for signing keys.

    Signed-off-by: Mat Martineau

    Mat Martineau
     
  • Look up asymmetric keyring restriction information using the key-type
    lookup_restrict hook.

    Signed-off-by: Mat Martineau

    Mat Martineau
     

04 Apr, 2017

1 commit

  • The first argument to the restrict_link_func_t functions was a keyring
    pointer. These functions are called by the key subsystem with this
    argument set to the destination keyring, but restrict_link_by_signature
    expects a pointer to the relevant trusted keyring.

    Restrict functions may need something other than a single struct key
    pointer to allow or reject key linkage, so the data used to make that
    decision (such as the trust keyring) is moved to a new, fourth
    argument. The first argument is now always the destination keyring.

    Signed-off-by: Mat Martineau

    Mat Martineau
     

03 Apr, 2017

2 commits

  • PKCS#7: Handle certificates that are blacklisted when verifying the chain
    of trust on the signatures on a PKCS#7 message.

    Signed-off-by: David Howells

    David Howells
     
  • Allow X.509 certs to be blacklisted based on their TBSCertificate hash.
    This is convenient since we have to determine this anyway to be able to
    check the signature on an X.509 certificate. This is also what UEFI uses
    in its blacklist.

    If a certificate built into the kernel is blacklisted, something like the
    following might then be seen during boot:

    X.509: Cert 123412341234c55c1dcc601ab8e172917706aa32fb5eaf826813547fdf02dd46 is blacklisted
    Problem loading in-kernel X.509 certificate (-129)

    where the hex string shown is the blacklisted hash.

    Signed-off-by: David Howells

    David Howells
     

01 Apr, 2017

1 commit

  • Pull crypto fixes from Herbert Xu:
    "This fixes the following issues:

    - memory corruption when kmalloc fails in xts/lrw

    - mark some CCP DMA channels as private

    - fix reordering race in padata

    - regression in omap-rng DT description"

    * 'linus' of git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6:
    crypto: xts,lrw - fix out-of-bounds write after kmalloc failure
    crypto: ccp - Make some CCP DMA channels private
    padata: avoid race in reordering
    dt-bindings: rng: clocks property on omap_rng not always mandatory

    Linus Torvalds
     

24 Mar, 2017

7 commits

  • An SGL to be initialized only once even when its buffers are written
    to several times.

    Signed-off-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Stephan Mueller
     
  • 3DES is missing the fips_allowed flag for CTR mode.

    Signed-off-by: Marcelo Henrique Cerri
    Acked-by: Stephan Mueller
    Signed-off-by: Herbert Xu

    Marcelo Cerri
     
  • The md5_transform function is no longer used any where in the tree,
    except for the crypto api's actual implementation of md5, so we can drop
    the function from lib and put it as a static function of the crypto
    file, where it belongs. There should be no new users of md5_transform,
    anyway, since there are more modern ways of doing what it once achieved.

    Signed-off-by: Jason A. Donenfeld
    Reviewed-by: Eric Biggers
    Signed-off-by: Herbert Xu

    Jason A. Donenfeld
     
  • vpmsum implementations often don't kick in for short test vectors.
    This is a simple test module that does a configurable number of
    random tests, each up to 64kB and each with random offsets.

    Both CRC-T10DIF and CRC32C are tested.

    Cc: Anton Blanchard
    Signed-off-by: Daniel Axtens
    Signed-off-by: Herbert Xu

    Daniel Axtens
     
  • T10DIF is a CRC16 used heavily in NVMe.

    It turns out we can accelerate it with a CRC32 library and a few
    little tricks.

    Provide the accelerator based the refactored CRC32 code.

    Cc: Anton Blanchard
    Thanks-to: Hong Bo Peng
    Signed-off-by: Daniel Axtens
    Signed-off-by: Herbert Xu

    Daniel Axtens
     
  • Merging 4.11-rc3 to pick up md5 removal from /dev/random.

    Herbert Xu
     
  • In the generic XTS and LRW algorithms, for input data > 128 bytes, a
    temporary buffer is allocated to hold the values to be XOR'ed with the
    data before and after encryption or decryption. If the allocation
    fails, the fixed-size buffer embedded in the request buffer is meant to
    be used as a fallback --- resulting in more calls to the ECB algorithm,
    but still producing the correct result. However, we weren't correctly
    limiting subreq->cryptlen in this case, resulting in pre_crypt()
    overrunning the embedded buffer. Fix this by setting subreq->cryptlen
    correctly.

    Fixes: f1c131b45410 ("crypto: xts - Convert to skcipher")
    Fixes: 700cb3f5fe75 ("crypto: lrw - Convert to skcipher")
    Cc: stable@vger.kernel.org # v4.10+
    Reported-by: Dmitry Vyukov
    Signed-off-by: Eric Biggers
    Acked-by: David S. Miller
    Signed-off-by: Herbert Xu

    Eric Biggers