1. 08 Dec, 2021 6 commits
    • Wei Wang's avatar
      virtio/vsock: fix the transport to work with VMADDR_CID_ANY · 1db8f5fc
      Wei Wang authored
      The VMADDR_CID_ANY flag used by a socket means that the socket isn't bound
      to any specific CID. For example, a host vsock server may want to be bound
      with VMADDR_CID_ANY, so that a guest vsock client can connect to the host
      server with CID=VMADDR_CID_HOST (i.e. 2), and meanwhile, a host vsock
      client can connect to the same local server with CID=VMADDR_CID_LOCAL
      (i.e. 1).
      
      The current implementation sets the destination socket's svm_cid to a
      fixed CID value after the first client's connection, which isn't an
      expected operation. For example, if the guest client first connects to the
      host server, the server's svm_cid gets set to VMADDR_CID_HOST, then other
      host clients won't be able to connect to the server anymore.
      
      Reproduce steps:
      1. Run the host server:
         socat VSOCK-LISTEN:1234,fork -
      2. Run a guest client to connect to the host server:
         socat - VSOCK-CONNECT:2:1234
      3. Run a host client to connect to the host server:
         socat - VSOCK-CONNECT:1:1234
      
      Without this patch, step 3. above fails to connect, and socat complains
      "socat[1720] E connect(5, AF=40 cid:1 port:1234, 16): Connection
      reset by peer".
      With this patch, the above works well.
      
      Fixes: c0cfa2d8 ("vsock: add multi-transports support")
      Signed-off-by: default avatarWei Wang <wei.w.wang@intel.com>
      Link: https://lore.kernel.org/r/20211126011823.1760-1-wei.w.wang@intel.comSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Reviewed-by: default avatarStefano Garzarella <sgarzare@redhat.com>
      1db8f5fc
    • Will Deacon's avatar
      virtio_ring: Fix querying of maximum DMA mapping size for virtio device · 817fc978
      Will Deacon authored
      virtio_max_dma_size() returns the maximum DMA mapping size of the virtio
      device by querying dma_max_mapping_size() for the device when the DMA
      API is in use for the vring. Unfortunately, the device passed is
      initialised by register_virtio_device() and does not inherit the DMA
      configuration from its parent, resulting in SWIOTLB errors when bouncing
      is enabled and the default 256K mapping limit (IO_TLB_SEGSIZE) is not
      respected:
      
        | virtio-pci 0000:00:01.0: swiotlb buffer is full (sz: 294912 bytes), total 1024 (slots), used 725 (slots)
      
      Follow the pattern used elsewhere in the virtio_ring code when calling
      into the DMA layer and pass the parent device to dma_max_mapping_size()
      instead.
      
      Cc: Marc Zyngier <maz@kernel.org>
      Cc: Quentin Perret <qperret@google.com>
      Cc: "Michael S. Tsirkin" <mst@redhat.com>
      Cc: Jason Wang <jasowang@redhat.com>
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      Link: https://lore.kernel.org/r/20211201112018.25276-1-will@kernel.orgAcked-by: default avatarJason Wang <jasowang@redhat.com>
      Tested-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Fixes: e6d6dd6c ("virtio: Introduce virtio_max_dma_size()")
      Cc: Joerg Roedel <jroedel@suse.de>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Robin Murphy <robin.murphy@arm.com>
      Signed-off-by: default avatarSteven Price <steven.price@arm.com>
      Signed-off-by: default avatarSuzuki K Poulose <suzuki.poulose@arm.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      817fc978
    • Arnd Bergmann's avatar
      virtio: always enter drivers/virtio/ · 27d9839f
      Arnd Bergmann authored
      When neither VIRTIO_PCI_LIB nor VIRTIO are enabled, but the alibaba
      vdpa driver is, the kernel runs into a link error because the legacy
      virtio module never gets built:
      
      x86_64-linux-ld: drivers/vdpa/alibaba/eni_vdpa.o: in function `eni_vdpa_set_features':
      eni_vdpa.c:(.text+0x23f): undefined reference to `vp_legacy_set_features'
      x86_64-linux-ld: drivers/vdpa/alibaba/eni_vdpa.o: in function `eni_vdpa_set_vq_state':
      eni_vdpa.c:(.text+0x2fe): undefined reference to `vp_legacy_get_queue_enable'
      x86_64-linux-ld: drivers/vdpa/alibaba/eni_vdpa.o: in function `eni_vdpa_set_vq_address':
      eni_vdpa.c:(.text+0x376): undefined reference to `vp_legacy_set_queue_address'
      x86_64-linux-ld: drivers/vdpa/alibaba/eni_vdpa.o: in function `eni_vdpa_set_vq_ready':
      eni_vdpa.c:(.text+0x3b4): undefined reference to `vp_legacy_set_queue_address'
      x86_64-linux-ld: drivers/vdpa/alibaba/eni_vdpa.o: in function `eni_vdpa_free_irq':
      eni_vdpa.c:(.text+0x460): undefined reference to `vp_legacy_queue_vector'
      x86_64-linux-ld: eni_vdpa.c:(.text+0x4b7): undefined reference to `vp_legacy_config_vector'
      x86_64-linux-ld: drivers/vdpa/alibaba/eni_vdpa.o: in function `eni_vdpa_reset':
      
      When VIRTIO_PCI_LIB was added, it was correctly added to drivers/Makefile
      as well, but for the legacy module, this is missing.  Solve this by always
      entering drivers/virtio during the build and letting its Makefile take
      care of the individual options, rather than having a separate line for
      each sub-option.
      
      Fixes: 64b9f64f ("vdpa: introduce virtio pci driver")
      Fixes: e85087be ("eni_vdpa: add vDPA driver for Alibaba ENI")
      Fixes: d89c8169 ("virtio-pci: introduce legacy device module")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Link: https://lore.kernel.org/r/20211206085034.2836099-1-arnd@kernel.orgSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      27d9839f
    • Dan Carpenter's avatar
      vduse: check that offset is within bounds in get_config() · dc1db006
      Dan Carpenter authored
      This condition checks "len" but it does not check "offset" and that
      could result in an out of bounds read if "offset > dev->config_size".
      The problem is that since both variables are unsigned the
      "dev->config_size - offset" subtraction would result in a very high
      unsigned value.
      
      I think these checks might not be necessary because "len" and "offset"
      are supposed to already have been validated using the
      vhost_vdpa_config_validate() function.  But I do not know the code
      perfectly, and I like to be safe.
      
      Fixes: c8a6153b ("vduse: Introduce VDUSE - vDPA Device in Userspace")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/20211208150956.GA29160@kiliSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Cc: stable@vger.kernel.org
      dc1db006
    • Dan Carpenter's avatar
      vdpa: check that offsets are within bounds · 3ed21c14
      Dan Carpenter authored
      In this function "c->off" is a u32 and "size" is a long.  On 64bit systems
      if "c->off" is greater than "size" then "size - c->off" is a negative and
      we always return -E2BIG.  But on 32bit systems the subtraction is type
      promoted to a high positive u32 value and basically any "c->len" is
      accepted.
      
      Fixes: 4c8cf318 ("vhost: introduce vDPA-based backend")
      Reported-by: default avatarXie Yongji <xieyongji@bytedance.com>
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/20211208103337.GA4047@kiliSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Cc: stable@vger.kernel.org
      3ed21c14
    • Dan Carpenter's avatar
      vduse: fix memory corruption in vduse_dev_ioctl() · ff9f9c6e
      Dan Carpenter authored
      The "config.offset" comes from the user.  There needs to a check to
      prevent it being out of bounds.  The "config.offset" and
      "dev->config_size" variables are both type u32.  So if the offset if
      out of bounds then the "dev->config_size - config.offset" subtraction
      results in a very high u32 value.  The out of bounds offset can result
      in memory corruption.
      
      Fixes: c8a6153b ("vduse: Introduce VDUSE - vDPA Device in Userspace")
      Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Link: https://lore.kernel.org/r/20211208103307.GA3778@kiliSigned-off-by: default avatarMichael S. Tsirkin <mst@redhat.com>
      Cc: stable@vger.kernel.org
      ff9f9c6e
  2. 05 Dec, 2021 12 commits
    • Linus Torvalds's avatar
      Linux 5.16-rc4 · 0fcfb00b
      Linus Torvalds authored
      0fcfb00b
    • Linus Torvalds's avatar
      Merge tag 'for-5.16/parisc-6' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux · 268ba095
      Linus Torvalds authored
      Pull parisc fixes from Helge Deller:
       "Some bug and warning fixes:
      
         - Fix "make install" to use debians "installkernel" script which is
           now in /usr/sbin
      
         - Fix the bindeb-pkg make target by giving the correct KBUILD_IMAGE
           file name
      
         - Fix compiler warnings by annotating parisc agp init functions with
           __init
      
         - Fix timekeeping on SMP machines with dual-core CPUs
      
         - Enable some more config options in the 64-bit defconfig"
      
      * tag 'for-5.16/parisc-6' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/parisc-linux:
        parisc: Mark cr16 CPU clocksource unstable on all SMP machines
        parisc: Fix "make install" on newer debian releases
        parisc/agp: Annotate parisc agp init functions with __init
        parisc: Enable sata sil, audit and usb support on 64-bit defconfig
        parisc: Fix KBUILD_IMAGE for self-extracting kernel
      268ba095
    • Linus Torvalds's avatar
      Merge tag 'usb-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 94420704
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small USB fixes for a few reported issues. Included in
        here are:
      
         - xhci fix for a _much_ reported regression. I don't think there's a
           community distro that has not reported this problem yet :(
      
         - new USB quirk addition
      
         - cdns3 minor fixes
      
         - typec regression fix.
      
        All of these have been in linux-next with no reported problems, and
        the xhci fix has been reported by many to resolve their reported
        problem"
      
      * tag 'usb-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: cdnsp: Fix a NULL pointer dereference in cdnsp_endpoint_init()
        usb: cdns3: gadget: fix new urb never complete if ep cancel previous requests
        usb: typec: tcpm: Wait in SNK_DEBOUNCED until disconnect
        USB: NO_LPM quirk Lenovo Powered USB-C Travel Hub
        xhci: Fix commad ring abort, write all 64 bits to CRCR register.
      94420704
    • Linus Torvalds's avatar
      Merge tag 'tty-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty · 51639539
      Linus Torvalds authored
      Pull tty/serial fixes from Greg KH:
       "Here are some small TTY and Serial driver fixes for 5.16-rc4 to
        resolve a number of reported problems.
      
        They include:
      
         - liteuart serial driver fixes
      
         - 8250_pci serial driver fixes for pericom devices
      
         - 8250 RTS line control fix while in RS-485 mode
      
         - tegra serial driver fix
      
         - msm_serial driver fix
      
         - pl011 serial driver new id
      
         - fsl_lpuart revert of broken change
      
         - 8250_bcm7271 serial driver fix
      
         - MAINTAINERS file update for rpmsg tty driver that came in 5.16-rc1
      
         - vgacon fix for reported problem
      
        All of these, except for the 8250_bcm7271 fix have been in linux-next
        with no reported problem. The 8250_bcm7271 fix was added to the tree
        on Friday so no chance to be linux-next yet. But it should be fine as
        the affected developers submitted it"
      
      * tag 'tty-5.16-rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/tty:
        serial: 8250_bcm7271: UART errors after resuming from S2
        serial: 8250_pci: rewrite pericom_do_set_divisor()
        serial: 8250_pci: Fix ACCES entries in pci_serial_quirks array
        serial: 8250: Fix RTS modem control while in rs485 mode
        Revert "tty: serial: fsl_lpuart: drop earlycon entry for i.MX8QXP"
        serial: tegra: Change lower tolerance baud rate limit for tegra20 and tegra30
        serial: liteuart: relax compile-test dependencies
        serial: liteuart: fix minor-number leak on probe errors
        serial: liteuart: fix use-after-free and memleak on unbind
        serial: liteuart: Fix NULL pointer dereference in ->remove()
        vgacon: Propagate console boot parameters before calling `vc_resize'
        tty: serial: msm_serial: Deactivate RX DMA for polling support
        serial: pl011: Add ACPI SBSA UART match id
        serial: core: fix transmit-buffer reset and memleak
        MAINTAINERS: Add rpmsg tty driver maintainer
      51639539
    • Linus Torvalds's avatar
      Merge tag 'timers_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7587a4a5
      Linus Torvalds authored
      Pull timer fix from Borislav Petkov:
      
       - Prevent a tick storm when a dedicated timekeeper CPU in nohz_full
         mode runs for prolonged periods with interrupts disabled and ends up
         programming the next tick in the past, leading to that storm
      
      * tag 'timers_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        timers/nohz: Last resort update jiffies on nohz_full IRQ entry
      7587a4a5
    • Linus Torvalds's avatar
      Merge tag 'sched_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 1d213767
      Linus Torvalds authored
      Pull scheduler fixes from Borislav Petkov:
      
       - Properly init uclamp_flags of a runqueue, on first enqueuing
      
       - Fix preempt= callback return values
      
       - Correct utime/stime resource usage reporting on nohz_full to return
         the proper times instead of shorter ones
      
      * tag 'sched_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/uclamp: Fix rq->uclamp_max not set on first enqueue
        preempt/dynamic: Fix setup_preempt_mode() return value
        sched/cputime: Fix getrusage(RUSAGE_THREAD) with nohz_full
      1d213767
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · f5d54a42
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
      
       - Fix a couple of SWAPGS fencing issues in the x86 entry code
      
       - Use the proper operand types in __{get,put}_user() to prevent
         truncation in SEV-ES string io
      
       - Make sure the kernel mappings are present in trampoline_pgd in order
         to prevent any potential accesses to unmapped memory after switching
         to it
      
       - Fix a trivial list corruption in objtool's pv_ops validation
      
       - Disable the clocksource watchdog for TSC on platforms which claim
         that the TSC is constant, doesn't stop in sleep states, CPU has TSC
         adjust and the number of sockets of the platform are max 2, to
         prevent erroneous markings of the TSC as unstable.
      
       - Make sure TSC adjust is always checked not only when going idle
      
       - Prevent a stack leak by initializing struct _fpx_sw_bytes properly in
         the FPU code
      
       - Fix INTEL_FAM6_RAPTORLAKE define naming to adhere to the convention
      
      * tag 'x86_urgent_for_v5.16_rc4' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/xen: Add xenpv_restore_regs_and_return_to_usermode()
        x86/entry: Use the correct fence macro after swapgs in kernel CR3
        x86/entry: Add a fence for kernel entry SWAPGS in paranoid_entry()
        x86/sev: Fix SEV-ES INS/OUTS instructions for word, dword, and qword
        x86/64/mm: Map all kernel memory into trampoline_pgd
        objtool: Fix pv_ops noinstr validation
        x86/tsc: Disable clocksource watchdog for TSC on qualified platorms
        x86/tsc: Add a timer to make sure TSC_adjust is always checked
        x86/fpu/signal: Initialize sw_bytes in save_xstate_epilog()
        x86/cpu: Drop spurious underscore from RAPTOR_LAKE #define
      f5d54a42
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 90bf8d98
      Linus Torvalds authored
      Pull more kvm fixes from Paolo Bonzini:
      
       - Static analysis fix
      
       - New SEV-ES protocol for communicating invalid VMGEXIT requests
      
       - Ensure APICv is considered inactive if there is no APIC
      
       - Fix reserved bits for AMD PerfEvtSeln register
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm:
        KVM: SVM: Do not terminate SEV-ES guests on GHCB validation failure
        KVM: SEV: Fall back to vmalloc for SEV-ES scratch area if necessary
        KVM: SEV: Return appropriate error codes if SEV-ES scratch setup fails
        KVM: x86/mmu: Retry page fault if root is invalidated by memslot update
        KVM: VMX: Set failure code in prepare_vmcs02()
        KVM: ensure APICv is considered inactive if there is no APIC
        KVM: x86/pmu: Fix reserved bits for AMD PerfEvtSeln register
      90bf8d98
    • Tom Lendacky's avatar
      KVM: SVM: Do not terminate SEV-ES guests on GHCB validation failure · ad5b3532
      Tom Lendacky authored
      Currently, an SEV-ES guest is terminated if the validation of the VMGEXIT
      exit code or exit parameters fails.
      
      The VMGEXIT instruction can be issued from userspace, even though
      userspace (likely) can't update the GHCB. To prevent userspace from being
      able to kill the guest, return an error through the GHCB when validation
      fails rather than terminating the guest. For cases where the GHCB can't be
      updated (e.g. the GHCB can't be mapped, etc.), just return back to the
      guest.
      
      The new error codes are documented in the lasest update to the GHCB
      specification.
      
      Fixes: 291bd20d ("KVM: SVM: Add initial support for a VMGEXIT VMEXIT")
      Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
      Message-Id: <b57280b5562893e2616257ac9c2d4525a9aeeb42.1638471124.git.thomas.lendacky@amd.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      ad5b3532
    • Sean Christopherson's avatar
      KVM: SEV: Fall back to vmalloc for SEV-ES scratch area if necessary · a655276a
      Sean Christopherson authored
      Use kvzalloc() to allocate KVM's buffer for SEV-ES's GHCB scratch area so
      that KVM falls back to __vmalloc() if physically contiguous memory isn't
      available.  The buffer is purely a KVM software construct, i.e. there's
      no need for it to be physically contiguous.
      
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20211109222350.2266045-3-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      a655276a
    • Sean Christopherson's avatar
      KVM: SEV: Return appropriate error codes if SEV-ES scratch setup fails · 75236f5f
      Sean Christopherson authored
      Return appropriate error codes if setting up the GHCB scratch area for an
      SEV-ES guest fails.  In particular, returning -EINVAL instead of -ENOMEM
      when allocating the kernel buffer could be confusing as userspace would
      likely suspect a guest issue.
      
      Fixes: 8f423a80 ("KVM: SVM: Support MMIO for an SEV-ES guest")
      Cc: Tom Lendacky <thomas.lendacky@amd.com>
      Signed-off-by: default avatarSean Christopherson <seanjc@google.com>
      Message-Id: <20211109222350.2266045-2-seanjc@google.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      75236f5f
    • Linus Torvalds's avatar
      Merge tag 'xfs-5.16-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux · 79a72162
      Linus Torvalds authored
      Pull xfs fix from Darrick Wong:
       "Remove an unnecessary (and backwards) rename flags check that
        duplicates a VFS level check"
      
      * tag 'xfs-5.16-fixes-2' of git://git.kernel.org/pub/scm/fs/xfs/xfs-linux:
        xfs: remove incorrect ASSERT in xfs_rename
      79a72162
  3. 04 Dec, 2021 9 commits
  4. 03 Dec, 2021 13 commits