[PW_SID:974083] [V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()#555
[PW_SID:974083] [V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()#555linux-riscv-bot wants to merge 2 commits into
Conversation
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>
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
|
Patch 1: "[V2] mm/ptdump: Take the memory hotplug lock inside ptdump_walk_pgd()" |
6ce2eef to
b5ded79
Compare
b5ded79 to
a7cb30d
Compare
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