07 Jul, 2018

1 commit

  • The new added "reciprocal_value_adv" implements the advanced version of the
    algorithm described in Figure 4.2 of the paper except when
    "divisor > (1U << 31)" whose ceil(log2(d)) result will be 32 which then
    requires u128 divide on host. The exception case could be easily handled
    before calling "reciprocal_value_adv".

    The advanced version requires more complex calculation to get the
    reciprocal multiplier and other control variables, but then could reduce
    the required emulation operations.

    It makes no sense to use this advanced version for host divide emulation,
    those extra complexities for calculating multiplier etc could completely
    waive our saving on emulation operations.

    However, it makes sense to use it for JIT divide code generation (for
    example eBPF JIT backends) for which we are willing to trade performance of
    JITed code with that of host. As shown by the following pseudo code, the
    required emulation operations could go down from 6 (the basic version) to 3
    or 4.

    To use the result of "reciprocal_value_adv", suppose we want to calculate
    n/d, the C-style pseudo code will be the following, it could be easily
    changed to real code generation for other JIT targets.

    struct reciprocal_value_adv rvalue;
    u8 pre_shift, exp;

    // handle exception case.
    if (d >= (1U << 31)) {
    result = n >= d;
    return;
    }
    rvalue = reciprocal_value_adv(d, 32)
    exp = rvalue.exp;
    if (rvalue.is_wide_m && !(d & 1)) {
    // floor(log2(d & (2^32 -d)))
    pre_shift = fls(d & -d) - 1;
    rvalue = reciprocal_value_adv(d >> pre_shift, 32 - pre_shift);
    } else {
    pre_shift = 0;
    }

    // code generation starts.
    if (imm == 1U << exp) {
    result = n >> exp;
    } else if (rvalue.is_wide_m) {
    // pre_shift must be zero when reached here.
    t = (n * rvalue.m) >> 32;
    result = n - t;
    result >>= 1;
    result += t;
    result >>= rvalue.sh - 1;
    } else {
    if (pre_shift)
    result = n >> pre_shift;
    result = ((u64)result * rvalue.m) >> 32;
    result >>= rvalue.sh;
    }

    Signed-off-by: Jiong Wang
    Reviewed-by: Jakub Kicinski
    Signed-off-by: Daniel Borkmann

    Jiong Wang
     

03 Jul, 2018

2 commits

  • Simple overlapping changes in stmmac driver.

    Adjust skb_gro_flush_final_remcsum function signature to make GRO list
    changes in net-next, as per Stephen Rothwell's example merge
    resolution.

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Pull networking fixes from David Miller:

    1) Verify netlink attributes properly in nf_queue, from Eric Dumazet.

    2) Need to bump memory lock rlimit for test_sockmap bpf test, from
    Yonghong Song.

    3) Fix VLAN handling in lan78xx driver, from Dave Stevenson.

    4) Fix uninitialized read in nf_log, from Jann Horn.

    5) Fix raw command length parsing in mlx5, from Alex Vesker.

    6) Cleanup loopback RDS connections upon netns deletion, from Sowmini
    Varadhan.

    7) Fix regressions in FIB rule matching during create, from Jason A.
    Donenfeld and Roopa Prabhu.

    8) Fix mpls ether type detection in nfp, from Pieter Jansen van Vuuren.

    9) More bpfilter build fixes/adjustments from Masahiro Yamada.

    10) Fix XDP_{TX,REDIRECT} flushing in various drivers, from Jesper
    Dangaard Brouer.

    11) fib_tests.sh file permissions were broken, from Shuah Khan.

    12) Make sure BH/preemption is disabled in data path of mac80211, from
    Denis Kenzior.

    13) Don't ignore nla_parse_nested() return values in nl80211, from
    Johannes berg.

    14) Properly account sock objects ot kmemcg, from Shakeel Butt.

    15) Adjustments to setting bpf program permissions to read-only, from
    Daniel Borkmann.

    16) TCP Fast Open key endianness was broken, it always took on the host
    endiannness. Whoops. Explicitly make it little endian. From Yuching
    Cheng.

    17) Fix prefix route setting for link local addresses in ipv6, from
    David Ahern.

    18) Potential Spectre v1 in zatm driver, from Gustavo A. R. Silva.

    19) Various bpf sockmap fixes, from John Fastabend.

    20) Use after free for GRO with ESP, from Sabrina Dubroca.

    21) Passing bogus flags to crypto_alloc_shash() in ipv6 SR code, from
    Eric Biggers.

    * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (87 commits)
    qede: Adverstise software timestamp caps when PHC is not available.
    qed: Fix use of incorrect size in memcpy call.
    qed: Fix setting of incorrect eswitch mode.
    qed: Limit msix vectors in kdump kernel to the minimum required count.
    ipvlan: call dev_change_flags when ipvlan mode is reset
    ipv6: sr: fix passing wrong flags to crypto_alloc_shash()
    net: fix use-after-free in GRO with ESP
    tcp: prevent bogus FRTO undos with non-SACK flows
    bpf: sockhash, add release routine
    bpf: sockhash fix omitted bucket lock in sock_close
    bpf: sockmap, fix smap_list_map_remove when psock is in many maps
    bpf: sockmap, fix crash when ipv6 sock is added
    net: fib_rules: bring back rule_exists to match rule during add
    hv_netvsc: split sub-channel setup into async and sync
    net: use dev_change_tx_queue_len() for SIOCSIFTXQLEN
    atm: zatm: Fix potential Spectre v1
    s390/qeth: consistently re-enable device features
    s390/qeth: don't clobber buffer on async TX completion
    s390/qeth: avoid using is_multicast_ether_addr_64bits on (u8 *)[6]
    s390/qeth: fix race when setting MAC address
    ...

    Linus Torvalds
     

