1. 02 Oct, 2023 3 commits
  2. 29 Sep, 2023 14 commits
  3. 28 Sep, 2023 5 commits
    • Kees Cook's avatar
      MAINTAINERS: hardening: Add Gustavo as Reviewer · 4ae7f632
      Kees Cook authored
      It's an oversight to not have already listed Gustavo here. Add him as a
      Reviewer.
      
      Cc: Gustavo A. R. Silva <gustavoars@kernel.org>
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      4ae7f632
    • Kees Cook's avatar
      accel/ivpu: Annotate struct ivpu_job with __counted_by · 5e6a1c80
      Kees Cook authored
      Prepare for the coming implementation by GCC and Clang of the __counted_by
      attribute. Flexible array members annotated with __counted_by can have
      their accesses bounds-checked at run-time checking via CONFIG_UBSAN_BOUNDS
      (for array indexing) and CONFIG_FORTIFY_SOURCE (for strcpy/memcpy-family
      functions).
      
      As found with Coccinelle[1], add __counted_by for struct ivpu_job.
      
      [1] https://github.com/kees/kernel-tools/blob/trunk/coccinelle/examples/counted_by.cocci
      
      Cc: Jacek Lawrynowicz <jacek.lawrynowicz@linux.intel.com>
      Cc: Stanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
      Cc: Oded Gabbay <ogabbay@kernel.org>
      Cc: Nathan Chancellor <nathan@kernel.org>
      Cc: Nick Desaulniers <ndesaulniers@google.com>
      Cc: Tom Rix <trix@redhat.com>
      Cc: dri-devel@lists.freedesktop.org
      Cc: llvm@lists.linux.dev
      Reviewed-by: default avatarStanislaw Gruszka <stanislaw.gruszka@linux.intel.com>
      Link: https://lore.kernel.org/r/20230922175416.work.272-kees@kernel.orgSigned-off-by: default avatarKees Cook <keescook@chromium.org>
      5e6a1c80
    • Kees Cook's avatar
      MAINTAINERS: hardening: Add __counted_by regex · 921f15fe
      Kees Cook authored
      Since __counted_by annotations may also require that code be changed to
      get initialization ordering correct, let's get an extra group of eyes on
      code that is working on these annotations.
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      921f15fe
    • Ricardo Cañuelo's avatar
      selftests/lkdtm: Disable CONFIG_UBSAN_TRAP in test config · cf77bf69
      Ricardo Cañuelo authored
      The lkdtm selftest config fragment enables CONFIG_UBSAN_TRAP to make the
      ARRAY_BOUNDS test kill the calling process when an out-of-bound access
      is detected by UBSAN. However, after this [1] commit, UBSAN is triggered
      under many new scenarios that weren't detected before, such as in struct
      definitions with fixed-size trailing arrays used as flexible arrays. As
      a result, CONFIG_UBSAN_TRAP=y has become a very aggressive option to
      enable except for specific situations.
      
      `make kselftest-merge` applies CONFIG_UBSAN_TRAP=y to the kernel config
      for all selftests, which makes many of them fail because of system hangs
      during boot.
      
      This change removes the config option from the lkdtm kselftest and
      configures the ARRAY_BOUNDS test to look for UBSAN reports rather than
      relying on the calling process being killed.
      
      [1] commit 2d47c695 ("ubsan: Tighten UBSAN_BOUNDS on GCC")'
      Signed-off-by: default avatarRicardo Cañuelo <ricardo.canuelo@collabora.com>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Link: https://lore.kernel.org/r/20230802063252.1917997-1-ricardo.canuelo@collabora.comSigned-off-by: default avatarKees Cook <keescook@chromium.org>
      cf77bf69
    • Mark Rutland's avatar
      lkdtm/bugs: add test for panic() with stuck secondary CPUs · eac80dd4
      Mark Rutland authored
      Upon a panic() the kernel will use either smp_send_stop() or
      crash_smp_send_stop() to attempt to stop secondary CPUs via an IPI,
      which may or may not be an NMI. Generally it's preferable that this is an
      NMI so that CPUs can be stopped in as many situations as possible, but
      it's not always possible to provide an NMI, and there are cases where
      CPUs may be unable to handle the NMI regardless.
      
      This patch adds a test for panic() where all other CPUs are stuck with
      interrupts disabled, which can be used to check whether the kernel
      gracefully handles CPUs failing to respond to a stop, and whether NMIs
      actually work to stop CPUs.
      
      For example, on arm64 *without* an NMI, this results in:
      
      | # echo PANIC_STOP_IRQOFF > /sys/kernel/debug/provoke-crash/DIRECT
      | lkdtm: Performing direct entry PANIC_STOP_IRQOFF
      | Kernel panic - not syncing: panic stop irqoff test
      | CPU: 2 PID: 24 Comm: migration/2 Not tainted 6.5.0-rc3-00077-ge6c782389895-dirty #4
      | Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
      | Stopper: multi_cpu_stop+0x0/0x1a0 <- stop_machine_cpuslocked+0x158/0x1a4
      | Call trace:
      |  dump_backtrace+0x94/0xec
      |  show_stack+0x18/0x24
      |  dump_stack_lvl+0x74/0xc0
      |  dump_stack+0x18/0x24
      |  panic+0x358/0x3e8
      |  lkdtm_PANIC+0x0/0x18
      |  multi_cpu_stop+0x9c/0x1a0
      |  cpu_stopper_thread+0x84/0x118
      |  smpboot_thread_fn+0x224/0x248
      |  kthread+0x114/0x118
      |  ret_from_fork+0x10/0x20
      | SMP: stopping secondary CPUs
      | SMP: failed to stop secondary CPUs 0-3
      | Kernel Offset: 0x401cf3490000 from 0xffff80008000000c0
      | PHYS_OFFSET: 0x40000000
      | CPU features: 0x00000000,68c167a1,cce6773f
      | Memory Limit: none
      | ---[ end Kernel panic - not syncing: panic stop irqoff test ]---
      
      Note the "failed to stop secondary CPUs 0-3" message.
      
      On arm64 *with* an NMI, this results in:
      
      | # echo PANIC_STOP_IRQOFF > /sys/kernel/debug/provoke-crash/DIRECT
      | lkdtm: Performing direct entry PANIC_STOP_IRQOFF
      | Kernel panic - not syncing: panic stop irqoff test
      | CPU: 1 PID: 19 Comm: migration/1 Not tainted 6.5.0-rc3-00077-ge6c782389895-dirty #4
      | Hardware name: QEMU QEMU Virtual Machine, BIOS 0.0.0 02/06/2015
      | Stopper: multi_cpu_stop+0x0/0x1a0 <- stop_machine_cpuslocked+0x158/0x1a4
      | Call trace:
      |  dump_backtrace+0x94/0xec
      |  show_stack+0x18/0x24
      |  dump_stack_lvl+0x74/0xc0
      |  dump_stack+0x18/0x24
      |  panic+0x358/0x3e8
      |  lkdtm_PANIC+0x0/0x18
      |  multi_cpu_stop+0x9c/0x1a0
      |  cpu_stopper_thread+0x84/0x118
      |  smpboot_thread_fn+0x224/0x248
      |  kthread+0x114/0x118
      |  ret_from_fork+0x10/0x20
      | SMP: stopping secondary CPUs
      | Kernel Offset: 0x55a9c0bc0000 from 0xffff800080000000
      | PHYS_OFFSET: 0x40000000
      | CPU features: 0x00000000,68c167a1,fce6773f
      | Memory Limit: none
      | ---[ end Kernel panic - not syncing: panic stop irqoff test ]---
      
      Note the absence of a "failed to stop secondary CPUs" message, since we
      don't log anything when secondary CPUs are successfully stopped.
      Signed-off-by: default avatarMark Rutland <mark.rutland@arm.com>
      Cc: Douglas Anderson <dianders@chromium.org>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Stephen Boyd <swboyd@chromium.org>
      Cc: Sumit Garg <sumit.garg@linaro.org>
      Reviewed-by: default avatarKees Cook <keescook@chromium.org>
      Reviewed-by: default avatarDouglas Anderson <dianders@chromium.org>
      Reviewed-by: default avatarStephen Boyd <swboyd@chromium.org>
      Link: https://lore.kernel.org/r/20230921161634.4063233-1-mark.rutland@arm.comSigned-off-by: default avatarKees Cook <keescook@chromium.org>
      eac80dd4
  4. 22 Sep, 2023 3 commits
  5. 17 Sep, 2023 11 commits
  6. 16 Sep, 2023 4 commits
    • Linus Torvalds's avatar
      Merge tag 'kbuild-fixes-v6.6' of... · f0b0d403
      Linus Torvalds authored
      Merge tag 'kbuild-fixes-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild
      
      Pull Kbuild fixes from Masahiro Yamada:
      
       - Fix kernel-devel RPM and linux-headers Deb package
      
       - Fix too long argument list error in 'make modules_install'
      
      * tag 'kbuild-fixes-v6.6' of git://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild:
        kbuild: avoid long argument lists in make modules_install
        kbuild: fix kernel-devel RPM package and linux-headers Deb package
      f0b0d403
    • Linus Torvalds's avatar
      vm: fix move_vma() memory accounting being off · 3cec5049
      Linus Torvalds authored
      Commit 408579cd ("mm: Update do_vmi_align_munmap() return
      semantics") seems to have updated one of the callers of do_vmi_munmap()
      incorrectly: it used to check for the error case (which didn't
      change: negative means error).
      
      That commit changed the check to the success case (which did change:
      before that commit, 0 was success, and 1 was "success and lock
      downgraded".  After the change, it's always 0 for success, and the lock
      will have been released if requested).
      
      This didn't change any actual VM behavior _except_ for memory accounting
      when 'VM_ACCOUNT' was set on the vma.  Which made the wrong return value
      test fairly subtle, since everything continues to work.
      
      Or rather - it continues to work but the "Committed memory" accounting
      goes all wonky (Committed_AS value in /proc/meminfo), and depending on
      settings that then causes problems much much later as the VM relies on
      bogus statistics for its heuristics.
      
      Revert that one line of the change back to the original logic.
      
      Fixes: 408579cd ("mm: Update do_vmi_align_munmap() return semantics")
      Reported-by: default avatarChristoph Biedl <linux-kernel.bfrz@manchmal.in-ulm.de>
      Reported-bisected-and-tested-by: default avatarMichael Labiuk <michael.labiuk@virtuozzo.com>
      Cc: Bagas Sanjaya <bagasdotme@gmail.com>
      Cc: Liam R. Howlett <Liam.Howlett@oracle.com>
      Link: https://lore.kernel.org/all/1694366957@msgid.manchmal.in-ulm.de/Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      3cec5049
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · ad8a69f3
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "16 small(ish) fixes all in drivers.
      
        The major fixes are in pm8001 (fixes MSI-X issue going back to its
        origin), the qla2xxx endianness fix, which fixes a bug on big endian
        and the lpfc ones which can cause an oops on module removal without
        them"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi:
        scsi: lpfc: Prevent use-after-free during rmmod with mapped NVMe rports
        scsi: lpfc: Early return after marking final NLP_DROPPED flag in dev_loss_tmo
        scsi: lpfc: Fix the NULL vs IS_ERR() bug for debugfs_create_file()
        scsi: target: core: Fix target_cmd_counter leak
        scsi: pm8001: Setup IRQs on resume
        scsi: pm80xx: Avoid leaking tags when processing OPC_INB_SET_CONTROLLER_CONFIG command
        scsi: pm80xx: Use phy-specific SAS address when sending PHY_START command
        scsi: ufs: core: Poll HCS.UCRDY before issuing a UIC command
        scsi: ufs: core: Move __ufshcd_send_uic_cmd() outside host_lock
        scsi: qedf: Add synchronization between I/O completions and abort
        scsi: target: Replace strlcpy() with strscpy()
        scsi: qla2xxx: Fix NULL vs IS_ERR() bug for debugfs_create_dir()
        scsi: qla2xxx: Use raw_smp_processor_id() instead of smp_processor_id()
        scsi: qla2xxx: Correct endianness for rqstlen and rsplen
        scsi: ppa: Fix accidentally reversed conditions for 16-bit and 32-bit EPP
        scsi: megaraid_sas: Fix deadlock on firmware crashdump
      ad8a69f3
    • Linus Torvalds's avatar
      Merge tag 'ata-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata · cc3e5afc
      Linus Torvalds authored
      Pull ata fixes from Damien Le Moal:
      
       - Fix link power management transitions to disallow unsupported states
         (Niklas)
      
       - A small string handling fix for the sata_mv driver (Christophe)
      
       - Clear port pending interrupts before reset, as per AHCI
         specifications (Szuying).
      
         Followup fixes for this one are to not clear ATA_PFLAG_EH_PENDING in
         ata_eh_reset() to allow EH to continue on with other actions recorded
         with error interrupts triggered before EH completes. And an
         additional fix to avoid thawing a port twice in EH (Niklas)
      
       - Small code style fixes in the pata_parport driver to silence the
         build bot as it keeps complaining about bad indentation (me)
      
       - A fix for the recent CDL code to avoid fetching sense data for
         successful commands when not necessary for correct operation (Niklas)
      
      * tag 'ata-6.6-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
        ata: libata-core: fetch sense data for successful commands iff CDL enabled
        ata: libata-eh: do not thaw the port twice in ata_eh_reset()
        ata: libata-eh: do not clear ATA_PFLAG_EH_PENDING in ata_eh_reset()
        ata: pata_parport: Fix code style issues
        ata: libahci: clear pending interrupt status
        ata: sata_mv: Fix incorrect string length computation in mv_dump_mem()
        ata: libata: disallow dev-initiated LPM transitions to unsupported states
      cc3e5afc