Skip to content
  1. Jan 20, 2022
    • Linus Torvalds's avatar
      Merge tag 'net-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · fa2e1ba3
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from netfilter, bpf.
      
        Quite a handful of old regression fixes but most of those are
        pre-5.16.
      
        Current release - regressions:
      
         - fix memory leaks in the skb free deferral scheme if upper layer
           protocols are used, i.e. in-kernel TCP readers like TLS
      
        Current release - new code bugs:
      
         - nf_tables: fix NULL check typo in _clone() functions
      
         - change the default to y for Vertexcom vendor Kconfig
      
         - a couple of fixes to incorrect uses of ref tracking
      
         - two fixes for constifying netdev->dev_addr
      
        Previous releases - regressions:
      
         - bpf:
            - various verifier fixes mainly around register offset handling
              when passed to helper functions
            - fix mount source displayed for bpffs (none -> bpffs)
      
         - bonding:
            - fix extraction of ports for connection hash calculation
            - fix bond_xmit_broadcast return value when some devices are down
      
         - phy: marvell: add Marvell specific PHY loopback
      
         - sch_api: don't skip qdisc attach on ingress, prevent ref leak
      
         - htb: restore minimal packet size handling in rate control
      
         - sfp: fix high power modules without diagnostic monitoring
      
         - mscc: ocelot:
            - don't let phylink re-enable TX PAUSE on the NPI port
            - don't dereference NULL pointers with shared tc filters
      
         - smsc95xx: correct reset handling for LAN9514
      
         - cpsw: avoid alignment faults by taking NET_IP_ALIGN into account
      
         - phy: micrel: use kszphy_suspend/_resume for irq aware devices,
           avoid races with the interrupt
      
        Previous releases - always broken:
      
         - xdp: check prog type before updating BPF link
      
         - smc: resolve various races around abnormal connection termination
      
         - sit: allow encapsulated IPv6 traffic to be delivered locally
      
         - axienet: fix init/reset handling, add missing barriers, read the
           right status words, stop queues correctly
      
         - add missing dev_put() in sock_timestamping_bind_phc()
      
        Misc:
      
         - ipv4: prevent accidentally passing RTO_ONLINK to
           ip_route_output_key_hash() by sanitizing flags
      
         - ipv4: avoid quadratic behavior in netns dismantle
      
         - stmmac: dwmac-oxnas: add support for OX810SE
      
         - fsl: xgmac_mdio: add workaround for erratum A-009885"
      
      * tag 'net-5.17-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (92 commits)
        ipv4: add net_hash_mix() dispersion to fib_info_laddrhash keys
        ipv4: avoid quadratic behavior in netns dismantle
        net/fsl: xgmac_mdio: Fix incorrect iounmap when removing module
        powerpc/fsl/dts: Enable WA for erratum A-009885 on fman3l MDIO buses
        dt-bindings: net: Document fsl,erratum-a009885
        net/fsl: xgmac_mdio: Add workaround for erratum A-009885
        net: mscc: ocelot: fix using match before it is set
        net: phy: micrel: use kszphy_suspend()/kszphy_resume for irq aware devices
        net: cpsw: avoid alignment faults by taking NET_IP_ALIGN into account
        nfc: llcp: fix NULL error pointer dereference on sendmsg() after failed bind()
        net: axienet: increase default TX ring size to 128
        net: axienet: fix for TX busy handling
        net: axienet: fix number of TX ring slots for available check
        net: axienet: Fix TX ring slot available check
        net: axienet: limit minimum TX ring size
        net: axienet: add missing memory barriers
        net: axienet: reset core on initialization prior to MDIO access
        net: axienet: Wait for PhyRstCmplt after core reset
        net: axienet: increase reset timeout
        bpf, selftests: Add ringbuf memory type confusion test
        ...
      fa2e1ba3
    • Linus Torvalds's avatar
      Merge branch 'akpm' (patches from Andrew) · f4484d13
      Linus Torvalds authored
      Merge more updates from Andrew Morton:
       "55 patches.
      
        Subsystems affected by this patch series: percpu, procfs, sysctl,
        misc, core-kernel, get_maintainer, lib, checkpatch, binfmt, nilfs2,
        hfs, fat, adfs, panic, delayacct, kconfig, kcov, and ubsan"
      
      * emailed patches from Andrew Morton <akpm@linux-foundation.org>: (55 commits)
        lib: remove redundant assignment to variable ret
        ubsan: remove CONFIG_UBSAN_OBJECT_SIZE
        kcov: fix generic Kconfig dependencies if ARCH_WANTS_NO_INSTR
        lib/Kconfig.debug: make TEST_KMOD depend on PAGE_SIZE_LESS_THAN_256KB
        btrfs: use generic Kconfig option for 256kB page size limit
        arch/Kconfig: split PAGE_SIZE_LESS_THAN_256KB from PAGE_SIZE_LESS_THAN_64KB
        configs: introduce debug.config for CI-like setup
        delayacct: track delays from memory compact
        Documentation/accounting/delay-accounting.rst: add thrashing page cache and direct compact
        delayacct: cleanup flags in struct task_delay_info and functions use it
        delayacct: fix incomplete disable operation when switch enable to disable
        delayacct: support swapin delay accounting for swapping without blkio
        panic: remove oops_id
        panic: use error_report_end tracepoint on warnings
        fs/adfs: remove unneeded variable make code cleaner
        FAT: use io_schedule_timeout() instead of congestion_wait()
        hfsplus: use struct_group_attr() for memcpy() region
        nilfs2: remove redundant pointer sbufs
        fs/binfmt_elf: use PT_LOAD p_align values for static PIE
        const_structs.checkpatch: add frequently used ops structs
        ...
      f4484d13
    • Colin Ian King's avatar
      lib: remove redundant assignment to variable ret · b1e78ef3
      Colin Ian King authored
      
      
      The variable ret is being assigned a value that is never read.  If the
      for-loop is entered then ret is immediately re-assigned a new value.  If
      the for-loop is not executed ret is never read.  The assignment is
      redundant and can be removed.
      
      Link: https://lkml.kernel.org/r/20211230134557.83633-1-colin.i.king@gmail.com
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Reviewed-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b1e78ef3
    • Kees Cook's avatar
      ubsan: remove CONFIG_UBSAN_OBJECT_SIZE · 69d0db01
      Kees Cook authored
      
      
      The object-size sanitizer is redundant to -Warray-bounds, and
      inappropriately performs its checks at run-time when all information
      needed for the evaluation is available at compile-time, making it quite
      difficult to use:
      
        https://bugzilla.kernel.org/show_bug.cgi?id=214861
      
      With -Warray-bounds almost enabled globally, it doesn't make sense to
      keep this around.
      
      Link: https://lkml.kernel.org/r/20211203235346.110809-1-keescook@chromium.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Michal Marek <michal.lkml@markovi.net>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Cc: "Peter Zijlstra (Intel)" <peterz@infradead.org>
      Cc: Stephen Rothwell <sfr@canb.auug.org.au>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      69d0db01
    • Marco Elver's avatar
      kcov: fix generic Kconfig dependencies if ARCH_WANTS_NO_INSTR · bece04b5
      Marco Elver authored
      Until recent versions of GCC and Clang, it was not possible to disable
      KCOV instrumentation via a function attribute.  The relevant function
      attribute was introduced in 540540d0 ("kcov: add
      __no_sanitize_coverage to fix noinstr for all architectures").
      
      x86 was the first architecture to want a working noinstr, and at the
      time no compiler support for the attribute existed yet.  Therefore,
      commit 0f1441b4 ("objtool: Fix noinstr vs KCOV") introduced the
      ability to NOP __sanitizer_cov_*() calls in .noinstr.text.
      
      However, this doesn't work for other architectures like arm64 and s390
      that want a working noinstr per ARCH_WANTS_NO_INSTR.
      
      At the time of 0f1441b4
      
      , we didn't yet have ARCH_WANTS_NO_INSTR,
      but now we can move the Kconfig dependency checks to the generic KCOV
      option.  KCOV will be available if:
      
      	- architecture does not care about noinstr, OR
      	- we have objtool support (like on x86), OR
      	- GCC is 12.0 or newer, OR
      	- Clang is 13.0 or newer.
      
      Link: https://lkml.kernel.org/r/20211201152604.3984495-1-elver@google.com
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Reviewed-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Cc: Mark Rutland <mark.rutland@arm.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: H. Peter Anvin <hpa@zytor.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Andrey Konovalov <andreyknvl@gmail.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bece04b5
    • Nathan Chancellor's avatar
      lib/Kconfig.debug: make TEST_KMOD depend on PAGE_SIZE_LESS_THAN_256KB · bbd2e05f
      Nathan Chancellor authored
      Commit b05fbcc3 ("btrfs: disable build on platforms having page size
      256K") disabled btrfs for configurations that used a 256kB page size.
      However, it did not fully solve the problem because CONFIG_TEST_KMOD
      selects CONFIG_BTRFS, which does not account for the dependency.  This
      results in a Kconfig warning and the failed BUILD_BUG_ON error
      returning.
      
        WARNING: unmet direct dependencies detected for BTRFS_FS
          Depends on [n]: BLOCK [=y] && !PPC_256K_PAGES && !PAGE_SIZE_256KB [=y]
          Selected by [m]:
          - TEST_KMOD [=m] && RUNTIME_TESTING_MENU [=y] && m && MODULES [=y] && NETDEVICES [=y] && NET_CORE [=y] && INET [=y] && BLOCK [=y]
      
      To resolve this, add CONFIG_PAGE_SIZE_LESS_THAN_256KB as a dependency of
      CONFIG_TEST_KMOD so there is no more invalid configuration or build
      errors.
      
      Link: https://lkml.kernel.org/r/20211129230141.228085-4-nathan@kernel.org
      Fixes: b05fbcc3
      
       ("btrfs: disable build on platforms having page size 256K")
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Cc: Chris Mason <clm@fb.com>
      Cc: David Sterba <dsterba@suse.com>
      Cc: Josef Bacik <josef@toxicpanda.com>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      bbd2e05f
    • Nathan Chancellor's avatar
      btrfs: use generic Kconfig option for 256kB page size limit · e9009095
      Nathan Chancellor authored
      Use the newly introduced CONFIG_PAGE_SIZE_LESS_THAN_256KB to describe
      the dependency introduced by commit b05fbcc3
      
       ("btrfs: disable build
      on platforms having page size 256K").
      
      Link: https://lkml.kernel.org/r/20211129230141.228085-3-nathan@kernel.org
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Acked-by: default avatarDavid Sterba <dsterba@suse.com>
      Cc: Chris Mason <clm@fb.com>
      Cc: Josef Bacik <josef@toxicpanda.com>
      Cc: kernel test robot <lkp@intel.com>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e9009095
    • Nathan Chancellor's avatar
      arch/Kconfig: split PAGE_SIZE_LESS_THAN_256KB from PAGE_SIZE_LESS_THAN_64KB · e4bbd20d
      Nathan Chancellor authored
      Patch series "Fix CONFIG_TEST_KMOD with 256kB page size".
      
      The kernel test robot reported a build error [1] from a failed assertion
      in fs/btrfs/inode.c with a hexagon randconfig that includes
      CONFIG_PAGE_SIZE_256KB.  This error is the same one that was addressed
      by commit b05fbcc3 ("btrfs: disable build on platforms having page
      size 256K") but CONFIG_TEST_KMOD selects CONFIG_BTRFS without having the
      "page size less than 256kB dependency", which results in the error
      reappearing.
      
      The first patch introduces CONFIG_PAGE_SIZE_LESS_THAN_256KB by splitting
      it off from CONFIG_PAGE_SIZE_LESS_THAN_64KB, which was introduced in
      commit 1f0e290c
      
       ("arch: Add generic Kconfig option indicating page
      size smaller than 64k") for a similar reason in 5.16-rc3.
      
      The second patch uses that configuration option for CONFIG_BTRFS to
      reduce duplication.
      
      The third patch resolves the build error by adding
      CONFIG_PAGE_SIZE_LESS_THAN_256KB as a dependency to CONFIG_TEST_KMOD so
      that CONFIG_BTRFS does not get enabled under that invalid configuration.
      
      [1]: https://lore.kernel.org/r/202111270255.UYOoN5VN-lkp@intel.com/
      
      This patch (of 3):
      
      btrfs requires a page size smaller than 256kB.  To use that dependency
      in other places, introduce CONFIG_PAGE_SIZE_LESS_THAN_256KB and reuse
      that dependency in CONFIG_PAGE_SIZE_LESS_THAN_64KB.
      
      Link: https://lkml.kernel.org/r/20211129230141.228085-1-nathan@kernel.org
      Link: https://lkml.kernel.org/r/20211129230141.228085-2-nathan@kernel.org
      Signed-off-by: default avatarNathan Chancellor <nathan@kernel.org>
      Cc: Chris Mason <clm@fb.com>
      Cc: Josef Bacik <josef@toxicpanda.com>
      Cc: David Sterba <dsterba@suse.com>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e4bbd20d
    • Qian Cai's avatar
      configs: introduce debug.config for CI-like setup · 0aaa8977
      Qian Cai authored
      
      
      Some general debugging features like kmemleak, KASAN, lockdep, UBSAN etc
      help fix many viruses like a microscope.  On the other hand, those
      features are scatter around and mixed up with more situational debugging
      options making them difficult to consume properly.  This cold help
      amplify the general debugging/testing efforts and help establish
      sensitive default values for those options across the broad.  This could
      also help different distros to collaborate on maintaining debug-flavored
      kernels.
      
      The config is based on years' experiences running daily CI inside the
      largest enterprise Linux distro company to seek regressions on
      linux-next builds on different bare-metal and virtual platforms.  It can
      be used for example,
      
        $ make ARCH=arm64 defconfig debug.config
      
      Since KASAN and KCSAN can't be enabled together, we will need to create
      a separate one for KCSAN later as well.
      
      Link: https://lkml.kernel.org/r/20211115134754.7334-1-quic_qiancai@quicinc.com
      Signed-off-by: default avatarQian Cai <quic_qiancai@quicinc.com>
      Acked-by: default avatarPaul E. McKenney <paulmck@kernel.org>
      Cc: Marco Elver <elver@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Daniel Thompson <daniel.thompson@linaro.org>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Naresh Kamboju <naresh.kamboju@linaro.org>
      Cc: "Stephen Rothwell" <sfr@canb.auug.org.au>
      Cc: Randy Dunlap <rdunlap@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0aaa8977
    • wangyong's avatar
      delayacct: track delays from memory compact · 5bf18281
      wangyong authored
      
      
      Delay accounting does not track the delay of memory compact.  When there
      is not enough free memory, tasks can spend a amount of their time
      waiting for compact.
      
      To get the impact of tasks in direct memory compact, measure the delay
      when allocating memory through memory compact.
      
      Also update tools/accounting/getdelays.c:
      
          / # ./getdelays_next  -di -p 304
          print delayacct stats ON
          printing IO accounting
          PID     304
      
          CPU             count     real total  virtual total    delay total  delay average
                            277      780000000      849039485       18877296          0.068ms
          IO              count    delay total  delay average
                              0              0              0ms
          SWAP            count    delay total  delay average
                              0              0              0ms
          RECLAIM         count    delay total  delay average
                              5    11088812685           2217ms
          THRASHING       count    delay total  delay average
                              0              0              0ms
          COMPACT         count    delay total  delay average
                              3          72758              0ms
          watch: read=0, write=0, cancelled_write=0
      
      Link: https://lkml.kernel.org/r/1638619795-71451-1-git-send-email-wang.yong12@zte.com.cn
      Signed-off-by: default avatarwangyong <wang.yong12@zte.com.cn>
      Reviewed-by: default avatarJiang Xuexin <jiang.xuexin@zte.com.cn>
      Reviewed-by: default avatarZhang Wenya <zhang.wenya1@zte.com.cn>
      Reviewed-by: default avatarYang Yang <yang.yang29@zte.com.cn>
      Reviewed-by: default avatarBalbir Singh <bsingharora@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5bf18281
    • wangyong's avatar
      Documentation/accounting/delay-accounting.rst: add thrashing page cache and direct compact · ec710aa8
      wangyong authored
      
      
      Add thrashing page cache and direct compact related descriptions and
      update the usage of getdelays userspace utility.
      
      The following patches modifications have been updated:
      https://lore.kernel.org/all/20190312102002.31737-4-jinpuwang@gmail.com/
      https://lore.kernel.org/all/1638619795-71451-1-git-send-email-
      wang.yong12@zte.com.cn/
      
      Link: https://lkml.kernel.org/r/1639583021-92977-1-git-send-email-wang.yong12@zte.com.cn
      Signed-off-by: default avatarwangyong <wang.yong12@zte.com.cn>
      Reviewed-by: default avatarYang Yang <yang.yang29@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Cc: Balbir Singh <bsingharora@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ec710aa8
    • Yang Yang's avatar
      delayacct: cleanup flags in struct task_delay_info and functions use it · 1193829d
      Yang Yang authored
      
      
      Flags in struct task_delay_info is used to distinguish the difference
      between swapin and blkio delay acountings.  But after patch "delayacct:
      support swapin delay accounting for swapping without blkio", there is no
      need to do that since swapin and blkio delay accounting use their own
      functions.
      
      Link: https://lkml.kernel.org/r/20211124065958.36703-1-yang.yang29@zte.com.cn
      Signed-off-by: default avatarYang Yang <yang.yang29@zte.com.cn>
      Cc: Balbir Singh <bsingharora@gmail.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Zeal Robot <zealci@zte.com.cn>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1193829d
    • Yang Yang's avatar
      delayacct: fix incomplete disable operation when switch enable to disable · 82065b72
      Yang Yang authored
      
      
      When a task is created after delayacct is enabled, kernel will do all
      the delay accountings for that task.  The problems is if user disables
      delayacct by set /proc/sys/kernel/task_delayacct to zero, only blkio
      delay accounting is disabled.
      
      Now disable all the kinds of delay accountings when
      /proc/sys/kernel/task_delayacct sets to zero.
      
      Link: https://lkml.kernel.org/r/20211123140342.32962-1-ran.xiaokai@zte.com.cn
      Signed-off-by: default avatarYang Yang <yang.yang29@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Cc: Balbir Singh <bsingharora@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      82065b72
    • Yang Yang's avatar
      delayacct: support swapin delay accounting for swapping without blkio · a3d5dc90
      Yang Yang authored
      
      
      Currently delayacct accounts swapin delay only for swapping that cause
      blkio.  If we use zram for swapping, tools/accounting/getdelays can't
      get any SWAP delay.
      
      It's useful to get zram swapin delay information, for example to adjust
      compress algorithm or /proc/sys/vm/swappiness.
      
      Reference to PSI, it accounts any kind of swapping by doing its work in
      swap_readpage(), no matter whether swapping causes blkio.  Let delayacct
      do the similar work.
      
      Link: https://lkml.kernel.org/r/20211112083813.8559-1-yang.yang29@zte.com.cn
      Signed-off-by: default avatarYang Yang <yang.yang29@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cn>
      Cc: Balbir Singh <bsingharora@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Johannes Weiner <hannes@cmpxchg.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a3d5dc90
    • Sebastian Andrzej Siewior's avatar
      panic: remove oops_id · e83a4472
      Sebastian Andrzej Siewior authored
      
      
      The oops id has been added as part of the end of trace marker for the
      kerneloops.org project.  The id is used to automatically identify
      duplicate submissions of the same report.  Identical looking reports
      with different a id can be considered as the same oops occurred again.
      
      The early initialisation of the oops_id can create a warning if the
      random core is not yet fully initialized.  On PREEMPT_RT it is
      problematic if the id is initialized on demand from non preemptible
      context.
      
      The kernel oops project is not available since 2017.  Remove the oops_id
      and use 0 in the output in case parser rely on it.
      
      Link: https://bugs.debian.org/953172
      Link: https://lkml.kernel.org/r/Ybdi16aP2NEugWHq@linutronix.de
      Signed-off-by: default avatarSebastian Andrzej Siewior <bigeasy@linutronix.de>
      Cc: Arjan van de Ven <arjan@linux.intel.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e83a4472
    • Marco Elver's avatar
      panic: use error_report_end tracepoint on warnings · 23b36fec
      Marco Elver authored
      
      
      Introduce the error detector "warning" to the error_report event and use
      the error_report_end tracepoint at the end of a warning report.
      
      This allows in-kernel tests but also userspace to more easily determine
      if a warning occurred without polling kernel logs.
      
      [akpm@linux-foundation.org: add comma to enum list, per Andy]
      
      Link: https://lkml.kernel.org/r/20211115085630.1756817-1-elver@google.com
      Signed-off-by: default avatarMarco Elver <elver@google.com>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: Wei Liu <wei.liu@kernel.org>
      Cc: Mike Rapoport <rppt@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: John Ogness <john.ogness@linutronix.de>
      Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Alexander Popov <alex.popov@linux.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      23b36fec
    • Minghao Chi's avatar
      fs/adfs: remove unneeded variable make code cleaner · 25d2e886
      Minghao Chi authored
      
      
      Return value directly instead of taking this in a variable.
      
      Link: https://lkml.kernel.org/r/20211210023211.424609-1-chi.minghao@zte.com.cn
      Signed-off-by: default avatarMinghao Chi <chi.minghao@zte.com.cn>
      Reported-by: default avatarZeal Robot <zealci@zte.com.cm>
      Cc: Christian Brauner <christian.brauner@ubuntu.com>
      Cc: Jan Kara <jack@suse.cz>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      25d2e886
    • NeilBrown's avatar
      FAT: use io_schedule_timeout() instead of congestion_wait() · 9bb56d59
      NeilBrown authored
      congestion_wait() in this context is just a sleep - block devices do not
      support congestion signalling any more.
      
      The goal for this wait, which was introduced in commit ae78bf9c
      
      
      ("[PATCH] add -o flush for fat") is to wait for any recently written
      data to get to storage.  We currently have no direct mechanism to do
      this, so a simple wait that behaves identically to the current
      congestion_wait() is the best we can do.
      
      This is a step towards removing congestion_wait()
      
      Link: https://lkml.kernel.org/r/163936544519.22433.13400436295732112065@noble.neil.brown.name
      Signed-off-by: default avatarNeilBrown <neilb@suse.de>
      Acked-by: default avatarOGAWA Hirofumi <hirofumi@mail.parknet.co.jp>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9bb56d59
    • Kees Cook's avatar
      hfsplus: use struct_group_attr() for memcpy() region · e35fa567
      Kees Cook authored
      
      
      In preparation for FORTIFY_SOURCE performing compile-time and run-time
      field bounds checking for memset(), avoid intentionally writing across
      neighboring fields.
      
      Add struct_group() to mark the "info" region (containing struct DInfo
      and struct DXInfo structs) in struct hfsplus_cat_folder and struct
      hfsplus_cat_file that are written into directly, so the compiler can
      correctly reason about the expected size of the writes.
      
      "pahole" shows no size nor member offset changes to struct
      hfsplus_cat_folder nor struct hfsplus_cat_file.  "objdump -d" shows no
      object code changes.
      
      Link: https://lkml.kernel.org/r/20211119192851.1046717-1-keescook@chromium.org
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Acked-by: default avatarChristian Brauner <christian.brauner@ubuntu.com>
      Cc: Zhen Lei <thunder.leizhen@huawei.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e35fa567
    • Colin Ian King's avatar
      nilfs2: remove redundant pointer sbufs · e1ce8a97
      Colin Ian King authored
      
      
      Pointer sbufs is being assigned a value but it's not being used later
      on.  The pointer is redundant and can be removed.  Cleans up scan-build
      static analysis warning:
      
        fs/nilfs2/page.c:203:8: warning: Although the value stored to 'sbufs'
          is used in the enclosing expression, the value is never actually read
          from 'sbufs' [deadcode.DeadStores]
              sbh = sbufs = page_buffers(src);
      
      Link: https://lkml.kernel.org/r/20211211180955.550380-1-colin.i.king@gmail.com
      Link: https://lkml.kernel.org/r/1640712476-15136-1-git-send-email-konishi.ryusuke@gmail.com
      Signed-off-by: default avatarColin Ian King <colin.i.king@gmail.com>
      Signed-off-by: default avatarRyusuke Konishi <konishi.ryusuke@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e1ce8a97
    • H.J. Lu's avatar
      fs/binfmt_elf: use PT_LOAD p_align values for static PIE · 9630f0d6
      H.J. Lu authored
      Extend commit ce81bb25
      
       ("fs/binfmt_elf: use PT_LOAD p_align values
      for suitable start address") which fixed PIE binaries built with
      -Wl,-z,max-page-size=0x200000, to cover static PIE binaries.  This
      fixes:
      
          https://bugzilla.kernel.org/show_bug.cgi?id=215275
      
      Tested by verifying static PIE binaries with -Wl,-z,max-page-size=0x200000 loading.
      
      Link: https://lkml.kernel.org/r/20211209174052.370537-1-hjl.tools@gmail.com
      Signed-off-by: default avatarH.J. Lu <hjl.tools@gmail.com>
      Cc: Chris Kennelly <ckennelly@google.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Alexey Dobriyan <adobriyan@gmail.com>
      Cc: Song Liu <songliubraving@fb.com>
      Cc: David Rientjes <rientjes@google.com>
      Cc: Ian Rogers <irogers@google.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Suren Baghdasaryan <surenb@google.com>
      Cc: Sandeep Patil <sspatil@google.com>
      Cc: Fangrui Song <maskray@google.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: Shuah Khan <shuah@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      9630f0d6
    • Rikard Falkeborn's avatar
      const_structs.checkpatch: add frequently used ops structs · c55cdc5c
      Rikard Falkeborn authored
      
      
      Add commonly used structs (>50 instances) which are always or almost
      always const.
      
      Link: https://lkml.kernel.org/r/20211127101134.33101-1-rikard.falkeborn@gmail.com
      Signed-off-by: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c55cdc5c
    • Joe Perches's avatar
      checkpatch: improve Kconfig help test · b8709bce
      Joe Perches authored
      
      
      The Kconfig help test erroneously counts patch context lines as part of
      the help text.
      
      Fix that and improve the message block output.
      
      Link: https://lkml.kernel.org/r/06c0cdc157ae1502e8e9eb3624b9ea995cf11e7a.camel@perches.com
      Signed-off-by: default avatarJoe Perches <joe@perches.com>
      Tested-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Acked-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Andy Whitcroft <apw@canonical.com>
      Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
      Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      b8709bce
    • Jerome Forissier's avatar
      checkpatch: relax regexp for COMMIT_LOG_LONG_LINE · 36f8b348
      Jerome Forissier authored
      
      
      One exceptions to the COMMIT_LOG_LONG_LINE rule is a file path followed
      by ':'.  That is typically some sort diagnostic message from a compiler
      or a build tool, in which case we don't want to wrap the lines but keep
      the message unmodified.
      
      The regular expression used to match this pattern currently doesn't
      accept absolute paths or + characters.  This can result in false
      positives as in the following (out-of-tree) example:
      
        ...
        /home/jerome/work/optee_repo_qemu/build/../toolchains/aarch32/bin/arm-linux-gnueabihf-ld.bfd: /home/jerome/work/toolchains-gcc10.2/aarch32/bin/../lib/gcc/arm-none-linux-gnueabihf/10.2.1/../../../../arm-none-linux-gnueabihf/lib/libstdc++.a(eh_alloc.o): in function `__cxa_allocate_exception':
        /tmp/dgboter/bbs/build03--cen7x86_64/buildbot/cen7x86_64--arm-none-linux-gnueabihf/build/src/gcc/libstdc++-v3/libsupc++/eh_alloc.cc:284: undefined reference to `malloc'
        ...
      
      Update the regular expression to match the above paths.
      
      Link: https://lkml.kernel.org/r/20210923143842.2837983-1-jerome@forissier.org
      Signed-off-by: default avatarJerome Forissier <jerome@forissier.org>
      Acked-by: default avatarJoe Perches <joe@perches.com>
      Cc: Andy Whitcroft <apw@canonical.com>
      Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
      Cc: Lukas Bulwahn <lukas.bulwahn@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      36f8b348
    • Andrey Konovalov's avatar
      lib/test_meminit: destroy cache in kmem_cache_alloc_bulk() test · e073e5ef
      Andrey Konovalov authored
      Make do_kmem_cache_size_bulk() destroy the cache it creates.
      
      Link: https://lkml.kernel.org/r/aced20a94bf04159a139f0846e41d38a1537debb.1640018297.git.andreyknvl@google.com
      Fixes: 03a9349a
      
       ("lib/test_meminit: add a kmem_cache_alloc_bulk() test")
      Signed-off-by: default avatarAndrey Konovalov <andreyknvl@google.com>
      Reviewed-by: default avatarMarco Elver <elver@google.com>
      Cc: Alexander Potapenko <glider@google.com>
      Cc: Dmitry Vyukov <dvyukov@google.com>
      Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      e073e5ef
    • Andy Shevchenko's avatar
      uuid: remove licence boilerplate text from the header · c7e4289c
      Andy Shevchenko authored
      
      
      Remove licence boilerplate text from the UAPI header.
      
      Link: https://lkml.kernel.org/r/20211216113552.81199-2-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      c7e4289c
    • Andy Shevchenko's avatar
      uuid: discourage people from using UAPI header in new code · 8e930a66
      Andy Shevchenko authored
      
      
      Discourage people from using UAPI header in new code by adding a note.
      
      Link: https://lkml.kernel.org/r/20211216113552.81199-1-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Acked-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      8e930a66
    • Andy Shevchenko's avatar
      kunit: replace kernel.h with the necessary inclusions · 60c7801b
      Andy Shevchenko authored
      
      
      When kernel.h is used in the headers it adds a lot into dependency hell,
      especially when there are circular dependencies are involved.
      
      Replace kernel.h inclusion with the list of what is really being used.
      
      Link: https://lkml.kernel.org/r/20211213204441.56204-1-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Reviewed-by: default avatarBrendan Higgins <brendanhiggins@google.com>
      Tested-by: default avatarBrendan Higgins <brendanhiggins@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      60c7801b
    • Isabella Basso's avatar
      test_hash.c: refactor into kunit · 0acc968f
      Isabella Basso authored
      
      
      Use KUnit framework to make tests more easily integrable with CIs.  Even
      though these tests are not yet properly written as unit tests this
      change should help in debugging.
      
      Also remove kernel messages (i.e.  through pr_info) as KUnit handles all
      debugging output and let it handle module init and exit details.
      
      Link: https://lkml.kernel.org/r/20211208183711.390454-6-isabbasso@riseup.net
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Tested-by: default avatarDavid Gow <davidgow@google.com>
      Co-developed-by: default avatarAugusto Durães Camargo <augusto.duraes33@gmail.com>
      Signed-off-by: default avatarAugusto Durães Camargo <augusto.duraes33@gmail.com>
      Co-developed-by: default avatarEnzo Ferreira <ferreiraenzoa@gmail.com>
      Signed-off-by: default avatarEnzo Ferreira <ferreiraenzoa@gmail.com>
      Signed-off-by: default avatarIsabella Basso <isabbasso@riseup.net>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      0acc968f
    • Isabella Basso's avatar
      lib/Kconfig.debug: properly split hash test kernel entries · 88168bf3
      Isabella Basso authored
      
      
      Split TEST_HASH so that each entry only has one file.
      
      Note that there's no stringhash test file, but actually
      <linux/stringhash.h> tests are performed in lib/test_hash.c.
      
      Link: https://lkml.kernel.org/r/20211208183711.390454-5-isabbasso@riseup.net
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Tested-by: default avatarDavid Gow <davidgow@google.com>
      Signed-off-by: default avatarIsabella Basso <isabbasso@riseup.net>
      Cc: Augusto Durães Camargo <augusto.duraes33@gmail.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: Enzo Ferreira <ferreiraenzoa@gmail.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: kernel test robot <lkp@intel.com>
      Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      88168bf3
    • Isabella Basso's avatar
      test_hash.c: split test_hash_init · 5427d3d7
      Isabella Basso authored
      
      
      Split up test_hash_init so that it calls each test more explicitly
      insofar it is possible without rewriting the entire file.  This aims at
      improving readability.
      
      Split tests performed on string_or as they don't interfere with those
      performed in hash_or.  Also separate pr_info calls about skipped tests
      as they're not part of the tests themselves, but only warn about
      (un)defined arch-specific hash functions.
      
      Link: https://lkml.kernel.org/r/20211208183711.390454-4-isabbasso@riseup.net
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Tested-by: default avatarDavid Gow <davidgow@google.com>
      Signed-off-by: default avatarIsabella Basso <isabbasso@riseup.net>
      Cc: Augusto Durães Camargo <augusto.duraes33@gmail.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: Enzo Ferreira <ferreiraenzoa@gmail.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: kernel test robot <lkp@intel.com>
      Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      5427d3d7
    • Isabella Basso's avatar
      test_hash.c: split test_int_hash into arch-specific functions · ae788067
      Isabella Basso authored
      
      
      Split the test_int_hash function to keep its mainloop separate from
      arch-specific chunks, which are only compiled as needed.  This aims at
      improving readability.
      
      Link: https://lkml.kernel.org/r/20211208183711.390454-3-isabbasso@riseup.net
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Tested-by: default avatarDavid Gow <davidgow@google.com>
      Signed-off-by: default avatarIsabella Basso <isabbasso@riseup.net>
      Cc: Augusto Durães Camargo <augusto.duraes33@gmail.com>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: Enzo Ferreira <ferreiraenzoa@gmail.com>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: kernel test robot <lkp@intel.com>
      Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      ae788067
    • Isabella Basso's avatar
      hash.h: remove unused define directive · fd0a1462
      Isabella Basso authored
      
      
      Patch series "test_hash.c: refactor into KUnit", v3.
      
      We refactored the lib/test_hash.c file into KUnit as part of the student
      group LKCAMP [1] introductory hackathon for kernel development.
      
      This test was pointed to our group by Daniel Latypov [2], so its full
      conversion into a pure KUnit test was our goal in this patch series, but
      we ran into many problems relating to it not being split as unit tests,
      which complicated matters a bit, as the reasoning behind the original
      tests is quite cryptic for those unfamiliar with hash implementations.
      
      Some interesting developments we'd like to highlight are:
      
       - In patch 1/5 we noticed that there was an unused define directive
         that could be removed.
      
       - In patch 4/5 we noticed how stringhash and hash tests are all under
         the lib/test_hash.c file, which might cause some confusion, and we
         also broke those kernel config entries up.
      
      Overall KUnit developments have been made in the other patches in this
      series:
      
      In patches 2/5, 3/5 and 5/5 we refactored the lib/test_hash.c file so as
      to make it more compatible with the KUnit style, whilst preserving the
      original idea of the maintainer who designed it (i.e.  George Spelvin),
      which might be undesirable for unit tests, but we assume it is enough
      for a first patch.
      
      This patch (of 5):
      
      Currently, there exist hash_32() and __hash_32() functions, which were
      introduced in a patch [1] targeting architecture specific optimizations.
      These functions can be overridden on a per-architecture basis to achieve
      such optimizations.  They must set their corresponding define directive
      (HAVE_ARCH_HASH_32 and HAVE_ARCH__HASH_32, respectively) so that header
      files can deal with these overrides properly.
      
      As the supported 32-bit architectures that have their own hash function
      implementation (i.e.  m68k, Microblaze, H8/300, pa-risc) have only been
      making use of the (more general) __hash_32() function (which only lacks
      a right shift operation when compared to the hash_32() function), remove
      the define directive corresponding to the arch-specific hash_32()
      implementation.
      
      [1] https://lore.kernel.org/lkml/20160525073311.5600.qmail@ns.sciencehorizons.net/
      
      [akpm@linux-foundation.org: hash_32_generic() becomes hash_32()]
      
      Link: https://lkml.kernel.org/r/20211208183711.390454-1-isabbasso@riseup.net
      Link: https://lkml.kernel.org/r/20211208183711.390454-2-isabbasso@riseup.net
      Reviewed-by: default avatarDavid Gow <davidgow@google.com>
      Tested-by: default avatarDavid Gow <davidgow@google.com>
      Co-developed-by: default avatarAugusto Durães Camargo <augusto.duraes33@gmail.com>
      Signed-off-by: default avatarAugusto Durães Camargo <augusto.duraes33@gmail.com>
      Co-developed-by: default avatarEnzo Ferreira <ferreiraenzoa@gmail.com>
      Signed-off-by: default avatarEnzo Ferreira <ferreiraenzoa@gmail.com>
      Signed-off-by: default avatarIsabella Basso <isabbasso@riseup.net>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Brendan Higgins <brendanhiggins@google.com>
      Cc: Daniel Latypov <dlatypov@google.com>
      Cc: Shuah Khan <skhan@linuxfoundation.org>
      Cc: Rodrigo Siqueira <rodrigosiqueiramelo@gmail.com>
      Cc: kernel test robot <lkp@intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      fd0a1462
    • Zhen Lei's avatar
      lib/list_debug.c: print more list debugging context in __list_del_entry_valid() · a31f9336
      Zhen Lei authored
      
      
      Currently, the entry->prev and entry->next are considered to be valid as
      long as they are not LIST_POISON{1|2}.  However, the memory may be
      corrupted.  The prev->next is invalid probably because 'prev' is
      invalid, not because prev->next's content is illegal.
      
      Unfortunately, the printk and its subfunctions will modify the registers
      that hold the 'prev' and 'next', and we don't see this valuable
      information in the BUG context.
      
      So print the contents of 'entry->prev' and 'entry->next'.
      
      Here's an example:
        list_del corruption. prev->next should be c0ecbf74, but was c08410dc
        kernel BUG at lib/list_debug.c:53!
        ... ...
        PC is at __list_del_entry_valid+0x58/0x98
        LR is at __list_del_entry_valid+0x58/0x98
        psr: 60000093
        sp : c0ecbf30  ip : 00000000  fp : 00000001
        r10: c08410d0  r9 : 00000001  r8 : c0825e0c
        r7 : 20000013  r6 : c08410d0  r5 : c0ecbf74  r4 : c0ecbf74
        r3 : c0825d08  r2 : 00000000  r1 : df7ce6f4  r0 : 00000044
        ... ...
        Stack: (0xc0ecbf30 to 0xc0ecc000)
        bf20:                                     c0ecbf74 c0164fd0 c0ecbf70 c0165170
        bf40: c0eca000 c0840c00 c0840c00 c0824500 c0825e0c c0189bbc c088f404 60000013
        bf60: 60000013 c0e85100 000004ec 00000000 c0ebcdc0 c0ecbf74 c0ecbf74 c0825d08
        bf80: c0e807c0 c018965c 00000000 c013f2a0 c0e807c0 c013f154 00000000 00000000
        bfa0: 00000000 00000000 00000000 c01001b0 00000000 00000000 00000000 00000000
        bfc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
        bfe0: 00000000 00000000 00000000 00000000 00000013 00000000 00000000 00000000
        (__list_del_entry_valid) from (__list_del_entry+0xc/0x20)
        (__list_del_entry) from (finish_swait+0x60/0x7c)
        (finish_swait) from (rcu_gp_kthread+0x560/0xa20)
        (rcu_gp_kthread) from (kthread+0x14c/0x15c)
        (kthread) from (ret_from_fork+0x14/0x24)
      
      At first, I thought prev->next was overwritten.  Later, I carefully
      analyzed the RCU code and the disassembly code.  The error occurred when
      deleting a node from the list rcu_state.gp_wq.  The System.map shows
      that the address of rcu_state is c0840c00.  Then I use gdb to obtain the
      offset of rcu_state.gp_wq.task_list.
      
        (gdb) p &((struct rcu_state *)0)->gp_wq.task_list
        $1 = (struct list_head *) 0x4dc
      
      Again:
        list_del corruption. prev->next should be c0ecbf74, but was c08410dc
      
        c08410dc = c0840c00 + 0x4dc = &rcu_state.gp_wq.task_list
      
      Because rcu_state.gp_wq has at most one node, so I can guess that "prev
      = &rcu_state.gp_wq.task_list".  But for other scenes, maybe I wasn't so
      lucky, I cannot figure out the value of 'prev'.
      
      Link: https://lkml.kernel.org/r/20211207025835.1909-1-thunder.leizhen@huawei.com
      Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
      Cc: "Paul E . McKenney" <paulmck@linux.vnet.ibm.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      a31f9336
    • Andy Shevchenko's avatar
      list: introduce list_is_head() helper and re-use it in list.h · 04254730
      Andy Shevchenko authored
      
      
      Introduce list_is_head() in the similar (*) way as it's done for
      list_entry_is_head().  Make use of it in the list.h.
      
      *) it's done as inliner and not a macro to be aligned with other
         list_is_*() APIs; while at it, make all three to have the same
         style.
      
      Link: https://lkml.kernel.org/r/20211201141824.81400-1-andriy.shevchenko@linux.intel.com
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      04254730
    • Alexey Dobriyan's avatar
      kstrtox: uninline everything · 70ac6992
      Alexey Dobriyan authored
      
      
      I've made a mistake of looking into lib/kstrtox.o code generation.
      
      The only function remotely performance critical is _parse_integer()
      (via /proc/*/map_files/*), everything else is not.
      
      Uninline everything, shrink lib/kstrtox.o by ~20 % !
      
      Space savings on x86_64:
      
      	add/remove: 0/0 grow/shrink: 0/23 up/down: 0/-1269 (-1269 !!!)
      	Function                                     old     new   delta
      	kstrtoull                                     16      13      -3
      	kstrtouint                                    59      48     -11
      	kstrtou8                                      60      49     -11
      	kstrtou16                                     61      50     -11
      	_kstrtoul                                     46      35     -11
      	kstrtoull_from_user                           95      83     -12
      	kstrtoul_from_user                            95      83     -12
      	kstrtoll                                      93      80     -13
      	kstrtouint_from_user                         124      83     -41
      	kstrtou8_from_user                           125      83     -42
      	kstrtou16_from_user                          126      83     -43
      	kstrtos8                                     101      50     -51
      	kstrtos16                                    102      51     -51
      	kstrtoint                                    100      49     -51
      	_kstrtol                                      93      35     -58
      	kstrtobool_from_user                         156      75     -81
      	kstrtoll_from_user                           165      83     -82
      	kstrtol_from_user                            165      83     -82
      	kstrtoint_from_user                          172      83     -89
      	kstrtos8_from_user                           173      83     -90
      	kstrtos16_from_user                          174      83     -91
      	_parse_integer                               136      10    -126
      	_kstrtoull                                   308     101    -207
      	Total: Before=3421236, After=3419967, chg -0.04%
      
      Link: https://lkml.kernel.org/r/YZDsFDhHst4m2Pnt@localhost.localdomain
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      70ac6992
    • Randy Dunlap's avatar
      get_maintainer: don't remind about no git repo when --nogit is used · 26d98e9f
      Randy Dunlap authored
      
      
      When --nogit is used with scripts/get_maintainer.pl, the script spews 4
      lines of unnecessary information (noise).  Do not print those lines when
      --nogit is specified.
      
      This change removes the printing of these 4 lines:
      
        ./scripts/get_maintainer.pl: No supported VCS found.  Add --nogit to options?
        Using a git repository produces better results.
        Try Linus Torvalds' latest git repository using:
        git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
      
      Link: https://lkml.kernel.org/r/20220102031424.3328-1-rdunlap@infradead.org
      Signed-off-by: default avatarRandy Dunlap <rdunlap@infradead.org>
      Cc: Joe Perches <joe@perches.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      26d98e9f
    • Davidlohr Bueso's avatar
      kernel/sys.c: only take tasklist_lock for get/setpriority(PRIO_PGRP) · 7f8ca0ed
      Davidlohr Bueso authored
      
      
      PRIO_PGRP needs the tasklist_lock mainly to serialize vs setpgid(2), to
      protect against any concurrent change_pid(PIDTYPE_PGID) that can move
      the task from one hlist to another while iterating.
      
      However, the remaining can only rely only on RCU:
      
      PRIO_PROCESS only does the task lookup and never iterates over tasklist
      and we already have an rcu-aware stable pointer.
      
      PRIO_USER is already racy vs setuid(2) so with creds being rcu
      protected, we can end up seeing stale data.  When removing the
      tasklist_lock there can be a race with (i) fork but this is benign as
      the child's nice is inherited and the new task is not observable by the
      user yet either, hence the return semantics do not differ.  And (ii) a
      race with exit, which is a small window and can cause us to miss a task
      which was removed from the list and it had the highest nice.
      
      Similarly change the buggy do_each_thread/while_each_thread combo in
      PRIO_USER for the rcu-safe for_each_process_thread flavor, which doesn't
      make use of next_thread/p->thread_group.
      
      [akpm@linux-foundation.org: coding style fixes]
      
      Link: https://lkml.kernel.org/r/20211210182250.43734-1-dave@stgolabs.net
      Signed-off-by: default avatarDavidlohr Bueso <dbueso@suse.de>
      Acked-by: default avatarOleg Nesterov <oleg@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      7f8ca0ed
    • Yafang Shao's avatar
      kthread: dynamically allocate memory to store kthread's full name · d6986ce2
      Yafang Shao authored
      
      
      When I was implementing a new per-cpu kthread cfs_migration, I found the
      comm of it "cfs_migration/%u" is truncated due to the limitation of
      TASK_COMM_LEN.  For example, the comm of the percpu thread on CPU10~19
      all have the same name "cfs_migration/1", which will confuse the user.
      This issue is not critical, because we can get the corresponding CPU
      from the task's Cpus_allowed.  But for kthreads corresponding to other
      hardware devices, it is not easy to get the detailed device info from
      task comm, for example,
      
          jbd2/nvme0n1p2-
          xfs-reclaim/sdf
      
      Currently there are so many truncated kthreads:
      
          rcu_tasks_kthre
          rcu_tasks_rude_
          rcu_tasks_trace
          poll_mpt3sas0_s
          ext4-rsv-conver
          xfs-reclaim/sd{a, b, c, ...}
          xfs-blockgc/sd{a, b, c, ...}
          xfs-inodegc/sd{a, b, c, ...}
          audit_send_repl
          ecryptfs-kthrea
          vfio-irqfd-clea
          jbd2/nvme0n1p2-
          ...
      
      We can shorten these names to work around this problem, but it may be
      not applied to all of the truncated kthreads.  Take 'jbd2/nvme0n1p2-'
      for example, it is a nice name, and it is not a good idea to shorten it.
      
      One possible way to fix this issue is extending the task comm size, but
      as task->comm is used in lots of places, that may cause some potential
      buffer overflows.  Another more conservative approach is introducing a
      new pointer to store kthread's full name if it is truncated, which won't
      introduce too much overhead as it is in the non-critical path.  Finally
      we make a dicision to use the second approach.  See also the discussions
      in this thread:
      https://lore.kernel.org/lkml/20211101060419.4682-1-laoar.shao@gmail.com/
      
      After this change, the full name of these truncated kthreads will be
      displayed via /proc/[pid]/comm:
      
          rcu_tasks_kthread
          rcu_tasks_rude_kthread
          rcu_tasks_trace_kthread
          poll_mpt3sas0_statu
          ext4-rsv-conversion
          xfs-reclaim/sdf1
          xfs-blockgc/sdf1
          xfs-inodegc/sdf1
          audit_send_reply
          ecryptfs-kthread
          vfio-irqfd-cleanup
          jbd2/nvme0n1p2-8
      
      Link: https://lkml.kernel.org/r/20211120112850.46047-1-laoar.shao@gmail.com
      Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
      Reviewed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarPetr Mladek <pmladek@suse.com>
      Suggested-by: default avatarPetr Mladek <pmladek@suse.com>
      Suggested-by: default avatarSteven Rostedt <rostedt@goodmis.org>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
      Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
      Cc: Michal Miroslaw <mirq-linux@rere.qmqm.pl>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      d6986ce2
    • Yafang Shao's avatar
      tools/testing/selftests/bpf: replace open-coded 16 with TASK_COMM_LEN · 3087c61e
      Yafang Shao authored
      
      
      As the sched:sched_switch tracepoint args are derived from the kernel,
      we'd better make it same with the kernel.  So the macro TASK_COMM_LEN is
      converted to type enum, then all the BPF programs can get it through
      BTF.
      
      The BPF program which wants to use TASK_COMM_LEN should include the
      header vmlinux.h.  Regarding the test_stacktrace_map and
      test_tracepoint, as the type defined in linux/bpf.h are also defined in
      vmlinux.h, so we don't need to include linux/bpf.h again.
      
      Link: https://lkml.kernel.org/r/20211120112738.45980-8-laoar.shao@gmail.com
      Signed-off-by: default avatarYafang Shao <laoar.shao@gmail.com>
      Acked-by: default avatarAndrii Nakryiko <andrii@kernel.org>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Cc: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
      Cc: Arnaldo Carvalho de Melo <arnaldo.melo@gmail.com>
      Cc: Andrii Nakryiko <andrii.nakryiko@gmail.com>
      Cc: Michal Miroslaw <mirq-linux@rere.qmqm.pl>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Steven Rostedt <rostedt@goodmis.org>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Al Viro <viro@zeniv.linux.org.uk>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Petr Mladek <pmladek@suse.com>
      Cc: Alexei Starovoitov <alexei.starovoitov@gmail.com>
      Cc: Dennis Dalessandro <dennis.dalessandro@cornelisnetworks.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3087c61e