Forum | Documentation | Website | Blog

Skip to content
Snippets Groups Projects
  1. Jun 12, 2024
  2. Jun 05, 2024
    • Barry Song's avatar
      mm: arm64: fix the out-of-bounds issue in contpte_clear_young_dirty_ptes · 6434e698
      Barry Song authored
      We are passing a huge nr to __clear_young_dirty_ptes() right now.  While
      we should pass the number of pages, we are actually passing CONT_PTE_SIZE.
      This is causing lots of crashes of MADV_FREE, panic oops could vary
      everytime.
      
      Link: https://lkml.kernel.org/r/20240524005444.135417-1-21cnbao@gmail.com
      Fixes: 89e86854
      
       ("mm/arm64: override clear_young_dirty_ptes() batch helper")
      Signed-off-by: default avatarBarry Song <v-songbaohua@oppo.com>
      Reviewed-by: default avatarBaolin Wang <baolin.wang@linux.alibaba.com>
      Acked-by: default avatarLance Yang <ioworker0@gmail.com>
      Acked-by: default avatarDavid Hildenbrand <david@redhat.com>
      Acked-by: default avatarChris Li <chrisl@kernel.org>
      Cc: Barry Song <21cnbao@gmail.com>
      Cc: Ryan Roberts <ryan.roberts@arm.com>
      Cc: Jeff Xie <xiehuan09@gmail.com>
      Cc: Kefeng Wang <wangkefeng.wang@huawei.com>
      Cc: Michal Hocko <mhocko@suse.com>
      Cc: Minchan Kim <minchan@kernel.org>
      Cc: Muchun Song <songmuchun@bytedance.com>
      Cc: Peter Xu <peterx@redhat.com>
      Cc: Yang Shi <shy828301@gmail.com>
      Cc: Yin Fengwei <fengwei.yin@intel.com>
      Cc: Zach O'Keefe <zokeefe@google.com>
      Cc: Catalin Marinas <catalin.marinas@arm.com>
      Cc: Will Deacon <will@kernel.org>
      Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
      6434e698
    • Yazen Ghannam's avatar
      x86/amd_nb: Check for invalid SMN reads · c625dabb
      Yazen Ghannam authored
      AMD Zen-based systems use a System Management Network (SMN) that
      provides access to implementation-specific registers.
      
      SMN accesses are done indirectly through an index/data pair in PCI
      config space. The PCI config access may fail and return an error code.
      This would prevent the "read" value from being updated.
      
      However, the PCI config access may succeed, but the return value may be
      invalid. This is in similar fashion to PCI bad reads, i.e. return all
      bits set.
      
      Most systems will return 0 for SMN addresses that are not accessible.
      This is in line with AMD convention that unavailable registers are
      Read-as-Zero/Writes-Ignored.
      
      However, some systems will return a "PCI Error Response" instead. This
      value, along with an error code of 0 from the PCI config access, will
      confuse callers of the amd_smn_read() function.
      
      Check for this condition, clear the return value, and set a proper error
      code.
      
      Fixes: ddfe43cd
      
       ("x86/amd_nb: Add SMN and Indirect Data Fabric access for AMD Fam17h")
      Signed-off-by: default avatarYazen Ghannam <yazen.ghannam@amd.com>
      Signed-off-by: default avatarBorislav Petkov (AMD) <bp@alien8.de>
      Cc: stable@vger.kernel.org
      Link: https://lore.kernel.org/r/20230403164244.471141-1-yazen.ghannam@amd.com
      c625dabb
    • Alexander Gordeev's avatar
      s390/crash: Do not use VM info if os_info does not have it · d38e4856
      Alexander Gordeev authored
      The virtual memory information stored in os_info area is
      required for creation of the kernel image PT_LOAD program
      header for kernels since commit a2ec5bec56dd ("s390/mm:
      uncouple physical vs virtual address spaces").
      
      By contrast, if such information in os_info is absent the
      PT_LOAD program header should not be created.
      
      Currently the proper PT_LOAD program header is created for
      kernels that contain the virtual memory information, but
      for kernels without one an invalid header of zero size is
      created. That in turn leads to stand-alone dump failures.
      
      Use OS_INFO_KASLR_OFFSET variable to check whether os_info
      is present or not (same as crash and makedumpfile tools do)
      and based on that create or do not create the kernel image
      PT_LOAD program header.
      
      Fixes: f4cac27d
      
       ("s390/crash: Use old os_info to create PT_LOAD headers")
      Tested-by: default avatarMikhail Zaslonko <zaslonko@linux.ibm.com>
      Acked-by: default avatarMikhail Zaslonko <zaslonko@linux.ibm.com>
      Acked-by: default avatarHeiko Carstens <hca@linux.ibm.com>
      Signed-off-by: default avatarAlexander Gordeev <agordeev@linux.ibm.com>
      d38e4856
    • Arnd Bergmann's avatar
      arm64/io: add constant-argument check · 5c40e428
      Arnd Bergmann authored
      In some configurations __const_iowrite32_copy() does not get inlined
      and gcc runs into the BUILD_BUG():
      
      In file included from <command-line>:
      In function '__const_memcpy_toio_aligned32',
          inlined from '__const_iowrite32_copy' at arch/arm64/include/asm/io.h:203:3,
          inlined from '__const_iowrite32_copy' at arch/arm64/include/asm/io.h:199:20:
      include/linux/compiler_types.h:487:45: error: call to '__compiletime_assert_538' declared with attribute error: BUILD_BUG failed
        487 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
            |                                             ^
      include/linux/compiler_types.h:468:25: note: in definition of macro '__compiletime_assert'
        468 |                         prefix ## suffix();                             \
            |                         ^~~~~~
      include/linux/compiler_types.h:487:9: note: in expansion of macro '_compiletime_assert'
        487 |         _compiletime_assert(condition, msg, __compiletime_assert_, __COUNTER__)
            |         ^~~~~~~~~~~~~~~~~~~
      include/linux/build_bug.h:39:37: note: in expansion of macro 'compiletime_assert'
         39 | #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg)
            |                                     ^~~~~~~~~~~~~~~~~~
      include/linux/build_bug.h:59:21: note: in expansion of macro 'BUILD_BUG_ON_MSG'
         59 | #define BUILD_BUG() BUILD_BUG_ON_MSG(1, "BUILD_BUG failed")
            |                     ^~~~~~~~~~~~~~~~
      arch/arm64/include/asm/io.h:193:17: note: in expansion of macro 'BUILD_BUG'
        193 |                 BUILD_BUG();
            |                 ^~~~~~~~~
      
      Move the check for constant arguments into the inline function to ensure
      it is still constant if the compiler decides against inlining it, and
      mark them as __always_inline to override the logic that sometimes leads
      to the compiler not producing the simplified output.
      
      Note that either the __always_inline annotation or the check for a
      constant value are sufficient here, but combining the two looks cleaner
      as it also avoids the macro. With clang-8 and older, the macro was still
      needed, but all versions of gcc and clang can reliably perform constant
      folding here.
      
      Fixes: ead79118
      
       ("arm64/io: Provide a WC friendly __iowriteXX_copy()")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Reviewed-by: default avatarMark Rutland <mark.rutland@arm.com>
      Reviewed-by: default avatarJason Gunthorpe <jgg@nvidia.com>
      Link: https://lore.kernel.org/r/20240604210006.668912-1-arnd@kernel.org
      
      
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      5c40e428
    • Tao Su's avatar
      KVM: x86/mmu: Don't save mmu_invalidate_seq after checking private attr · db574f2f
      Tao Su authored
      Drop the second snapshot of mmu_invalidate_seq in kvm_faultin_pfn().
      Before checking the mismatch of private vs. shared, mmu_invalidate_seq is
      saved to fault->mmu_seq, which can be used to detect an invalidation
      related to the gfn occurred, i.e. KVM will not install a mapping in page
      table if fault->mmu_seq != mmu_invalidate_seq.
      
      Currently there is a second snapshot of mmu_invalidate_seq, which may not
      be same as the first snapshot in kvm_faultin_pfn(), i.e. the gfn attribute
      may be changed between the two snapshots, but the gfn may be mapped in
      page table without hindrance. Therefore, drop the second snapshot as it
      has no obvious benefits.
      
      Fixes: f6adeae8
      
       ("KVM: x86/mmu: Handle no-slot faults at the beginning of kvm_faultin_pfn()")
      Signed-off-by: default avatarTao Su <tao1.su@linux.intel.com>
      Message-ID: <20240528102234.2162763-1-tao1.su@linux.intel.com>
      Signed-off-by: default avatarPaolo Bonzini <pbonzini@redhat.com>
      db574f2f
    • Wei Li's avatar
      arm64: armv8_deprecated: Fix warning in isndep cpuhp starting process · 14951bea
      Wei Li authored
      
      The function run_all_insn_set_hw_mode() is registered as startup callback
      of 'CPUHP_AP_ARM64_ISNDEP_STARTING', it invokes set_hw_mode() methods of
      all emulated instructions.
      
      As the STARTING callbacks are not expected to fail, if one of the
      set_hw_mode() fails, e.g. due to el0 mixed-endian is not supported for
      'setend', it will report a warning:
      
      ```
      CPU[2] cannot support the emulation of setend
      CPU 2 UP state arm64/isndep:starting (136) failed (-22)
      CPU2: Booted secondary processor 0x0000000002 [0x414fd0c1]
      ```
      
      To fix it, add a check for INSN_UNAVAILABLE status and skip the process.
      
      Signed-off-by: default avatarWei Li <liwei391@huawei.com>
      Tested-by: default avatarHuisong Li <lihuisong@huawei.com>
      Link: https://lore.kernel.org/r/20240423093501.3460764-1-liwei391@huawei.com
      
      
      Signed-off-by: default avatarWill Deacon <will@kernel.org>
      14951bea
  3. Jun 04, 2024
  4. Jun 03, 2024
  5. May 31, 2024
  6. May 30, 2024