1. 16 Apr, 2020 2 commits
    • Will Deacon's avatar
      READ_ONCE: Enforce atomicity for {READ,WRITE}_ONCE() memory accesses · 9e343b46
      Will Deacon authored
      {READ,WRITE}_ONCE() cannot guarantee atomicity for arbitrary data sizes.
      This can be surprising to callers that might incorrectly be expecting
      atomicity for accesses to aggregate structures, although there are other
      callers where tearing is actually permissable (e.g. if they are using
      something akin to sequence locking to protect the access).
      
      Linus sayeth:
      
        | We could also look at being stricter for the normal READ/WRITE_ONCE(),
        | and require that they are
        |
        | (a) regular integer types
        |
        | (b) fit in an atomic word
        |
        | We actually did (b) for a while, until we noticed that we do it on
        | loff_t's etc and relaxed the rules. But maybe we could have a
        | "non-atomic" version of READ/WRITE_ONCE() that is used for the
        | questionable cases?
      
      The slight snag is that we also have to support 64-bit accesses on 32-bit
      architectures, as these appear to be widespread and tend to work out ok
      if either the architecture supports atomic 64-bit accesses (x86, armv7)
      or if the variable being accesses represents a virtual address and
      therefore only requires 32-bit atomicity in practice.
      
      Take a step in that direction by introducing a variant of
      'compiletime_assert_atomic_type()' and use it to check the pointer
      argument to {READ,WRITE}_ONCE(). Expose __{READ,WRITE}_ONCE() variants
      which are allowed to tear and convert the one broken caller over to the
      new macros.
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      9e343b46
    • Will Deacon's avatar
      READ_ONCE: Simplify implementations of {READ,WRITE}_ONCE() · a5460b5e
      Will Deacon authored
      The implementations of {READ,WRITE}_ONCE() suffer from a significant
      amount of indirection and complexity due to a historic GCC bug:
      
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145
      
      which was originally worked around by 230fa253 ("kernel: Provide
      READ_ONCE and ASSIGN_ONCE").
      
      Since GCC 4.8 is fairly vintage at this point and we emit a warning if
      we detect it during the build, return {READ,WRITE}_ONCE() to their former
      glory with an implementation that is easier to understand and, crucially,
      more amenable to optimisation. A side effect of this simplification is
      that WRITE_ONCE() no longer returns a value, but nobody seems to be
      relying on that and the new behaviour is aligned with smp_store_release().
      Suggested-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Christian Borntraeger <borntraeger@de.ibm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      a5460b5e
  2. 15 Apr, 2020 5 commits
    • Will Deacon's avatar
      arm64: csum: Disable KASAN for do_csum() · c6a771d9
      Will Deacon authored
      do_csum() over-reads the source buffer and therefore abuses
      READ_ONCE_NOCHECK() to avoid tripping up KASAN. In preparation for
      READ_ONCE_NOCHECK() becoming a macro, and therefore losing its
      '__no_sanitize_address' annotation, just annotate do_csum() explicitly
      and fall back to normal loads.
      
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      c6a771d9
    • Will Deacon's avatar
      fault_inject: Don't rely on "return value" from WRITE_ONCE() · 9b4fb5ce
      Will Deacon authored
      It's a bit weird that WRITE_ONCE() evaluates to the value it stores and
      it's different to smp_store_release(), which can't be used this way.
      
      In preparation for preventing this in WRITE_ONCE(), change the fault
      injection code to use a local variable instead.
      
      Cc: Akinobu Mita <akinobu.mita@gmail.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      9b4fb5ce
    • Will Deacon's avatar
      net: tls: Avoid assigning 'const' pointer to non-const pointer · 9a893949
      Will Deacon authored
      tls_build_proto() uses WRITE_ONCE() to assign a 'const' pointer to a
      'non-const' pointer. Cleanups to the implementation of WRITE_ONCE() mean
      that this will give rise to a compiler warning, just like a plain old
      assignment would do:
      
        | net/tls/tls_main.c: In function ‘tls_build_proto’:
        | ./include/linux/compiler.h:229:30: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
        | net/tls/tls_main.c:640:4: note: in expansion of macro ‘smp_store_release’
        |   640 |    smp_store_release(&saved_tcpv6_prot, prot);
        |       |    ^~~~~~~~~~~~~~~~~
      
      Drop the const qualifier from the local 'prot' variable, as it isn't
      needed.
      
      Cc: Boris Pismenny <borisp@mellanox.com>
      Cc: Aviad Yehezkel <aviadye@mellanox.com>
      Cc: John Fastabend <john.fastabend@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      9a893949
    • Will Deacon's avatar
      netfilter: Avoid assigning 'const' pointer to non-const pointer · 514cc55b
      Will Deacon authored
      nf_remove_net_hook() uses WRITE_ONCE() to assign a 'const' pointer to a
      'non-const' pointer. Cleanups to the implementation of WRITE_ONCE() mean
      that this will give rise to a compiler warning, just like a plain old
      assignment would do:
      
        | In file included from ./include/linux/export.h:43,
        |                  from ./include/linux/linkage.h:7,
        |                  from ./include/linux/kernel.h:8,
        |                  from net/netfilter/core.c:9:
        | net/netfilter/core.c: In function ‘nf_remove_net_hook’:
        | ./include/linux/compiler.h:216:30: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
        |   *(volatile typeof(x) *)&(x) = (val);  \
        |                               ^
        | net/netfilter/core.c:379:3: note: in expansion of macro ‘WRITE_ONCE’
        |    WRITE_ONCE(orig_ops[i], &dummy_ops);
        |    ^~~~~~~~~~
      
      Follow the pattern used elsewhere in this file and add a cast to 'void *'
      to squash the warning.
      
      Cc: Pablo Neira Ayuso <pablo@netfilter.org>
      Cc: Jozsef Kadlecsik <kadlec@netfilter.org>
      Cc: Florian Westphal <fw@strlen.de>
      Cc: "David S. Miller" <davem@davemloft.net>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      514cc55b
    • Will Deacon's avatar
      compiler/gcc: Raise minimum GCC version for kernel builds to 4.8 · 5429ef62
      Will Deacon authored
      It is very rare to see versions of GCC prior to 4.8 being used to build
      the mainline kernel. These old compilers are also know to have codegen
      issues which can lead to silent miscompilation:
      
      https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58145
      
      Raise the minimum GCC version for kernel build to 4.8 and remove some
      tautological Kconfig dependencies as a consequence.
      
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Acked-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarNick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      5429ef62
  3. 12 Apr, 2020 10 commits
    • Linus Torvalds's avatar
      Linux 5.7-rc1 · 8f3d9f35
      Linus Torvalds authored
      8f3d9f35
    • Linus Torvalds's avatar
      MAINTAINERS: sort field names for all entries · 3b50142d
      Linus Torvalds authored
      This sorts the actual field names too, potentially causing even more
      chaos and confusion at merge time if you have edited the MAINTAINERS
      file.  But the end result is a more consistent layout, and hopefully
      it's a one-time pain minimized by doing this just before the -rc1
      release.
      
      This was entirely scripted:
      
        ./scripts/parse-maintainers.pl --input=MAINTAINERS --output=MAINTAINERS --order
      Requested-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3b50142d
    • Linus Torvalds's avatar
      MAINTAINERS: sort entries by entry name · 4400b7d6
      Linus Torvalds authored
      They are all supposed to be sorted, but people who add new entries don't
      always know the alphabet.  Plus sometimes the entry names get edited,
      and people don't then re-order the entry.
      
      Let's see how painful this will be for merging purposes (the MAINTAINERS
      file is often edited in various different trees), but Joe claims there's
      relatively few patches in -next that touch this, and doing it just
      before -rc1 is likely the best time.  Fingers crossed.
      
      This was scripted with
      
        /scripts/parse-maintainers.pl --input=MAINTAINERS --output=MAINTAINERS
      
      but then I also ended up manually upper-casing a few entry names that
      stood out when looking at the end result.
      Requested-by: default avatarJoe Perches <joe@perches.com>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      4400b7d6
    • Linus Torvalds's avatar
      Merge tag 'x86-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 4f8a3cc1
      Linus Torvalds authored
      Pull x86 fixes from Thomas Gleixner:
       "A set of three patches to fix the fallout of the newly added split
        lock detection feature.
      
        It addressed the case where a KVM guest triggers a split lock #AC and
        KVM reinjects it into the guest which is not prepared to handle it.
      
        Add proper sanity checks which prevent the unconditional injection
        into the guest and handles the #AC on the host side in the same way as
        user space detections are handled. Depending on the detection mode it
        either warns and disables detection for the task or kills the task if
        the mode is set to fatal"
      
      * tag 'x86-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        KVM: VMX: Extend VMXs #AC interceptor to handle split lock #AC in guest
        KVM: x86: Emulate split-lock access as a write in emulator
        x86/split_lock: Provide handle_guest_split_lock()
      4f8a3cc1
    • Linus Torvalds's avatar
      Merge tag 'timers-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 0785249f
      Linus Torvalds authored
      Pull time(keeping) updates from Thomas Gleixner:
      
       - Fix the time_for_children symlink in /proc/$PID/ so it properly
         reflects that it part of the 'time' namespace
      
       - Add the missing userns limit for the allowed number of time
         namespaces, which was half defined but the actual array member was
         not added. This went unnoticed as the array has an exessive empty
         member at the end but introduced a user visible regression as the
         output was corrupted.
      
       - Prevent further silent ucount corruption by adding a BUILD_BUG_ON()
         to catch half updated data.
      
      * tag 'timers-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        ucount: Make sure ucounts in /proc/sys/user don't regress again
        time/namespace: Add max_time_namespaces ucount
        time/namespace: Fix time_for_children symlink
      0785249f
    • Linus Torvalds's avatar
      Merge tag 'sched-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 590680d1
      Linus Torvalds authored
      Pull scheduler fixes/updates from Thomas Gleixner:
      
       - Deduplicate the average computations in the scheduler core and the
         fair class code.
      
       - Fix a raise between runtime distribution and assignement which can
         cause exceeding the quota by up to 70%.
      
       - Prevent negative results in the imbalanace calculation
      
       - Remove a stale warning in the workqueue code which can be triggered
         since the call site was moved out of preempt disabled code. It's a
         false positive.
      
       - Deduplicate the print macros for procfs
      
       - Add the ucmap values to the SCHED_DEBUG procfs output for completness
      
      * tag 'sched-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/debug: Add task uclamp values to SCHED_DEBUG procfs
        sched/debug: Factor out printing formats into common macros
        sched/debug: Remove redundant macro define
        sched/core: Remove unused rq::last_load_update_tick
        workqueue: Remove the warning in wq_worker_sleeping()
        sched/fair: Fix negative imbalance in imbalance calculation
        sched/fair: Fix race between runtime distribution and assignment
        sched/fair: Align rq->avg_idle and rq->avg_scan_cost
      590680d1
    • Linus Torvalds's avatar
      Merge tag 'perf-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 20e2aa81
      Linus Torvalds authored
      Pull perf fixes from Thomas Gleixner:
       "Three fixes/updates for perf:
      
         - Fix the perf event cgroup tracking which tries to track the cgroup
           even for disabled events.
      
         - Add Ice Lake server support for uncore events
      
         - Disable pagefaults when retrieving the physical address in the
           sampling code"
      
      * tag 'perf-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/core: Disable page faults when getting phys address
        perf/x86/intel/uncore: Add Ice Lake server uncore support
        perf/cgroup: Correct indirection in perf_less_group_idx()
        perf/core: Fix event cgroup tracking
      20e2aa81
    • Linus Torvalds's avatar
      Merge tag 'locking-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 652fa53c
      Linus Torvalds authored
      Pull locking fixes from Thomas Gleixner:
       "Three small fixes/updates for the locking core code:
      
         - Plug a task struct reference leak in the percpu rswem
           implementation.
      
         - Document the refcount interaction with PID_MAX_LIMIT
      
         - Improve the 'invalid wait context' data dump in lockdep so it
           contains all information which is required to decode the problem"
      
      * tag 'locking-urgent-2020-04-12' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/lockdep: Improve 'invalid wait context' splat
        locking/refcount: Document interaction with PID_MAX_LIMIT
        locking/percpu-rwsem: Fix a task_struct refcount
      652fa53c
    • Linus Torvalds's avatar
      Merge tag '5.7-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6 · 4119bf9f
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
       "Ten cifs/smb fixes:
      
         - five RDMA (smbdirect) related fixes
      
         - add experimental support for swap over SMB3 mounts
      
         - also a fix which improves performance of signed connections"
      
      * tag '5.7-rc-smb3-fixes-part2' of git://git.samba.org/sfrench/cifs-2.6:
        smb3: enable swap on SMB3 mounts
        smb3: change noisy error message to FYI
        smb3: smbdirect support can be configured by default
        cifs: smbd: Do not schedule work to send immediate packet on every receive
        cifs: smbd: Properly process errors on ib_post_send
        cifs: Allocate crypto structures on the fly for calculating signatures of incoming packets
        cifs: smbd: Update receive credits before sending and deal with credits roll back on failure before sending
        cifs: smbd: Check send queue size before posting a send
        cifs: smbd: Merge code to track pending packets
        cifs: ignore cached share root handle closing errors
      4119bf9f
    • Linus Torvalds's avatar
      Merge tag 'nfs-for-5.7-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs · 50bda5fa
      Linus Torvalds authored
      Pull NFS client bugfix from Trond Myklebust:
       "Fix an RCU read lock leakage in pnfs_alloc_ds_commits_list()"
      
      * tag 'nfs-for-5.7-2' of git://git.linux-nfs.org/projects/trondmy/linux-nfs:
        pNFS: Fix RCU lock leakage
      50bda5fa
  4. 11 Apr, 2020 14 commits
  5. 10 Apr, 2020 9 commits