Skip to content

[PW_SID:974083] [V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()#555

Closed
linux-riscv-bot wants to merge 2 commits into
workflow__riscv__fixesfrom
pw974083
Closed

[PW_SID:974083] [V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()#555
linux-riscv-bot wants to merge 2 commits into
workflow__riscv__fixesfrom
pw974083

Conversation

@linux-riscv-bot
Copy link
Copy Markdown

PR for series 974083 applied to workflow__riscv__fixes

Name: [V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=974083
Version: 2

Linux RISC-V bot and others added 2 commits June 12, 2025 20:20
Memory hot remove unmaps and tears down various kernel page table regions
as required. The ptdump code can race with concurrent modifications of the
kernel page tables. When leaf entries are modified concurrently, the dump
code may log stale or inconsistent information for a VA range, but this is
otherwise not harmful.

But when intermediate levels of kernel page table are freed, the dump code
will continue to use memory that has been freed and potentially reallocated
for another purpose. In such cases, the ptdump code may dereference bogus
addresses, leading to a number of potential problems.

To avoid the above mentioned race condition, platforms such as arm64, riscv
and s390 take memory hotplug lock, while dumping kernel page table via the
sysfs interface /sys/kernel/debug/kernel_page_tables.

Similar race condition exists while checking for pages that might have been
marked W+X via /sys/kernel/debug/kernel_page_tables/check_wx_pages which in
turn calls ptdump_check_wx(). Instead of solving this race condition again,
let's just move the memory hotplug lock inside generic ptdump_check_wx()
which will benefit both the scenarios.

Drop get_online_mems() and put_online_mems() combination from all existing
platform ptdump code paths.

Cc: Catalin Marinas <catalin.marinas@arm.com>
Cc: Will Deacon <will@kernel.org>
Cc: Ryan Roberts <ryan.roberts@arm.com>
Cc: Paul Walmsley <paul.walmsley@sifive.com>
Cc: Palmer Dabbelt <palmer@dabbelt.com>
Cc: Alexander Gordeev <agordeev@linux.ibm.com>
Cc: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
Cc: Heiko Carstens <hca@linux.ibm.com>
Cc: Vasily Gorbik <gor@linux.ibm.com>
Cc: Christian Borntraeger <borntraeger@linux.ibm.com>
Cc: Sven Schnelle <svens@linux.ibm.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
CC: linux-arm-kernel@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-riscv@lists.infradead.org
Cc: linux-s390@vger.kernel.org
Cc: linux-mm@kvack.org
Signed-off-by: Anshuman Khandual <anshuman.khandual@arm.com>
Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
build-rv32-defconfig
Desc: Builds riscv32 defconfig
Duration: 102.27 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
build-rv64-clang-allmodconfig
Desc: Builds riscv64 allmodconfig with Clang, and checks for errors and added warnings
Duration: 1002.81 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
build-rv64-gcc-allmodconfig
Desc: Builds riscv64 allmodconfig with GCC, and checks for errors and added warnings
Duration: 1479.05 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
build-rv64-nommu-k210-defconfig
Desc: Builds riscv64 defconfig with NOMMU for K210
Duration: 20.76 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
build-rv64-nommu-k210-virt
Desc: Builds riscv64 defconfig with NOMMU for the virt platform
Duration: 21.38 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
checkpatch
Desc: Runs checkpatch.pl on the patch
Duration: 1.31 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
dtb-warn-rv64
Desc: Checks for Device Tree warnings/errors
Duration: 71.59 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
header-inline
Desc: Detects static functions without inline keyword in header files
Duration: 0.23 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
kdoc
Desc: Detects for kdoc errors
Duration: 0.90 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
module-param
Desc: Detect module_param changes
Duration: 0.25 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
verify-fixes
Desc: Verifies that the Fixes: tags exist
Duration: 0.22 seconds
Result: PASS

@linux-riscv-bot
Copy link
Copy Markdown
Author

Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()"
verify-signedoff
Desc: Verifies that Signed-off-by: tags are correct
Duration: 0.30 seconds
Result: PASS

@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch 2 times, most recently from 6ce2eef to b5ded79 Compare June 24, 2025 01:05
@linux-riscv-bot linux-riscv-bot force-pushed the workflow__riscv__fixes branch from b5ded79 to a7cb30d Compare June 27, 2025 17:47
@linux-riscv-bot linux-riscv-bot deleted the pw974083 branch June 28, 2025 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant