All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/3] riscv: Map the kernel with correct permissions the first time
@ 2021-06-03  8:27 ` Alexandre Ghiti
  0 siblings, 0 replies; 32+ messages in thread
From: Alexandre Ghiti @ 2021-06-03  8:27 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou, Jisheng Zhang,
	Christoph Hellwig, Zong Li, Anup Patel, linux-riscv,
	linux-kernel
  Cc: Alexandre Ghiti

The kernel permissions are fixed after the kernel page table is created:         
fix that by mapping the kernel 'correctly' the first time.                       
                                                                                 
Patch 1 is a cleanup patch on which the next patches are based on, not           
necessary for this patchset though.                                              
                                                                                 
Patch 2 introduces a new helper to set kernel mapping permissions while          
avoiding all the casts when using set_memory_* API.                              
                                                                                 
Patch 3 is the bulk of this work and deals with mapping the kernel with          
the right permissions.                                                           
                                                                                 
Changes in v3:                                                                   
* Add a patch that factorizes kernel address conversions                         
* Add a helper called set_kernel_memory in its own patch, as suggested by        
  Christoph                                                                      
* Prefer IS_ENABLED over #ifdef, as suggested by Christoph                       
* Split overly long lines, as suggested by Christoph                             
* Simplify kernel mapping by mapping ALL text as readonly and taking advantage   
  of already present code that enables write for init text before                
  free_initmem_default.                                                          
                                                                                 
Changes in v2:                                                                   
* Rebased on top of for-next (and "riscv: mm: fix build errors caused by         
  mk_pmd()")                                                                     
* Get rid of protect_kernel_linear_mapping_text_rodata as suggested by           
  Jisheng                                                                        
* Improve code in general compared to previous RFC

Alexandre Ghiti (3):
  riscv: Factorize xip and !xip kernel address conversion macros
  riscv: Introduce set_kernel_memory helper
  riscv: Map the kernel with correct permissions the first time

 arch/riscv/include/asm/page.h       |  27 ++++----
 arch/riscv/include/asm/pgtable.h    |   2 +
 arch/riscv/include/asm/sections.h   |  17 +++++
 arch/riscv/include/asm/set_memory.h |  13 ++--
 arch/riscv/kernel/setup.c           |  11 +--
 arch/riscv/mm/init.c                | 102 ++++++++++++----------------
 arch/riscv/mm/pageattr.c            |  10 +++
 7 files changed, 95 insertions(+), 87 deletions(-)

-- 
2.30.2


^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2021-06-03 15:56 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-03  8:27 [PATCH v3 0/3] riscv: Map the kernel with correct permissions the first time Alexandre Ghiti
2021-06-03  8:27 ` Alexandre Ghiti
2021-06-03  8:27 ` [PATCH v3 1/3] riscv: Factorize xip and !xip kernel address conversion macros Alexandre Ghiti
2021-06-03  8:27   ` Alexandre Ghiti
2021-06-03 11:39   ` Anup Patel
2021-06-03 11:39     ` Anup Patel
2021-06-03 12:27   ` Jisheng Zhang
2021-06-03 12:27     ` Jisheng Zhang
2021-06-03 12:49     ` Jisheng Zhang
2021-06-03 12:49       ` Jisheng Zhang
2021-06-03 15:51       ` Vitaly Wool
2021-06-03 15:51         ` Vitaly Wool
2021-06-03 15:49         ` Jisheng Zhang
2021-06-03 15:49           ` Jisheng Zhang
2021-06-03 12:57     ` Alex Ghiti
2021-06-03 12:57       ` Alex Ghiti
2021-06-03 13:16       ` Anup Patel
2021-06-03 13:16         ` Anup Patel
2021-06-03 13:53         ` Jisheng Zhang
2021-06-03 13:53           ` Jisheng Zhang
2021-06-03 15:06           ` Alex Ghiti
2021-06-03 15:06             ` Alex Ghiti
2021-06-03 15:16             ` Jisheng Zhang
2021-06-03 15:16               ` Jisheng Zhang
2021-06-03  8:27 ` [PATCH v3 2/3] riscv: Introduce set_kernel_memory helper Alexandre Ghiti
2021-06-03  8:27   ` Alexandre Ghiti
2021-06-03 11:35   ` Anup Patel
2021-06-03 11:35     ` Anup Patel
2021-06-03  8:27 ` [PATCH v3 3/3] riscv: Map the kernel with correct permissions the first time Alexandre Ghiti
2021-06-03  8:27   ` Alexandre Ghiti
2021-06-03 11:45   ` Anup Patel
2021-06-03 11:45     ` Anup Patel

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.