Skip to content
  1. Aug 19, 2023
    • Eric DeVolder's avatar
      kexec: consolidate kexec and crash options into kernel/Kconfig.kexec · 89cde455
      Eric DeVolder authored
      Patch series "refactor Kconfig to consolidate KEXEC and CRASH options", v6.
      
      The Kconfig is refactored to consolidate KEXEC and CRASH options from
      various arch/<arch>/Kconfig files into new file kernel/Kconfig.kexec.
      
      The Kconfig.kexec is now a submenu titled "Kexec and crash features"
      located under "General Setup".
      
      The following options are impacted:
      
       - KEXEC
       - KEXEC_FILE
       - KEXEC_SIG
       - KEXEC_SIG_FORCE
       - KEXEC_IMAGE_VERIFY_SIG
       - KEXEC_BZIMAGE_VERIFY_SIG
       - KEXEC_JUMP
       - CRASH_DUMP
      
      Over time, these options have been copied between Kconfig files and
      are very similar to one another, but with slight differences.
      
      The following architectures are impacted by the refactor (because of
      use of one or more KEXEC/CRASH options):
      
       - arm
       - arm64
       - ia64
       - loongarch
       - m68k
       - mips
       - parisc
       - powerpc
       - riscv
       - s390
       - sh
       - x86 
      
      More information:
      
      In the patch series "crash: Kernel handling of CPU and memory hot
      un/plug"
      
       https://lore.kernel.org/lkml/20230503224145.7405-1-eric.devolder@oracle.com/
      
      the new kernel feature introduces the config option CRASH_HOTPLUG.
      
      In reviewing, Thomas Gleixner requested that the new config option
      not be placed in x86 Kconfig. Rather the option needs a generic/common
      home. To Thomas' point, the KEXEC and CRASH options have largely been
      duplicated in the various arch/<arch>/Kconfig files, with minor
      differences. This kind of proliferation is to be avoid/stopped.
      
       https://lore.kernel.org/lkml/875y91yv63.ffs@tglx/
      
      To that end, I have refactored the arch Kconfigs so as to consolidate
      the various KEXEC and CRASH options. Generally speaking, this work has
      the following themes:
      
      - KEXEC and CRASH options are moved into new file kernel/Kconfig.kexec
        - These items from arch/Kconfig:
            CRASH_CORE KEXEC_CORE KEXEC_ELF HAVE_IMA_KEXEC
        - These items from arch/x86/Kconfig form the common options:
            KEXEC KEXEC_FILE KEXEC_SIG KEXEC_SIG_FORCE
            KEXEC_BZIMAGE_VERIFY_SIG KEXEC_JUMP CRASH_DUMP
        - These items from arch/arm64/Kconfig form the common options:
            KEXEC_IMAGE_VERIFY_SIG
        - The crash hotplug series appends CRASH_HOTPLUG to Kconfig.kexec
      - The Kconfig.kexec is now a submenu titled "Kexec and crash features"
        and is now listed in "General Setup" submenu from init/Kconfig.
      - To control the common options, each has a new ARCH_SUPPORTS_<option>
        option. These gateway options determine whether the common options
        options are valid for the architecture.
      - To account for the slight differences in the original architecture
        coding of the common options, each now has a corresponding
        ARCH_SELECTS_<option> which are used to elicit the same side effects
        as the original arch/<arch>/Kconfig files for KEXEC and CRASH options.
      
      An example, 'make menuconfig' illustrating the submenu:
      
        > General setup > Kexec and crash features
        [*] Enable kexec system call
        [*] Enable kexec file based system call
        [*]   Verify kernel signature during kexec_file_load() syscall
        [ ]     Require a valid signature in kexec_file_load() syscall
        [ ]     Enable bzImage signature verification support
        [*] kexec jump
        [*] kernel crash dumps
        [*]   Update the crash elfcorehdr on system configuration changes
      
      In the process of consolidating the common options, I encountered
      slight differences in the coding of these options in several of the
      architectures. As a result, I settled on the following solution:
      
      - Each of the common options has a 'depends on ARCH_SUPPORTS_<option>'
        statement. For example, the KEXEC_FILE option has a 'depends on
        ARCH_SUPPORTS_KEXEC_FILE' statement.
      
        This approach is needed on all common options so as to prevent
        options from appearing for architectures which previously did
        not allow/enable them. For example, arm supports KEXEC but not
        KEXEC_FILE. The arch/arm/Kconfig does not provide
        ARCH_SUPPORTS_KEXEC_FILE and so KEXEC_FILE and related options
        are not available to arm.
      
      - The boolean ARCH_SUPPORTS_<option> in effect allows the arch to
        determine when the feature is allowed.  Archs which don't have the
        feature simply do not provide the corresponding ARCH_SUPPORTS_<option>.
        For each arch, where there previously were KEXEC and/or CRASH
        options, these have been replaced with the corresponding boolean
        ARCH_SUPPORTS_<option>, and an appropriate def_bool statement.
      
        For example, if the arch supports KEXEC_FILE, then the
        ARCH_SUPPORTS_KEXEC_FILE simply has a 'def_bool y'. This permits
        the KEXEC_FILE option to be available.
      
        If the arch has a 'depends on' statement in its original coding
        of the option, then that expression becomes part of the def_bool
        expression. For example, arm64 had:
      
        config KEXEC
          depends on PM_SLEEP_SMP
      
        and in this solution, this converts to:
      
        config ARCH_SUPPORTS_KEXEC
          def_bool PM_SLEEP_SMP
      
      
      - In order to account for the architecture differences in the
        coding for the common options, the ARCH_SELECTS_<option> in the
        arch/<arch>/Kconfig is used. This option has a 'depends on
        <option>' statement to couple it to the main option, and from
        there can insert the differences from the common option and the
        arch original coding of that option.
      
        For example, a few archs enable CRYPTO and CRYTPO_SHA256 for
        KEXEC_FILE. These require a ARCH_SELECTS_KEXEC_FILE and
        'select CRYPTO' and 'select CRYPTO_SHA256' statements.
      
      Illustrating the option relationships:
      
      For each of the common KEXEC and CRASH options:
       ARCH_SUPPORTS_<option> <- <option> <- ARCH_SELECTS_<option>
      
       <option>                   # in Kconfig.kexec
       ARCH_SUPPORTS_<option>     # in arch/<arch>/Kconfig, as needed
       ARCH_SELECTS_<option>      # in arch/<arch>/Kconfig, as needed
      
      
      For example, KEXEC:
       ARCH_SUPPORTS_KEXEC <- KEXEC <- ARCH_SELECTS_KEXEC
      
       KEXEC                      # in Kconfig.kexec
       ARCH_SUPPORTS_KEXEC        # in arch/<arch>/Kconfig, as needed
       ARCH_SELECTS_KEXEC         # in arch/<arch>/Kconfig, as needed
      
      
      To summarize, the ARCH_SUPPORTS_<option> permits the <option> to be
      enabled, and the ARCH_SELECTS_<option> handles side effects (ie.
      select statements).
      
      Examples:
      A few examples to show the new strategy in action:
      
      ===== x86 (minus the help section) =====
      Original:
       config KEXEC
          bool "kexec system call"
          select KEXEC_CORE
      
       config KEXEC_FILE
          bool "kexec file based system call"
          select KEXEC_CORE
          select HAVE_IMA_KEXEC if IMA
          depends on X86_64
          depends on CRYPTO=y
          depends on CRYPTO_SHA256=y
      
       config ARCH_HAS_KEXEC_PURGATORY
          def_bool KEXEC_FILE
      
       config KEXEC_SIG
          bool "Verify kernel signature during kexec_file_load() syscall"
          depends on KEXEC_FILE
      
       config KEXEC_SIG_FORCE
          bool "Require a valid signature in kexec_file_load() syscall"
          depends on KEXEC_SIG
      
       config KEXEC_BZIMAGE_VERIFY_SIG
          bool "Enable bzImage signature verification support"
          depends on KEXEC_SIG
          depends on SIGNED_PE_FILE_VERIFICATION
          select SYSTEM_TRUSTED_KEYRING
      
       config CRASH_DUMP
          bool "kernel crash dumps"
          depends on X86_64 || (X86_32 && HIGHMEM)
      
       config KEXEC_JUMP
          bool "kexec jump"
          depends on KEXEC && HIBERNATION
          help
      
      becomes...
      New:
      config ARCH_SUPPORTS_KEXEC
          def_bool y
      
      config ARCH_SUPPORTS_KEXEC_FILE
          def_bool X86_64 && CRYPTO && CRYPTO_SHA256
      
      config ARCH_SELECTS_KEXEC_FILE
          def_bool y
          depends on KEXEC_FILE
          select HAVE_IMA_KEXEC if IMA
      
      config ARCH_SUPPORTS_KEXEC_PURGATORY
          def_bool KEXEC_FILE
      
      config ARCH_SUPPORTS_KEXEC_SIG
          def_bool y
      
      config ARCH_SUPPORTS_KEXEC_SIG_FORCE
          def_bool y
      
      config ARCH_SUPPORTS_KEXEC_BZIMAGE_VERIFY_SIG
          def_bool y
      
      config ARCH_SUPPORTS_KEXEC_JUMP
          def_bool y
      
      config ARCH_SUPPORTS_CRASH_DUMP
          def_bool X86_64 || (X86_32 && HIGHMEM)
      
      
      ===== powerpc (minus the help section) =====
      Original:
       config KEXEC
          bool "kexec system call"
          depends on PPC_BOOK3S || PPC_E500 || (44x && !SMP)
          select KEXEC_CORE
      
       config KEXEC_FILE
          bool "kexec file based system call"
          select KEXEC_CORE
          select HAVE_IMA_KEXEC if IMA
          select KEXEC_ELF
          depends on PPC64
          depends on CRYPTO=y
          depends on CRYPTO_SHA256=y
      
       config ARCH_HAS_KEXEC_PURGATORY
          def_bool KEXEC_FILE
      
       config CRASH_DUMP
          bool "Build a dump capture kernel"
          depends on PPC64 || PPC_BOOK3S_32 || PPC_85xx || (44x && !SMP)
          select RELOCATABLE if PPC64 || 44x || PPC_85xx
      
      becomes...
      New:
      config ARCH_SUPPORTS_KEXEC
          def_bool PPC_BOOK3S || PPC_E500 || (44x && !SMP)
      
      config ARCH_SUPPORTS_KEXEC_FILE
          def_bool PPC64 && CRYPTO=y && CRYPTO_SHA256=y
      
      config ARCH_SUPPORTS_KEXEC_PURGATORY
          def_bool KEXEC_FILE
      
      config ARCH_SELECTS_KEXEC_FILE
          def_bool y
          depends on KEXEC_FILE
          select KEXEC_ELF
          select HAVE_IMA_KEXEC if IMA
      
      config ARCH_SUPPORTS_CRASH_DUMP
          def_bool PPC64 || PPC_BOOK3S_32 || PPC_85xx || (44x && !SMP)
      
      config ARCH_SELECTS_CRASH_DUMP
          def_bool y
          depends on CRASH_DUMP
          select RELOCATABLE if PPC64 || 44x || PPC_85xx
      
      
      Testing Approach and Results
      
      There are 388 config files in the arch/<arch>/configs directories.
      For each of these config files, a .config is generated both before and
      after this Kconfig series, and checked for equivalence. This approach
      allows for a rather rapid check of all architectures and a wide
      variety of configs wrt/ KEXEC and CRASH, and avoids requiring
      compiling for all architectures and running kernels and run-time
      testing.
      
      For each config file, the olddefconfig, allnoconfig and allyesconfig
      targets are utilized. In testing the randconfig has revealed problems
      as well, but is not used in the before and after equivalence check
      since one can not generate the "same" .config for before and after,
      even if using the same KCONFIG_SEED since the option list is
      different.
      
      As such, the following script steps compare the before and after
      of 'make olddefconfig'. The new symbols introduced by this series
      are filtered out, but otherwise the config files are PASS only if
      they were equivalent, and FAIL otherwise.
      
      The script performs the test by doing the following:
      
       # Obtain the "golden" .config output for given config file
       # Reset test sandbox
       git checkout master
       git branch -D test_Kconfig
       git checkout -B test_Kconfig master
       make distclean
       # Write out updated config
       cp -f <config file> .config
       make ARCH=<arch> olddefconfig
       # Track each item in .config, LHSB is "golden"
       scoreboard .config 
      
       # Obtain the "changed" .config output for given config file
       # Reset test sandbox
       make distclean
       # Apply this Kconfig series
       git am <this Kconfig series>
       # Write out updated config
       cp -f <config file> .config
       make ARCH=<arch> olddefconfig
       # Track each item in .config, RHSB is "changed"
       scoreboard .config 
      
       # Determine test result
       # Filter-out new symbols introduced by this series
       # Filter-out symbol=n which not in either scoreboard
       # Compare LHSB "golden" and RHSB "changed" scoreboards and issue PASS/FAIL
      
      The script was instrumental during the refactoring of Kconfig as it
      continually revealed problems. The end result being that the solution
      presented in this series passes all configs as checked by the script,
      with the following exceptions:
      
      - arch/ia64/configs/zx1_config with olddefconfig
        This config file has:
        # CONFIG_KEXEC is not set
        CONFIG_CRASH_DUMP=y
        and this refactor now couples KEXEC to CRASH_DUMP, so it is not
        possible to enable CRASH_DUMP without KEXEC.
      
      - arch/sh/configs/* with allyesconfig
        The arch/sh/Kconfig codes CRASH_DUMP as dependent upon BROKEN_ON_MMU
        (which clearly is not meant to be set). This symbol is not provided
        but with the allyesconfig it is set to yes which enables CRASH_DUMP.
        But KEXEC is coded as dependent upon MMU, and is set to no in
        arch/sh/mm/Kconfig, so KEXEC is not enabled.
        This refactor now couples KEXEC to CRASH_DUMP, so it is not
        possible to enable CRASH_DUMP without KEXEC.
      
      While the above exceptions are not equivalent to their original,
      the config file produced is valid (and in fact better wrt/ CRASH_DUMP
      handling).
      
      
      This patch (of 14)
      
      The config options for kexec and crash features are consolidated
      into new file kernel/Kconfig.kexec. Under the "General Setup" submenu
      is a new submenu "Kexec and crash handling". All the kexec and
      crash options that were once in the arch-dependent submenu "Processor
      type and features" are now consolidated in the new submenu.
      
      The following options are impacted:
      
       - KEXEC
       - KEXEC_FILE
       - KEXEC_SIG
       - KEXEC_SIG_FORCE
       - KEXEC_BZIMAGE_VERIFY_SIG
       - KEXEC_JUMP
       - CRASH_DUMP
      
      The three main options are KEXEC, KEXEC_FILE and CRASH_DUMP.
      
      Architectures specify support of certain KEXEC and CRASH features with
      similarly named new ARCH_SUPPORTS_<option> config options.
      
      Architectures can utilize the new ARCH_SELECTS_<option> config
      options to specify additional components when <option> is enabled.
      
      To summarize, the ARCH_SUPPORTS_<option> permits the <option> to be
      enabled, and the ARCH_SELECTS_<option> handles side effects (ie.
      select statements).
      
      Link: https://lkml.kernel.org/r/20230712161545.87870-1-eric.devolder@oracle.com
      Link: https://lkml.kernel.org/r/20230712161545.87870-2-eric.devolder@oracle.com
      
      
      Signed-off-by: default avatarEric DeVolder <eric.devolder@oracle.com>
      Cc: Albert Ou <aou@eecs.berkeley.edu>
      Cc: Alexander Gordeev <agordeev@linux.ibm.com>
      Cc: Anshuman Khandual <anshuman.khandual@arm.com>
      Cc: Ard Biesheuvel <ardb@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Baoquan He <bhe@redhat.com>
      Cc: Borislav Petkov (AMD) <bp@alien8.de>
      Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Cc. "H. Peter Anvin" <hpa@zytor.com>
      Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Dave Hansen <dave.hansen@linux.intel.com> # for x86
      Cc: Frederic Weisbecker <frederic@kernel.org>
      Cc: Geert Uytterhoeven <geert@linux-m68k.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Hari Bathini <hbathini@linux.ibm.com>
      Cc: Heiko Carstens <hca@linux.ibm.com>
      Cc: Helge Deller <deller@gmx.de>
      Cc: Huacai Chen <chenhuacai@kernel.org>
      Cc: Ingo Molnar <mingo@redhat.com>
      Cc: "James E.J. Bottomley" <James.Bottomley@HansenPartnership.com>
      Cc: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
      Cc: Juerg Haefliger <juerg.haefliger@canonical.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Cc: Marc Aurèle La France <tsi@tuyoix.net>
      Cc: Masahiro Yamada <masahiroy@kernel.org>
      Cc: Masami Hiramatsu (Google) <mhiramat@kernel.org>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Miguel Ojeda <ojeda@kernel.org>
      Cc: Mike Rapoport (IBM) <rppt@kernel.org>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Palmer Dabbelt <palmer@dabbelt.com>
      Cc: Paul E. McKenney <paulmck@kernel.org>
      Cc: Paul Walmsley <paul.walmsley@sifive.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rich Felker <dalias@libc.org>
      Cc: Russell King <linux@armlinux.org.uk>
      Cc: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
      Cc: Sami Tolvanen <samitolvanen@google.com>
      Cc: Sebastian Reichel <sebastian.reichel@collabora.com>
      Cc: Sourabh Jain <sourabhjain@linux.ibm.com>
      Cc: Sven Schnelle <svens@linux.ibm.com>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Thomas Bogendoerfer <tsbogend@alpha.franken.de>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Vasily Gorbik <gor@linux.ibm.com>
      Cc: WANG Xuerui <kernel@xen0n.name>
      Cc: Will Deacon <will@kernel.org>
      Cc: Xin Li <xin3.li@intel.com>
      Cc: Yoshinori Sato <ysato@users.sourceforge.jp>
      Cc: Zhen Lei <thunder.leizhen@huawei.com>
      Cc: Zi Yan <ziy@nvidia.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      89cde455
    • Baoquan He's avatar
      irqchip/al-fic: make AL_FIC depend on HAS_IOMEM · 35e0cd77
      Baoquan He authored
      On s390 systems (aka mainframes), it has classic channel devices for
      networking and permanent storage that are currently even more common than
      PCI devices.  Hence it could have a fully functional s390 kernel with
      CONFIG_PCI=n, then the relevant iomem mapping functions [including
      ioremap(), devm_ioremap(), etc.] are not available.
      
      Here let AL_FIC depend on HAS_IOMEM so that it won't be built
      to cause below compiling error if PCI is unset:
      
      ------
      ld: drivers/irqchip/irq-al-fic.o: in function `al_fic_init_dt':
      irq-al-fic.c:(.init.text+0x76): undefined reference to `of_iomap'
      ld: irq-al-fic.c:(.init.text+0x4ce): undefined reference to `iounmap'
      ------
      
      Link: https://lkml.kernel.org/r/20230707135852.24292-7-bhe@redhat.com
      
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202306211329.ticOJCSv-lkp@intel.com/
      
      
      Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Marc Zyngier <maz@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      35e0cd77
    • Baoquan He's avatar
      net: altera-tse: make ALTERA_TSE depend on HAS_IOMEM · 925ddf07
      Baoquan He authored
      On s390 systems (aka mainframes), it has classic channel devices for
      networking and permanent storage that are currently even more common than
      PCI devices.  Hence it could have a fully functional s390 kernel with
      CONFIG_PCI=n, then the relevant iomem mapping functions [including
      ioremap(), devm_ioremap(), etc.] are not available.
      
      Here let ALTERA_TSE depend on HAS_IOMEM so that it won't be built to cause
      below compiling error if PCI is unset:
      
      ------
      ERROR: modpost: "devm_ioremap" [drivers/net/ethernet/altera/altera_tse.ko] undefined!
      ------
      
      Link: https://lkml.kernel.org/r/20230707135852.24292-6-bhe@redhat.com
      
      
      Reported-by: default avatarkernel test robot <lkp@intel.com>
      Closes: https://lore.kernel.org/oe-kbuild-all/202306211329.ticOJCSv-lkp@intel.com/
      
      
      Signed-off-by: default avatarBaoquan He <bhe@redhat.com>
      Cc: Joyce Ooi <joyce.ooi@intel.com>
      Cc: "David S. Miller" <davem@davemloft.net>
      Cc: Eric Dumazet <edumazet@google.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: Paolo Abeni <pabeni@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      925ddf07
    • Christophe JAILLET's avatar
      ipc/sem: use flexible array in 'struct sem_undo' · b46fae06
      Christophe JAILLET authored
      Turn 'semadj' in 'struct sem_undo' into a flexible array.
      
      The advantages are:
         - save the size of a pointer when the new undo structure is allocated
         - avoid some always ugly pointer arithmetic to get the address of semadj
         - avoid an indirection when the array is accessed
      
      While at it, use struct_size() to compute the size of the new undo
      structure.
      
      Link: https://lkml.kernel.org/r/1ba993d443ad7e16ac2b1902adab1f05ebdfa454.1688918791.git.christophe.jaillet@wanadoo.fr
      
      
      Signed-off-by: default avatarChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Reviewed-by: default avatarManfred Spraul <manfred@colorfullife.com>
      Reviewed-by: default avatarDavidlohr Bueso <dave@stgolabs.net>
      Cc: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
      Cc: Jann Horn <jannh@google.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      b46fae06
    • Azeem Shaikh's avatar
      acct: replace all non-returning strlcpy with strscpy · 4264be50
      Azeem Shaikh authored
      strlcpy() reads the entire source buffer first.  This read may exceed the
      destination size limit.  This is both inefficient and can lead to linear
      read overflows if a source string is not NUL-terminated [1].  In an effort
      to remove strlcpy() completely [2], replace strlcpy() here with strscpy().
      No return values were used, so direct replacement is safe.
      
      [1] https://www.kernel.org/doc/html/latest/process/deprecated.html#strlcpy
      [2] https://github.com/KSPP/linux/issues/89
      
      Link: https://lkml.kernel.org/r/20230710011748.3538624-1-azeemshaikh38@gmail.com
      
      
      Signed-off-by: default avatarAzeem Shaikh <azeemshaikh38@gmail.com>
      Cc: Kees Cook <keescook@chromium.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      4264be50
    • Vincent Whitchurch's avatar
      signal: print comm and exe name on fatal signals · b0b88e02
      Vincent Whitchurch authored
      Make the print-fatal-signals message more useful by printing the comm
      and the exe name for the process which received the fatal signal:
      
      Before:
      
       potentially unexpected fatal signal 4
       potentially unexpected fatal signal 11
      
      After:
      
       buggy-program: pool: potentially unexpected fatal signal 4
       some-daemon: gdbus: potentially unexpected fatal signal 11
      
      comm used to be present but was removed in commit 681a90ff
      ("arc, print-fatal-signals: reduce duplicated information") because it's
      also included as part of the later stack trace.  Having the comm as part
      of the main "unexpected fatal..." print is rather useful though when
      analysing logs, and the exe name is also valuable as shown in the
      examples above where the comm ends up having some generic name like
      "pool".
      
      [akpm@linux-foundation.org: don't include linux/file.h twice]
      Link: https://lkml.kernel.org/r/20230707-fatal-comm-v1-1-400363905d5e@axis.com
      
      
      Signed-off-by: default avatarVincent Whitchurch <vincent.whitchurch@axis.com>
      Cc: Ingo Molnar <mingo@kernel.org>
      Cc: Tejun Heo <tj@kernel.org>
      Cc: Vineet Gupta <vgupta@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      b0b88e02
    • Thomas Huth's avatar
      arch/ia64/include: remove CONFIG_IA64_DEBUG_CMPXCHG from uapi header · 9702a046
      Thomas Huth authored
      CONFIG_* switches should not be exposed in uapi headers.  The macros that
      are defined here are also only useful for the kernel code, so let's move
      them to asm/cmpxchg.h instead.
      
      The only two files that are using these macros are the headers
      arch/ia64/include/asm/bitops.h and arch/ia64/include/asm/atomic.h and
      these include asm/cmpxchg.h via asm/intrinsics.h, so this movement should
      not cause any trouble.
      
      Link: https://lkml.kernel.org/r/20230426065032.517693-1-thuth@redhat.com
      
      
      Signed-off-by: default avatarThomas Huth <thuth@redhat.com>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      9702a046
    • Sumitra Sharma's avatar
      lib: replace kmap() with kmap_local_page() · ae96e0cd
      Sumitra Sharma authored
      kmap() has been deprecated in favor of the kmap_local_page() due to high
      cost, restricted mapping space, the overhead of a global lock for
      synchronization, and making the process sleep in the absence of free
      slots.
      
      kmap_local_page() is faster than kmap() and offers thread-local and
      CPU-local mappings, take pagefaults in a local kmap region and preserves
      preemption by saving the mappings of outgoing tasks and restoring those of
      the incoming one during a context switch.
      
      The mappings are kept thread local in the functions “dmirror_do_read”
      and “dmirror_do_write” in test_hmm.c
      
      Therefore, replace kmap() with kmap_local_page() and use
      mempcy_from/to_page() to avoid open coding kmap_local_page() + memcpy() +
      kunmap_local().
      
      Remove the unused variable “tmp”.
      
      Link: https://lkml.kernel.org/r/20230610175712.GA348514@sumitra.com
      
      
      Signed-off-by: default avatarSumitra Sharma <sumitraartsy@gmail.com>
      Suggested-by: default avatarFabio M. De Francesco <fmdefrancesco@gmail.com>
      Reviewed-by: default avatarFabio M. De Francesco <fmdefrancesco@gmail.com>
      Reviewed-by: default avatarIra Weiny <ira.weiny@intel.com>
      Cc: Deepak R Varma <drv@mailo.com>
      Cc: Jérôme Glisse <jglisse@redhat.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      ae96e0cd
    • Alexey Dobriyan's avatar
      proc: skip proc-empty-vm on anything but amd64 and i386 · f58a2dd8
      Alexey Dobriyan authored
      This test is arch specific, requires "munmap everything" primitive.
      
      Link: https://lkml.kernel.org/r/20230630183434.17434-2-adobriyan@gmail.com
      
      
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Björn Töpel <bjorn@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      f58a2dd8
    • Alexey Dobriyan's avatar
      proc: support proc-empty-vm test on i386 · 4356b11e
      Alexey Dobriyan authored
      Unmap everything starting from 4GB length until it unmaps, otherwise test
      has to detect which virtual memory split kernel is using.
      
      Link: https://lkml.kernel.org/r/20230630183434.17434-1-adobriyan@gmail.com
      
      
      Signed-off-by: default avatarAlexey Dobriyan <adobriyan@gmail.com>
      Cc: Björn Töpel <bjorn@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      4356b11e
    • tiozhang's avatar
      cred: convert printks to pr_<level> · 4099451a
      tiozhang authored
      Use current logging style.
      
      Link: https://lkml.kernel.org/r/20230625033452.GA22858@didi-ThinkCentre-M930t-N000
      
      
      Signed-off-by: default avatartiozhang <tiozhang@didiglobal.com>
      Reviewed-by: default avatarSergey Senozhatsky <senozhatsky@chromium.org>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Joe Perches <joe@perches.com>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Luis Chamberlain <mcgrof@kernel.org>
      Cc: Paulo Alcantara <pc@cjr.nz>
      Cc: Weiping Zhang <zwp10758@gmail.com>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      4099451a
  2. Jul 31, 2023
    • Linus Torvalds's avatar
      Linux 6.5-rc4 · 5d0c230f
      Linus Torvalds authored
      v6.5-rc4
      5d0c230f
    • Linus Torvalds's avatar
      Merge tag 'spi-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi · d5bb4b89
      Linus Torvalds authored
      Pull spi fixes from Mark Brown:
       "A bunch of fixes for the Qualcomm QSPI driver, fixing multiple issues
        with the newly added DMA mode - it had a number of issues exposed when
        tested in a wider range of use cases, both race condition style issues
        and issues with different inputs to those that had been used in test"
      
      * tag 'spi-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/spi:
        spi: spi-qcom-qspi: Add mem_ops to avoid PIO for badly sized reads
        spi: spi-qcom-qspi: Fallback to PIO for xfers that aren't multiples of 4 bytes
        spi: spi-qcom-qspi: Add DMA_CHAIN_DONE to ALL_IRQS
        spi: spi-qcom-qspi: Call dma_wmb() after setting up descriptors
        spi: spi-qcom-qspi: Use GFP_ATOMIC flag while allocating for descriptor
        spi: spi-qcom-qspi: Ignore disabled interrupts' status in isr
      d5bb4b89
    • Linus Torvalds's avatar
      Merge tag 'regulator-fix-v6.5-rc3' of... · 3dfe6886
      Linus Torvalds authored
      Merge tag 'regulator-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator
      
      Pull regulator fixes from Mark Brown:
       "A couple of small fixes for the the mt6358 driver, fixing error
        reporting and a bootstrapping issue"
      
      * tag 'regulator-fix-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator:
        regulator: mt6358: Fix incorrect VCN33 sync error message
        regulator: mt6358: Sync VCN33_* enable status after checking ID
      3dfe6886
    • Linus Torvalds's avatar
      Merge tag 'usb-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 88f66f13
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a set of USB driver fixes for 6.5-rc4. Include in here are:
      
         - new USB serial device ids
      
         - dwc3 driver fixes for reported issues
      
         - typec driver fixes for reported problems
      
         - gadget driver fixes
      
         - reverts of some problematic USB changes that went into -rc1
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'usb-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (24 commits)
        usb: misc: ehset: fix wrong if condition
        usb: dwc3: pci: skip BYT GPIO lookup table for hardwired phy
        usb: cdns3: fix incorrect calculation of ep_buf_size when more than one config
        usb: gadget: call usb_gadget_check_config() to verify UDC capability
        usb: typec: Use sysfs_emit_at when concatenating the string
        usb: typec: Iterate pds array when showing the pd list
        usb: typec: Set port->pd before adding device for typec_port
        usb: typec: qcom: fix return value check in qcom_pmic_typec_probe()
        Revert "usb: gadget: tegra-xudc: Fix error check in tegra_xudc_powerdomain_init()"
        Revert "usb: xhci: tegra: Fix error check"
        USB: gadget: Fix the memory leak in raw_gadget driver
        usb: gadget: core: remove unbalanced mutex_unlock in usb_gadget_activate
        Revert "usb: dwc3: core: Enable AutoRetry feature in the controller"
        Revert "xhci: add quirk for host controllers that don't update endpoint DCS"
        USB: quirks: add quirk for Focusrite Scarlett
        usb: xhci-mtk: set the dma max_seg_size
        MAINTAINERS: drop invalid usb/cdns3 Reviewer e-mail
        usb: dwc3: don't reset device side if dwc3 was configured as host-only
        usb: typec: ucsi: move typec_set_mode(TYPEC_STATE_SAFE) to ucsi_unregister_partner()
        usb: ohci-at91: Fix the unhandle interrupt when resume
        ...
      88f66f13
    • Linus Torvalds's avatar
      Merge tag 'tty-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · e6d34ced
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are some small TTY and serial driver fixes for 6.5-rc4 for some
        reported problems. Included in here is:
      
         - TIOCSTI fix for braille readers
      
         - documentation fix for minor numbers
      
         - MAINTAINERS update for new serial files in -rc1
      
         - minor serial driver fixes for reported problems
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'tty-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: 8250_dw: Preserve original value of DLF register
        tty: serial: sh-sci: Fix sleeping in atomic context
        serial: sifive: Fix sifive_serial_console_setup() section
        Documentation: devices.txt: reconcile serial/ucc_uart minor numers
        MAINTAINERS: Update TTY layer for lists and recently added files
        tty: n_gsm: fix UAF in gsm_cleanup_mux
        TIOCSTI: always enable for CAP_SYS_ADMIN
      e6d34ced
    • Linus Torvalds's avatar
      Merge tag 'staging-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 3d6b77a8
      Linus Torvalds authored
      Pull staging driver fixes from Greg KH:
       "Here are three small staging driver fixes for 6.5-rc4 that resolve
        some reported problems. These fixes are:
      
         - fix for an old bug in the r8712 driver
      
         - fbtft driver fix for a spi device
      
         - potential overflow fix in the ks7010 driver
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'staging-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        staging: ks7010: potential buffer overflow in ks_wlan_set_encode_ext()
        staging: fbtft: ili9341: use macro FBTFT_REGISTER_SPI_DRIVER
        staging: r8712: Fix memory leak in _r8712_init_xmit_priv()
      3d6b77a8
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · cf270e7b
      Linus Torvalds authored
      Pull char driver and Documentation fixes from Greg KH:
       "Here is a char driver fix and some documentation updates for 6.5-rc4
        that contain the following changes:
      
         - sram/genalloc bugfix for reported problem
      
         - security-bugs.rst update based on recent discussions
      
         - embargoed-hardware-issues minor cleanups and then partial revert
           for the project/company lists
      
        All of these have been in linux-next for a while with no reported
        problems, and the documentation updates have all been reviewed by the
        relevant developers"
      
      * tag 'char-misc-6.5-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        misc/genalloc: Name subpools by of_node_full_name()
        Documentation: embargoed-hardware-issues.rst: add AMD to the list
        Documentation: embargoed-hardware-issues.rst: clean out empty and unused entries
        Documentation: security-bugs.rst: clarify CVE handling
        Documentation: security-bugs.rst: update preferences when dealing with the linux-distros group
      cf270e7b
    • Linus Torvalds's avatar
      Merge tag 'probes-fixes-v6.5-rc3' of... · b0b9850e
      Linus Torvalds authored
      Merge tag 'probes-fixes-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
      
      Pull probe fixes from Masami Hiramatsu:
      
       - probe-events: add NULL check for some BTF API calls which can return
         error code and NULL.
      
       - ftrace selftests: check fprobe and kprobe event correctly. This fixes
         a miss condition of the test command.
      
       - kprobes: do not allow probing functions that start with "__cfi_" or
         "__pfx_" since those are auto generated for kernel CFI and not
         executed.
      
      * tag 'probes-fixes-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        kprobes: Prohibit probing on CFI preamble symbol
        selftests/ftrace: Fix to check fprobe event eneblement
        tracing/probes: Fix to add NULL check for BTF APIs
      b0b9850e
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 98a05fe8
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "x86:
      
         - Do not register IRQ bypass consumer if posted interrupts not
           supported
      
         - Fix missed device interrupt due to non-atomic update of IRR
      
         - Use GFP_KERNEL_ACCOUNT for pid_table in ipiv
      
         - Make VMREAD error path play nice with noinstr
      
         - x86: Acquire SRCU read lock when handling fastpath MSR writes
      
         - Support linking rseq tests statically against glibc 2.35+
      
         - Fix reference count for stats file descriptors
      
         - Detect userspace setting invalid CR0
      
        Non-KVM:
      
         - Remove coccinelle script that has caused multiple confusion
           ("debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE()
           usage", acked by Greg)"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (21 commits)
        KVM: selftests: Expand x86's sregs test to cover illegal CR0 values
        KVM: VMX: Don't fudge CR0 and CR4 for restricted L2 guest
        KVM: x86: Disallow KVM_SET_SREGS{2} if incoming CR0 is invalid
        Revert "debugfs, coccinelle: check for obsolete DEFINE_SIMPLE_ATTRIBUTE() usage"
        KVM: selftests: Verify stats fd is usable after VM fd has been closed
        KVM: selftests: Verify stats fd can be dup()'d and read
        KVM: selftests: Verify userspace can create "redundant" binary stats files
        KVM: selftests: Explicitly free vcpus array in binary stats test
        KVM: selftests: Clean up stats fd in common stats_test() helper
        KVM: selftests: Use pread() to read binary stats header
        KVM: Grab a reference to KVM for VM and vCPU stats file descriptors
        selftests/rseq: Play nice with binaries statically linked against glibc 2.35+
        Revert "KVM: SVM: Skip WRMSR fastpath on VM-Exit if next RIP isn't valid"
        KVM: x86: Acquire SRCU read lock when handling fastpath MSR writes
        KVM: VMX: Use vmread_error() to report VM-Fail in "goto" path
        KVM: VMX: Make VMREAD error path play nice with noinstr
        KVM: x86/irq: Conditionally register IRQ bypass consumer again
        KVM: X86: Use GFP_KERNEL_ACCOUNT for pid_table in ipiv
        KVM: x86: check the kvm_cpu_get_interrupt result before using it
        KVM: x86: VMX: set irr_pending in kvm_apic_update_irr
        ...
      98a05fe8
    • Linus Torvalds's avatar
      Merge tag 'locking_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · c959e900
      Linus Torvalds authored
      Pull locking fix from Borislav Petkov:
      
       - Fix a rtmutex race condition resulting from sharing of the sort key
         between the lock waiters and the PI chain tree (->pi_waiters) of a
         task by giving each tree their own sort key
      
      * tag 'locking_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/rtmutex: Fix task->pi_waiters integrity
      c959e900
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · d410b62e
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - AMD's automatic IBRS doesn't enable cross-thread branch target
         injection protection (STIBP) for user processes. Enable STIBP on such
         systems.
      
       - Do not delete (but put the ref instead) of AMD MCE error thresholding
         sysfs kobjects when destroying them in order not to delete the kernfs
         pointer prematurely
      
       - Restore annotation in ret_from_fork_asm() in order to fix kthread
         stack unwinding from being marked as unreliable and thus breaking
         livepatching
      
      * tag 'x86_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/cpu: Enable STIBP on AMD if Automatic IBRS is enabled
        x86/MCE/AMD: Decrement threshold_bank refcount when removing threshold blocks
        x86: Fix kthread unwind
      d410b62e
    • Linus Torvalds's avatar
      Merge tag 'irq_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · eb9fe179
      Linus Torvalds authored
      Pull irq fixes from Borislav Petkov:
      
       - Work around an erratum on GIC700, where a race between a CPU handling
         a wake-up interrupt, a change of affinity, and another CPU going to
         sleep can result in a lack of wake-up event on the next interrupt
      
       - Fix the locking required on a VPE for GICv4
      
       - Enable Rockchip 3588001 erratum workaround for RK3588S
      
       - Fix the irq-bcm6345-l1 assumtions of the boot CPU always be the first
         CPU in the system
      
      * tag 'irq_urgent_for_v6.5_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        irqchip/gic-v3: Workaround for GIC-700 erratum 2941627
        irqchip/gic-v3: Enable Rockchip 3588001 erratum workaround for RK3588S
        irqchip/gic-v4.1: Properly lock VPEs when doing a directLPI invalidation
        irq-bcm6345-l1: Do not assume a fixed block to cpu mapping
      eb9fe179
  3. Jul 30, 2023
    • Linus Torvalds's avatar
      Merge tag '6.5-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6 · d31e3792
      Linus Torvalds authored
      Pull smb client fixes from Steve French:
       "Four small SMB3 client fixes:
      
         - two reconnect fixes (to address the case where non-default
           iocharset gets incorrectly overridden at reconnect with the
           default charset)
      
         - fix for NTLMSSP_AUTH request setting a flag incorrectly)
      
         - Add missing check for invalid tlink (tree connection) in ioctl"
      
      * tag '6.5-rc3-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: add missing return value check for cifs_sb_tlink
        smb3: do not set NTLMSSP_VERSION flag for negotiate not auth request
        cifs: fix charset issue in reconnection
        fs/nls: make load_nls() take a const parameter
      d31e3792
    • Linus Torvalds's avatar
      Merge tag 'trace-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace · b88e123c
      Linus Torvalds authored
      Pull tracing fixes from Steven Rostedt:
      
       - Fix to /sys/kernel/tracing/per_cpu/cpu*/stats read and entries.
      
         If a resize shrinks the buffer it clears the read count to notify
         readers that they need to reset. But the read count is also used for
         accounting and this causes the numbers to be off. Instead, create a
         separate variable to use to notify readers to reset.
      
       - Fix the ref counts of the "soft disable" mode. The wrong value was
         used for testing if soft disable mode should be enabled or disable,
         but instead, just change the logic to do the enable and disable in
         place when the SOFT_MODE is set or cleared.
      
       - Several kernel-doc fixes
      
       - Removal of unused external declarations
      
      * tag 'trace-v6.5-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace:
        tracing: Fix warning in trace_buffered_event_disable()
        ftrace: Remove unused extern declarations
        tracing: Fix kernel-doc warnings in trace_seq.c
        tracing: Fix kernel-doc warnings in trace_events_trigger.c
        tracing/synthetic: Fix kernel-doc warnings in trace_events_synth.c
        ring-buffer: Fix kernel-doc warnings in ring_buffer.c
        ring-buffer: Fix wrong stat of cpu_buffer->read
      b88e123c
    • Sven Joachim's avatar
      arch/*/configs/*defconfig: Replace AUTOFS4_FS by AUTOFS_FS · 1f2190d6
      Sven Joachim authored
      Commit a2225d93
      
       ("autofs: remove left-over autofs4 stubs")
      promised the removal of the fs/autofs/Kconfig fragment for AUTOFS4_FS
      within a couple of releases, but five years later this still has not
      happened yet, and AUTOFS4_FS is still enabled in 63 defconfigs.
      
      Get rid of it mechanically:
      
         git grep -l CONFIG_AUTOFS4_FS -- '*defconfig' |
             xargs sed -i 's/AUTOFS4_FS/AUTOFS_FS/'
      
      Also just remove the AUTOFS4_FS config option stub.  Anybody who hasn't
      regenerated their config file in the last five years will need to just
      get the new name right when they do.
      
      Signed-off-by: default avatarSven Joachim <svenjoac@gmx.de>
      Acked-by: default avatarIan Kent <raven@themaw.net>
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      1f2190d6
  4. Jul 29, 2023