1. 04 Nov, 2022 2 commits
    • Kai Huang's avatar
      KVM/VMX: Allow exposing EDECCSSA user leaf function to KVM guest · 16a7fe37
      Kai Huang authored
      The new Asynchronous Exit (AEX) notification mechanism (AEX-notify)
      allows one enclave to receive a notification in the ERESUME after the
      enclave exit due to an AEX.  EDECCSSA is a new SGX user leaf function
      (ENCLU[EDECCSSA]) to facilitate the AEX notification handling.  The new
      EDECCSSA is enumerated via CPUID(EAX=0x12,ECX=0x0):EAX[11].
      
      Besides Allowing reporting the new AEX-notify attribute to KVM guests,
      also allow reporting the new EDECCSSA user leaf function to KVM guests
      so the guest can fully utilize the AEX-notify mechanism.
      
      Similar to existing X86_FEATURE_SGX1 and X86_FEATURE_SGX2, introduce a
      new scattered X86_FEATURE_SGX_EDECCSSA bit for the new EDECCSSA, and
      report it in KVM's supported CPUIDs.
      
      Note, no additional KVM enabling is required to allow the guest to use
      EDECCSSA.  It's impossible to trap ENCLU (without completely preventing
      the guest from using SGX).  Advertise EDECCSSA as supported purely so
      that userspace doesn't need to special case EDECCSSA, i.e. doesn't need
      to manually check host CPUID.
      
      The inability to trap ENCLU also means that KVM can't prevent the guest
      from using EDECCSSA, but that virtualization hole is benign as far as
      KVM is concerned.  EDECCSSA is simply a fancy way to modify internal
      enclave state.
      
      More background about how do AEX-notify and EDECCSSA work:
      
      SGX maintains a Current State Save Area Frame (CSSA) for each enclave
      thread.  When AEX happens, the enclave thread context is saved to the
      CSSA and the CSSA is increased by 1.  For a normal ERESUME which doesn't
      deliver AEX notification, it restores the saved thread context from the
      previously saved SSA and decreases the CSSA.  If AEX-notify is enabled
      for one enclave, the ERESUME acts differently.  Instead of restoring the
      saved thread context and decreasing the CSSA, it acts like EENTER which
      doesn't decrease the CSSA but establishes a clean slate thread context
      using the CSSA for the enclave to handle the notification.  After some
      handling, the enclave must discard the "new-established" SSA and switch
      back to the previously saved SSA (upon AEX).  Otherwise, the enclave
      will run out of SSA space upon further AEXs and eventually fail to run.
      
      To solve this problem, the new EDECCSSA essentially decreases the CSSA.
      It can be used by the enclave notification handler to switch back to the
      previous saved SSA when needed, i.e. after it handles the notification.
      Signed-off-by: default avatarKai Huang <kai.huang@intel.com>
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Acked-by: default avatarSean Christopherson <seanjc@google.com>
      Acked-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Link: https://lore.kernel.org/all/20221101022422.858944-1-kai.huang%40intel.com
      16a7fe37
    • Dave Hansen's avatar
      x86/sgx: Allow enclaves to use Asynchrounous Exit Notification · 370839c2
      Dave Hansen authored
      Short Version:
      
      Allow enclaves to use the new Asynchronous EXit (AEX)
      notification mechanism.  This mechanism lets enclaves run a
      handler after an AEX event.  These handlers can run mitigations
      for things like SGX-Step[1].
      
      AEX Notify will be made available both on upcoming processors and
      on some older processors through microcode updates.
      
      Long Version:
      
      == SGX Attribute Background ==
      
      The SGX architecture includes a list of SGX "attributes".  These
      attributes ensure consistency and transparency around specific
      enclave features.
      
      As a simple example, the "DEBUG" attribute allows an enclave to
      be debugged, but also destroys virtually all of SGX security.
      Using attributes, enclaves can know that they are being debugged.
      Attributes also affect enclave attestation so an enclave can, for
      instance, be denied access to secrets while it is being debugged.
      
      The kernel keeps a list of known attributes and will only
      initialize enclaves that use a known set of attributes.  This
      kernel policy eliminates the chance that a new SGX attribute
      could cause undesired effects.
      
      For example, imagine a new attribute was added called
      "PROVISIONKEY2" that provided similar functionality to
      "PROVISIIONKEY".  A kernel policy that allowed indiscriminate use
      of unknown attributes and thus PROVISIONKEY2 would undermine the
      existing kernel policy which limits use of PROVISIONKEY enclaves.
      
      == AEX Notify Background ==
      
      "Intel Architecture Instruction Set Extensions and Future
      Features - Version 45" is out[2].  There is a new chapter:
      
      	Asynchronous Enclave Exit Notify and the EDECCSSA User Leaf Function.
      
      Enclaves exit can be either synchronous and consensual (EEXIT for
      instance) or asynchronous (on an interrupt or fault).  The
      asynchronous ones can evidently be exploited to single step
      enclaves[1], on top of which other naughty things can be built.
      
      AEX Notify will be made available both on upcoming processors and
      on some older processors through microcode updates.
      
      == The Problem ==
      
      These attacks are currently entirely opaque to the enclave since
      the hardware does the save/restore under the covers. The
      Asynchronous Enclave Exit Notify (AEX Notify) mechanism provides
      enclaves an ability to detect and mitigate potential exposure to
      these kinds of attacks.
      
      == The Solution ==
      
      Define the new attribute value for AEX Notification.  Ensure the
      attribute is cleared from the list reserved attributes.  Instead
      of adding to the open-coded lists of individual attributes,
      add named lists of privileged (disallowed by default) and
      unprivileged (allowed by default) attributes.  Add the AEX notify
      attribute as an unprivileged attribute, which will keep the kernel
      from rejecting enclaves with it set.
      
      1. https://github.com/jovanbulck/sgx-step
      2. https://cdrdv2.intel.com/v1/dl/getContent/671368?explicitVersion=trueSigned-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Acked-by: default avatarJarkko Sakkinen <jarkko@kernel.org>
      Tested-by: default avatarHaitao Huang <haitao.huang@intel.com>
      Tested-by: default avatarKai Huang <kai.huang@intel.com>
      Link: https://lore.kernel.org/all/20220720191347.1343986-1-dave.hansen%40linux.intel.com
      370839c2
  2. 31 Oct, 2022 1 commit
    • Reinette Chatre's avatar
      x86/sgx: Reduce delay and interference of enclave release · 7b72c823
      Reinette Chatre authored
      commit 8795359e ("x86/sgx: Silence softlockup detection when
      releasing large enclaves") introduced a cond_resched() during enclave
      release where the EREMOVE instruction is applied to every 4k enclave
      page. Giving other tasks an opportunity to run while tearing down a
      large enclave placates the soft lockup detector but Iqbal found
      that the fix causes a 25% performance degradation of a workload
      run using Gramine.
      
      Gramine maintains a 1:1 mapping between processes and SGX enclaves.
      That means if a workload in an enclave creates a subprocess then
      Gramine creates a duplicate enclave for that subprocess to run in.
      The consequence is that the release of the enclave used to run
      the subprocess can impact the performance of the workload that is
      run in the original enclave, especially in large enclaves when
      SGX2 is not in use.
      
      The workload run by Iqbal behaves as follows:
      Create enclave (enclave "A")
      /* Initialize workload in enclave "A" */
      Create enclave (enclave "B")
      /* Run subprocess in enclave "B" and send result to enclave "A" */
      Release enclave (enclave "B")
      /* Run workload in enclave "A" */
      Release enclave (enclave "A")
      
      The performance impact of releasing enclave "B" in the above scenario
      is amplified when there is a lot of SGX memory and the enclave size
      matches the SGX memory. When there is 128GB SGX memory and an enclave
      size of 128GB, from the time enclave "B" starts the 128GB SGX memory
      is oversubscribed with a combined demand for 256GB from the two
      enclaves.
      
      Before commit 8795359e ("x86/sgx: Silence softlockup detection when
      releasing large enclaves") enclave release was done in a tight loop
      without giving other tasks a chance to run. Even though the system
      experienced soft lockups the workload (run in enclave "A") obtained
      good performance numbers because when the workload started running
      there was no interference.
      
      Commit 8795359e ("x86/sgx: Silence softlockup detection when
      releasing large enclaves") gave other tasks opportunity to run while an
      enclave is released. The impact of this in this scenario is that while
      enclave "B" is released and needing to access each page that belongs
      to it in order to run the SGX EREMOVE instruction on it, enclave "A"
      is attempting to run the workload needing to access the enclave
      pages that belong to it. This causes a lot of swapping due to the
      demand for the oversubscribed SGX memory. Longer latencies are
      experienced by the workload in enclave "A" while enclave "B" is
      released.
      
      Improve the performance of enclave release while still avoiding the
      soft lockup detector with two enhancements:
      - Only call cond_resched() after XA_CHECK_SCHED iterations.
      - Use the xarray advanced API to keep the xarray locked for
        XA_CHECK_SCHED iterations instead of locking and unlocking
        at every iteration.
      
      This batching solution is copied from sgx_encl_may_map() that
      also iterates through all enclave pages using this technique.
      
      With this enhancement the workload experiences a 5%
      performance degradation when compared to a kernel without
      commit 8795359e ("x86/sgx: Silence softlockup detection when
      releasing large enclaves"), an improvement to the reported 25%
      degradation, while still placating the soft lockup detector.
      
      Scenarios with poor performance are still possible even with these
      enhancements. For example, short workloads creating sub processes
      while running in large enclaves. Further performance improvements
      are pursued in user space through avoiding to create duplicate enclaves
      for certain sub processes, and using SGX2 that will do lazy allocation
      of pages as needed so enclaves created for sub processes start quickly
      and release quickly.
      
      Fixes: 8795359e ("x86/sgx: Silence softlockup detection when releasing large enclaves")
      Reported-by: default avatarMd Iqbal Hossain <md.iqbal.hossain@intel.com>
      Signed-off-by: default avatarReinette Chatre <reinette.chatre@intel.com>
      Signed-off-by: default avatarDave Hansen <dave.hansen@linux.intel.com>
      Tested-by: default avatarMd Iqbal Hossain <md.iqbal.hossain@intel.com>
      Link: https://lore.kernel.org/all/00efa80dd9e35dc85753e1c5edb0344ac07bb1f0.1667236485.git.reinette.chatre%40intel.com
      7b72c823
  3. 30 Oct, 2022 13 commits
    • Linus Torvalds's avatar
      Linux 6.1-rc3 · 30a0b95b
      Linus Torvalds authored
      30a0b95b
    • Linus Torvalds's avatar
      Merge tag 'fbdev-for-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev · b72018ab
      Linus Torvalds authored
      Pull fbdev fixes from Helge Deller:
       "A use-after-free bugfix in the smscufx driver and various minor error
        path fixes, smaller build fixes, sysfs fixes and typos in comments in
        the stifb, sisfb, da8xxfb, xilinxfb, sm501fb, gbefb and cyber2000fb
        drivers"
      
      * tag 'fbdev-for-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/deller/linux-fbdev:
        fbdev: cyber2000fb: fix missing pci_disable_device()
        fbdev: sisfb: use explicitly signed char
        fbdev: smscufx: Fix several use-after-free bugs
        fbdev: xilinxfb: Make xilinxfb_release() return void
        fbdev: sisfb: fix repeated word in comment
        fbdev: gbefb: Convert sysfs snprintf to sysfs_emit
        fbdev: sm501fb: Convert sysfs snprintf to sysfs_emit
        fbdev: stifb: Fall back to cfb_fillrect() on 32-bit HCRX cards
        fbdev: da8xx-fb: Fix error handling in .remove()
        fbdev: MIPS supports iomem addresses
      b72018ab
    • Linus Torvalds's avatar
      Merge tag 'char-misc-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc · 9f127546
      Linus Torvalds authored
      Pull char/misc fixes from Greg KH:
       "Some small driver fixes for 6.1-rc3.  They include:
      
         - iio driver bugfixes
      
         - counter driver bugfixes
      
         - coresight bugfixes, including a revert and then a second fix to get
           it right.
      
        All of these have been in linux-next with no reported problems"
      
      * tag 'char-misc-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (21 commits)
        misc: sgi-gru: use explicitly signed char
        coresight: cti: Fix hang in cti_disable_hw()
        Revert "coresight: cti: Fix hang in cti_disable_hw()"
        counter: 104-quad-8: Fix race getting function mode and direction
        counter: microchip-tcb-capture: Handle Signal1 read and Synapse
        coresight: cti: Fix hang in cti_disable_hw()
        coresight: Fix possible deadlock with lock dependency
        counter: ti-ecap-capture: fix IS_ERR() vs NULL check
        counter: Reduce DEFINE_COUNTER_ARRAY_POLARITY() to defining counter_array
        iio: bmc150-accel-core: Fix unsafe buffer attributes
        iio: adxl367: Fix unsafe buffer attributes
        iio: adxl372: Fix unsafe buffer attributes
        iio: at91-sama5d2_adc: Fix unsafe buffer attributes
        iio: temperature: ltc2983: allocate iio channels once
        tools: iio: iio_utils: fix digit calculation
        iio: adc: stm32-adc: fix channel sampling time init
        iio: adc: mcp3911: mask out device ID in debug prints
        iio: adc: mcp3911: use correct id bits
        iio: adc: mcp3911: return proper error code on failure to allocate trigger
        iio: adc: mcp3911: fix sizeof() vs ARRAY_SIZE() bug
        ...
      9f127546
    • Linus Torvalds's avatar
      Merge tag 'usb-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb · c4d25ce6
      Linus Torvalds authored
      Pull USB fixes from Greg KH:
       "A few small USB fixes for 6.1-rc3. Include in here are:
      
         - MAINTAINERS update, including a big one for the USB gadget
           subsystem. Many thanks to Felipe for all of the years of hard work
           he has done on this codebase, it was greatly appreciated.
      
         - dwc3 driver fixes for reported problems.
      
         - xhci driver fixes for reported problems.
      
         - typec driver fixes for minor issues
      
         - uvc gadget driver change, and then revert as it wasn't relevant for
           6.1-final, as it is a new feature and people are still reviewing
           and modifying it.
      
        All of these have been in the linux-next tree with no reported issues"
      
      * tag 'usb-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb:
        usb: dwc3: gadget: Don't set IMI for no_interrupt
        usb: dwc3: gadget: Stop processing more requests on IMI
        Revert "usb: gadget: uvc: limit isoc_sg to super speed gadgets"
        xhci: Remove device endpoints from bandwidth list when freeing the device
        xhci-pci: Set runtime PM as default policy on all xHC 1.2 or later devices
        xhci: Add quirk to reset host back to default state at shutdown
        usb: xhci: add XHCI_SPURIOUS_SUCCESS to ASM1042 despite being a V0.96 controller
        usb: dwc3: st: Rely on child's compatible instead of name
        usb: gadget: uvc: limit isoc_sg to super speed gadgets
        usb: bdc: change state when port disconnected
        usb: typec: ucsi: acpi: Implement resume callback
        usb: typec: ucsi: Check the connection on resume
        usb: gadget: aspeed: Fix probe regression
        usb: gadget: uvc: fix sg handling during video encode
        usb: gadget: uvc: fix sg handling in error case
        usb: gadget: uvc: fix dropped frame after missed isoc
        usb: dwc3: gadget: Don't delay End Transfer on delayed_status
        usb: dwc3: Don't switch OTG -> peripheral if extcon is present
        MAINTAINERS: Update maintainers for broadcom USB
        MAINTAINERS: move USB gadget and phy entries under the main USB entry
      c4d25ce6
    • Linus Torvalds's avatar
      Merge tag 'gpio-fixes-for-v6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux · ef3c0949
      Linus Torvalds authored
      Pull gpio fixes from Bartosz Golaszewski:
      
       - convert gpio-tegra to using an immutable irqchip
      
       - MAINTAINERS update
      
      * tag 'gpio-fixes-for-v6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux:
        MAINTAINERS: Change myself to a maintainer
        gpio: tegra: Convert to immutable irq chip
      ef3c0949
    • Linus Torvalds's avatar
      Merge tag 'perf_urgent_for_v6.1_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · 43476605
      Linus Torvalds authored
      Pull perf fixes from Borislav Petkov:
      
       - Rename a perf memory level event define to denote it is of CXL type
      
       - Add Alder and Raptor Lakes support to RAPL
      
       - Make sure raw sample data is output with tracepoints
      
      * tag 'perf_urgent_for_v6.1_rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        perf/mem: Rename PERF_MEM_LVLNUM_EXTN_MEM to PERF_MEM_LVLNUM_CXL
        perf/x86/rapl: Add support for Intel Raptor Lake
        perf/x86/rapl: Add support for Intel AlderLake-N
        perf: Fix missing raw data on tracepoint events
      43476605
    • Linus Torvalds's avatar
      Merge tag 'loongarch-fixes-6.1-1' of... · c96bb958
      Linus Torvalds authored
      Merge tag 'loongarch-fixes-6.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
      
      Pull LoongArch fixes from Huacai Chen:
       "Remove unused kernel stack padding, fix some build errors/warnings and
        two bugs in laptop platform driver"
      
      * tag 'loongarch-fixes-6.1-1' of git://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson:
        platform/loongarch: laptop: Fix possible UAF and simplify generic_acpi_laptop_init()
        platform/loongarch: laptop: Adjust resume order for loongson_hotkey_resume()
        LoongArch: BPF: Avoid declare variables in switch-case
        LoongArch: Use flexible-array member instead of zero-length array
        LoongArch: Remove unused kernel stack padding
      c96bb958
    • Linus Torvalds's avatar
      Merge tag '6.1-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6 · 28b7bd4a
      Linus Torvalds authored
      Pull cifs fixes from Steve French:
      
       - use after free fix for reconnect race
      
       - two memory leak fixes
      
      * tag '6.1-rc2-smb3-fixes' of git://git.samba.org/sfrench/cifs-2.6:
        cifs: fix use-after-free caused by invalid pointer `hostname`
        cifs: Fix pages leak when writedata alloc failed in cifs_write_from_iter()
        cifs: Fix pages array leak when writedata alloc failed in cifs_writedata_alloc()
      28b7bd4a
    • Linus Torvalds's avatar
      Merge tag 'random-6.1-rc3-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/crng/random · 882ad2a2
      Linus Torvalds authored
      Pull random number generator fix from Jason Donenfeld:
       "One fix from Jean-Philippe Brucker, addressing a regression in which
        early boot code on ARM64 would use the non-_early variant of the
        arch_get_random family of functions, resulting in the architectural
        random number generator appearing unavailable during that early phase
        of boot.
      
        The fix simply changes arch_get_random*() to arch_get_random*_early().
      
        This distinction between these two functions is a bit of an old wart
        I'm not a fan of, and for 6.2 I'll see if I can make obsolete the
        _early variant, so that one function does the right thing in all
        contexts without overhead"
      
      * tag 'random-6.1-rc3-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/crng/random:
        random: use arch_get_random*_early() in random_init()
      882ad2a2
    • Linus Torvalds's avatar
      Merge tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi · 83633ed7
      Linus Torvalds authored
      Pull SCSI fixes from James Bottomley:
       "Varions small  fixes, all  in drivers.
      
        Some of these arrived during the merge window and got held over to
        make sure of testing on the -rc tree.
      
        The biggest change is for standards conformance in the target driver,
        closely followed by a set of bug fixes in megaraid_sas"
      
      * tag 'scsi-fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi: (21 commits)
        scsi: ufs: core: Fix typo in comment
        scsi: mpi3mr: Select CONFIG_SCSI_SAS_ATTRS
        scsi: ufs: core: Fix typo for register name in comments
        scsi: pm80xx: Display proc_name in sysfs
        scsi: ufs: core: Fix the error log in ufshcd_query_flag_retry()
        scsi: ufs: core: Remove unneeded casts from void *
        scsi: lpfc: Fix spelling mistake "unsolicted" -> "unsolicited"
        scsi: qla2xxx: Use transport-defined speed mask for supported_speeds
        scsi: target: iblock: Fold iblock_emulate_read_cap_with_block_size() into iblock_get_blocks()
        scsi: qla2xxx: Fix serialization of DCBX TLV data request
        scsi: ufs: qcom: Remove redundant dev_err() call
        scsi: megaraid_sas: Move megasas_dbg_lvl init to megasas_init()
        scsi: megaraid_sas: Remove unnecessary memset()
        scsi: megaraid_sas: Simplify megasas_update_device_list
        scsi: megaraid_sas: Correct an error message
        scsi: megaraid_sas: Correct value passed to scsi_device_lookup()
        scsi: target: core: UA on all LUNs after reset
        scsi: target: core: New key must be used for moved PR
        scsi: target: core: Abort all preempted regs if requested
        scsi: target: core: Fix memory leak in preempt_and_abort
        ...
      83633ed7
    • Linus Torvalds's avatar
      Merge tag 'block-6.1-2022-10-28' of git://git.kernel.dk/linux · c6e0e874
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
      
       - NVMe pull request via Christoph:
            - make the multipath dma alignment match the non-multipath one
              (Keith Busch)
            - fix a bogus use of sg_init_marker() (Nam Cao)
            - fix circulr locking in nvme-tcp (Sagi Grimberg)
      
       - Initialization fix for requests allocated via the special hw queue
         allocator (John)
      
       - Fix for a regression added in this release with the batched
         completions of end_io backed requests (Ming)
      
       - Error handling leak fix for rbd (Yang)
      
       - Error handling leak fix for add_disk() failure (Yu)
      
      * tag 'block-6.1-2022-10-28' of git://git.kernel.dk/linux:
        blk-mq: Properly init requests from blk_mq_alloc_request_hctx()
        blk-mq: don't add non-pt request with ->end_io to batch
        rbd: fix possible memory leak in rbd_sysfs_init()
        nvme-multipath: set queue dma alignment to 3
        nvme-tcp: fix possible circular locking when deleting a controller under memory pressure
        nvme-tcp: replace sg_init_marker() with sg_init_table()
        block: fix memory leak for elevator on add_disk failure
      c6e0e874
    • Linus Torvalds's avatar
      Merge tag 'io_uring-6.1-2022-10-28' of git://git.kernel.dk/linux · 4d244327
      Linus Torvalds authored
      Pull io_uring fix from Jens Axboe:
       "Just a fix for a locking regression introduced with the deferred
        task_work running from this merge window"
      
      * tag 'io_uring-6.1-2022-10-28' of git://git.kernel.dk/linux:
        io_uring: unlock if __io_run_local_work locked inside
        io_uring: use io_run_local_work_locked helper
      4d244327
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2022-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm · 3c339dbd
      Linus Torvalds authored
      Pull misc hotfixes from Andrew Morton:
       "Eight fix pre-6.0 bugs and the remainder address issues which were
        introduced in the 6.1-rc merge cycle, or address issues which aren't
        considered sufficiently serious to warrant a -stable backport"
      
      * tag 'mm-hotfixes-stable-2022-10-28' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (23 commits)
        mm: multi-gen LRU: move lru_gen_add_mm() out of IRQ-off region
        lib: maple_tree: remove unneeded initialization in mtree_range_walk()
        mmap: fix remap_file_pages() regression
        mm/shmem: ensure proper fallback if page faults
        mm/userfaultfd: replace kmap/kmap_atomic() with kmap_local_page()
        x86: fortify: kmsan: fix KMSAN fortify builds
        x86: asm: make sure __put_user_size() evaluates pointer once
        Kconfig.debug: disable CONFIG_FRAME_WARN for KMSAN by default
        x86/purgatory: disable KMSAN instrumentation
        mm: kmsan: export kmsan_copy_page_meta()
        mm: migrate: fix return value if all subpages of THPs are migrated successfully
        mm/uffd: fix vma check on userfault for wp
        mm: prep_compound_tail() clear page->private
        mm,madvise,hugetlb: fix unexpected data loss with MADV_DONTNEED on hugetlbfs
        mm/page_isolation: fix clang deadcode warning
        fs/ext4/super.c: remove unused `deprecated_msg'
        ipc/msg.c: fix percpu_counter use after free
        memory tier, sysfs: rename attribute "nodes" to "nodelist"
        MAINTAINERS: git://github.com -> https://github.com for nilfs2
        mm/kmemleak: prevent soft lockup in kmemleak_scan()'s object iteration loops
        ...
      3c339dbd
  4. 29 Oct, 2022 8 commits
    • Linus Torvalds's avatar
      Merge tag 'powerpc-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux · 91562cf9
      Linus Torvalds authored
      Pull powerpc fixes from Michael Ellerman:
      
       - Fix a case of rescheduling with user access unlocked, when preempt is
         enabled.
      
       - A follow-up fix for a recent fix, which could lead to IRQ state
         assertions firing incorrectly.
      
       - Two fixes for lockdep warnings seen when using kfence with the Hash
         MMU.
      
       - Two fixes for preempt warnings seen when using the Hash MMU.
      
       - Two fixes for the VAS coprocessor mechanism used on pseries.
      
       - Prevent building some of our older KVM backends when
         CONTEXT_TRACKING_USER is enabled, as it's known to cause crashes.
      
       - A couple of fixes for issues seen with PMU NMIs.
      
      Thanks to Nicholas Piggin, Guenter Roeck, Frederic Barrat Haren Myneni,
      Sachin Sant, and Samuel Holland.
      
      * tag 'powerpc-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux:
        powerpc/64s/interrupt: Fix clear of PACA_IRQS_HARD_DIS when returning to soft-masked context
        powerpc/64s/interrupt: Perf NMI should not take normal exit path
        powerpc/64/interrupt: Prevent NMI PMI causing a dangerous warning
        KVM: PPC: BookS PR-KVM and BookE do not support context tracking
        powerpc: Fix reschedule bug in KUAP-unlocked user copy
        powerpc/64s: Fix hash__change_memory_range preemption warning
        powerpc/64s: Disable preemption in hash lazy mmu mode
        powerpc/64s: make linear_map_hash_lock a raw spinlock
        powerpc/64s: make HPTE lock and native_tlbie_lock irq-safe
        powerpc/64s: Add lockdep for HPTE lock
        powerpc/pseries: Use lparcfg to reconfig VAS windows for DLPAR CPU
        powerpc/pseries/vas: Add VAS IRQ primary handler
      91562cf9
    • Yang Yingliang's avatar
      platform/loongarch: laptop: Fix possible UAF and simplify generic_acpi_laptop_init() · d8191691
      Yang Yingliang authored
      Currently the return value of 'sub_driver->init' is not checked. If
      sparse_keymap_setup() called in the init function fails, 'generic_
      inputdev' is freed, then it will lead a UAF when using it in generic_
      acpi_laptop_init(). Fix it by checking the return value and setting
      generic_inputdev to NULL after free, so as to avoid double free it.
      
      The error code in generic_subdriver_init() is always negative, so the
      return of generic_subdriver_init() can be simplified.
      
      Fixes: 6246ed09 ("LoongArch: Add ACPI-based generic laptop driver")
      Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      d8191691
    • Huacai Chen's avatar
      platform/loongarch: laptop: Adjust resume order for loongson_hotkey_resume() · fbe605ab
      Huacai Chen authored
      Some laptops don't support SW_LID, but still have backlight control,
      move backlight resuming before SW_LID event handling so as to avoid
      backlight mistake due to early return.
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      fbe605ab
    • Huacai Chen's avatar
      LoongArch: BPF: Avoid declare variables in switch-case · bbfddb90
      Huacai Chen authored
      Not all compilers support declare variables in switch-case, so move
      declarations to the beginning of a function. Otherwise we may get such
      build errors:
      
      arch/loongarch/net/bpf_jit.c: In function ‘emit_atomic’:
      arch/loongarch/net/bpf_jit.c:362:3: error: a label can only be part of a statement and a declaration is not a statement
         u8 r0 = regmap[BPF_REG_0];
         ^~
      arch/loongarch/net/bpf_jit.c: In function ‘build_insn’:
      arch/loongarch/net/bpf_jit.c:727:3: error: a label can only be part of a statement and a declaration is not a statement
         u8 t7 = -1;
         ^~
      arch/loongarch/net/bpf_jit.c:778:3: error: a label can only be part of a statement and a declaration is not a statement
         int ret;
         ^~~
      arch/loongarch/net/bpf_jit.c:779:3: error: expected expression before ‘u64’
         u64 func_addr;
         ^~~
      arch/loongarch/net/bpf_jit.c:780:3: warning: ISO C90 forbids mixed declarations and code [-Wdeclaration-after-statement]
         bool func_addr_fixed;
         ^~~~
      arch/loongarch/net/bpf_jit.c:784:11: error: ‘func_addr’ undeclared (first use in this function); did you mean ‘in_addr’?
                &func_addr, &func_addr_fixed);
                 ^~~~~~~~~
                 in_addr
      arch/loongarch/net/bpf_jit.c:784:11: note: each undeclared identifier is reported only once for each function it appears in
      arch/loongarch/net/bpf_jit.c:814:3: error: a label can only be part of a statement and a declaration is not a statement
         u64 imm64 = (u64)(insn + 1)->imm << 32 | (u32)insn->imm;
         ^~~
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      bbfddb90
    • Yushan Zhou's avatar
      LoongArch: Use flexible-array member instead of zero-length array · 4805a13d
      Yushan Zhou authored
      Eliminate the following coccicheck warning:
      ./arch/loongarch/include/asm/ptrace.h:32:15-21: WARNING use flexible-array member instead
      Reviewed-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarYushan Zhou <katrinzhou@tencent.com>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      4805a13d
    • Jinyang He's avatar
      LoongArch: Remove unused kernel stack padding · b40fa75e
      Jinyang He authored
      The current LoongArch kernel stack is padded as if obeying the MIPS o32
      calling convention (32 bytes), signifying the port's MIPS lineage but no
      longer making sense. Remove the padding for clarity.
      Reviewed-by: default avatarWANG Xuerui <git@xen0n.name>
      Signed-off-by: default avatarJinyang He <hejinyang@loongson.cn>
      Signed-off-by: default avatarHuacai Chen <chenhuacai@loongson.cn>
      b40fa75e
    • Linus Torvalds's avatar
      Merge tag 's390-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux · 576e61ce
      Linus Torvalds authored
      Pull s390 fixes from Vasily Gorbik:
      
       - Remove outdated linux390 link from MAINTAINERS
      
       - Add few missing EX_TABLE entries to inline assemblies
      
       - Fix raw data collection for pai_ext PMU
      
       - Add kernel image secure boot trailer for future firmware versions
      
       - Fix out-of-bounds access on cio_ignore free
      
       - Fix memory allocation of mdev_types array in vfio-ap
      
      * tag 's390-6.1-3' of git://git.kernel.org/pub/scm/linux/kernel/git/s390/linux:
        s390/vfio-ap: Fix memory allocation for mdev_types array
        s390/cio: fix out-of-bounds access on cio_ignore free
        s390/pai: fix raw data collection for PMU pai_ext
        s390/boot: add secure boot trailer
        s390/pci: add missing EX_TABLE entries to __pcistg_mio_inuser()/__pcilg_mio_inuser()
        s390/futex: add missing EX_TABLE entry to __futex_atomic_op()
        s390/uaccess: add missing EX_TABLE entries to __clear_user()
        MAINTAINERS: remove outdated linux390 link
      576e61ce
    • Linus Torvalds's avatar
      Merge tag 'riscv-for-linus-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux · 283f13d4
      Linus Torvalds authored
      Pull RISC-V fixes from Palmer Dabbelt:
      
       - A fix for a build warning in the jump_label code
      
       - One of the git://github -> https://github cleanups, for the SiFive
         drivers
      
       - A fix for the kasan initialization code, this still likely warrants
         some cleanups but that's a bigger problem and at least this fixes the
         crashes in the short term
      
       - A pair of fixes for extension support detection on mixed LLVM/GNU
         toolchains
      
       - A fix for a runtime warning in the /proc/cpuinfo code
      
      * tag 'riscv-for-linus-6.1-rc3' of git://git.kernel.org/pub/scm/linux/kernel/git/riscv/linux:
        RISC-V: Fix /proc/cpuinfo cpumask warning
        riscv: fix detection of toolchain Zihintpause support
        riscv: fix detection of toolchain Zicbom support
        riscv: mm: add missing memcpy in kasan_init
        MAINTAINERS: git://github.com -> https://github.com for sifive
        riscv: jump_label: mark arguments as const to satisfy asm constraints
      283f13d4
  5. 28 Oct, 2022 16 commits