1. 08 May, 2020 1 commit
  2. 06 May, 2020 3 commits
  3. 27 Apr, 2020 2 commits
  4. 14 Apr, 2020 9 commits
    • Marco Elver's avatar
      kcsan: Make reporting aware of KCSAN tests · cdb9b07d
      Marco Elver authored
      Reporting hides KCSAN runtime functions in the stack trace, with
      filtering done based on function names. Currently this included all
      functions (or modules) that would match "kcsan_". Make the filter aware
      of KCSAN tests, which contain "kcsan_test", and are no longer skipped in
      the report.
      
      This is in preparation for adding a KCSAN test module.
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      cdb9b07d
    • Marco Elver's avatar
      kcsan: Fix function matching in report · f770ed10
      Marco Elver authored
      Pass string length as returned by scnprintf() to strnstr(), since
      strnstr() searches exactly len bytes in haystack, even if it contains a
      NUL-terminator before haystack+len.
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      f770ed10
    • Marco Elver's avatar
      kcsan: Change data_race() to no longer require marking racing accesses · d071e913
      Marco Elver authored
      Thus far, accesses marked with data_race() would still require the
      racing access to be marked in some way (be it with READ_ONCE(),
      WRITE_ONCE(), or data_race() itself), as otherwise KCSAN would still
      report a data race.  This requirement, however, seems to be unintuitive,
      and some valid use-cases demand *not* marking other accesses, as it
      might hide more serious bugs (e.g. diagnostic reads).
      
      Therefore, this commit changes data_race() to no longer require marking
      racing accesses (although it's still recommended if possible).
      
      The alternative would have been introducing another variant of
      data_race(), however, since usage of data_race() already needs to be
      carefully reasoned about, distinguishing between these cases likely adds
      more complexity in the wrong place.
      
      Link: https://lkml.kernel.org/r/20200331131002.GA30975@willie-the-truck
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Cc: Will Deacon <will@kernel.org>
      Cc: Qian Cai <cai@lca.pw>
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      d071e913
    • Marco Elver's avatar
      kcsan: Move kcsan_{disable,enable}_current() to kcsan-checks.h · 01b4ff58
      Marco Elver authored
      Both affect access checks, and should therefore be in kcsan-checks.h.
      This is in preparation to use these in compiler.h.
      Acked-by: default avatarWill Deacon <will@kernel.org>
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      01b4ff58
    • Marco Elver's avatar
      kcsan: Introduce scoped ASSERT_EXCLUSIVE macros · d8949ef1
      Marco Elver authored
      Introduce ASSERT_EXCLUSIVE_*_SCOPED(), which provide an intuitive
      interface to use the scoped-access feature, without having to explicitly
      mark the start and end of the desired scope. Basing duration of the
      checks on scope avoids accidental misuse and resulting false positives,
      which may be hard to debug. See added comments for usage.
      
      The macros are implemented using __attribute__((__cleanup__(func))),
      which is supported by all compilers that currently support KCSAN.
      Suggested-by: default avatarBoqun Feng <boqun.feng@gmail.com>
      Suggested-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      d8949ef1
    • Marco Elver's avatar
      objtool, kcsan: Add explicit check functions to uaccess whitelist · 9967683c
      Marco Elver authored
      Add explicitly invoked KCSAN check functions to objtool's uaccess
      whitelist. This is needed in order to permit calling into
      kcsan_check_scoped_accesses() from the fast-path, which in turn calls
      __kcsan_check_access().  __kcsan_check_access() is the generic variant
      of the already whitelisted specializations __tsan_{read,write}N.
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      9967683c
    • Marco Elver's avatar
      kcsan: Add support for scoped accesses · 757a4cef
      Marco Elver authored
      This adds support for scoped accesses, where the memory range is checked
      for the duration of the scope. The feature is implemented by inserting
      the relevant access information into a list of scoped accesses for
      the current execution context, which are then checked (until removed)
      on every call (through instrumentation) into the KCSAN runtime.
      
      An alternative, more complex, implementation could set up a watchpoint for
      the scoped access, and keep the watchpoint set up. This, however, would
      require first exposing a handle to the watchpoint, as well as dealing
      with cases such as accesses by the same thread while the watchpoint is
      still set up (and several more cases). It is also doubtful if this would
      provide any benefit, since the majority of delay where the watchpoint
      is set up is likely due to the injected delays by KCSAN.  Therefore,
      the implementation in this patch is simpler and avoids hurting KCSAN's
      main use-case (normal data race detection); it also implicitly increases
      scoped-access race-detection-ability due to increased probability of
      setting up watchpoints by repeatedly calling __kcsan_check_access()
      throughout the scope of the access.
      
      The implementation required adding an additional conditional branch to
      the fast-path. However, the microbenchmark showed a *speedup* of ~5%
      on the fast-path. This appears to be due to subtly improved codegen by
      GCC from moving get_ctx() and associated load of preempt_count earlier.
      Suggested-by: default avatarBoqun Feng <boqun.feng@gmail.com>
      Suggested-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      757a4cef
    • Marco Elver's avatar
      kcsan: Avoid blocking producers in prepare_report() · 6119418f
      Marco Elver authored
      To avoid deadlock in case watchers can be interrupted, we need to ensure
      that producers of the struct other_info can never be blocked by an
      unrelated consumer. (Likely to occur with KCSAN_INTERRUPT_WATCHER.)
      
      There are several cases that can lead to this scenario, for example:
      
      	1. A watchpoint A was set up by task T1, but interrupted by
      	   interrupt I1. Some other thread (task or interrupt) finds
      	   watchpoint A consumes it, and sets other_info. Then I1 also
      	   finds some unrelated watchpoint B, consumes it, but is blocked
      	   because other_info is in use. T1 cannot consume other_info
      	   because I1 never returns -> deadlock.
      
      	2. A watchpoint A was set up by task T1, but interrupted by
      	   interrupt I1, which also sets up a watchpoint B. Some other
      	   thread finds watchpoint A, and consumes it and sets up
      	   other_info with its information. Similarly some other thread
      	   finds watchpoint B and consumes it, but is then blocked because
      	   other_info is in use. When I1 continues it sees its watchpoint
      	   was consumed, and that it must wait for other_info, which
      	   currently contains information to be consumed by T1. However, T1
      	   cannot unblock other_info because I1 never returns -> deadlock.
      
      To avoid this, we need to ensure that producers of struct other_info
      always have a usable other_info entry. This is obviously not the case
      with only a single instance of struct other_info, as concurrent
      producers must wait for the entry to be released by some consumer (which
      may be locked up as illustrated above).
      
      While it would be nice if producers could simply call kmalloc() and
      append their instance of struct other_info to a list, we are very
      limited in this code path: since KCSAN can instrument the allocators
      themselves, calling kmalloc() could lead to deadlock or corrupted
      allocator state.
      
      Since producers of the struct other_info will always succeed at
      try_consume_watchpoint(), preceding the call into kcsan_report(), we
      know that the particular watchpoint slot cannot simply be reused or
      consumed by another potential other_info producer. If we move removal of
      a watchpoint after reporting (by the consumer of struct other_info), we
      can see a consumed watchpoint as a held lock on elements of other_info,
      if we create a one-to-one mapping of a watchpoint to an other_info
      element.
      
      Therefore, the simplest solution is to create an array of struct
      other_info that is as large as the watchpoints array in core.c, and pass
      the watchpoint index to kcsan_report() for producers and consumers, and
      change watchpoints to be removed after reporting is done.
      
      With a default config on a 64-bit system, the array other_infos consumes
      ~37KiB. For most systems today this is not a problem. On smaller memory
      constrained systems, the config value CONFIG_KCSAN_NUM_WATCHPOINTS can
      be reduced appropriately.
      
      Overall, this change is a simplification of the prepare_report() code,
      and makes some of the checks (such as checking if at least one access is
      a write) redundant.
      
      Tested:
      $ tools/testing/selftests/rcutorture/bin/kvm.sh \
      	--cpus 12 --duration 10 --kconfig "CONFIG_DEBUG_INFO=y \
      	CONFIG_KCSAN=y CONFIG_KCSAN_ASSUME_PLAIN_WRITES_ATOMIC=n \
      	CONFIG_KCSAN_REPORT_VALUE_CHANGE_ONLY=n \
      	CONFIG_KCSAN_REPORT_ONCE_IN_MS=100000 CONFIG_KCSAN_VERBOSE=y \
      	CONFIG_KCSAN_INTERRUPT_WATCHER=y CONFIG_PROVE_LOCKING=y" \
      	--configs TREE03
      => No longer hangs and runs to completion as expected.
      Reported-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      6119418f
    • Marco Elver's avatar
      kcsan: Introduce report access_info and other_info · 135c0872
      Marco Elver authored
      Improve readability by introducing access_info and other_info structs,
      and in preparation of the following commit in this series replaces the
      single instance of other_info with an array of size 1.
      
      No functional change intended.
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Signed-off-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      135c0872
  5. 13 Apr, 2020 1 commit
  6. 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
  7. 11 Apr, 2020 14 commits