From: Palmer Dabbelt Date: Wed, 8 Nov 2023 15:08:35 +0000 (-0800) Subject: Merge patch series "riscv: Fix set_memory_XX() and set_direct_map_XX()" X-Git-Tag: configfs-6.13-2024-11-19~2733^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=05942f780ac6a70e5859fc41d5700e2ca43c4867;p=users%2Fhch%2Fconfigfs.git Merge patch series "riscv: Fix set_memory_XX() and set_direct_map_XX()" Alexandre Ghiti says: Those 2 patches fix the set_memory_XX() and set_direct_map_XX() APIs, which in turn fix STRICT_KERNEL_RWX and memfd_secret(). Those were broken since the permission changes were not applied to the linear mapping because the linear mapping is mapped using hugepages and walk_page_range_novma() does not split such mappings. To fix that, patch 1 disables PGD mappings in the linear mapping as it is hard to propagate changes at this level in *all* the page tables, this has the downside of disabling PMD mapping for sv32 and PUD (1GB) mapping for sv39 in the linear mapping (for specific kernels, we could add a Kconfig to enable ARCH_HAS_SET_DIRECT_MAP and STRICT_KERNEL_RWX if needed, I'm pretty sure we'll discuss that). patch 2 implements the split of the huge linear mappings so that walk_page_range_novma() can properly apply the permissions. The whole split is protected with mmap_sem in write mode, but I'm wondering if that's enough, any opinion on that is appreciated. * b4-shazam-merge: riscv: Fix set_memory_XX() and set_direct_map_XX() by splitting huge linear mappings riscv: Don't use PGD entries for the linear mapping Link: https://lore.kernel.org/r/20231108075930.7157-1-alexghiti@rivosinc.com Signed-off-by: Palmer Dabbelt --- 05942f780ac6a70e5859fc41d5700e2ca43c4867