1. 17 Oct, 2017 9 commits
    • Johan Hovold's avatar
      USB: musb: fix late external abort on suspend · 0c3aae9b
      Johan Hovold authored
      The musb delayed irq work was never flushed on suspend, something which
      since 4.9 can lead to an external abort if the work is scheduled after
      the grandparent's clock has been disabled:
      
      PM: Suspending system (mem)
      PM: suspend of devices complete after 125.224 msecs
      PM: suspend devices took 0.132 seconds
      PM: late suspend of devices complete after 7.423 msecs
      PM: noirq suspend of devices complete after 7.083 msecs
      suspend debug: Waiting for 5 second(s).
      Unhandled fault: external abort on non-linefetch (0x1008) at 0xd0262c60
      ...
      [<c054880c>] (musb_default_readb) from [<c0547b5c>] (musb_irq_work+0x48/0x220)
      [<c0547b5c>] (musb_irq_work) from [<c014f8a4>] (process_one_work+0x1f4/0x758)
      [<c014f8a4>] (process_one_work) from [<c014fe5c>] (worker_thread+0x54/0x514)
      [<c014fe5c>] (worker_thread) from [<c015704c>] (kthread+0x128/0x158)
      [<c015704c>] (kthread) from [<c0109330>] (ret_from_fork+0x14/0x24)
      
      Commit 2bff3916 ("usb: musb: Fix PM for hub disconnect") started
      scheduling musb_irq_work with a delay of up to a second and with
      retries thereby making this easy to trigger, for example, by suspending
      shortly after a disconnect.
      
      Note that we set a flag to prevent the irq work from rescheduling itself
      during suspend and instead process a disconnect immediately. This takes
      care of the case where we are disconnected shortly before suspending.
      
      However, when in host mode, a disconnect while suspended will still
      go unnoticed and thus prevent the controller from runtime suspending
      upon resume as the session bit is always set. This will need to be
      addressed separately.
      
      Fixes: 550a7375 ("USB: Add MUSB and TUSB support")
      Fixes: 467d5c98 ("usb: musb: Implement session bit based runtime PM for musb-core")
      Fixes: 2bff3916 ("usb: musb: Fix PM for hub disconnect")
      Cc: stable <stable@vger.kernel.org>     # 4.9
      Cc: Felipe Balbi <felipe.balbi@linux.intel.com>
      Cc: Tony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Tested-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      0c3aae9b
    • Johan Hovold's avatar
      USB: musb: fix session-bit runtime-PM quirk · 4f190e0b
      Johan Hovold authored
      The current session-bit quirk implementation does not prevent the retry
      counter from underflowing, something which could break runtime PM and
      keep the device active for a very long time (about 2^32 seconds) after a
      disconnect.
      
      This notably breaks the B-device timeout case, but could potentially
      cause problems also when the controller is operating as an A-device.
      
      Fixes: 2bff3916 ("usb: musb: Fix PM for hub disconnect")
      Cc: stable <stable@vger.kernel.org>     # 4.9
      Cc: Tony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarJohan Hovold <johan@kernel.org>
      Tested-by: default avatarTony Lindgren <tony@atomide.com>
      Signed-off-by: default avatarBin Liu <b-liu@ti.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      4f190e0b
    • Maksim Salau's avatar
      usb: cdc_acm: Add quirk for Elatec TWN3 · 765fb2f1
      Maksim Salau authored
      Elatec TWN3 has the union descriptor on data interface. This results in
      failure to bind the device to the driver with the following log:
        usb 1-1.2: new full speed USB device using streamplug-ehci and address 4
        usb 1-1.2: New USB device found, idVendor=09d8, idProduct=0320
        usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
        usb 1-1.2: Product: RFID Device (COM)
        usb 1-1.2: Manufacturer: OEM
        cdc_acm 1-1.2:1.0: Zero length descriptor references
        cdc_acm: probe of 1-1.2:1.0 failed with error -22
      
      Adding the NO_UNION_NORMAL quirk for the device fixes the issue.
      
      `lsusb -v` of the device:
      
      Bus 001 Device 003: ID 09d8:0320
      Device Descriptor:
        bLength                18
        bDescriptorType         1
        bcdUSB               2.00
        bDeviceClass            2 Communications
        bDeviceSubClass         0
        bDeviceProtocol         0
        bMaxPacketSize0        32
        idVendor           0x09d8
        idProduct          0x0320
        bcdDevice            3.00
        iManufacturer           1 OEM
        iProduct                2 RFID Device (COM)
        iSerial                 0
        bNumConfigurations      1
        Configuration Descriptor:
          bLength                 9
          bDescriptorType         2
          wTotalLength           67
          bNumInterfaces          2
          bConfigurationValue     1
          iConfiguration          0
          bmAttributes         0x80
            (Bus Powered)
          MaxPower              250mA
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        0
            bAlternateSetting       0
            bNumEndpoints           1
            bInterfaceClass         2 Communications
            bInterfaceSubClass      2 Abstract (modem)
            bInterfaceProtocol      1 AT-commands (v.25ter)
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x83  EP 3 IN
              bmAttributes            3
                Transfer Type            Interrupt
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0020  1x 32 bytes
              bInterval               2
          Interface Descriptor:
            bLength                 9
            bDescriptorType         4
            bInterfaceNumber        1
            bAlternateSetting       0
            bNumEndpoints           2
            bInterfaceClass        10 CDC Data
            bInterfaceSubClass      0 Unused
            bInterfaceProtocol      0
            iInterface              0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x02  EP 2 OUT
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0020  1x 32 bytes
              bInterval               0
            Endpoint Descriptor:
              bLength                 7
              bDescriptorType         5
              bEndpointAddress     0x81  EP 1 IN
              bmAttributes            2
                Transfer Type            Bulk
                Synch Type               None
                Usage Type               Data
              wMaxPacketSize     0x0020  1x 32 bytes
              bInterval               0
            CDC Header:
              bcdCDC               1.10
            CDC Call Management:
              bmCapabilities       0x03
                call management
                use DataInterface
              bDataInterface          1
            CDC ACM:
              bmCapabilities       0x06
                sends break
                line coding and serial state
            CDC Union:
              bMasterInterface        0
              bSlaveInterface         1
      Device Status:     0x0000
        (Bus Powered)
      Signed-off-by: default avatarMaksim Salau <msalau@iotecha.com>
      Acked-by: default avatarOliver Neukum <oneukum@suse.com>
      Cc: stable <stable@vger.kernel.org>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      765fb2f1
    • Hans de Goede's avatar
      USB: devio: Revert "USB: devio: Don't corrupt user memory" · 845d584f
      Hans de Goede authored
      Taking the uurb->buffer_length userspace passes in as a maximum for the
      actual urbs transfer_buffer_length causes 2 serious issues:
      
      1) It breaks isochronous support for all userspace apps using libusb,
         as existing libusb versions pass in 0 for uurb->buffer_length,
         relying on the kernel using the lenghts of the usbdevfs_iso_packet_desc
         descriptors passed in added together as buffer length.
      
         This for example causes redirection of USB audio and Webcam's into
         virtual machines using qemu-kvm to no longer work. This is a userspace
         ABI break and as such must be reverted.
      
         Note that the original commit does not protect other users / the
         kernels memory, it only stops the userspace process making the call
         from shooting itself in the foot.
      
      2) It may cause the kernel to program host controllers to DMA over random
         memory. Just as the devio code used to only look at the iso_packet_desc
         lenghts, the host drivers do the same, relying on the submitter of the
         urbs to make sure the entire buffer is large enough and not checking
         transfer_buffer_length.
      
         But the "USB: devio: Don't corrupt user memory" commit now takes the
         userspace provided uurb->buffer_length for the buffer-size while copying
         over the user-provided iso_packet_desc lengths 1:1, allowing the user
         to specify a small buffer size while programming the host controller to
         dma a lot more data.
      
         (Atleast the ohci, uhci, xhci and fhci drivers do not check
          transfer_buffer_length for isoc transfers.)
      
      This reverts commit fa1ed74e ("USB: devio: Don't corrupt user memory")
      fixing both these issues.
      
      Cc: Dan Carpenter <dan.carpenter@oracle.com>
      Cc: stable@vger.kernel.org
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Acked-by: default avatarAlan Stern <stern@rowland.harvard.edu>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      845d584f
    • Greg Kroah-Hartman's avatar
      Merge tag 'phy-for-4.14-rc' of... · 283776e9
      Greg Kroah-Hartman authored
      Merge tag 'phy-for-4.14-rc' of git://git.kernel.org/pub/scm/linux/kernel/git/kishon/linux-phy into usb-linus
      
      Kishon writes:
      
      phy: for 4.14 -rc
      
       *) Handle error return values in rockchip-typec and tegra-xusb
       *) Fix MUX error check and ioremap_resource error check in mvebu-cp110-comphy
       *) Fix NULL pointer dereference error in phy-mtk-tphy
       *) Make sure pipe selector is not set to incompatible value
       *) Fix flaky aux channel communication with rockchip-typec PHY
       *) Fix DP monitors detection issue in rockchip-typec PHY
      Signed-off-by: default avatarKishon Vijay Abraham I <kishon@ti.com>
      283776e9
    • Mayank Rana's avatar
      usb: xhci: Handle error condition in xhci_stop_device() · b3207c65
      Mayank Rana authored
      xhci_stop_device() calls xhci_queue_stop_endpoint() multiple times
      without checking the return value. xhci_queue_stop_endpoint() can
      return error if the HC is already halted or unable to queue commands.
      This can cause a deadlock condition as xhci_stop_device() would
      end up waiting indefinitely for a completion for the command that
      didn't get queued. Fix this by checking the return value and bailing
      out of xhci_stop_device() in case of error. This patch happens to fix
      potential memory leaks of the allocated command structures as well.
      
      Fixes: c311e391 ("xhci: rework command timeout and cancellation,")
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarMayank Rana <mrana@codeaurora.org>
      Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      b3207c65
    • Lu Baolu's avatar
      usb: xhci: Reset halted endpoint if trb is noop · 810a624b
      Lu Baolu authored
      When a URB is cancled, xhci driver turns the untransferred trbs
      into no-ops.  If an endpoint stalls on a no-op trb that belongs
      to the cancelled URB, the event handler won't reset the endpoint.
      Hence, it will stay halted.
      
      Link: http://marc.info/?l=linux-usb&m=149582598330127&w=2
      
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarLu Baolu <baolu.lu@linux.intel.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      810a624b
    • Jeffy Chen's avatar
      xhci: Cleanup current_cmd in xhci_cleanup_command_queue() · d1aad52c
      Jeffy Chen authored
      KASAN reported use-after-free bug when xhci host controller died:
      [  176.952537] BUG: KASAN: use-after-free in xhci_handle_command_timeout+0x68/0x224
      [  176.960846] Write of size 4 at addr ffffffc0cbb01608 by task kworker/3:3/1680
      ...
      [  177.180644] Freed by task 0:
      [  177.183882]  kasan_slab_free+0x90/0x15c
      [  177.188194]  kfree+0x114/0x28c
      [  177.191630]  xhci_cleanup_command_queue+0xc8/0xf8
      [  177.196916]  xhci_hc_died+0x84/0x358
      
      Problem here is that when the cmd_timer fired, it would try to access
      current_cmd while the command queue is already freed by xhci_hc_died().
      
      Cleanup current_cmd in xhci_cleanup_command_queue() to avoid that.
      
      Fixes: d9f11ba9 ("xhci: Rework how we handle unresponsive or hoptlug removed hosts")
      Cc: <stable@vger.kernel.org> # v4.12+
      Signed-off-by: default avatarJeffy Chen <jeffy.chen@rock-chips.com>
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      d1aad52c
    • Mathias Nyman's avatar
      xhci: Identify USB 3.1 capable hosts by their port protocol capability · ea7d0d69
      Mathias Nyman authored
      Many USB 3.1 capable hosts never updated the Serial Bus Release Number
      (SBRN) register to USB 3.1 from USB 3.0
      
      xhci driver identified USB 3.1 capable hosts based on this SBRN register,
      which according to specs "contains the release of the Universal Serial
      Bus Specification with which this Universal Serial Bus Host Controller
      module is compliant." but still in october 2017 gives USB 3.0 as
      the only possible option.
      
      Make an additional check for USB 3.1 support and enable it if the xHCI
      supported protocol capablity lists USB 3.1 capable ports.
      
      Cc: <stable@vger.kernel.org> # v4.6+
      Signed-off-by: default avatarMathias Nyman <mathias.nyman@linux.intel.com>
      Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
      ea7d0d69
  2. 16 Oct, 2017 1 commit
  3. 15 Oct, 2017 3 commits
    • Linus Torvalds's avatar
      Merge tag 'char-misc-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · ae7df8f9
      Linus Torvalds authored
      Pull char/misc driver fixes from Greg KH:
       "Here are 4 patches to resolve some char/misc driver issues found these
        past weeks.
      
        One of them is a mei bugfix and another is a new mei device id. There
        is also a hyper-v fix for a reported issue, and a binder issue fix for
        a problem reported by a few people.
      
        All of these have been in my tree for a while, I don't know if
        linux-next is really testing much this month. But 0-day is happy with
        them :)"
      
      * tag 'char-misc-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc:
        binder: fix use-after-free in binder_transaction()
        Drivers: hv: vmbus: Fix bugs in rescind handling
        mei: me: add gemini lake devices id
        mei: always use domain runtime pm callbacks.
      ae7df8f9
    • Linus Torvalds's avatar
      Merge tag 'usb-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 7a263b16
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are a handful of USB driver fixes for 4.14-rc5.
      
        There is the "usual" usb-serial fixes and device ids, USB gadget
        fixes, and some more fixes found by the fuzz testing that is happening
        on the USB layer right now.
      
        All of these have been in my tree this week with no reported issues"
      
      * tag 'usb-4.14-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: usbtest: fix NULL pointer dereference
        usb: gadget: configfs: Fix memory leak of interface directory data
        usb: gadget: composite: Fix use-after-free in usb_composite_overwrite_options
        usb: misc: usbtest: Fix overflow in usbtest_do_ioctl()
        usb: renesas_usbhs: Fix DMAC sequence for receiving zero-length packet
        USB: dummy-hcd: Fix deadlock caused by disconnect detection
        usb: phy: tegra: Fix phy suspend for UDC
        USB: serial: console: fix use-after-free after failed setup
        USB: serial: console: fix use-after-free on disconnect
        USB: serial: qcserial: add Dell DW5818, DW5819
        USB: serial: cp210x: add support for ELV TFD500
        USB: serial: cp210x: fix partnum regression
        USB: serial: option: add support for TP-Link LTE module
        USB: serial: ftdi_sio: add id for Cypress WICED dev board
      7a263b16
    • Linus Torvalds's avatar
      Merge tag 'dmaengine-fix-4.14-rc5' of git://git.infradead.org/users/vkoul/slave-dma · 7a23c5ab
      Linus Torvalds authored
      Pull dmaengine fixes from Vinod Koul:
       "Here are fixes for this round
      
         - fix spinlock usage amd fifo response for altera driver
      
         - fix ti crossbar race condition
      
         - fix edma memcpy align"
      
      * tag 'dmaengine-fix-4.14-rc5' of git://git.infradead.org/users/vkoul/slave-dma:
        dmaengine: altera: fix spinlock usage
        dmaengine: altera: fix response FIFO emptying
        dmaengine: ti-dma-crossbar: Fix possible race condition with dma_inuse
        dmaengine: edma: Align the memcpy acnt array size with the transfer
      7a23c5ab
  4. 14 Oct, 2017 12 commits
    • Linus Torvalds's avatar
      Merge branch 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · e7a36a6e
      Linus Torvalds authored
      Pull x86 fixes from Ingo Molnar:
       "A landry list of fixes:
      
         - fix reboot breakage on some PCID-enabled system
      
         - fix crashes/hangs on some PCID-enabled systems
      
         - fix microcode loading on certain older CPUs
      
         - various unwinder fixes
      
         - extend an APIC quirk to more hardware systems and disable APIC
           related warning on virtualized systems
      
         - various Hyper-V fixes
      
         - a macro definition robustness fix
      
         - remove jprobes IRQ disabling
      
         - various mem-encryption fixes"
      
      * 'x86-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/microcode: Do the family check first
        x86/mm: Flush more aggressively in lazy TLB mode
        x86/apic: Update TSC_DEADLINE quirk with additional SKX stepping
        x86/apic: Silence "FW_BUG TSC_DEADLINE disabled due to Errata" on hypervisors
        x86/mm: Disable various instrumentations of mm/mem_encrypt.c and mm/tlb.c
        x86/hyperv: Fix hypercalls with extended CPU ranges for TLB flushing
        x86/hyperv: Don't use percpu areas for pcpu_flush/pcpu_flush_ex structures
        x86/hyperv: Clear vCPU banks between calls to avoid flushing unneeded vCPUs
        x86/unwind: Disable unwinder warnings on 32-bit
        x86/unwind: Align stack pointer in unwinder dump
        x86/unwind: Use MSB for frame pointer encoding on 32-bit
        x86/unwind: Fix dereference of untrusted pointer
        x86/alternatives: Fix alt_max_short macro to really be a max()
        x86/mm/64: Fix reboot interaction with CR4.PCIDE
        kprobes/x86: Remove IRQ disabling from jprobe handlers
        kprobes/x86: Set up frame pointer in kprobe trampoline
      e7a36a6e
    • Linus Torvalds's avatar
      Merge branch 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a339b351
      Linus Torvalds authored
      Pull scheduler fixes from Ingo Molnar:
       "Three fixes that address an SMP balancing performance regression"
      
      * 'sched-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        sched/core: Ensure load_balance() respects the active_mask
        sched/core: Address more wake_affine() regressions
        sched/core: Fix wake_affine() performance regression
      a339b351
    • Linus Torvalds's avatar
      Merge branch 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 7b764ced
      Linus Torvalds authored
      Pull RAS fixes from Ingo Molnar:
       "A boot parameter fix, plus a header export fix"
      
      * 'ras-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/mce: Hide mca_cfg
        RAS/CEC: Use the right length for "cec_disable"
      7b764ced
    • Linus Torvalds's avatar
      Merge branch 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 26c923ab
      Linus Torvalds authored
      Pull perf fixes from Ingo Molnar:
       "Some tooling fixes plus three kernel fixes: a memory leak fix, a
        statistics fix and a crash fix"
      
      * 'perf-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/x86/intel/uncore: Fix memory leaks on allocation failures
        perf/core: Fix cgroup time when scheduling descendants
        perf/core: Avoid freeing static PMU contexts when PMU is unregistered
        tools include uapi bpf.h: Sync kernel ABI header with tooling header
        perf pmu: Unbreak perf record for arm/arm64 with events with explicit PMU
        perf script: Add missing separator for "-F ip,brstack" (and brstackoff)
        perf callchain: Compare dsos (as well) for CCKEY_FUNCTION
      26c923ab
    • Linus Torvalds's avatar
      Merge branch 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 60a6ca6c
      Linus Torvalds authored
      Pull locking fixes from Ingo Molnar:
       "Two lockdep fixes for bugs introduced by the cross-release dependency
        tracking feature - plus a commit that disables it because performance
        regressed in an absymal fashion on some systems"
      
      * 'locking-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        locking/lockdep: Disable cross-release features for now
        locking/selftest: Avoid false BUG report
        locking/lockdep: Fix stacktrace mess
      60a6ca6c
    • Linus Torvalds's avatar
      Merge branch 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 2b34218e
      Linus Torvalds authored
      Pull irq fixes from Ingo Molnar:
       "A CPU hotplug related fix, plus two related sanity checks"
      
      * 'irq-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        genirq/cpuhotplug: Enforce affinity setting on startup of managed irqs
        genirq/cpuhotplug: Add sanity check for effective affinity mask
        genirq: Warn when effective affinity is not updated
      2b34218e
    • Linus Torvalds's avatar
      Merge branch 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a515d05e
      Linus Torvalds authored
      Pull objtool fix from Ingo Molnar:
       "A single objtool fix: avoid silently broken ORC debuginfo builds and
        error out instead"
      
      * 'core-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        objtool: Upgrade libelf-devel warning to error for CONFIG_ORC_UNWINDER
      a515d05e
    • Borislav Petkov's avatar
      x86/microcode: Do the family check first · 1f161f67
      Borislav Petkov authored
      On CPUs like AMD's Geode, for example, we shouldn't even try to load
      microcode because they do not support the modern microcode loading
      interface.
      
      However, we do the family check *after* the other checks whether the
      loader has been disabled on the command line or whether we're running in
      a guest.
      
      So move the family checks first in order to exit early if we're being
      loaded on an unsupported family.
      Reported-and-tested-by: default avatarSven Glodowski <glodi1@arcor.de>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: <stable@vger.kernel.org> # 4.11..
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Link: http://bugzilla.suse.com/show_bug.cgi?id=1061396
      Link: http://lkml.kernel.org/r/20171012112316.977-1-bp@alien8.deSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      1f161f67
    • Ingo Molnar's avatar
      locking/lockdep: Disable cross-release features for now · b483cf3b
      Ingo Molnar authored
      Johan Hovold reported a big lockdep slowdown on his system, caused by lockdep:
      
      > I had noticed that the BeagleBone Black boot time appeared to have
      > increased significantly with 4.14 and yesterday I finally had time to
      > investigate it.
      >
      > Boot time (from "Linux version" to login prompt) had in fact doubled
      > since 4.13 where it took 17 seconds (with my current config) compared to
      > the 35 seconds I now see with 4.14-rc4.
      >
      > I quick bisect pointed to lockdep and specifically the following commit:
      >
      >	28a903f6 ("locking/lockdep: Handle non(or multi)-acquisition of a crosslock")
      
      Because the final v4.14 release is close, disable the cross-release lockdep
      features for now.
      Bisected-by: default avatarJohan Hovold <johan@kernel.org>
      Debugged-by: default avatarJohan Hovold <johan@kernel.org>
      Reported-by: default avatarJohan Hovold <johan@kernel.org>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: Byungchul Park <byungchul.park@lge.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Cc: Tony Lindgren <tony@atomide.com>
      Cc: kernel-team@lge.com
      Cc: linux-arm-kernel@lists.infradead.org
      Cc: linux-mm@kvack.org
      Cc: linux-omap@vger.kernel.org
      Link: http://lkml.kernel.org/r/20171014072659.f2yr6mhm5ha3eou7@gmail.comSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b483cf3b
    • Linus Torvalds's avatar
      Merge branch '4.14-fixes' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus · be1f16ba
      Linus Torvalds authored
      Pull MIPS fixes from Ralf Baechle:
       "More MIPS fixes for 4.14:
      
         - Loongson 1: Set the default number of RX and TX queues to
           accomodate for recent changes of stmmac driver.
      
         - BPF: Fix uninitialised target compiler error.
      
         - Fix cmpxchg on 32 bit signed ints for 64 bit kernels with
           !kernel_uses_llsc
      
         - Fix generic-board-config.sh for builds using O=
      
         - Remove pr_err() calls from fpu_emu() for a case which is not a
           kernel error"
      
      * '4.14-fixes' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus:
        MIPS: math-emu: Remove pr_err() calls from fpu_emu()
        MIPS: Fix generic-board-config.sh for builds using O=
        MIPS: Fix cmpxchg on 32b signed ints for 64b kernel with !kernel_uses_llsc
        MIPS: loongson1: set default number of rx and tx queues for stmmac
        MIPS: bpf: Fix uninitialised target compiler error
      be1f16ba
    • Andy Lutomirski's avatar
      x86/mm: Flush more aggressively in lazy TLB mode · b956575b
      Andy Lutomirski authored
      Since commit:
      
        94b1b03b ("x86/mm: Rework lazy TLB mode and TLB freshness tracking")
      
      x86's lazy TLB mode has been all the way lazy: when running a kernel thread
      (including the idle thread), the kernel keeps using the last user mm's
      page tables without attempting to maintain user TLB coherence at all.
      
      From a pure semantic perspective, this is fine -- kernel threads won't
      attempt to access user pages, so having stale TLB entries doesn't matter.
      
      Unfortunately, I forgot about a subtlety.  By skipping TLB flushes,
      we also allow any paging-structure caches that may exist on the CPU
      to become incoherent.  This means that we can have a
      paging-structure cache entry that references a freed page table, and
      the CPU is within its rights to do a speculative page walk starting
      at the freed page table.
      
      I can imagine this causing two different problems:
      
       - A speculative page walk starting from a bogus page table could read
         IO addresses.  I haven't seen any reports of this causing problems.
      
       - A speculative page walk that involves a bogus page table can install
         garbage in the TLB.  Such garbage would always be at a user VA, but
         some AMD CPUs have logic that triggers a machine check when it notices
         these bogus entries.  I've seen a couple reports of this.
      
      Boris further explains the failure mode:
      
      > It is actually more of an optimization which assumes that paging-structure
      > entries are in WB DRAM:
      >
      > "TlbCacheDis: cacheable memory disable. Read-write. 0=Enables
      > performance optimization that assumes PML4, PDP, PDE, and PTE entries
      > are in cacheable WB-DRAM; memory type checks may be bypassed, and
      > addresses outside of WB-DRAM may result in undefined behavior or NB
      > protocol errors. 1=Disables performance optimization and allows PML4,
      > PDP, PDE and PTE entries to be in any memory type. Operating systems
      > that maintain page tables in memory types other than WB- DRAM must set
      > TlbCacheDis to insure proper operation."
      >
      > The MCE generated is an NB protocol error to signal that
      >
      > "Link: A specific coherent-only packet from a CPU was issued to an
      > IO link. This may be caused by software which addresses page table
      > structures in a memory type other than cacheable WB-DRAM without
      > properly configuring MSRC001_0015[TlbCacheDis]. This may occur, for
      > example, when page table structure addresses are above top of memory. In
      > such cases, the NB will generate an MCE if it sees a mismatch between
      > the memory operation generated by the core and the link type."
      >
      > I'm assuming coherent-only packets don't go out on IO links, thus the
      > error.
      
      To fix this, reinstate TLB coherence in lazy mode.  With this patch
      applied, we do it in one of two ways:
      
       - If we have PCID, we simply switch back to init_mm's page tables
         when we enter a kernel thread -- this seems to be quite cheap
         except for the cost of serializing the CPU.
      
       - If we don't have PCID, then we set a flag and switch to init_mm
         the first time we would otherwise need to flush the TLB.
      
      The /sys/kernel/debug/x86/tlb_use_lazy_mode debug switch can be changed
      to override the default mode for benchmarking.
      
      In theory, we could optimize this better by only flushing the TLB in
      lazy CPUs when a page table is freed.  Doing that would require
      auditing the mm code to make sure that all page table freeing goes
      through tlb_remove_page() as well as reworking some data structures
      to implement the improved flush logic.
      Reported-by: default avatarMarkus Trippelsdorf <markus@trippelsdorf.de>
      Reported-by: default avatarAdam Borowski <kilobyte@angband.pl>
      Signed-off-by: default avatarAndy Lutomirski <luto@kernel.org>
      Signed-off-by: default avatarBorislav Petkov <bp@suse.de>
      Cc: Borislav Petkov <bp@alien8.de>
      Cc: Brian Gerst <brgerst@gmail.com>
      Cc: Daniel Borkmann <daniel@iogearbox.net>
      Cc: Eric Biggers <ebiggers@google.com>
      Cc: Johannes Hirte <johannes.hirte@datenkhaos.de>
      Cc: Kees Cook <keescook@chromium.org>
      Cc: Kirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Linus Torvalds <torvalds@linux-foundation.org>
      Cc: Nadav Amit <nadav.amit@gmail.com>
      Cc: Peter Zijlstra <peterz@infradead.org>
      Cc: Rik van Riel <riel@redhat.com>
      Cc: Roman Kagan <rkagan@virtuozzo.com>
      Cc: Thomas Gleixner <tglx@linutronix.de>
      Fixes: 94b1b03b ("x86/mm: Rework lazy TLB mode and TLB freshness tracking")
      Link: http://lkml.kernel.org/r/20171009170231.fkpraqokz6e4zeco@pd.tnicSigned-off-by: default avatarIngo Molnar <mingo@kernel.org>
      b956575b
    • Linus Torvalds's avatar
      Merge tag 'drm-fixes-for-v4.14-rc5' of git://people.freedesktop.org/~airlied/linux · 9aa0d2dd
      Linus Torvalds authored
      Pull drm fixes from Dave Airlie:
       "Couple of the arm people seem to wake up so this has imx and msm
        fixes, along with a bunch of i915 stable bounds fixes and an amdgpu
        regression fix.
      
        All seems pretty okay for now"
      
      * tag 'drm-fixes-for-v4.14-rc5' of git://people.freedesktop.org/~airlied/linux:
        drm/msm: fix _NO_IMPLICIT fencing case
        drm/msm: fix error path cleanup
        drm/msm/mdp5: Remove extra pm_runtime_put call in mdp5_crtc_cursor_set()
        drm/msm/dsi: Use correct pm_runtime_put variant during host_init
        drm/msm: fix return value check in _msm_gem_kernel_new()
        drm/msm: use proper memory barriers for updating tail/head
        drm/msm/mdp5: add missing max size for 8x74 v1
        drm/amdgpu: fix placement flags in amdgpu_ttm_bind
        drm/i915/bios: parse DDI ports also for CHV for HDMI DDC pin and DP AUX channel
        gpu: ipu-v3: pre: implement workaround for ERR009624
        gpu: ipu-v3: prg: wait for double buffers to be filled on channel startup
        gpu: ipu-v3: Allow channel burst locking on i.MX6 only
        drm/i915: Read timings from the correct transcoder in intel_crtc_mode_get()
        drm/i915: Order two completing nop_submit_request
        drm/i915: Silence compiler warning for hsw_power_well_enable()
        drm/i915: Use crtc_state_is_legacy_gamma in intel_color_check
        drm/i915/edp: Increase the T12 delay quirk to 1300ms
        drm/i915/edp: Get the Panel Power Off timestamp after panel is off
        sync_file: Return consistent status in SYNC_IOC_FILE_INFO
        drm/atomic: Unref duplicated drm_atomic_state in drm_atomic_helper_resume()
      9aa0d2dd
  5. 13 Oct, 2017 15 commits