1. 29 Sep, 2022 6 commits
  2. 28 Sep, 2022 5 commits
  3. 27 Sep, 2022 5 commits
    • Linus Torvalds's avatar
      Merge tag 'soc-fixes-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc · 49c13ed0
      Linus Torvalds authored
      Pull ARM SoC fixes from Arnd Bergmann:
       "This should be the last set of bugfixes in the SoC tree:
      
         - Two fixes for Arm integrator, dealing with a regression caused by
           invalid DT properties combined with a change in dma address
           translation, and missing device_type annotations on the PCI bus
      
         - Fixes for drivers/reset/, addressing bugs in i.MX8MP, Sparx5 and
           NPCM8XX platforms
      
         - Bjorn Andersson's email address changes in the MAINTAINERS file
      
         - Multiple minor fixes to Qualcomm dts files, and a change to the
           remoteproc firmware filename that did not match the actual path in
           the linux-firmware package
      
         - Minor code fixes for the Allwinner/sunxi SRAM driver, and the
           broadcom STB Bus Interface Unit driver
      
         - A build fix for the sunplus sp7021 platform
      
         - Two dts fixes for TI OMAP family SoCs, addressing an extraneous
           usb4 device node and an incorrect DMA handle"
      
      * tag 'soc-fixes-6.0-rc7' of git://git.kernel.org/pub/scm/linux/kernel/git/soc/soc:
        ARM: dts: integrator: Fix DMA ranges
        ARM: dts: integrator: Tag PCI host with device_type
        ARM: sunplus: fix serial console kconfig and build problems
        reset: npcm: fix iprst2 and iprst4 setting
        arm64: dts: qcom: sm8350: fix UFS PHY serdes size
        soc: bcm: brcmstb: biuctrl: Avoid double of_node_put()
        arm64: dts: qcom: sc8280xp-x13s: Update firmware location
        soc: sunxi: sram: Fix debugfs info for A64 SRAM C
        soc: sunxi: sram: Fix probe function ordering issues
        soc: sunxi: sram: Prevent the driver from being unbound
        soc: sunxi: sram: Actually claim SRAM regions
        ARM: dts: am5748: keep usb4_tm disabled
        reset: microchip-sparx5: issue a reset on startup
        reset: imx7: Fix the iMX8MP PCIe PHY PERST support
        MAINTAINERS: Update Bjorn's email address
        arm64: dts: qcom: sc7280: move USB wakeup-source property
        arm64: dts: qcom: thinkpad-x13s: Fix firmware location
        arm64: dts: qcom: sm8150: Fix fastrpc iommu values
        ARM: dts: am33xx: Fix MMCHS0 dma properties
      49c13ed0
    • Sebastian Krzyszkowiak's avatar
      Input: snvs_pwrkey - fix SNVS_HPVIDR1 register address · e62563db
      Sebastian Krzyszkowiak authored
      Both i.MX6 and i.MX8 reference manuals list 0xBF8 as SNVS_HPVIDR1
      (chapters 57.9 and 6.4.5 respectively).
      
      Without this, trying to read the revision number results in 0 on
      all revisions, causing the i.MX6 quirk to apply on all platforms,
      which in turn causes the driver to synthesise power button release
      events instead of passing the real one as they happen even on
      platforms like i.MX8 where that's not wanted.
      
      Fixes: 1a26c920 ("Input: snvs_pwrkey - send key events for i.MX6 S, DL and Q")
      Tested-by: default avatarMartin Kepplinger <martin.kepplinger@puri.sm>
      Signed-off-by: default avatarSebastian Krzyszkowiak <sebastian.krzyszkowiak@puri.sm>
      Reviewed-by: default avatarMattijs Korpershoek <mkorpershoek@baylibre.com>
      Cc: <stable@vger.kernel.org>
      Link: https://lore.kernel.org/r/4599101.ElGaqSPkdT@pliszkaSigned-off-by: default avatarDmitry Torokhov <dmitry.torokhov@gmail.com>
      e62563db
    • Linus Torvalds's avatar
      Merge tag 'sound-6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound · 46452d37
      Linus Torvalds authored
      Pull sound fixes from Takashi Iwai:
       "A few device-specific fixes, mostly for ASoC. All look small / trivial
        enough"
      
      * tag 'sound-6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound:
        ALSA: hda: intel-dsp-config: add missing RaptorLake PCI IDs
        ASoC: tas2770: Reinit regcache on reset
        ASoC: nau8824: Fix semaphore is released unexpectedly
        ASoC: Intel: sof_sdw: add support for Dell SKU 0AFF
        ASoC: imx-card: Fix refcount issue with of_node_put
        ASoC: rt5640: Fix the issue of the abnormal JD2 status
      46452d37
    • Borislav Petkov's avatar
      Merge tag 'irqchip-fixes-6.0-2' of... · c0cca6a6
      Borislav Petkov authored
      Merge tag 'irqchip-fixes-6.0-2' of git://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms into irq/urgent
      
      Pull more irqchip fixes for 6.0 from Marc Zyngier:
      
        - A couple of configuration fixes for the recently merged Loongarch drivers
      
        - A fix to avoid dynamic allocation of a cpumask which was causing issues
          with PREEMPT_RT and the GICv3 ITS
      
        - A tightening of an error check in the stm32 exti driver
      
      Link: https://lore.kernel.org/r/20220916085158.2592518-1-maz@kernel.org
      c0cca6a6
    • Wenchao Chen's avatar
      mmc: hsq: Fix data stomping during mmc recovery · e7afa79a
      Wenchao Chen authored
      The block device uses multiple queues to access emmc. There will be up to 3
      requests in the hsq of the host. The current code will check whether there
      is a request doing recovery before entering the queue, but it will not check
      whether there is a request when the lock is issued. The request is in recovery
      mode. If there is a request in recovery, then a read and write request is
      initiated at this time, and the conflict between the request and the recovery
      request will cause the data to be trampled.
      Signed-off-by: default avatarWenchao Chen <wenchao.chen@unisoc.com>
      Fixes: 511ce378 ("mmc: Add MMC host software queue support")
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20220916090506.10662-1-wenchao.chen666@gmail.comSigned-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
      e7afa79a
  4. 26 Sep, 2022 17 commits
    • Niklas Cassel's avatar
      libata: add ATA_HORKAGE_NOLPM for Pioneer BDR-207M and BDR-205 · ea08aec7
      Niklas Cassel authored
      Commit 1527f692 ("ata: ahci: Add Green Sardine vendor ID as
      board_ahci_mobile") added an explicit entry for AMD Green Sardine
      AHCI controller using the board_ahci_mobile configuration (this
      configuration has later been renamed to board_ahci_low_power).
      
      The board_ahci_low_power configuration enables support for low power
      modes.
      
      This explicit entry takes precedence over the generic AHCI controller
      entry, which does not enable support for low power modes.
      
      Therefore, when commit 1527f692 ("ata: ahci: Add Green Sardine
      vendor ID as board_ahci_mobile") was backported to stable kernels,
      it make some Pioneer optical drives, which was working perfectly fine
      before the commit was backported, stop working.
      
      The real problem is that the Pioneer optical drives do not handle low
      power modes correctly. If these optical drives would have been tested
      on another AHCI controller using the board_ahci_low_power configuration,
      this issue would have been detected earlier.
      
      Unfortunately, the board_ahci_low_power configuration is only used in
      less than 15% of the total AHCI controller entries, so many devices
      have never been tested with an AHCI controller with low power modes.
      
      Fixes: 1527f692 ("ata: ahci: Add Green Sardine vendor ID as board_ahci_mobile")
      Cc: stable@vger.kernel.org
      Reported-by: default avatarJaap Berkhout <j.j.berkhout@staalenberk.nl>
      Signed-off-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
      Reviewed-by: default avatarMario Limonciello <mario.limonciello@amd.com>
      Signed-off-by: default avatarDamien Le Moal <damien.lemoal@opensource.wdc.com>
      ea08aec7
    • Linus Torvalds's avatar
      Merge tag 'x86_urgent_for_v6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip · a1375562
      Linus Torvalds authored
      Pull x86 fixes from Dave Hansen:
      
       - A performance fix for recent large AMD systems that avoids an ancient
         cpu idle hardware workaround
      
       - A new Intel model number. Folks like these upstream as soon as
         possible so that each developer doing feature development doesn't
         need to carry their own #define
      
       - SGX fixes for a userspace crash and a rare kernel warning
      
      * tag 'x86_urgent_for_v6.0-rc8' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
        ACPI: processor idle: Practically limit "Dummy wait" workaround to old Intel systems
        x86/sgx: Handle VA page allocation failure for EAUG on PF.
        x86/sgx: Do not fail on incomplete sanitization on premature stop of ksgxd
        x86/cpu: Add CPU model numbers for Meteor Lake
      a1375562
    • Linus Walleij's avatar
      ARM: dts: integrator: Fix DMA ranges · 7bea67a9
      Linus Walleij authored
      A recent change affecting the behaviour of phys_to_dma() to
      actually require the device tree ranges to work unmasked a
      bug in the Integrator DMA ranges.
      
      The PL110 uses the CMA allocator to obtain coherent allocations
      from a dedicated 1MB video memory, leading to the following
      call chain:
      
      drm_gem_cma_create()
        dma_alloc_attrs()
          dma_alloc_from_dev_coherent()
            __dma_alloc_from_coherent()
              dma_get_device_base()
                phys_to_dma()
                  translate_phys_to_dma()
      
      phys_to_dma() by way of translate_phys_to_dma() will nowadays not
      provide 1:1 mappings unless the ranges are properly defined in
      the device tree and reflected into the dev->dma_range_map.
      
      There is a bug in the device trees because the DMA ranges are
      incorrectly specified, and the patch uncovers this bug.
      
      Solution:
      
      - Fix the LB (logic bus) ranges to be 1-to-1 like they should
        have always been.
      - Provide a 1:1 dma-ranges attribute to the PL110.
      - Mark the PL110 display controller as DMA coherent.
      
      This makes the DMA ranges work right and makes the PL110
      framebuffer work again.
      
      Fixes: af6f23b8 ("ARM/dma-mapping: use the generic versions of dma_to_phys/phys_to_dma by default")
      Signed-off-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Cc: Christoph Hellwig <hch@lst.de>
      Cc: Arnd Bergmann <arnd@arndb.de>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20220926073311.1610568-1-linus.walleij@linaro.org'
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      7bea67a9
    • Linus Torvalds's avatar
      Merge tag 'mm-hotfixes-stable-2022-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm · 3800a713
      Linus Torvalds authored
      Pull last (?) hotfixes from Andrew Morton:
       "26 hotfixes.
      
        8 are for issues which were introduced during this -rc cycle, 18 are
        for earlier issues, and are cc:stable"
      
      * tag 'mm-hotfixes-stable-2022-09-26' of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm: (26 commits)
        x86/uaccess: avoid check_object_size() in copy_from_user_nmi()
        mm/page_isolation: fix isolate_single_pageblock() isolation behavior
        mm,hwpoison: check mm when killing accessing process
        mm/hugetlb: correct demote page offset logic
        mm: prevent page_frag_alloc() from corrupting the memory
        mm: bring back update_mmu_cache() to finish_fault()
        frontswap: don't call ->init if no ops are registered
        mm/huge_memory: use pfn_to_online_page() in split_huge_pages_all()
        mm: fix madivse_pageout mishandling on non-LRU page
        powerpc/64s/radix: don't need to broadcast IPI for radix pmd collapse flush
        mm: gup: fix the fast GUP race against THP collapse
        mm: fix dereferencing possible ERR_PTR
        vmscan: check folio_test_private(), not folio_get_private()
        mm: fix VM_BUG_ON in __delete_from_swap_cache()
        tools: fix compilation after gfp_types.h split
        mm/damon/dbgfs: fix memory leak when using debugfs_lookup()
        mm/migrate_device.c: copy pte dirty bit to page
        mm/migrate_device.c: add missing flush_cache_page()
        mm/migrate_device.c: flush TLB while holding PTL
        x86/mm: disable instrumentations of mm/pgprot.c
        ...
      3800a713
    • Linus Torvalds's avatar
      Merge tag 'ext4_for_linus_fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4 · 3a710532
      Linus Torvalds authored
      Pull missed ext4 fix from Ted Ts'o:
       "Fix an potential unitialzied variable bug; this was a fixup that I had
        forgotten to apply before the last pull request for ext4. My bad"
      
      * tag 'ext4_for_linus_fixes2' of git://git.kernel.org/pub/scm/linux/kernel/git/tytso/ext4:
        ext4: fixup possible uninitialized variable access in ext4_mb_choose_next_group_cr1()
      3a710532
    • Kees Cook's avatar
      x86/uaccess: avoid check_object_size() in copy_from_user_nmi() · 59298997
      Kees Cook authored
      The check_object_size() helper under CONFIG_HARDENED_USERCOPY is designed
      to skip any checks where the length is known at compile time as a
      reasonable heuristic to avoid "likely known-good" cases.  However, it can
      only do this when the copy_*_user() helpers are, themselves, inline too.
      
      Using find_vmap_area() requires taking a spinlock.  The
      check_object_size() helper can call find_vmap_area() when the destination
      is in vmap memory.  If show_regs() is called in interrupt context, it will
      attempt a call to copy_from_user_nmi(), which may call check_object_size()
      and then find_vmap_area().  If something in normal context happens to be
      in the middle of calling find_vmap_area() (with the spinlock held), the
      interrupt handler will hang forever.
      
      The copy_from_user_nmi() call is actually being called with a fixed-size
      length, so check_object_size() should never have been called in the first
      place.  Given the narrow constraints, just replace the
      __copy_from_user_inatomic() call with an open-coded version that calls
      only into the sanitizers and not check_object_size(), followed by a call
      to raw_copy_from_user().
      
      [akpm@linux-foundation.org: no instrument_copy_from_user() in my tree...]
      Link: https://lkml.kernel.org/r/20220919201648.2250764-1-keescook@chromium.org
      Link: https://lore.kernel.org/all/CAOUHufaPshtKrTWOz7T7QFYUNVGFm0JBjvM700Nhf9qEL9b3EQ@mail.gmail.com
      Fixes: 0aef499f ("mm/usercopy: Detect vmalloc overruns")
      Signed-off-by: default avatarKees Cook <keescook@chromium.org>
      Reported-by: default avatarYu Zhao <yuzhao@google.com>
      Reported-by: default avatarFlorian Lehner <dev@der-flo.net>
      Suggested-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      Acked-by: default avatarPeter Zijlstra (Intel) <peterz@infradead.org>
      Tested-by: default avatarFlorian Lehner <dev@der-flo.net>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Josh Poimboeuf <jpoimboe@kernel.org>
      Cc: Dave Hansen <dave.hansen@linux.intel.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      59298997
    • Zi Yan's avatar
      mm/page_isolation: fix isolate_single_pageblock() isolation behavior · 80e2b584
      Zi Yan authored
      set_migratetype_isolate() does not allow isolating MIGRATE_CMA pageblocks
      unless it is used for CMA allocation.  isolate_single_pageblock() did not
      have the same behavior when it is used together with
      set_migratetype_isolate() in start_isolate_page_range().  This allows
      alloc_contig_range() with migratetype other than MIGRATE_CMA, like
      MIGRATE_MOVABLE (used by alloc_contig_pages()), to isolate first and last
      pageblock but fail the rest.  The failure leads to changing migratetype of
      the first and last pageblock to MIGRATE_MOVABLE from MIGRATE_CMA,
      corrupting the CMA region.  This can happen during gigantic page
      allocations.
      
      Like Doug said here:
      https://lore.kernel.org/linux-mm/a3363a52-883b-dcd1-b77f-f2bb378d6f2d@gmail.com/T/#u,
      for gigantic page allocations, the user would notice no difference,
      since the allocation on CMA region will fail as well as it did before. 
      But it might hurt the performance of device drivers that use CMA, since
      CMA region size decreases.
      
      Fix it by passing migratetype into isolate_single_pageblock(), so that
      set_migratetype_isolate() used by isolate_single_pageblock() will prevent
      the isolation happening.
      
      Link: https://lkml.kernel.org/r/20220914023913.1855924-1-zi.yan@sent.com
      Fixes: b2c9e2fb ("mm: make alloc_contig_range work at pageblock granularity")
      Signed-off-by: default avatarZi Yan <ziy@nvidia.com>
      Reported-by: default avatarDoug Berger <opendmb@gmail.com>
      Cc: David Hildenbrand <david@redhat.com>
      Cc: Doug Berger <opendmb@gmail.com>
      Cc: Mike Kravetz <mike.kravetz@oracle.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      80e2b584
    • Shuai Xue's avatar
      mm,hwpoison: check mm when killing accessing process · 77677cdb
      Shuai Xue authored
      The GHES code calls memory_failure_queue() from IRQ context to queue work
      into workqueue and schedule it on the current CPU.  Then the work is
      processed in memory_failure_work_func() by kworker and calls
      memory_failure().
      
      When a page is already poisoned, commit a3f5d80e ("mm,hwpoison: send
      SIGBUS with error virutal address") make memory_failure() call
      kill_accessing_process() that:
      
          - holds mmap locking of current->mm
          - does pagetable walk to find the error virtual address
          - and sends SIGBUS to the current process with error info.
      
      However, the mm of kworker is not valid, resulting in a null-pointer
      dereference.  So check mm when killing the accessing process.
      
      [akpm@linux-foundation.org: remove unrelated whitespace alteration]
      Link: https://lkml.kernel.org/r/20220914064935.7851-1-xueshuai@linux.alibaba.com
      Fixes: a3f5d80e ("mm,hwpoison: send SIGBUS with error virutal address")
      Signed-off-by: default avatarShuai Xue <xueshuai@linux.alibaba.com>
      Reviewed-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Acked-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
      Cc: Huang Ying <ying.huang@intel.com>
      Cc: Baolin Wang <baolin.wang@linux.alibaba.com>
      Cc: Bixuan Cui <cuibixuan@linux.alibaba.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      77677cdb
    • Doug Berger's avatar
      mm/hugetlb: correct demote page offset logic · 31731452
      Doug Berger authored
      With gigantic pages it may not be true that struct page structures are
      contiguous across the entire gigantic page.  The nth_page macro is used
      here in place of direct pointer arithmetic to correct for this.
      
      Mike said:
      
      : This error could cause addressing exceptions.  However, this is only
      : possible in configurations where CONFIG_SPARSEMEM &&
      : !CONFIG_SPARSEMEM_VMEMMAP.  Such a configuration option is rare and
      : unknown to be the default anywhere.
      
      Link: https://lkml.kernel.org/r/20220914190917.3517663-1-opendmb@gmail.com
      Fixes: 8531fc6f ("hugetlb: add hugetlb demote page support")
      Signed-off-by: default avatarDoug Berger <opendmb@gmail.com>
      Reviewed-by: default avatarMike Kravetz <mike.kravetz@oracle.com>
      Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
      Reviewed-by: default avatarAnshuman Khandual <anshuman.khandual@arm.com>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      31731452
    • Maurizio Lombardi's avatar
      mm: prevent page_frag_alloc() from corrupting the memory · dac22531
      Maurizio Lombardi authored
      A number of drivers call page_frag_alloc() with a fragment's size >
      PAGE_SIZE.
      
      In low memory conditions, __page_frag_cache_refill() may fail the order
      3 cache allocation and fall back to order 0; In this case, the cache
      will be smaller than the fragment, causing memory corruptions.
      
      Prevent this from happening by checking if the newly allocated cache is
      large enough for the fragment; if not, the allocation will fail and
      page_frag_alloc() will return NULL.
      
      Link: https://lkml.kernel.org/r/20220715125013.247085-1-mlombard@redhat.com
      Fixes: b63ae8ca ("mm/net: Rename and move page fragment handling from net/ to mm/")
      Signed-off-by: default avatarMaurizio Lombardi <mlombard@redhat.com>
      Reviewed-by: default avatarAlexander Duyck <alexanderduyck@fb.com>
      Cc: Chen Lin <chen45464546@163.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      dac22531
    • Sergei Antonov's avatar
      mm: bring back update_mmu_cache() to finish_fault() · 70427f6e
      Sergei Antonov authored
      Running this test program on ARMv4 a few times (sometimes just once)
      reproduces the bug.
      
      int main()
      {
              unsigned i;
              char paragon[SIZE];
              void* ptr;
      
              memset(paragon, 0xAA, SIZE);
              ptr = mmap(NULL, SIZE, PROT_READ | PROT_WRITE,
                         MAP_ANON | MAP_SHARED, -1, 0);
              if (ptr == MAP_FAILED) return 1;
              printf("ptr = %p\n", ptr);
              for (i=0;i<10000;i++){
                      memset(ptr, 0xAA, SIZE);
                      if (memcmp(ptr, paragon, SIZE)) {
                              printf("Unexpected bytes on iteration %u!!!\n", i);
                              break;
                      }
              }
              munmap(ptr, SIZE);
      }
      
      In the "ptr" buffer there appear runs of zero bytes which are aligned
      by 16 and their lengths are multiple of 16.
      
      Linux v5.11 does not have the bug, "git bisect" finds the first bad commit:
      f9ce0be7 ("mm: Cleanup faultaround and finish_fault() codepaths")
      
      Before the commit update_mmu_cache() was called during a call to
      filemap_map_pages() as well as finish_fault(). After the commit
      finish_fault() lacks it.
      
      Bring back update_mmu_cache() to finish_fault() to fix the bug.
      Also call update_mmu_tlb() only when returning VM_FAULT_NOPAGE to more
      closely reproduce the code of alloc_set_pte() function that existed before
      the commit.
      
      On many platforms update_mmu_cache() is nop:
       x86, see arch/x86/include/asm/pgtable
       ARMv6+, see arch/arm/include/asm/tlbflush.h
      So, it seems, few users ran into this bug.
      
      Link: https://lkml.kernel.org/r/20220908204809.2012451-1-saproj@gmail.com
      Fixes: f9ce0be7 ("mm: Cleanup faultaround and finish_fault() codepaths")
      Signed-off-by: default avatarSergei Antonov <saproj@gmail.com>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Will Deacon <will@kernel.org>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      70427f6e
    • Christoph Hellwig's avatar
      frontswap: don't call ->init if no ops are registered · 37dcc673
      Christoph Hellwig authored
      If no frontswap module (i.e.  zswap) was registered, frontswap_ops will be
      NULL.  In such situation, swapon crashes with the following stack trace:
      
        Unable to handle kernel access to user memory outside uaccess routines at virtual address 0000000000000000
        Mem abort info:
          ESR = 0x0000000096000004
          EC = 0x25: DABT (current EL), IL = 32 bits
          SET = 0, FnV = 0
          EA = 0, S1PTW = 0
          FSC = 0x04: level 0 translation fault
        Data abort info:
          ISV = 0, ISS = 0x00000004
          CM = 0, WnR = 0
        user pgtable: 4k pages, 48-bit VAs, pgdp=00000020a4fab000
        [0000000000000000] pgd=0000000000000000, p4d=0000000000000000
        Internal error: Oops: 96000004 [#1] SMP
        Modules linked in: zram fsl_dpaa2_eth pcs_lynx phylink ahci_qoriq crct10dif_ce ghash_ce sbsa_gwdt fsl_mc_dpio nvme lm90 nvme_core at803x xhci_plat_hcd rtc_fsl_ftm_alarm xgmac_mdio ahci_platform i2c_imx ip6_tables ip_tables fuse
        Unloaded tainted modules: cppc_cpufreq():1
        CPU: 10 PID: 761 Comm: swapon Not tainted 6.0.0-rc2-00454-g22100432cf14 #1
        Hardware name: SolidRun Ltd. SolidRun CEX7 Platform, BIOS EDK II Jun 21 2022
        pstate: 00400005 (nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
        pc : frontswap_init+0x38/0x60
        lr : __do_sys_swapon+0x8a8/0x9f4
        sp : ffff80000969bcf0
        x29: ffff80000969bcf0 x28: ffff37bee0d8fc00 x27: ffff80000a7f5000
        x26: fffffcdefb971e80 x25: ffffaba797453b90 x24: 0000000000000064
        x23: ffff37c1f209d1a8 x22: ffff37bee880e000 x21: ffffaba797748560
        x20: ffff37bee0d8fce4 x19: ffffaba797748488 x18: 0000000000000014
        x17: 0000000030ec029a x16: ffffaba795a479b0 x15: 0000000000000000
        x14: 0000000000000000 x13: 0000000000000030 x12: 0000000000000001
        x11: ffff37c63c0aba18 x10: 0000000000000000 x9 : ffffaba7956b8c88
        x8 : ffff80000969bcd0 x7 : 0000000000000000 x6 : 0000000000000000
        x5 : 0000000000000001 x4 : 0000000000000000 x3 : ffffaba79730f000
        x2 : ffff37bee0d8fc00 x1 : 0000000000000000 x0 : 0000000000000000
        Call trace:
        frontswap_init+0x38/0x60
        __do_sys_swapon+0x8a8/0x9f4
        __arm64_sys_swapon+0x28/0x3c
        invoke_syscall+0x78/0x100
        el0_svc_common.constprop.0+0xd4/0xf4
        do_el0_svc+0x38/0x4c
        el0_svc+0x34/0x10c
        el0t_64_sync_handler+0x11c/0x150
        el0t_64_sync+0x190/0x194
        Code: d000e283 910003fd f9006c41 f946d461 (f9400021)
        ---[ end trace 0000000000000000 ]---
      
      Link: https://lkml.kernel.org/r/20220909130829.3262926-1-hch@lst.de
      Fixes: 1da0d94a ("frontswap: remove support for multiple ops")
      Reported-by: default avatarNathan Chancellor <nathan@kernel.org>
      Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
      Signed-off-by: default avatarLiu Shixin <liushixin2@huawei.com>
      Cc: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      37dcc673
    • Naoya Horiguchi's avatar
      mm/huge_memory: use pfn_to_online_page() in split_huge_pages_all() · 2b7aa91b
      Naoya Horiguchi authored
      NULL pointer dereference is triggered when calling thp split via debugfs
      on the system with offlined memory blocks.  With debug option enabled, the
      following kernel messages are printed out:
      
        page:00000000467f4890 refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x121c000
        flags: 0x17fffc00000000(node=0|zone=2|lastcpupid=0x1ffff)
        raw: 0017fffc00000000 0000000000000000 dead000000000122 0000000000000000
        raw: 0000000000000000 0000000000000000 00000001ffffffff 0000000000000000
        page dumped because: unmovable page
        page:000000007d7ab72e is uninitialized and poisoned
        page dumped because: VM_BUG_ON_PAGE(PagePoisoned(p))
        ------------[ cut here ]------------
        kernel BUG at include/linux/mm.h:1248!
        invalid opcode: 0000 [#1] PREEMPT SMP PTI
        CPU: 16 PID: 20964 Comm: bash Tainted: G          I        6.0.0-rc3-foll-numa+ #41
        ...
        RIP: 0010:split_huge_pages_write+0xcf4/0xe30
      
      This shows that page_to_nid() in page_zone() is unexpectedly called for an
      offlined memmap.
      
      Use pfn_to_online_page() to get struct page in PFN walker.
      
      Link: https://lkml.kernel.org/r/20220908041150.3430269-1-naoya.horiguchi@linux.dev
      Fixes: f1dd2cd1 ("mm, memory_hotplug: do not associate hotadded memory to zones until online")      [visible after d0dc12e8]
      Signed-off-by: default avatarNaoya Horiguchi <naoya.horiguchi@nec.com>
      Co-developed-by: default avatarDavid Hildenbrand <david@redhat.com>
      Signed-off-by: default avatarDavid Hildenbrand <david@redhat.com>
      Reviewed-by: default avatarYang Shi <shy828301@gmail.com>
      Acked-by: default avatarMichal Hocko <mhocko@suse.com>
      Reviewed-by: default avatarMiaohe Lin <linmiaohe@huawei.com>
      Reviewed-by: default avatarOscar Salvador <osalvador@suse.de>
      Acked-by: default avatarKirill A. Shutemov <kirill.shutemov@linux.intel.com>
      Cc: Matthew Wilcox <willy@infradead.org>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: <stable@vger.kernel.org>	[5.10+]
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      2b7aa91b
    • Minchan Kim's avatar
      mm: fix madivse_pageout mishandling on non-LRU page · 58d426a7
      Minchan Kim authored
      MADV_PAGEOUT tries to isolate non-LRU pages and gets a warning from
      isolate_lru_page below.
      
      Fix it by checking PageLRU in advance.
      
      ------------[ cut here ]------------
      trying to isolate tail page
      WARNING: CPU: 0 PID: 6175 at mm/folio-compat.c:158 isolate_lru_page+0x130/0x140
      Modules linked in:
      CPU: 0 PID: 6175 Comm: syz-executor.0 Not tainted 5.18.12 #1
      Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS 1.13.0-1ubuntu1.1 04/01/2014
      RIP: 0010:isolate_lru_page+0x130/0x140
      
      Link: https://lore.kernel.org/linux-mm/485f8c33.2471b.182d5726afb.Coremail.hantianshuo@iie.ac.cn/
      Link: https://lkml.kernel.org/r/20220908151204.762596-1-minchan@kernel.org
      Fixes: 1a4e58cc ("mm: introduce MADV_PAGEOUT")
      Signed-off-by: default avatarMinchan Kim <minchan@kernel.org>
      Reported-by: default avatar韩天ç`• <hantianshuo@iie.ac.cn>
      Suggested-by: default avatarYang Shi <shy828301@gmail.com>
      Acked-by: default avatarYang Shi <shy828301@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      58d426a7
    • Yang Shi's avatar
      powerpc/64s/radix: don't need to broadcast IPI for radix pmd collapse flush · bedf0341
      Yang Shi authored
      The IPI broadcast is used to serialize against fast-GUP, but fast-GUP will
      move to use RCU instead of disabling local interrupts in fast-GUP.  Using
      an IPI is the old-styled way of serializing against fast-GUP although it
      still works as expected now.
      
      And fast-GUP now fixed the potential race with THP collapse by checking
      whether PMD is changed or not.  So IPI broadcast in radix pmd collapse
      flush is not necessary anymore.  But it is still needed for hash TLB.
      
      Link: https://lkml.kernel.org/r/20220907180144.555485-2-shy828301@gmail.comSuggested-by: default avatarAneesh Kumar K.V <aneesh.kumar@linux.ibm.com>
      Signed-off-by: default avatarYang Shi <shy828301@gmail.com>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarPeter Xu <peterx@redhat.com>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jason Gunthorpe <jgg@nvidia.com>
      Cc: John Hubbard <jhubbard@nvidia.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      bedf0341
    • Yang Shi's avatar
      mm: gup: fix the fast GUP race against THP collapse · 70cbc3cc
      Yang Shi authored
      Since general RCU GUP fast was introduced in commit 2667f50e ("mm:
      introduce a general RCU get_user_pages_fast()"), a TLB flush is no longer
      sufficient to handle concurrent GUP-fast in all cases, it only handles
      traditional IPI-based GUP-fast correctly.  On architectures that send an
      IPI broadcast on TLB flush, it works as expected.  But on the
      architectures that do not use IPI to broadcast TLB flush, it may have the
      below race:
      
         CPU A                                          CPU B
      THP collapse                                     fast GUP
                                                    gup_pmd_range() <-- see valid pmd
                                                        gup_pte_range() <-- work on pte
      pmdp_collapse_flush() <-- clear pmd and flush
      __collapse_huge_page_isolate()
          check page pinned <-- before GUP bump refcount
                                                            pin the page
                                                            check PTE <-- no change
      __collapse_huge_page_copy()
          copy data to huge page
          ptep_clear()
      install huge pmd for the huge page
                                                            return the stale page
      discard the stale page
      
      The race can be fixed by checking whether PMD is changed or not after
      taking the page pin in fast GUP, just like what it does for PTE.  If the
      PMD is changed it means there may be parallel THP collapse, so GUP should
      back off.
      
      Also update the stale comment about serializing against fast GUP in
      khugepaged.
      
      Link: https://lkml.kernel.org/r/20220907180144.555485-1-shy828301@gmail.com
      Fixes: 2667f50e ("mm: introduce a general RCU get_user_pages_fast()")
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarPeter Xu <peterx@redhat.com>
      Signed-off-by: default avatarYang Shi <shy828301@gmail.com>
      Reviewed-by: default avatarJohn Hubbard <jhubbard@nvidia.com>
      Cc: "Aneesh Kumar K.V" <aneesh.kumar@linux.ibm.com>
      Cc: Hugh Dickins <hughd@google.com>
      Cc: Jason Gunthorpe <jgg@nvidia.com>
      Cc: "Kirill A. Shutemov" <kirill.shutemov@linux.intel.com>
      Cc: Michael Ellerman <mpe@ellerman.id.au>
      Cc: Nicholas Piggin <npiggin@gmail.com>
      Cc: Christophe Leroy <christophe.leroy@csgroup.eu>
      Cc: <stable@vger.kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      70cbc3cc
    • Jan Kara's avatar
      ext4: fixup possible uninitialized variable access in ext4_mb_choose_next_group_cr1() · a078dff8
      Jan Kara authored
      Variable 'grp' may be left uninitialized if there's no group with
      suitable average fragment size (or larger). Fix the problem by
      initializing it earlier.
      
      Link: https://lore.kernel.org/r/20220922091542.pkhedytey7wzp5fi@quack3
      Fixes: 83e80a6e ("ext4: use buckets for cr 1 block scan instead of rbtree")
      Cc: stable@kernel.org
      Reported-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: default avatarJan Kara <jack@suse.cz>
      Signed-off-by: default avatarTheodore Ts'o <tytso@mit.edu>
      a078dff8
  5. 25 Sep, 2022 7 commits