Patch "riscv: Sparse-Memory/vmemmap out-of-bounds fix" has been added to the 6.1-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    riscv: Sparse-Memory/vmemmap out-of-bounds fix

to the 6.1-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     riscv-sparse-memory-vmemmap-out-of-bounds-fix.patch
and it can be found in the queue-6.1 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit f527034fc185199c26687af087a232fab62a4431
Author: Dimitris Vlachos <dvlachos@xxxxxxxxxxxx>
Date:   Thu Feb 29 21:17:23 2024 +0200

    riscv: Sparse-Memory/vmemmap out-of-bounds fix
    
    [ Upstream commit a11dd49dcb9376776193e15641f84fcc1e5980c9 ]
    
    Offset vmemmap so that the first page of vmemmap will be mapped
    to the first page of physical memory in order to ensure that
    vmemmap’s bounds will be respected during
    pfn_to_page()/page_to_pfn() operations.
    The conversion macros will produce correct SV39/48/57 addresses
    for every possible/valid DRAM_BASE inside the physical memory limits.
    
    v2:Address Alex's comments
    
    Suggested-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
    Signed-off-by: Dimitris Vlachos <dvlachos@xxxxxxxxxxxx>
    Reported-by: Dimitris Vlachos <dvlachos@xxxxxxxxxxxx>
    Closes: https://lore.kernel.org/linux-riscv/20240202135030.42265-1-csd4492@xxxxxxxxxx
    Fixes: d95f1a542c3d ("RISC-V: Implement sparsemem")
    Reviewed-by: Alexandre Ghiti <alexghiti@xxxxxxxxxxxx>
    Link: https://lore.kernel.org/r/20240229191723.32779-1-dvlachos@xxxxxxxxxxxx
    Signed-off-by: Palmer Dabbelt <palmer@xxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/arch/riscv/include/asm/pgtable.h b/arch/riscv/include/asm/pgtable.h
index 59bb53da473dd..63055c6ad2c25 100644
--- a/arch/riscv/include/asm/pgtable.h
+++ b/arch/riscv/include/asm/pgtable.h
@@ -79,7 +79,7 @@
  * Define vmemmap for pfn_to_page & page_to_pfn calls. Needed if kernel
  * is configured with CONFIG_SPARSEMEM_VMEMMAP enabled.
  */
-#define vmemmap		((struct page *)VMEMMAP_START)
+#define vmemmap		((struct page *)VMEMMAP_START - (phys_ram_base >> PAGE_SHIFT))
 
 #define PCI_IO_SIZE      SZ_16M
 #define PCI_IO_END       VMEMMAP_START




[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux