mirror of
git://git.kernel.org/pub/scm/linux/kernel/git/xiang/erofs.git
synced 2026-11-19 08:29:42 +01:00
x86/mm/pti: Make pti_clone_kernel_text() compile on 32 bit
The pti_clone_kernel_text() function references __end_rodata_hpage_align, which is only present on x86-64. This makes sense as the end of the rodata section is not huge-page aligned on 32 bit. Nevertheless a symbol is required for the function that points at the right address for both 32 and 64 bit. Introduce __end_rodata_aligned for that purpose and use it in pti_clone_kernel_text(). Signed-off-by: Joerg Roedel <[email protected]> Signed-off-by: Thomas Gleixner <[email protected]> Tested-by: Pavel Machek <[email protected]> Cc: "H . Peter Anvin" <[email protected]> Cc: [email protected] Cc: Linus Torvalds <[email protected]> Cc: Andy Lutomirski <[email protected]> Cc: Dave Hansen <[email protected]> Cc: Josh Poimboeuf <[email protected]> Cc: Juergen Gross <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Borislav Petkov <[email protected]> Cc: Jiri Kosina <[email protected]> Cc: Boris Ostrovsky <[email protected]> Cc: Brian Gerst <[email protected]> Cc: David Laight <[email protected]> Cc: Denys Vlasenko <[email protected]> Cc: Eduardo Valentin <[email protected]> Cc: Greg KH <[email protected]> Cc: Will Deacon <[email protected]> Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: [email protected] Cc: Andrea Arcangeli <[email protected]> Cc: Waiman Long <[email protected]> Cc: "David H . Gutteridge" <[email protected]> Cc: [email protected] Link: https://lkml.kernel.org/r/[email protected]
This commit is contained in:
1 parent
f94560cd6b
commit
39d668e04e
3 files changed
+12
-8
No files matched your search
@@ -7,6 +7,7 @@
|
||||
|
||||
extern char __brk_base[], __brk_limit[];
|
||||
extern struct exception_table_entry __stop___ex_table[];
|
||||
extern char __end_rodata_aligned[];
|
||||
|
||||
#if defined(CONFIG_X86_64)
|
||||
extern char __end_rodata_hpage_align[];
|
||||
|
||||
@@ -55,19 +55,22 @@ jiffies_64 = jiffies;
|
||||
* so we can enable protection checks as well as retain 2MB large page
|
||||
* mappings for kernel text.
|
||||
*/
|
||||
#define X64_ALIGN_RODATA_BEGIN . = ALIGN(HPAGE_SIZE);
|
||||
#define X86_ALIGN_RODATA_BEGIN . = ALIGN(HPAGE_SIZE);
|
||||
|
||||
#define X64_ALIGN_RODATA_END \
|
||||
#define X86_ALIGN_RODATA_END \
|
||||
. = ALIGN(HPAGE_SIZE); \
|
||||
__end_rodata_hpage_align = .;
|
||||
__end_rodata_hpage_align = .; \
|
||||
__end_rodata_aligned = .;
|
||||
|
||||
#define ALIGN_ENTRY_TEXT_BEGIN . = ALIGN(PMD_SIZE);
|
||||
#define ALIGN_ENTRY_TEXT_END . = ALIGN(PMD_SIZE);
|
||||
|
||||
#else
|
||||
|
||||
#define X64_ALIGN_RODATA_BEGIN
|
||||
#define X64_ALIGN_RODATA_END
|
||||
#define X86_ALIGN_RODATA_BEGIN
|
||||
#define X86_ALIGN_RODATA_END \
|
||||
. = ALIGN(PAGE_SIZE); \
|
||||
__end_rodata_aligned = .;
|
||||
|
||||
#define ALIGN_ENTRY_TEXT_BEGIN
|
||||
#define ALIGN_ENTRY_TEXT_END
|
||||
@@ -141,9 +144,9 @@ SECTIONS
|
||||
|
||||
/* .text should occupy whole number of pages */
|
||||
. = ALIGN(PAGE_SIZE);
|
||||
X64_ALIGN_RODATA_BEGIN
|
||||
X86_ALIGN_RODATA_BEGIN
|
||||
RO_DATA(PAGE_SIZE)
|
||||
X64_ALIGN_RODATA_END
|
||||
X86_ALIGN_RODATA_END
|
||||
|
||||
/* Data */
|
||||
.data : AT(ADDR(.data) - LOAD_OFFSET) {
|
||||
|
||||
+1
-1
@@ -470,7 +470,7 @@ void pti_clone_kernel_text(void)
|
||||
* clone the areas past rodata, they might contain secrets.
|
||||
*/
|
||||
unsigned long start = PFN_ALIGN(_text);
|
||||
unsigned long end = (unsigned long)__end_rodata_hpage_align;
|
||||
unsigned long end = (unsigned long)__end_rodata_aligned;
|
||||
|
||||
if (!pti_kernel_image_global_ok())
|
||||
return;
|
||||
|
||||
Reference in new issue
Block a user