01 Jul, 2018

2 commits

  • Daniel Borkmann says:

    ====================
    pull-request: bpf 2018-07-01

    The following pull-request contains BPF updates for your *net* tree.

    The main changes are:

    1) A bpf_fib_lookup() helper fix to change the API before freeze to
    return an encoding of the FIB lookup result and return the nexthop
    device index in the params struct (instead of device index as return
    code that we had before), from David.

    2) Various BPF JIT fixes to address syzkaller fallout, that is, do not
    reject progs when set_memory_*() fails since it could still be RO.
    Also arm32 JIT was not using bpf_jit_binary_lock_ro() API which was
    an issue, and a memory leak in s390 JIT found during review, from
    Daniel.

    3) Multiple fixes for sockmap/hash to address most of the syzkaller
    triggered bugs. Usage with IPv6 was crashing, a GPF in bpf_tcp_close(),
    a missing sock_map_release() routine to hook up to callbacks, and a
    fix for an omitted bucket lock in sock_close(), from John.

    4) Two bpftool fixes to remove duplicated error message on program load,
    and another one to close the libbpf object after program load. One
    additional fix for nfp driver's BPF offload to avoid stopping offload
    completely if replace of program failed, from Jakub.

    5) Couple of BPF selftest fixes that bail out in some of the test
    scripts if the user does not have the right privileges, from Jeffrin.

    6) Fixes in test_bpf for s390 when CONFIG_BPF_JIT_ALWAYS_ON is set
    where we need to set the flag that some of the test cases are expected
    to fail, from Kleber.

    7) Fix to detangle BPF_LIRC_MODE2 dependency from CONFIG_CGROUP_BPF
    since it has no relation to it and lirc2 users often have configs
    without cgroups enabled and thus would not be able to use it, from Sean.

    8) Fix a selftest failure in sockmap by removing a useless setrlimit()
    call that would set a too low limit where at the same time we are
    already including bpf_rlimit.h that does the job, from Yonghong.

    9) Fix BPF selftest config with missing missing NET_SCHED, from Anders.
    ====================

    Signed-off-by: David S. Miller

    David S. Miller
     
  • Pull block fixes from Jens Axboe:
    "Small set of fixes for this series. Mostly just minor fixes, the only
    oddball in here is the sg change.

    The sg change came out of the stall fix for NVMe, where we added a
    mempool and limited us to a single page allocation. CONFIG_SG_DEBUG
    sort-of ruins that, since we'd need to account for that. That's
    actually a generic problem, since lots of drivers need to allocate SG
    lists. So this just removes support for CONFIG_SG_DEBUG, which I added
    back in 2007 and to my knowledge it was never useful.

    Anyway, outside of that, this pull contains:

    - clone of request with special payload fix (Bart)

    - drbd discard handling fix (Bart)

    - SATA blk-mq stall fix (me)

    - chunk size fix (Keith)

    - double free nvme rdma fix (Sagi)"

    * tag 'for-linus-20180629' of git://git.kernel.dk/linux-block:
    sg: remove ->sg_magic member
    drbd: Fix drbd_request_prepare() discard handling
    blk-mq: don't queue more if we get a busy return
    block: Fix cloning of requests with a special payload
    nvme-rdma: fix possible double free of controller async event buffer
    block: Fix transfer when chunk sectors exceeds max

    Linus Torvalds
     

29 Jun, 2018

