1. 20 Aug, 2022 5 commits
    • Linus Torvalds's avatar
      Merge tag 'block-6.0-2022-08-19' of git://git.kernel.dk/linux-block · b9bce6e5
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "A few fixes that should go into this release:
      
         - Small series of patches for ublk (ZiyangZhang)
      
         - Remove dead function (Yu)
      
         - Fix for running a block queue in case of resource starvation
           (Yufen)"
      
      * tag 'block-6.0-2022-08-19' of git://git.kernel.dk/linux-block:
        blk-mq: run queue no matter whether the request is the last request
        blk-mq: remove unused function blk_mq_queue_stopped()
        ublk_drv: do not add a re-issued request aborted previously to ioucmd's task_work
        ublk_drv: update comment for __ublk_fail_req()
        ublk_drv: check ubq_daemon_is_dying() in __ublk_rq_task_work()
        ublk_drv: update iod->addr for UBLK_IO_NEED_GET_DATA
      b9bce6e5
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.0-2022-08-19' of git://git.kernel.dk/linux-block · beaf1397
      Linus Torvalds authored
      Pull io_uring fixes from Jens Axboe:
       "A few fixes for regressions in this cycle:
      
         - Two instances of using the wrong "has async data" helper (Pavel)
      
         - Fixup zero-copy address import (Pavel)
      
         - Bump zero-copy notification slot limit (Pavel)"
      
      * tag 'io_uring-6.0-2022-08-19' of git://git.kernel.dk/linux-block:
        io_uring/net: use right helpers for async_data
        io_uring/notif: raise limit on notification slots
        io_uring/net: improve zc addr import error handling
        io_uring/net: use right helpers for async recycle
      beaf1397
    • Linus Torvalds's avatar
      Merge tag 'ata-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata · 044610f8
      Linus Torvalds authored
      Pull ATA fixes from Damien Le Moal:
      
       - Add a missing command name definition for ata_get_cmd_name(), from
         me.
      
       - A fix to address a performance regression due to the default
         max_sectors queue limit for ATA devices connected to AHCI adapters
         being too small, from John.
      
      * tag 'ata-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/dlemoal/libata:
        ata: libata: Set __ATA_BASE_SHT max_sectors
        ata: libata-eh: Add missing command name
      044610f8
    • Linus Torvalds's avatar
      Merge tag 'mmc-v6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc · 4d099c33
      Linus Torvalds authored
      Pull MMC host fixes from Ulf Hansson:
      
       - meson-gx: Fix error handling in ->probe()
      
       - mtk-sd: Fix a command problem when using cqe off/disable
      
       - pxamci: Fix error handling in ->probe()
      
       - sdhci-of-dwcmshc: Fix broken support for the BlueField-3 variant
      
      * tag 'mmc-v6.0-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/ulfh/mmc:
        mmc: sdhci-of-dwcmshc: Re-enable support for the BlueField-3 SoC
        mmc: meson-gx: Fix an error handling path in meson_mmc_probe()
        mmc: mtk-sd: Clear interrupts when cqe off/disable
        mmc: pxamci: Fix another error handling path in pxamci_probe()
        mmc: pxamci: Fix an error handling path in pxamci_probe()
      4d099c33
    • John Garry's avatar
      ata: libata: Set __ATA_BASE_SHT max_sectors · a357f7b4
      John Garry authored
      Commit 0568e612 ("ata: libata-scsi: cap ata_device->max_sectors
      according to shost->max_sectors") inadvertently capped the max_sectors
      value for some SATA disks to a value which is lower than we would want.
      
      For a device which supports LBA48, we would previously have request queue
      max_sectors_kb and max_hw_sectors_kb values of 1280 and 32767 respectively.
      
      For AHCI controllers, the value chosen for shost max sectors comes from
      the minimum of the SCSI host default max sectors in
      SCSI_DEFAULT_MAX_SECTORS (1024) and the shost DMA device mapping limit.
      
      This means that we would now set the max_sectors_kb and max_hw_sectors_kb
      values for a disk which supports LBA48 at 512, ignoring DMA mapping limit.
      
      As report by Oliver at [0], this caused a performance regression.
      
      Fix by picking a large enough max sectors value for ATA host controllers
      such that we don't needlessly reduce max_sectors_kb for LBA48 disks.
      
      [0] https://lore.kernel.org/linux-ide/YvsGbidf3na5FpGb@xsang-OptiPlex-9020/T/#m22d9fc5ad15af66066dd9fecf3d50f1b1ef11da3
      
      Fixes: 0568e612 ("ata: libata-scsi: cap ata_device->max_sectors according to shost->max_sectors")
      Reported-by: default avatarOliver Sang <oliver.sang@intel.com>
      Signed-off-by: default avatarJohn Garry <john.garry@huawei.com>
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      a357f7b4
  2. 19 Aug, 2022 25 commits
    • Linus Torvalds's avatar
      Merge tag 'execve-v6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · 50cd95ac
      Linus Torvalds authored
      Pull execve fix from Kees Cook:
      
       - Replace remaining kmap() uses with kmap_local_page() (Fabio M. De
         Francesco)
      
      * tag 'execve-v6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        exec: Replace kmap{,_atomic}() with kmap_local_page()
      50cd95ac
    • Linus Torvalds's avatar
      Merge tag 'hardening-v6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux · e45c8901
      Linus Torvalds authored
      Pull hardening fixes from Kees Cook:
      
       - Also undef LATENT_ENTROPY_PLUGIN for per-file disabling (Andrew
         Donnellan)
      
       - Return EFAULT on copy_from_user() failures in LoadPin (Kees Cook)
      
      * tag 'hardening-v6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux:
        gcc-plugins: Undefine LATENT_ENTROPY_PLUGIN when plugin disabled for a file
        LoadPin: Return EFAULT on copy_from_user() failures
      e45c8901
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 8fd00059
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - A fix to make the ISA extension static keys writable after init. This
         manifests at least as a crash when loading modules (including KVM).
      
       - A fixup for a build warning related to a poorly formed comment in our
         perf driver.
      
      * tag 'riscv-for-linus-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        perf: riscv legacy: fix kerneldoc comment warning
        riscv: Ensure isa-ext static keys are writable
      8fd00059
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · ca052cfd
      Linus Torvalds authored
      Pull kvm fixes from Paolo Bonzini:
       "ARM:
      
         - Fix unexpected sign extension of KVM_ARM_DEVICE_ID_MASK
      
         - Tidy-up handling of AArch32 on asymmetric systems
      
        x86:
      
         - Fix 'missing ENDBR' BUG for fastop functions
      
        Generic:
      
         - Some cleanup and static analyzer patches
      
         - More fixes to KVM_CREATE_VM unwind paths"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: Drop unnecessary initialization of "ops" in kvm_ioctl_create_device()
        KVM: Drop unnecessary initialization of "npages" in hva_to_pfn_slow()
        x86/kvm: Fix "missing ENDBR" BUG for fastop functions
        x86/kvm: Simplify FOP_SETCC()
        x86/ibt, objtool: Add IBT_NOSEAL()
        KVM: Rename mmu_notifier_* to mmu_invalidate_*
        KVM: Rename KVM_PRIVATE_MEM_SLOTS to KVM_INTERNAL_MEM_SLOTS
        KVM: MIPS: remove unnecessary definition of KVM_PRIVATE_MEM_SLOTS
        KVM: Move coalesced MMIO initialization (back) into kvm_create_vm()
        KVM: Unconditionally get a ref to /dev/kvm module when creating a VM
        KVM: Properly unwind VM creation if creating debugfs fails
        KVM: arm64: Reject 32bit user PSTATE on asymmetric systems
        KVM: arm64: Treat PMCR_EL1.LC as RES1 on asymmetric systems
        KVM: arm64: Fix compile error due to sign extension
      ca052cfd
    • Linus Torvalds's avatar
      Merge tag 'for-6.0-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux · 42c54d54
      Linus Torvalds authored
      Pull btrfs fixes from David Sterba:
       "A few short fixes and a lockdep warning fix (needs moving some code):
      
         - tree-log replay fixes:
            - fix error handling when looking up extent refs
            - fix warning when setting inode number of links
      
         - relocation fixes:
            - reset block group read-only status when relocation fails
            - unset control structure if transaction fails when starting
              to process a block group
            - add lockdep annotations to fix a warning during relocation
              where blocks temporarily belong to another tree and can lead
              to reversed dependencies
      
         - tree-checker verifies that extent items don't overlap"
      
      * tag 'for-6.0-rc1-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/kdave/linux:
        btrfs: tree-checker: check for overlapping extent items
        btrfs: fix warning during log replay when bumping inode link count
        btrfs: fix lost error handling when looking up extended ref on log replay
        btrfs: fix lockdep splat with reloc root extent buffers
        btrfs: move lockdep class helpers to locking.c
        btrfs: unset reloc control if transaction commit fails in prepare_to_relocate()
        btrfs: reset RO counter on block group if we fail to relocate
      42c54d54
    • Linus Torvalds's avatar
      Merge tag '5.20-rc2-ksmbd-smb3-server-fixes' of git://git.samba.org/ksmbd · a3a78b63
      Linus Torvalds authored
      Pull ksmbd server fixes from Steve French:
      
       - important sparse file fix
      
       - allocation size fix
      
       - fix incorrect rc on bad share
      
       - share config fix
      
      * tag '5.20-rc2-ksmbd-smb3-server-fixes' of git://git.samba.org/ksmbd:
        ksmbd: don't remove dos attribute xattr on O_TRUNC open
        ksmbd: remove unnecessary generic_fillattr in smb2_open
        ksmbd: request update to stale share config
        ksmbd: return STATUS_BAD_NETWORK_NAME error status if share is not configured
      a3a78b63
    • Linus Torvalds's avatar
      Merge tag 'sound-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 963a70be
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "The only significant core change is ASoC DPCM fix for asymmetric
        setup; other remaining changes are device-specific fixes, including
        the hardening of string manipulations.
      
        One change in platform/x86 is the patch I forgot to apply from a
        series for CS35L41 codec"
      
      * tag 'sound-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (21 commits)
        ALSA: hda/realtek: Add quirk for Clevo NS50PU, NS70PU
        ALSA: info: Fix llseek return value when using callback
        ALSA: hda/cs8409: Support new Dolphin Variants
        platform/x86: serial-multi-instantiate: Add CLSA0101 Laptop
        ALSA: hda/realtek: Add quirk for Lenovo Yoga7 14IAL7
        ALSA: hda: cs35l41: Clarify support for CSC3551 without _DSD Properties
        ALSA: hda/realtek: Add quirks for ASUS Zenbooks using CS35L41
        ASoC: codec: tlv320aic32x4: fix mono playback via I2S
        ASoC: rt5640: Fix the JD voltage dropping issue
        ASoC: tas2770: Fix handling of mute/unmute
        ASoC: tas2770: Drop conflicting set_bias_level power setting
        ASoC: tas2770: Allow mono streams
        ASoC: tas2770: Set correct FSYNC polarity
        ASoC: Intel: fix sof_es8336 probe
        ASoC: DPCM: Don't pick up BE without substream
        ASoC: SOF: ipc3-topology: Fix clang -Wformat warning
        ASoC: sh: rz-ssi: Improve error handling in rz_ssi_probe() error path
        ASoC: SOF: Intel: hda: Fix potential buffer overflow by snprintf()
        ASoC: SOF: debug: Fix potential buffer overflow by snprintf()
        ASoC: Intel: avs: Fix potential buffer overflow by snprintf()
        ...
      963a70be
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-2022-08-19' of git://anongit.freedesktop.org/drm/drm · adb67b37
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Regular weekly fixes.
      
        The nouveau patch just enables modesetting on GA103 hw which is like
        other ampere cards that are already supported. amdgpu has 2 weeks of
        fixes, as Alex was away, so a bit larger than usual, otherwise some
        i915 and misc other fixes.
      
        ttm:
         - NULL ptr dereference
      
        i915:
         - disable pci resize on 32-bit systems
         - don't leak the ccs state
         - TLB invalidation fixes
      
        nouveau:
         - GA103 enablement
         - off-by-one fix
      
        amdgpu:
         - Revert some DML stack changes
         - Rounding fixes in KFD allocations
         - atombios vram info table parsing fix
         - DCN 3.1.4 fixes
         - Clockgating fixes for various new IPs
         - SMU 13.0.4 fixes
         - DCN 3.1.4 FP fixes
         - TMDS fixes for YCbCr420 4k modes
         - DCN 3.2.x fixes
         - USB 4 fixes
         - SMU 13.0 fixes
         - SMU driver unload memory leak fixes
         - Display orientation fix
         - Regression fix for generic fbdev conversion
         - SDMA 6.x fixes
         - SR-IOV fixes
         - IH 6.x fixes
         - Use after free fix in bo list handling
         - Revert pipe1 support
         - XGMI hive reset fix
      
        amdkfd:
         - Fix potential crach in kfd_create_indirect_link_prop()
      
        imx:
         - warning fix
      
        meson:
         - refcounting fix
      
        lvds-codec:
         - error check fix
      
        sun4i:
         - underflow fix
         - dt-binding fix"
      
      * tag 'drm-fixes-2022-08-19' of git://anongit.freedesktop.org/drm/drm: (109 commits)
        Revert "drm/amd/amdgpu: add pipe1 hardware support"
        drm/amdgpu: Fix use-after-free on amdgpu_bo_list mutex
        drm/amdgpu: Fix interrupt handling on ih_soft ring
        drm/amdgpu: Add secure display TA load for Renoir
        drm/amd/display: Include scaling factor for SubVP command
        drm/amdgpu/vcn: Return void from the stop_dbg_mode
        drm/amdgpu: remove useless condition in amdgpu_job_stop_all_jobs_on_sched()
        drm/amdgpu: Add decode_iv_ts helper for ih_v6 block
        drm/amd/display: add chip revision to DCN32
        drm/amd/display: avoid doing vm_init multiple time
        drm/amd/display: Use pitch when calculating size to cache in MALL
        drm/amd/display: Don't set DSC for phantom pipes
        drm/amd/display: Update clock table policy for DCN314
        drm/amd/display: Modify header inclusion pattern
        drm/amd/display: Fix plug/unplug external monitor will hang while playback MPO video
        drm/amd/display: Add debug parameter to retain default clock table
        drm/amdgpu: Increase tlb flush timeout for sriov
        drm/amd/display: do not compare integers of different widths
        drm/amd/display: Add reserved dc_log_type.
        drm/amd/display: Fix pixel clock programming
        ...
      adb67b37
    • Linus Torvalds's avatar
      Merge tag 'bitmap-6.0-rc2' of https://github.com/norov/linux · a4ee891b
      Linus Torvalds authored
      Pull bitmap updates from Yury Norov:
       "cpumask: UP optimisation fixes follow-up
      
        As an older version of the UP optimisation fixes was merged, not all
        review feedback has been implemented.
      
        This implements the feedback received on the merged version [1], and
        the respin [2], for changes related to <linux/cpumask.h> and
        lib/cpumask.c"
      
      Link: https://lore.kernel.org/lkml/cover.1656777646.git.sander@svanheule.net/ [1]
      Link: https://lore.kernel.org/lkml/cover.1659077534.git.sander@svanheule.net/ [2]
      
      It spent for more than a week with no issues.
      
      * tag 'bitmap-6.0-rc2' of https://github.com/norov/linux:
        lib/cpumask: drop always-true preprocessor guard
        lib/cpumask: add inline cpumask_next_wrap() for UP
        cpumask: align signatures of UP implementations
      a4ee891b
    • Aaron Lu's avatar
      x86/mm: Use proper mask when setting PUD mapping · 88e0a749
      Aaron Lu authored
      Commit c164fbb4("x86/mm: thread pgprot_t through
      init_memory_mapping()") mistakenly used __pgprot() which doesn't respect
      __default_kernel_pte_mask when setting PUD mapping.
      
      Fix it by only setting the one bit we actually need (PSE) and leaving
      the other bits (that have been properly masked) alone.
      
      Fixes: c164fbb4 ("x86/mm: thread pgprot_t through init_memory_mapping()")
      Signed-off-by: default avatarAaron Lu <aaron.lu@intel.com>
      Cc: stable@kernel.org
      Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
      88e0a749
    • Paolo Bonzini's avatar
      Merge tag 'kvmarm-fixes-6.0-1' of... · 959d6c4a
      Paolo Bonzini authored
      Merge tag 'kvmarm-fixes-6.0-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kvmarm/kvmarm into HEAD
      
      KVM/arm64 fixes for 6.0, take #1
      
      - Fix unexpected sign extension of KVM_ARM_DEVICE_ID_MASK
      
      - Tidy-up handling of AArch32 on asymmetric systems
      959d6c4a
    • Li kunyu's avatar
      KVM: Drop unnecessary initialization of "ops" in kvm_ioctl_create_device() · eceb6e1d
      Li kunyu authored
      The variable is initialized but it is only used after its assignment.
      Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarLi kunyu <kunyu@nfschina.com>
      Message-Id: <20220819021535.483702-1-kunyu@nfschina.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      eceb6e1d
    • Li kunyu's avatar
      KVM: Drop unnecessary initialization of "npages" in hva_to_pfn_slow() · 28249139
      Li kunyu authored
      The variable is initialized but it is only used after its assignment.
      Reviewed-by: default avatarSean Christopherson <seanjc@google.com>
      Signed-off-by: default avatarLi kunyu <kunyu@nfschina.com>
      Message-Id: <20220819022804.483914-1-kunyu@nfschina.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      28249139
    • Josh Poimboeuf's avatar
      x86/kvm: Fix "missing ENDBR" BUG for fastop functions · 3d9606b0
      Josh Poimboeuf authored
      The following BUG was reported:
      
        traps: Missing ENDBR: andw_ax_dx+0x0/0x10 [kvm]
        ------------[ cut here ]------------
        kernel BUG at arch/x86/kernel/traps.c:253!
        invalid opcode: 0000 [#1] PREEMPT SMP NOPTI
         <TASK>
         asm_exc_control_protection+0x2b/0x30
        RIP: 0010:andw_ax_dx+0x0/0x10 [kvm]
        Code: c3 cc cc cc cc 0f 1f 44 00 00 66 0f 1f 00 48 19 d0 c3 cc cc cc
              cc 0f 1f 40 00 f3 0f 1e fa 20 d0 c3 cc cc cc cc 0f 1f 44 00 00
              <66> 0f 1f 00 66 21 d0 c3 cc cc cc cc 0f 1f 40 00 66 0f 1f 00 21
              d0
      
         ? andb_al_dl+0x10/0x10 [kvm]
         ? fastop+0x5d/0xa0 [kvm]
         x86_emulate_insn+0x822/0x1060 [kvm]
         x86_emulate_instruction+0x46f/0x750 [kvm]
         complete_emulated_mmio+0x216/0x2c0 [kvm]
         kvm_arch_vcpu_ioctl_run+0x604/0x650 [kvm]
         kvm_vcpu_ioctl+0x2f4/0x6b0 [kvm]
         ? wake_up_q+0xa0/0xa0
      
      The BUG occurred because the ENDBR in the andw_ax_dx() fastop function
      had been incorrectly "sealed" (converted to a NOP) by apply_ibt_endbr().
      
      Objtool marked it to be sealed because KVM has no compile-time
      references to the function.  Instead KVM calculates its address at
      runtime.
      
      Prevent objtool from annotating fastop functions as sealable by creating
      throwaway dummy compile-time references to the functions.
      
      Fixes: 6649fa87 ("x86/ibt,kvm: Add ENDBR to fastops")
      Reported-by: default avatarPengfei Xu <pengfei.xu@intel.com>
      Debugged-by: default avatarPeter Zijlstra <peterz@infradead.org>
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Message-Id: <0d4116f90e9d0c1b754bb90c585e6f0415a1c508.1660837839.git.jpoimboe@kernel.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      3d9606b0
    • Josh Poimboeuf's avatar
      x86/kvm: Simplify FOP_SETCC() · 22472d12
      Josh Poimboeuf authored
      SETCC_ALIGN and FOP_ALIGN are both 16.  Remove the special casing for
      FOP_SETCC() and just make it a normal fastop.
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Message-Id: <7c13d94d1a775156f7e36eed30509b274a229140.1660837839.git.jpoimboe@kernel.org>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      22472d12
    • Josh Poimboeuf's avatar
      x86/ibt, objtool: Add IBT_NOSEAL() · e27e5bea
      Josh Poimboeuf authored
      Add a macro which prevents a function from getting sealed if there are
      no compile-time references to it.
      Signed-off-by: default avatarJosh Poimboeuf <jpoimboe@kernel.org>
      Message-Id: <20220818213927.e44fmxkoq4yj6ybn@treble>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      e27e5bea
    • Chao Peng's avatar
      KVM: Rename mmu_notifier_* to mmu_invalidate_* · 20ec3ebd
      Chao Peng authored
      The motivation of this renaming is to make these variables and related
      helper functions less mmu_notifier bound and can also be used for non
      mmu_notifier based page invalidation. mmu_invalidate_* was chosen to
      better describe the purpose of 'invalidating' a page that those
      variables are used for.
      
        - mmu_notifier_seq/range_start/range_end are renamed to
          mmu_invalidate_seq/range_start/range_end.
      
        - mmu_notifier_retry{_hva} helper functions are renamed to
          mmu_invalidate_retry{_hva}.
      
        - mmu_notifier_count is renamed to mmu_invalidate_in_progress to
          avoid confusion with mn_active_invalidate_count.
      
        - While here, also update kvm_inc/dec_notifier_count() to
          kvm_mmu_invalidate_begin/end() to match the change for
          mmu_notifier_count.
      
      No functional change intended.
      Signed-off-by: default avatarChao Peng <chao.p.peng@linux.intel.com>
      Message-Id: <20220816125322.1110439-3-chao.p.peng@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      20ec3ebd
    • Chao Peng's avatar
      KVM: Rename KVM_PRIVATE_MEM_SLOTS to KVM_INTERNAL_MEM_SLOTS · bdd1c37a
      Chao Peng authored
      KVM_INTERNAL_MEM_SLOTS better reflects the fact those slots are KVM
      internally used (invisible to userspace) and avoids confusion to future
      private slots that can have different meaning.
      Signed-off-by: default avatarChao Peng <chao.p.peng@linux.intel.com>
      Message-Id: <20220816125322.1110439-2-chao.p.peng@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      bdd1c37a
    • Paolo Bonzini's avatar
      KVM: MIPS: remove unnecessary definition of KVM_PRIVATE_MEM_SLOTS · b0754508
      Paolo Bonzini authored
      KVM_PRIVATE_MEM_SLOTS defaults to zero, so it is not necessary to
      define it in MIPS's asm/kvm_host.h.
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      b0754508
    • Sean Christopherson's avatar
      KVM: Move coalesced MMIO initialization (back) into kvm_create_vm() · c2b82397
      Sean Christopherson authored
      Invoke kvm_coalesced_mmio_init() from kvm_create_vm() now that allocating
      and initializing coalesced MMIO objects is separate from registering any
      associated devices.  Moving coalesced MMIO cleans up the last oddity
      where KVM does VM creation/initialization after kvm_create_vm(), and more
      importantly after kvm_arch_post_init_vm() is called and the VM is added
      to the global vm_list, i.e. after the VM is fully created as far as KVM
      is concerned.
      
      Originally, kvm_coalesced_mmio_init() was called by kvm_create_vm(), but
      the original implementation was completely devoid of error handling.
      Commit 6ce5a090 ("KVM: coalesced_mmio: fix kvm_coalesced_mmio_init()'s
      error handling" fixed the various bugs, and in doing so rightly moved the
      call to after kvm_create_vm() because kvm_coalesced_mmio_init() also
      registered the coalesced MMIO device.  Commit 2b3c246a ("KVM: Make
      coalesced mmio use a device per zone") cleaned up that mess by having
      each zone register a separate device, i.e. moved device registration to
      its logical home in kvm_vm_ioctl_register_coalesced_mmio().  As a result,
      kvm_coalesced_mmio_init() is now a "pure" initialization helper and can
      be safely called from kvm_create_vm().
      
      Opportunstically drop the #ifdef, KVM provides stubs for
      kvm_coalesced_mmio_{init,free}() when CONFIG_KVM_MMIO=n (s390).
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20220816053937.2477106-4-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      c2b82397
    • Sean Christopherson's avatar
      KVM: Unconditionally get a ref to /dev/kvm module when creating a VM · 405294f2
      Sean Christopherson authored
      Unconditionally get a reference to the /dev/kvm module when creating a VM
      instead of using try_get_module(), which will fail if the module is in
      the process of being forcefully unloaded.  The error handling when
      try_get_module() fails doesn't properly unwind all that has been done,
      e.g. doesn't call kvm_arch_pre_destroy_vm() and doesn't remove the VM
      from the global list.  Not removing VMs from the global list tends to be
      fatal, e.g. leads to use-after-free explosions.
      
      The obvious alternative would be to add proper unwinding, but the
      justification for using try_get_module(), "rmmod --wait", is completely
      bogus as support for "rmmod --wait", i.e. delete_module() without
      O_NONBLOCK, was removed by commit 3f2b9c9c ("module: remove rmmod
      --wait option.") nearly a decade ago.
      
      It's still possible for try_get_module() to fail due to the module dying
      (more like being killed), as the module will be tagged MODULE_STATE_GOING
      by "rmmod --force", i.e. delete_module(..., O_TRUNC), but playing nice
      with forced unloading is an exercise in futility and gives a falsea sense
      of security.  Using try_get_module() only prevents acquiring _new_
      references, it doesn't magically put the references held by other VMs,
      and forced unloading doesn't wait, i.e. "rmmod --force" on KVM is all but
      guaranteed to cause spectacular fireworks; the window where KVM will fail
      try_get_module() is tiny compared to the window where KVM is building and
      running the VM with an elevated module refcount.
      
      Addressing KVM's inability to play nice with "rmmod --force" is firmly
      out-of-scope.  Forcefully unloading any module taints kernel (for obvious
      reasons)  _and_ requires the kernel to be built with
      CONFIG_MODULE_FORCE_UNLOAD=y, which is off by default and comes with the
      amusing disclaimer that it's "mainly for kernel developers and desperate
      users".  In other words, KVM is free to scoff at bug reports due to using
      "rmmod --force" while VMs may be running.
      
      Fixes: 5f6de5cb ("KVM: Prevent module exit until all VMs are freed")
      Cc: stable@vger.kernel.org
      Cc: David Matlack <dmatlack@google.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20220816053937.2477106-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      405294f2
    • Sean Christopherson's avatar
      KVM: Properly unwind VM creation if creating debugfs fails · 4ba4f419
      Sean Christopherson authored
      Properly unwind VM creation if kvm_create_vm_debugfs() fails.  A recent
      change to invoke kvm_create_vm_debug() in kvm_create_vm() was led astray
      by buggy try_get_module() handling adding by commit 5f6de5cb ("KVM:
      Prevent module exit until all VMs are freed").  The debugfs error path
      effectively inherits the bad error path of try_module_get(), e.g. KVM
      leaves the to-be-free VM on vm_list even though KVM appears to do the
      right thing by calling module_put() and falling through.
      
      Opportunistically hoist kvm_create_vm_debugfs() above the call to
      kvm_arch_post_init_vm() so that the "post-init" arch hook is actually
      invoked after the VM is initialized (ignoring kvm_coalesced_mmio_init()
      for the moment).  x86 is the only non-nop implementation of the post-init
      hook, and it doesn't allocate/initialize any objects that are reachable
      via debugfs code (spawns a kthread worker for the NX huge page mitigation).
      
      Leave the buggy try_get_module() alone for now, it will be fixed in a
      separate commit.
      
      Fixes: b74ed7a6 ("KVM: Actually create debugfs in kvm_create_vm()")
      Reported-by: syzbot+744e173caec2e1627ee0@syzkaller.appspotmail.com
      Cc: Oliver Upton <oliver.upton@linux.dev>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Reviewed-by: default avatarOliver Upton <oliver.upton@linux.dev>
      Message-Id: <20220816053937.2477106-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      4ba4f419
    • Linus Torvalds's avatar
      Merge tag 'net-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net · 4c2d0b03
      Linus Torvalds authored
      Pull networking fixes from Jakub Kicinski:
       "Including fixes from netfilter.
      
        Current release - regressions:
      
         - tcp: fix cleanup and leaks in tcp_read_skb() (the new way BPF
           socket maps get data out of the TCP stack)
      
         - tls: rx: react to strparser initialization errors
      
         - netfilter: nf_tables: fix scheduling-while-atomic splat
      
         - net: fix suspicious RCU usage in bpf_sk_reuseport_detach()
      
        Current release - new code bugs:
      
         - mlxsw: ptp: fix a couple of races, static checker warnings and
           error handling
      
        Previous releases - regressions:
      
         - netfilter:
            - nf_tables: fix possible module reference underflow in error path
            - make conntrack helpers deal with BIG TCP (skbs > 64kB)
            - nfnetlink: re-enable conntrack expectation events
      
         - net: fix potential refcount leak in ndisc_router_discovery()
      
        Previous releases - always broken:
      
         - sched: cls_route: disallow handle of 0
      
         - neigh: fix possible local DoS due to net iface start/stop loop
      
         - rtnetlink: fix module refcount leak in rtnetlink_rcv_msg
      
         - sched: fix adding qlen to qcpu->backlog in gnet_stats_add_queue_cpu
      
         - virtio_net: fix endian-ness for RSS
      
         - dsa: mv88e6060: prevent crash on an unused port
      
         - fec: fix timer capture timing in `fec_ptp_enable_pps()`
      
         - ocelot: stats: fix races, integer wrapping and reading incorrect
           registers (the change of register definitions here accounts for
           bulk of the changed LoC in this PR)"
      
      * tag 'net-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net: (77 commits)
        net: moxa: MAC address reading, generating, validity checking
        tcp: handle pure FIN case correctly
        tcp: refactor tcp_read_skb() a bit
        tcp: fix tcp_cleanup_rbuf() for tcp_read_skb()
        tcp: fix sock skb accounting in tcp_read_skb()
        igb: Add lock to avoid data race
        dt-bindings: Fix incorrect "the the" corrections
        net: genl: fix error path memory leak in policy dumping
        stmmac: intel: Add a missing clk_disable_unprepare() call in intel_eth_pci_remove()
        net: ethernet: mtk_eth_soc: fix possible NULL pointer dereference in mtk_xdp_run
        net/mlx5e: Allocate flow steering storage during uplink initialization
        net: mscc: ocelot: report ndo_get_stats64 from the wraparound-resistant ocelot->stats
        net: mscc: ocelot: keep ocelot_stat_layout by reg address, not offset
        net: mscc: ocelot: make struct ocelot_stat_layout array indexable
        net: mscc: ocelot: fix race between ndo_get_stats64 and ocelot_check_stats_work
        net: mscc: ocelot: turn stats_lock into a spinlock
        net: mscc: ocelot: fix address of SYS_COUNT_TX_AGING counter
        net: mscc: ocelot: fix incorrect ndo_get_stats64 packet counters
        net: dsa: felix: fix ethtool 256-511 and 512-1023 TX packet counters
        net: dsa: don't warn in dsa_port_set_state_now() when driver doesn't support it
        ...
      4c2d0b03
    • Linus Torvalds's avatar
      Merge tag 'linux-kselftest-next-6.0-rc2' of... · 90b6b686
      Linus Torvalds authored
      Merge tag 'linux-kselftest-next-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
      
      Pull Kselftest fix from Shuah Khan:
      
       - fix landlock test build regression
      
      * tag 'linux-kselftest-next-6.0-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest:
        selftests/landlock: fix broken include of linux/landlock.h
      90b6b686
    • Linus Torvalds's avatar
      Merge tag 'trace-rtla-v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace · 0de277d4
      Linus Torvalds authored
      Pull rtla tool fixes from Steven Rostedt:
       "Fixes for the Real-Time Linux Analysis tooling:
      
         - Fix tracer name in comments and prints
      
         - Fix setting up symlinks
      
         - Allow extra flags to be set in build
      
         - Consolidate and show all necessary libraries not found in build
           error"
      
      * tag 'trace-rtla-v6.0' of git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/linux-trace:
        rtla: Consolidate and show all necessary libraries that failed for building
        tools/rtla: Build with EXTRA_{C,LD}FLAGS
        tools/rtla: Fix command symlinks
        rtla: Fix tracer name
      0de277d4
  3. 18 Aug, 2022 10 commits