1. 15 Jun, 2021 1 commit
    • Michael Ellerman's avatar
      powerpc: Fix initrd corruption with relative jump labels · 478036c4
      Michael Ellerman authored
      Commit b0b3b2c7 ("powerpc: Switch to relative jump labels") switched
      us to using relative jump labels. That involves changing the code,
      target and key members in struct jump_entry to be relative to the
      address of the jump_entry, rather than absolute addresses.
      
      We have two static inlines that create a struct jump_entry,
      arch_static_branch() and arch_static_branch_jump(), as well as an asm
      macro ARCH_STATIC_BRANCH, which is used by the pseries-only hypervisor
      tracing code.
      
      Unfortunately we missed updating the key to be a relative reference in
      ARCH_STATIC_BRANCH.
      
      That causes a pseries kernel to have a handful of jump_entry structs
      with bad key values. Instead of being a relative reference they instead
      hold the full address of the key.
      
      However the code doesn't expect that, it still adds the key value to the
      address of the jump_entry (see jump_entry_key()) expecting to get a
      pointer to a key somewhere in kernel data.
      
      The table of jump_entry structs sits in rodata, which comes after the
      kernel text. In a typical build this will be somewhere around 15MB. The
      address of the key will be somewhere in data, typically around 20MB.
      Adding the two values together gets us a pointer somewhere around 45MB.
      
      We then call static_key_set_entries() with that bad pointer and modify
      some members of the struct static_key we think we are pointing at.
      
      A pseries kernel is typically ~30MB in size, so writing to ~45MB won't
      corrupt the kernel itself. However if we're booting with an initrd,
      depending on the size and exact location of the initrd, we can corrupt
      the initrd. Depending on how exactly we corrupt the initrd it can either
      cause the system to not boot, or just corrupt one of the files in the
      initrd.
      
      The fix is simply to make the key value relative to the jump_entry
      struct in the ARCH_STATIC_BRANCH macro.
      
      Fixes: b0b3b2c7 ("powerpc: Switch to relative jump labels")
      Reported-by: default avatarAnastasia Kovaleva <a.kovaleva@yadro.com>
      Reported-by: default avatarRoman Bolshakov <r.bolshakov@yadro.com>
      Reported-by: default avatarGreg Kurz <groug@kaod.org>
      Reported-by: default avatarDaniel Axtens <dja@axtens.net>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Tested-by: default avatarDaniel Axtens <dja@axtens.net>
      Tested-by: default avatarGreg Kurz <groug@kaod.org>
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210614131440.312360-1-mpe@ellerman.id.au
      478036c4
  2. 14 Jun, 2021 1 commit
    • Michael Ellerman's avatar
      powerpc/signal64: Copy siginfo before changing regs->nip · e41d6c3f
      Michael Ellerman authored
      In commit 96d7a4e0 ("powerpc/signal64: Rewrite handle_rt_signal64()
      to minimise uaccess switches") the 64-bit signal code was rearranged to
      use user_write_access_begin/end().
      
      As part of that change the call to copy_siginfo_to_user() was moved
      later in the function, so that it could be done after the
      user_write_access_end().
      
      In particular it was moved after we modify regs->nip to point to the
      signal trampoline. That means if copy_siginfo_to_user() fails we exit
      handle_rt_signal64() with an error but with regs->nip modified, whereas
      previously we would not modify regs->nip until the copy succeeded.
      
      Returning an error from signal delivery but with regs->nip updated
      leaves the process in a sort of half-delivered state. We do immediately
      force a SEGV in signal_setup_done(), called from do_signal(), so the
      process should never run in the half-delivered state.
      
      However that SEGV is not delivered until we've gone around to
      do_notify_resume() again, so it's possible some tracing could observe
      the half-delivered state.
      
      There are other cases where we fail signal delivery with regs partly
      updated, eg. the write to newsp and SA_SIGINFO, but the latter at least
      is very unlikely to fail as it reads back from the frame we just wrote
      to.
      
      Looking at other arches they seem to be more careful about leaving regs
      unchanged until the copy operations have succeeded, and in general that
      seems like good hygenie.
      
      So although the current behaviour is not cleary buggy, it's also not
      clearly correct. So move the call to copy_siginfo_to_user() up prior to
      the modification of regs->nip, which is closer to the old behaviour, and
      easier to reason about.
      
      Fixes: 96d7a4e0 ("powerpc/signal64: Rewrite handle_rt_signal64() to minimise uaccess switches")
      Signed-off-by: default avatarMichael Ellerman <mpe@ellerman.id.au>
      Link: https://lore.kernel.org/r/20210608134605.2783677-1-mpe@ellerman.id.au
      e41d6c3f
  3. 06 Jun, 2021 1 commit
  4. 01 Jun, 2021 1 commit
  5. 28 May, 2021 3 commits
  6. 20 May, 2021 3 commits
  7. 16 May, 2021 7 commits
    • Linus Torvalds's avatar
      Linux 5.13-rc2 · d07f6ca9
      Linus Torvalds authored
      d07f6ca9
    • Linus Torvalds's avatar
      Merge tag 'driver-core-5.13-rc2' of... · 28183dbf
      Linus Torvalds authored
      Merge tag 'driver-core-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
      
      Pull driver core fixes from Greg KH:
       "Here are two driver fixes for driver core changes that happened in
        5.13-rc1.
      
        The clk driver fix resolves a many-reported issue with booting some
        devices, and the USB typec fix resolves the reported problem of USB
        systems on some embedded boards.
      
        Both of these have been in linux-next this week with no reported
        issues"
      
      * tag 'driver-core-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core:
        clk: Skip clk provider registration when np is NULL
        usb: typec: tcpm: Don't block probing of consumers of "connector" nodes
      28183dbf
    • Linus Torvalds's avatar
      Merge tag 'staging-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging · 6942d81a
      Linus Torvalds authored
      Pull staging and IIO driver fixes from Greg KH:
       "Here are some small IIO driver fixes and one Staging driver fix for
        5.13-rc2.
      
        Nothing major, just some resolutions for reported problems:
      
         - gcc-11 bogus warning fix for rtl8723bs
      
         - iio driver tiny fixes
      
        All of these have been in linux-next for many days with no reported
        issues"
      
      * tag 'staging-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging:
        iio: tsl2583: Fix division by a zero lux_val
        iio: core: return ENODEV if ioctl is unknown
        iio: core: fix ioctl handlers removal
        iio: gyro: mpu3050: Fix reported temperature value
        iio: hid-sensors: select IIO_TRIGGERED_BUFFER under HID_SENSOR_IIO_TRIGGER
        iio: proximity: pulsedlight: Fix rumtime PM imbalance on error
        iio: light: gp2ap002: Fix rumtime PM imbalance on error
        staging: rtl8723bs: avoid bogus gcc warning
      6942d81a
    • Linus Torvalds's avatar
      Merge tag 'usb-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · 4a668429
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "Here are some small USB fixes for 5.13-rc2. They consist of a number
        of resolutions for reported issues:
      
         - typec fixes for found problems
      
         - xhci fixes and quirk additions
      
         - dwc3 driver fixes
      
         - minor fixes found by Coverity
      
         - cdc-wdm fixes for reported problems
      
        All of these have been in linux-next for a few days with no reported
        issues"
      
      * tag 'usb-5.13-rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (28 commits)
        usb: core: hub: fix race condition about TRSMRCY of resume
        usb: typec: tcpm: Fix SINK_DISCOVERY current limit for Rp-default
        xhci: Add reset resume quirk for AMD xhci controller.
        usb: xhci: Increase timeout for HC halt
        xhci: Do not use GFP_KERNEL in (potentially) atomic context
        xhci: Fix giving back cancelled URBs even if halted endpoint can't reset
        xhci-pci: Allow host runtime PM as default for Intel Alder Lake xHCI
        usb: musb: Fix an error message
        usb: typec: tcpm: Fix wrong handling for Not_Supported in VDM AMS
        usb: typec: tcpm: Send DISCOVER_IDENTITY from dedicated work
        usb: typec: ucsi: Retrieve all the PDOs instead of just the first 4
        usb: fotg210-hcd: Fix an error message
        docs: usb: function: Modify path name
        usb: dwc3: omap: improve extcon initialization
        usb: typec: ucsi: Put fwnode in any case during ->probe()
        usb: typec: tcpm: Fix wrong handling in GET_SINK_CAP
        usb: dwc2: Remove obsolete MODULE_ constants from platform.c
        usb: dwc3: imx8mp: fix error return code in dwc3_imx8mp_probe()
        usb: dwc3: imx8mp: detect dwc3 core node via compatible string
        usb: dwc3: gadget: Return success always for kick transfer in ep queue
        ...
      4a668429
    • Linus Torvalds's avatar
      Merge tag 'timers-urgent-2021-05-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 8ce36481
      Linus Torvalds authored
      Pull timer fixes from Thomas Gleixner:
       "Two fixes for timers:
      
         - Use the ALARM feature check in the alarmtimer core code insted of
           the old method of checking for the set_alarm() callback.
      
           Drivers can have that callback set but the feature bit cleared. If
           such a RTC device is selected then alarms wont work.
      
         - Use a proper define to let the preprocessor check whether Hyper-V
           VDSO clocksource should be active.
      
           The code used a constant in an enum with #ifdef, which evaluates to
           always false and disabled the clocksource for VDSO"
      
      * tag 'timers-urgent-2021-05-16' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        clocksource/drivers/hyper-v: Re-enable VDSO_CLOCKMODE_HVCLOCK on X86
        alarmtimer: Check RTC features instead of ops
      8ce36481
    • Linus Torvalds's avatar
      Merge tag 'for-linus-5.13b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip · f44e58bb
      Linus Torvalds authored
      Pull xen fixes from Juergen Gross:
      
       - two patches for error path fixes
      
       - a small series for fixing a regression with swiotlb with Xen on Arm
      
      * tag 'for-linus-5.13b-rc2-tag' of git://git.kernel.org/pub/scm/linux/kernel/git/xen/tip:
        xen/swiotlb: check if the swiotlb has already been initialized
        arm64: do not set SWIOTLB_NO_FORCE when swiotlb is required
        xen/arm: move xen_swiotlb_detect to arm/swiotlb-xen.h
        xen/unpopulated-alloc: fix error return code in fill_list()
        xen/gntdev: fix gntdev_mmap() error exit path
      f44e58bb
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v5.13_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · ccb013c2
      Linus Torvalds authored
      Pull x86 fixes from Borislav Petkov:
       "The three SEV commits are not really urgent material. But we figured
        since getting them in now will avoid a huge amount of conflicts
        between future SEV changes touching tip, the kvm and probably other
        trees, sending them to you now would be best.
      
        The idea is that the tip, kvm etc branches for 5.14 will all base
        ontop of -rc2 and thus everything will be peachy. What is more, those
        changes are purely mechanical and defines movement so they should be
        fine to go now (famous last words).
      
        Summary:
      
         - Enable -Wundef for the compressed kernel build stage
      
         - Reorganize SEV code to streamline and simplify future development"
      
      * tag 'x86_urgent_for_v5.13_rc2' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        x86/boot/compressed: Enable -Wundef
        x86/msr: Rename MSR_K8_SYSCFG to MSR_AMD64_SYSCFG
        x86/sev: Move GHCB MSR protocol and NAE definitions in a common header
        x86/sev-es: Rename sev-es.{ch} to sev.{ch}
      ccb013c2
  8. 15 May, 2021 23 commits