5 commits

  • This was introduced more than a decade ago when sg chaining was
    added, but we never really caught anything with it. The scatterlist
    entry size can be critical, since drivers allocate it, so remove
    the magic member. Recently it's been triggering allocation stalls
    and failures in NVMe.

    Tested-by: Jordan Glover
    Acked-by: Christoph Hellwig
    Signed-off-by: Jens Axboe

    Jens Axboe
     
  • Flag with FLAG_EXPECTED_FAIL the BPF_MAXINSNS tests that cannot be jited
    on s390 because they exceed BPF_SIZE_MAX and fail when
    CONFIG_BPF_JIT_ALWAYS_ON is set. Also set .expected_errcode to -ENOTSUPP
    so the tests pass in that case.

    Signed-off-by: Kleber Sacilotto de Souza
    Acked-by: Song Liu
    Signed-off-by: Daniel Borkmann

    Kleber Sacilotto de Souza
     
  • Pull printk fix from Petr Mladek:
    "Revert a commit that went in by mistake. I already have a better fix
    in the queue for 4.19"

    * tag 'printk-for-4.18-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/pmladek/printk:
    Revert "lib/test_printf.c: call wait_for_random_bytes() before plain %p tests"

    Linus Torvalds
     
  • KASAN depends on having access to some of the accounting that SLUB_DEBUG
    does; without it, there are immediate crashes [1]. So, the natural
    thing to do is to make KASAN select SLUB_DEBUG.

    [1] http://lkml.kernel.org/r/CAHmME9rtoPwxUSnktxzKso14iuVCWT7BE_-_8PAC=pGw1iJnQg@mail.gmail.com

    Link: http://lkml.kernel.org/r/20180622154623.25388-1-Jason@zx2c4.com
    Fixes: f9e13c0a5a33 ("slab, slub: skip unnecessary kasan_cache_shutdown()")
    Signed-off-by: Jason A. Donenfeld
    Acked-by: Michal Hocko
    Reviewed-by: Shakeel Butt
    Acked-by: Christoph Lameter
    Cc: Shakeel Butt
    Cc: David Rientjes
    Cc: Pekka Enberg
    Cc: Joonsoo Kim
    Cc: Andrey Ryabinin
    Cc:
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Jason A. Donenfeld
     
  • In commit 804209d8a009 ("lib/percpu_ida.c: use _irqsave() instead of
    local_irq_save() + spin_lock") I inlined alloc_local_tag() and mixed up
    the >= check from percpu_ida_alloc() with the one in alloc_local_tag().

    Don't alloc from per-CPU freelist if ->nr_free is zero.

    Link: http://lkml.kernel.org/r/20180613075830.c3zeva52fuj6fxxv@linutronix.de
    Fixes: 804209d8a009 ("lib/percpu_ida.c: use _irqsave() instead of local_irq_save() + spin_lock")
    Signed-off-by: Sebastian Andrzej Siewior
    Reported-by: David Disseldorp
    Tested-by: David Disseldorp
    Cc: Thomas Gleixner
    Cc: Nicholas Bellinger
    Cc: Shaohua Li
    Cc: Kent Overstreet
    Cc: Matthew Wilcox
    Cc: Jens Axboe
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Sebastian Andrzej Siewior
     

28 Jun, 2018

1 commit


26 Jun, 2018

1 commit


25 Jun, 2018

1 commit


24 Jun, 2018

1 commit

  • Pull locking fixes from Thomas Gleixner:
    "A set of fixes and updates for the locking code:

    - Prevent lockdep from updating irq state within its own code and
    thereby confusing itself.

    - Buid fix for older GCCs which mistreat anonymous unions

    - Add a missing lockdep annotation in down_read_non_onwer() which
    causes up_read_non_owner() to emit a lockdep splat

    - Remove the custom alpha dec_and_lock() implementation which is
    incorrect in terms of ordering and use the generic one.

    The remaining two commits are not strictly fixes. They provide irqsave
    variants of atomic_dec_and_lock() and refcount_dec_and_lock(). These
    are required to merge the relevant updates and cleanups into different
    maintainer trees for 4.19, so routing them into mainline without
    actual users is the sanest approach.

    They should have been in -rc1, but last weekend I took the liberty to
    just avoid computers in order to regain some mental sanity"

    * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
    locking/qspinlock: Fix build for anonymous union in older GCC compilers
    locking/lockdep: Do not record IRQ state within lockdep code
    locking/rwsem: Fix up_read_non_owner() warning with DEBUG_RWSEMS
    locking/refcounts: Implement refcount_dec_and_lock_irqsave()
    atomic: Add irqsave variant of atomic_dec_and_lock()
    alpha: Remove custom dec_and_lock() implementation

    Linus Torvalds
     

22 Jun, 2018

7 commits

  • Using rht_dereference_bucket() to dereference
    ->future_tbl looks like a type error, and could be confusing.
    Using rht_dereference_rcu() to test a pointer for NULL
    adds an unnecessary barrier - rcu_access_pointer() is preferred
    for NULL tests when no lock is held.

    This uses 3 different ways to access ->future_tbl.
    - if we know the mutex is held, use rht_dereference()
    - if we don't hold the mutex, and are only testing for NULL,
    use rcu_access_pointer()
    - otherwise (using RCU protection for true dereference),
    use rht_dereference_rcu().

    Note that this includes a simplification of the call to
    rhashtable_last_table() - we don't do an extra dereference
    before the call any more.

    Acked-by: Herbert Xu
    Signed-off-by: NeilBrown
    Signed-off-by: David S. Miller

    NeilBrown
     
  • Rather than borrowing one of the bucket locks to
    protect ->future_tbl updates, use cmpxchg().
    This gives more freedom to change how bucket locking
    is implemented.

    Acked-by: Herbert Xu
    Signed-off-by: NeilBrown
    Signed-off-by: David S. Miller

    NeilBrown
     
  • Now that we don't use the hash value or shift in nested_table_alloc()
    there is room for simplification.
    We only need to pass a "is this a leaf" flag to nested_table_alloc(),
    and don't need to track as much information in
    rht_bucket_nested_insert().

    Note there is another minor cleanup in nested_table_alloc() here.
    The number of elements in a page of "union nested_tables" is most naturally

    PAGE_SIZE / sizeof(ntbl[0])

    The previous code had

    PAGE_SIZE / sizeof(ntbl[0].bucket)

    which happens to be the correct value only because the bucket uses all
    the space in the union.

    Acked-by: Herbert Xu
    Signed-off-by: NeilBrown
    Signed-off-by: David S. Miller

    NeilBrown
     
  • The 'ht' and 'hash' arguments to INIT_RHT_NULLS_HEAD() are
    no longer used - so drop them. This allows us to also
    remove the nhash argument from nested_table_alloc().

    Acked-by: Herbert Xu
    Signed-off-by: NeilBrown
    Signed-off-by: David S. Miller

    NeilBrown
     
  • This "feature" is unused, undocumented, and untested and so doesn't
    really belong. A patch is under development to properly implement
    support for detecting when a search gets diverted down a different
    chain, which the common purpose of nulls markers.

    This patch actually fixes a bug too. The table resizing allows a
    table to grow to 2^31 buckets, but the hash is truncated to 27 bits -
    any growth beyond 2^27 is wasteful an ineffective.

    This patch results in NULLS_MARKER(0) being used for all chains,
    and leaves the use of rht_is_a_null() to test for it.

    Acked-by: Herbert Xu
    Signed-off-by: NeilBrown
    Signed-off-by: David S. Miller

    NeilBrown
     
  • Due to the use of rhashtables in net namespaces,
    rhashtable.h is included in lots of the kernel,
    so a small changes can required a large recompilation.
    This makes development painful.

    This patch splits out rhashtable-types.h which just includes
    the major type declarations, and does not include (non-trivial)
    inline code. rhashtable.h is no longer included by anything
    in the include/ directory.
    Common include files only include rhashtable-types.h so a large
    recompilation is only triggered when that changes.

    Acked-by: Herbert Xu
    Signed-off-by: NeilBrown
    Signed-off-by: David S. Miller

    NeilBrown
     
  • print_ht in rhashtable_test calls rht_dereference() with neither
    RCU protection or the mutex. This triggers an RCU warning.
    So take the mutex to silence the warning.

    Acked-by: Herbert Xu
    Signed-off-by: NeilBrown
    Signed-off-by: David S. Miller

    NeilBrown
     

20 Jun, 2018

1 commit


16 Jun, 2018

1 commit

  • As we move stuff around, some doc references are broken. Fix some of
    them via this script:
    ./scripts/documentation-file-ref-check --fix

    Manually checked if the produced result is valid, removing a few
    false-positives.

    Acked-by: Takashi Iwai
    Acked-by: Masami Hiramatsu
    Acked-by: Stephen Boyd
    Acked-by: Charles Keepax
    Acked-by: Mathieu Poirier
    Reviewed-by: Coly Li
    Signed-off-by: Mauro Carvalho Chehab
    Acked-by: Jonathan Corbet

    Mauro Carvalho Chehab
     

15 Jun, 2018

2 commits

  • If the test_printf module is loaded before the crng is initialized, the
    plain 'p' tests will fail because the printed address will not be hashed
    and the buffer will contain '(ptrval)' instead.

    This patch adds a call to wait_for_random_bytes() before plain 'p' tests
    to make sure the crng is initialized.

    Link: http://lkml.kernel.org/r/20180604113708.11554-1-thierry.escande@linaro.org
    Signed-off-by: Thierry Escande
    Acked-by: Tobin C. Harding
    Reviewed-by: Andrew Morton
    Cc: David Miller
    Cc: Rasmus Villemoes
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Thierry Escande
     
  • Reorder Kconfig entries, so that menuconfig displays proper indentation.

    Link: http://lkml.kernel.org/r/alpine.LRH.2.02.1804251601160.30569@file01.intranet.prod.int.rdu2.redhat.com
    Signed-off-by: Mikulas Patocka
    Acked-by: Randy Dunlap
    Tested-by: Randy Dunlap
    Signed-off-by: Andrew Morton
    Signed-off-by: Linus Torvalds

    Mikulas Patocka
     

14 Jun, 2018

2 commits


13 Jun, 2018

11 commits

  • Pull more Kbuild updates from Masahiro Yamada:

    - fix some bugs introduced by the recent Kconfig syntax extension

    - add some symbols about compiler information in Kconfig, such as
    CC_IS_GCC, CC_IS_CLANG, GCC_VERSION, etc.

    - test compiler capability for the stack protector in Kconfig, and
    clean-up Makefile

    - test compiler capability for GCC-plugins in Kconfig, and clean-up
    Makefile

    - allow to enable GCC-plugins for COMPILE_TEST

    - test compiler capability for KCOV in Kconfig and correct dependency

    - remove auto-detect mode of the GCOV format, which is now more nicely
    handled in Kconfig

    - test compiler capability for mprofile-kernel on PowerPC, and clean-up
    Makefile

    - misc cleanups

    * tag 'kbuild-v4.18-2' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
    linux/linkage.h: replace VMLINUX_SYMBOL_STR() with __stringify()
    kconfig: fix localmodconfig
    sh: remove no-op macro VMLINUX_SYMBOL()
    powerpc/kbuild: move -mprofile-kernel check to Kconfig
    Documentation: kconfig: add recommended way to describe compiler support
    gcc-plugins: disable GCC_PLUGIN_STRUCTLEAK_BYREF_ALL for COMPILE_TEST
    gcc-plugins: allow to enable GCC_PLUGINS for COMPILE_TEST
    gcc-plugins: test plugin support in Kconfig and clean up Makefile
    gcc-plugins: move GCC version check for PowerPC to Kconfig
    kcov: test compiler capability in Kconfig and correct dependency
    gcov: remove CONFIG_GCOV_FORMAT_AUTODETECT
    arm64: move GCC version check for ARCH_SUPPORTS_INT128 to Kconfig
    kconfig: add CC_IS_CLANG and CLANG_VERSION
    kconfig: add CC_IS_GCC and GCC_VERSION
    stack-protector: test compiler capability in Kconfig and drop AUTO mode
    kbuild: fix endless syncconfig in case arch Makefile sets CROSS_COMPILE

    Linus Torvalds
     
  • Pull more overflow updates from Kees Cook:
    "The rest of the overflow changes for v4.18-rc1.

    This includes the explicit overflow fixes from Silvio, further
    struct_size() conversions from Matthew, and a bug fix from Dan.

    But the bulk of it is the treewide conversions to use either the
    2-factor argument allocators (e.g. kmalloc(a * b, ...) into
    kmalloc_array(a, b, ...) or the array_size() macros (e.g. vmalloc(a *
    b) into vmalloc(array_size(a, b)).

    Coccinelle was fighting me on several fronts, so I've done a bunch of
    manual whitespace updates in the patches as well.

    Summary:

    - Error path bug fix for overflow tests (Dan)

    - Additional struct_size() conversions (Matthew, Kees)

    - Explicitly reported overflow fixes (Silvio, Kees)

    - Add missing kvcalloc() function (Kees)

    - Treewide conversions of allocators to use either 2-factor argument
    variant when available, or array_size() and array3_size() as needed
    (Kees)"

    * tag 'overflow-v4.18-rc1-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux: (26 commits)
    treewide: Use array_size in f2fs_kvzalloc()
    treewide: Use array_size() in f2fs_kzalloc()
    treewide: Use array_size() in f2fs_kmalloc()
    treewide: Use array_size() in sock_kmalloc()
    treewide: Use array_size() in kvzalloc_node()
    treewide: Use array_size() in vzalloc_node()
    treewide: Use array_size() in vzalloc()
    treewide: Use array_size() in vmalloc()
    treewide: devm_kzalloc() -> devm_kcalloc()
    treewide: devm_kmalloc() -> devm_kmalloc_array()
    treewide: kvzalloc() -> kvcalloc()
    treewide: kvmalloc() -> kvmalloc_array()
    treewide: kzalloc_node() -> kcalloc_node()
    treewide: kzalloc() -> kcalloc()
    treewide: kmalloc() -> kmalloc_array()
    mm: Introduce kvcalloc()
    video: uvesafb: Fix integer overflow in allocation
    UBIFS: Fix potential integer overflow in allocation
    leds: Use struct_size() in allocation
    Convert intel uncore to struct_size
    ...

    Linus Torvalds
     
  • The vzalloc() function has no 2-factor argument form, so multiplication
    factors need to be wrapped in array_size(). This patch replaces cases of:

    vzalloc(a * b)

    with:
    vzalloc(array_size(a, b))

    as well as handling cases of:

    vzalloc(a * b * c)

    with:

    vzalloc(array3_size(a, b, c))

    This does, however, attempt to ignore constant size factors like:

    vzalloc(4 * 1024)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    vzalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    vzalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    vzalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    vzalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    vzalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    vzalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    vzalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    vzalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    vzalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    vzalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    vzalloc(
    - sizeof(TYPE) * (COUNT_ID)
    + array_size(COUNT_ID, sizeof(TYPE))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE) * COUNT_ID
    + array_size(COUNT_ID, sizeof(TYPE))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE) * (COUNT_CONST)
    + array_size(COUNT_CONST, sizeof(TYPE))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE) * COUNT_CONST
    + array_size(COUNT_CONST, sizeof(TYPE))
    , ...)
    |
    vzalloc(
    - sizeof(THING) * (COUNT_ID)
    + array_size(COUNT_ID, sizeof(THING))
    , ...)
    |
    vzalloc(
    - sizeof(THING) * COUNT_ID
    + array_size(COUNT_ID, sizeof(THING))
    , ...)
    |
    vzalloc(
    - sizeof(THING) * (COUNT_CONST)
    + array_size(COUNT_CONST, sizeof(THING))
    , ...)
    |
    vzalloc(
    - sizeof(THING) * COUNT_CONST
    + array_size(COUNT_CONST, sizeof(THING))
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    vzalloc(
    - SIZE * COUNT
    + array_size(COUNT, SIZE)
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    vzalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    vzalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    vzalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    vzalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    vzalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    vzalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    vzalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    vzalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    vzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    vzalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vzalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vzalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vzalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vzalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vzalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vzalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    vzalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    vzalloc(C1 * C2 * C3, ...)
    |
    vzalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants.
    @@
    expression E1, E2;
    constant C1, C2;
    @@

    (
    vzalloc(C1 * C2, ...)
    |
    vzalloc(
    - E1 * E2
    + array_size(E1, E2)
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     
  • The kzalloc_node() function has a 2-factor argument form, kcalloc_node(). This
    patch replaces cases of:

    kzalloc_node(a * b, gfp, node)

    with:
    kcalloc_node(a * b, gfp, node)

    as well as handling cases of:

    kzalloc_node(a * b * c, gfp, node)

    with:

    kzalloc_node(array3_size(a, b, c), gfp, node)

    as it's slightly less ugly than:

    kcalloc_node(array_size(a, b), c, gfp, node)

    This does, however, attempt to ignore constant size factors like:

    kzalloc_node(4 * 1024, gfp, node)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kzalloc_node(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kzalloc_node(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kzalloc_node(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc_node(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc_node(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc_node(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc_node(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc_node(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc_node(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kzalloc_node(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kzalloc_node
    + kcalloc_node
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kzalloc_node(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc_node(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc_node(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc_node(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc_node(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc_node(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc_node(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc_node(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kzalloc_node(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc_node(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc_node(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc_node(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc_node(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kzalloc_node(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kzalloc_node(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc_node(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc_node(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc_node(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc_node(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc_node(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc_node(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc_node(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kzalloc_node(C1 * C2 * C3, ...)
    |
    kzalloc_node(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc_node(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc_node(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc_node(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kzalloc_node(sizeof(THING) * C2, ...)
    |
    kzalloc_node(sizeof(TYPE) * C2, ...)
    |
    kzalloc_node(C1 * C2 * C3, ...)
    |
    kzalloc_node(C1 * C2, ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kzalloc_node
    + kcalloc_node
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     
  • The kzalloc() function has a 2-factor argument form, kcalloc(). This
    patch replaces cases of:

    kzalloc(a * b, gfp)

    with:
    kcalloc(a * b, gfp)

    as well as handling cases of:

    kzalloc(a * b * c, gfp)

    with:

    kzalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kzalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kzalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kzalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kzalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kzalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kzalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kzalloc
    + kcalloc
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kzalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kzalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kzalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kzalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kzalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kzalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kzalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kzalloc(sizeof(THING) * C2, ...)
    |
    kzalloc(sizeof(TYPE) * C2, ...)
    |
    kzalloc(C1 * C2 * C3, ...)
    |
    kzalloc(C1 * C2, ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kzalloc
    + kcalloc
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     
  • The kmalloc() function has a 2-factor argument form, kmalloc_array(). This
    patch replaces cases of:

    kmalloc(a * b, gfp)

    with:
    kmalloc_array(a * b, gfp)

    as well as handling cases of:

    kmalloc(a * b * c, gfp)

    with:

    kmalloc(array3_size(a, b, c), gfp)

    as it's slightly less ugly than:

    kmalloc_array(array_size(a, b), c, gfp)

    This does, however, attempt to ignore constant size factors like:

    kmalloc(4 * 1024, gfp)

    though any constants defined via macros get caught up in the conversion.

    Any factors with a sizeof() of "unsigned char", "char", and "u8" were
    dropped, since they're redundant.

    The tools/ directory was manually excluded, since it has its own
    implementation of kmalloc().

    The Coccinelle script used for this was:

    // Fix redundant parens around sizeof().
    @@
    type TYPE;
    expression THING, E;
    @@

    (
    kmalloc(
    - (sizeof(TYPE)) * E
    + sizeof(TYPE) * E
    , ...)
    |
    kmalloc(
    - (sizeof(THING)) * E
    + sizeof(THING) * E
    , ...)
    )

    // Drop single-byte sizes and redundant parens.
    @@
    expression COUNT;
    typedef u8;
    typedef __u8;
    @@

    (
    kmalloc(
    - sizeof(u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * (COUNT)
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(__u8) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(char) * COUNT
    + COUNT
    , ...)
    |
    kmalloc(
    - sizeof(unsigned char) * COUNT
    + COUNT
    , ...)
    )

    // 2-factor product with sizeof(type/expression) and identifier or constant.
    @@
    type TYPE;
    expression THING;
    identifier COUNT_ID;
    constant COUNT_CONST;
    @@

    (
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_ID)
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_ID
    + COUNT_ID, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (COUNT_CONST)
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * COUNT_CONST
    + COUNT_CONST, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_ID)
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_ID
    + COUNT_ID, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (COUNT_CONST)
    + COUNT_CONST, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * COUNT_CONST
    + COUNT_CONST, sizeof(THING)
    , ...)
    )

    // 2-factor product, only identifiers.
    @@
    identifier SIZE, COUNT;
    @@

    - kmalloc
    + kmalloc_array
    (
    - SIZE * COUNT
    + COUNT, SIZE
    , ...)

    // 3-factor product with 1 sizeof(type) or sizeof(expression), with
    // redundant parens removed.
    @@
    expression THING;
    identifier STRIDE, COUNT;
    type TYPE;
    @@

    (
    kmalloc(
    - sizeof(TYPE) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(TYPE))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * (COUNT) * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * (STRIDE)
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    |
    kmalloc(
    - sizeof(THING) * COUNT * STRIDE
    + array3_size(COUNT, STRIDE, sizeof(THING))
    , ...)
    )

    // 3-factor product with 2 sizeof(variable), with redundant parens removed.
    @@
    expression THING1, THING2;
    identifier COUNT;
    type TYPE1, TYPE2;
    @@

    (
    kmalloc(
    - sizeof(TYPE1) * sizeof(TYPE2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(TYPE2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(THING1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(THING1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * COUNT
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    |
    kmalloc(
    - sizeof(TYPE1) * sizeof(THING2) * (COUNT)
    + array3_size(COUNT, sizeof(TYPE1), sizeof(THING2))
    , ...)
    )

    // 3-factor product, only identifiers, with redundant parens removed.
    @@
    identifier STRIDE, SIZE, COUNT;
    @@

    (
    kmalloc(
    - (COUNT) * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * STRIDE * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - (COUNT) * (STRIDE) * (SIZE)
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    |
    kmalloc(
    - COUNT * STRIDE * SIZE
    + array3_size(COUNT, STRIDE, SIZE)
    , ...)
    )

    // Any remaining multi-factor products, first at least 3-factor products,
    // when they're not all constants...
    @@
    expression E1, E2, E3;
    constant C1, C2, C3;
    @@

    (
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(
    - (E1) * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * E3
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - (E1) * (E2) * (E3)
    + array3_size(E1, E2, E3)
    , ...)
    |
    kmalloc(
    - E1 * E2 * E3
    + array3_size(E1, E2, E3)
    , ...)
    )

    // And then all remaining 2 factors products when they're not all constants,
    // keeping sizeof() as the second factor argument.
    @@
    expression THING, E1, E2;
    type TYPE;
    constant C1, C2, C3;
    @@

    (
    kmalloc(sizeof(THING) * C2, ...)
    |
    kmalloc(sizeof(TYPE) * C2, ...)
    |
    kmalloc(C1 * C2 * C3, ...)
    |
    kmalloc(C1 * C2, ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * (E2)
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(TYPE) * E2
    + E2, sizeof(TYPE)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * (E2)
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - sizeof(THING) * E2
    + E2, sizeof(THING)
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * E2
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - (E1) * (E2)
    + E1, E2
    , ...)
    |
    - kmalloc
    + kmalloc_array
    (
    - E1 * E2
    + E1, E2
    , ...)
    )

    Signed-off-by: Kees Cook

    Kees Cook
     
  • root_device_register() returns error pointers, it never returns NULL.

    Fixes: ca90800a91ba ("test_overflow: Add memory allocation overflow tests")
    Signed-off-by: Dan Carpenter
    Signed-off-by: Kees Cook

    Dan Carpenter
     
  • There are in-tree users of refcount_dec_and_lock() which must acquire the
    spin lock with interrupts disabled. To workaround the lack of an irqsave
    variant of refcount_dec_and_lock() they use local_irq_save() at the call
    site. This causes extra code and creates in some places unneeded long
    interrupt disabled times. These places need also extra treatment for
    PREEMPT_RT due to the disconnect of the irq disabling and the lock
    function.

    Implement the missing irqsave variant of the function.

    Signed-off-by: Anna-Maria Gleixner
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r20180612161621.22645-4-bigeasy@linutronix.de

    [bigeasy: s@atomic_dec_and_lock@refcount_dec_and_lock@g]

    Anna-Maria Gleixner
     
  • There are in-tree users of atomic_dec_and_lock() which must acquire the
    spin lock with interrupts disabled. To workaround the lack of an irqsave
    variant of atomic_dec_and_lock() they use local_irq_save() at the call
    site. This causes extra code and creates in some places unneeded long
    interrupt disabled times. These places need also extra treatment for
    PREEMPT_RT due to the disconnect of the irq disabling and the lock
    function.

    Implement the missing irqsave variant of the function.

    Signed-off-by: Anna-Maria Gleixner
    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra (Intel)
    Link: https://lkml.kernel.org/r20180612161621.22645-3-bigeasy@linutronix.de

    Anna-Maria Gleixner
     
  • Alpha provides a custom implementation of dec_and_lock(). The functions
    is split into two parts:
    - atomic_add_unless() + return 0 (fast path in assembly)
    - remaining part including locking (slow path in C)

    Comparing the result of the alpha implementation with the generic
    implementation compiled by gcc it looks like the fast path is optimized
    by avoiding a stack frame (and reloading the GP), register store and all
    this. This is only done in the slowpath.
    After marking the slowpath (atomic_dec_and_lock_1()) as "noinline" and
    doing the slowpath in C (the atomic_add_unless(atomic, -1, 1) part) I
    noticed differences in the resulting assembly:
    - the GP is still reloaded
    - atomic_add_unless() adds more memory barriers compared to the custom
    assembly
    - the custom assembly here does "load, sub, beq" while
    atomic_add_unless() does "load, cmpeq, add, bne". This is okay because
    it compares against zero after subtraction while the generic code
    compares against 1 before.

    I'm not sure if avoiding the stack frame (and GP reloading) brings a lot
    in terms of performance. Regarding the different barriers, Peter
    Zijlstra says:

    |refcount decrement needs to be a RELEASE operation, such that all the
    |load/stores to the object happen before we decrement the refcount.
    |
    |Otherwise things like:
    |
    | obj->foo = 5;
    | refcnt_dec(&obj->ref);
    |
    |can be re-ordered, which then allows fun scenarios like:
    |
    | CPU0 CPU1
    |
    | refcnt_dec(&obj->ref);
    | if (dec_and_test(&obj->ref))
    | free(obj);
    | obj->foo = 5; // oops UaF
    |
    |
    |This means (for alpha) that there should be a memory barrier _before_
    |the decrement, however the dec_and_lock asm thing only has one _after_,
    |which, per the above, is too late.
    |
    |The generic version using add_unless will result in memory barrier
    |before and after (because that is the rule for atomic ops with a return
    |value) which is strictly too many barriers for the refcount story, but
    |who knows what other ordering requirements code has.

    Remove the custom alpha implementation of dec_and_lock() and if it is an
    issue (performance wise) then the fast path could still be inlined.

    Signed-off-by: Sebastian Andrzej Siewior
    Signed-off-by: Thomas Gleixner
    Acked-by: Peter Zijlstra (Intel)
    Cc: Richard Henderson
    Cc: Ivan Kokshaysky
    Cc: Matt Turner
    Cc: linux-alpha@vger.kernel.org
    Link: https://lkml.kernel.org/r/20180606115918.GG12198@hirez.programming.kicks-ass.net
    Link: https://lkml.kernel.org/r20180612161621.22645-2-bigeasy@linutronix.de

    Sebastian Andrzej Siewior
     
  • Pull MIPS updates from James Hogan:
    "These are the main MIPS changes for 4.18.

    Rough overview:

    - MAINTAINERS: Add Paul Burton as MIPS co-maintainer

    - Misc: Generic compiler intrinsics, Y2038 improvements, Perf+MT fixes

    - Platform support: Netgear WNR1000 V3, Microsemi Ocelot integrated
    switch, Ingenic watchdog cleanups

    More detailed summary:

    Maintainers:

    - Add Paul Burton as MIPS co-maintainer, as I soon won't have access
    to much MIPS hardware, nor enough time to properly maintain MIPS on
    my own.

    Miscellaneous:

    - Use generic GCC library routines from lib/
    - Add notrace to generic ucmpdi2 implementation
    - Rename compiler intrinsic selects to GENERIC_LIB_*
    - vmlinuz: Use generic ashldi3

    - y2038: Convert update/read_persistent_clock() to *_clock64()
    - sni: Remove read_persistent_clock()

    - perf: Fix perf with MT counting other threads
    - Probe for per-TC perf counters in cpu-probe.c
    - Use correct VPE ID for VPE tracing

    Minor cleanups:

    - Avoid unneeded built-in.a in DTS dirs

    - sc-debugfs: Re-use kstrtobool_from_user

    - memset.S: Reinstate delay slot indentation

    - VPE: Fix spelling "uneeded" -> "Unneeded"

    Platform support:

    BCM47xx:

    - Add support for Netgear WNR1000 V3

    - firmware: Support small NVRAM partitions

    - Use __initdata for LEDs platform data

    Ingenic:

    - Watchdog driver & platform code improvements:
    - Disable clock after stopping counter
    - Use devm_* functions
    - Drop module remove function
    - Move platform reset code to restart handler in driver
    - JZ4740: Convert watchdog instantiation to DT
    - JZ4780: Fix watchdog DT node
    - qi_lb60_defconfig: Enable watchdog driver

    Microsemi:

    - Ocelot: Add support for integrated switch
    - pcb123: Connect phys to ports"

    * tag 'mips_4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/mips/linux: (30 commits)
    MAINTAINERS: Add Paul Burton as MIPS co-maintainer
    MIPS: ptrace: Make FPU context layout comments match reality
    MIPS: memset.S: Reinstate delay slot indentation
    MIPS: perf: Fix perf with MT counting other threads
    MIPS: perf: Use correct VPE ID when setting up VPE tracing
    MIPS: perf: More robustly probe for the presence of per-tc counters
    MIPS: Probe for MIPS MT perf counters per TC
    MIPS: mscc: Connect phys to ports on ocelot_pcb123
    MIPS: mscc: Add switch to ocelot
    MIPS: JZ4740: Drop old platform reset code
    MIPS: qi_lb60: Enable the jz4740-wdt driver
    MIPS: JZ4780: dts: Fix watchdog node
    MIPS: JZ4740: dts: Add bindings for the jz4740-wdt driver
    watchdog: JZ4740: Drop module remove function
    watchdog: JZ4740: Register a restart handler
    watchdog: JZ4740: Use devm_* functions
    watchdog: JZ4740: Disable clock after stopping counter
    MIPS: VPE: Fix spelling mistake: "uneeded" -> "unneeded"
    MIPS: Re-use kstrtobool_from_user()
    MIPS: Convert update_persistent_clock() to update_persistent_clock64()
    ...

    Linus Torvalds
     

11 Jun, 2018

1 commit

  • As Documentation/kbuild/kconfig-language.txt notes, 'select' should be
    be used with care - it forces a lower limit of another symbol, ignoring
    the dependency. Currently, KCOV can select GCC_PLUGINS even if arch
    does not select HAVE_GCC_PLUGINS. This could cause the unmet direct
    dependency.

    Now that Kconfig can test compiler capability, let's handle this in a
    more sophisticated way.

    There are two ways to enable KCOV; use the compiler that natively
    supports -fsanitize-coverage=trace-pc, or build the SANCOV plugin if
    the compiler has ability to build GCC plugins. Hence, the correct
    dependency for KCOV is:

    depends on CC_HAS_SANCOV_TRACE_PC || GCC_PLUGINS

    You do not need to build the SANCOV plugin if the compiler already
    supports -fsanitize-coverage=trace-pc. Hence, the select should be:

    select GCC_PLUGIN_SANCOV if !CC_HAS_SANCOV_TRACE_PC

    With this, GCC_PLUGIN_SANCOV is selected only when necessary, so
    scripts/Makefile.gcc-plugins can be cleaner.

    I also cleaned up Kconfig and scripts/Makefile.kcov as well.

    Signed-off-by: Masahiro Yamada
    Reviewed-by: Kees Cook

    Masahiro Yamada
     

09 Jun, 2018

1 commit

  • Pull libnvdimm updates from Dan Williams:
    "This adds a user for the new 'bytes-remaining' updates to
    memcpy_mcsafe() that you already received through Ingo via the
    x86-dax- for-linus pull.

    Not included here, but still targeting this cycle, is support for
    handling memory media errors (poison) consumed via userspace dax
    mappings.

    Summary:

    - DAX broke a fundamental assumption of truncate of file mapped
    pages. The truncate path assumed that it is safe to disconnect a
    pinned page from a file and let the filesystem reclaim the physical
    block. With DAX the page is equivalent to the filesystem block.
    Introduce dax_layout_busy_page() to enable filesystems to wait for
    pinned DAX pages to be released. Without this wait a filesystem
    could allocate blocks under active device-DMA to a new file.

    - DAX arranges for the block layer to be bypassed and uses
    dax_direct_access() + copy_to_iter() to satisfy read(2) calls.
    However, the memcpy_mcsafe() facility is available through the pmem
    block driver. In order to safely handle media errors, via the DAX
    block-layer bypass, introduce copy_to_iter_mcsafe().

    - Fix cache management policy relative to the ACPI NFIT Platform
    Capabilities Structure to properly elide cache flushes when they
    are not necessary. The table indicates whether CPU caches are
    power-fail protected. Clarify that a deep flush is always performed
    on REQ_{FUA,PREFLUSH} requests"

    * tag 'libnvdimm-for-4.18' of git://git.kernel.org/pub/scm/linux/kernel/git/nvdimm/nvdimm: (21 commits)
    dax: Use dax_write_cache* helpers
    libnvdimm, pmem: Do not flush power-fail protected CPU caches
    libnvdimm, pmem: Unconditionally deep flush on *sync
    libnvdimm, pmem: Complete REQ_FLUSH => REQ_PREFLUSH
    acpi, nfit: Remove ecc_unit_size
    dax: dax_insert_mapping_entry always succeeds
    libnvdimm, e820: Register all pmem resources
    libnvdimm: Debug probe times
    linvdimm, pmem: Preserve read-only setting for pmem devices
    x86, nfit_test: Add unit test for memcpy_mcsafe()
    pmem: Switch to copy_to_iter_mcsafe()
    dax: Report bytes remaining in dax_iomap_actor()
    dax: Introduce a ->copy_to_iter dax operation
    uio, lib: Fix CONFIG_ARCH_HAS_UACCESS_MCSAFE compilation
    xfs, dax: introduce xfs_break_dax_layouts()
    xfs: prepare xfs_break_layouts() for another layout type
    xfs: prepare xfs_break_layouts() to be called with XFS_MMAPLOCK_EXCL
    mm, fs, dax: handle layout changes to pinned dax mappings
    mm: fix __gup_device_huge vs unmap
    mm: introduce MEMORY_DEVICE_FS_DAX and CONFIG_DEV_PAGEMAP_OPS
    ...

    Linus Torvalds