mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
mm: Make empty_zero_page[] const
The empty zero page is used to back any kernel or user space mapping that is supposed to remain cleared, and so the page itself is never supposed to be modified. So mark it as const, which moves it into .rodata rather than .bss: on most architectures, this ensures that both the kernel's mapping of it and any aliases that are accessible via the kernel direct (linear) map are mapped read-only, and cannot be used (inadvertently or maliciously) to corrupt the contents of the zero page. Reviewed-by: Mike Rapoport (Microsoft) <rppt@kernel.org> Reviewed-by: Kevin Brodsky <kevin.brodsky@arm.com> Acked-by: David Hildenbrand (Arm) <david@kernel.org> Reviewed-by: Jann Horn <jannh@google.com> Reviewed-by: Feng Tang <feng.tang@linux.alibaba.com> Signed-off-by: Ard Biesheuvel <ardb@kernel.org> Signed-off-by: Will Deacon <will@kernel.org>
This commit is contained in:
parent
99bad3e992
commit
0aae825f1e
|
|
@ -1993,7 +1993,7 @@ static inline unsigned long zero_pfn(unsigned long addr)
|
|||
return zero_page_pfn;
|
||||
}
|
||||
|
||||
extern uint8_t empty_zero_page[PAGE_SIZE];
|
||||
extern const uint8_t empty_zero_page[PAGE_SIZE];
|
||||
extern struct page *__zero_page;
|
||||
|
||||
static inline struct page *_zero_page(unsigned long addr)
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ unsigned long zero_page_pfn __ro_after_init;
|
|||
EXPORT_SYMBOL(zero_page_pfn);
|
||||
|
||||
#ifndef __HAVE_COLOR_ZERO_PAGE
|
||||
uint8_t empty_zero_page[PAGE_SIZE] __page_aligned_bss;
|
||||
const uint8_t empty_zero_page[PAGE_SIZE] __aligned(PAGE_SIZE);
|
||||
EXPORT_SYMBOL(empty_zero_page);
|
||||
|
||||
struct page *__zero_page __ro_after_init;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user