vmlinux.lds.h: Move NOTES into RO_DATA
The .notes section should be non-executable read-only data. As such, move it to the RO_DATA macro instead of being per-architecture defined. Signed-off-by: Kees Cook <keescook@chromium.org> Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Heiko Carstens <heiko.carstens@de.ibm.com> # s390 Cc: Andy Lutomirski <luto@kernel.org> Cc: Arnd Bergmann <arnd@arndb.de> Cc: Dave Hansen <dave.hansen@linux.intel.com> Cc: linux-alpha@vger.kernel.org Cc: linux-arch@vger.kernel.org Cc: linux-arm-kernel@lists.infradead.org Cc: linux-c6x-dev@linux-c6x.org Cc: linux-ia64@vger.kernel.org Cc: linux-s390@vger.kernel.org Cc: linuxppc-dev@lists.ozlabs.org Cc: Michael Ellerman <mpe@ellerman.id.au> Cc: Michal Simek <monstr@monstr.eu> Cc: Rick Edgecombe <rick.p.edgecombe@intel.com> Cc: Segher Boessenkool <segher@kernel.crashing.org> Cc: Will Deacon <will@kernel.org> Cc: x86-ml <x86@kernel.org> Cc: Yoshinori Sato <ysato@users.sourceforge.jp> Link: https://lkml.kernel.org/r/20191029211351.13243-11-keescook@chromium.org
This commit is contained in:
parent
fbe6a8e618
commit
eaf937075c
|
@ -34,8 +34,6 @@ SECTIONS
|
||||||
swapper_pg_dir = SWAPPER_PGD;
|
swapper_pg_dir = SWAPPER_PGD;
|
||||||
_etext = .; /* End of text section */
|
_etext = .; /* End of text section */
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
RODATA
|
RODATA
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
|
|
||||||
|
|
|
@ -118,8 +118,6 @@ SECTIONS
|
||||||
/DISCARD/ : { *(.eh_frame) }
|
/DISCARD/ : { *(.eh_frame) }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
. = ALIGN(PAGE_SIZE);
|
. = ALIGN(PAGE_SIZE);
|
||||||
_end = . ;
|
_end = . ;
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,6 @@ SECTIONS
|
||||||
ARM_UNWIND_SECTIONS
|
ARM_UNWIND_SECTIONS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
_etext = .; /* End of text and rodata section */
|
_etext = .; /* End of text and rodata section */
|
||||||
|
|
||||||
ARM_VECTORS
|
ARM_VECTORS
|
||||||
|
|
|
@ -81,8 +81,6 @@ SECTIONS
|
||||||
ARM_UNWIND_SECTIONS
|
ARM_UNWIND_SECTIONS
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
#ifdef CONFIG_STRICT_KERNEL_RWX
|
#ifdef CONFIG_STRICT_KERNEL_RWX
|
||||||
. = ALIGN(1<<SECTION_SHIFT);
|
. = ALIGN(1<<SECTION_SHIFT);
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -137,7 +137,6 @@ SECTIONS
|
||||||
|
|
||||||
RO_DATA(PAGE_SIZE) /* everything from this point to */
|
RO_DATA(PAGE_SIZE) /* everything from this point to */
|
||||||
EXCEPTION_TABLE(8) /* __init_begin will be marked RO NX */
|
EXCEPTION_TABLE(8) /* __init_begin will be marked RO NX */
|
||||||
NOTES
|
|
||||||
|
|
||||||
. = ALIGN(PAGE_SIZE);
|
. = ALIGN(PAGE_SIZE);
|
||||||
idmap_pg_dir = .;
|
idmap_pg_dir = .;
|
||||||
|
|
|
@ -81,7 +81,6 @@ SECTIONS
|
||||||
}
|
}
|
||||||
|
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
NOTES
|
|
||||||
|
|
||||||
RO_DATA_SECTION(PAGE_SIZE)
|
RO_DATA_SECTION(PAGE_SIZE)
|
||||||
.const :
|
.const :
|
||||||
|
|
|
@ -53,7 +53,6 @@ SECTIONS
|
||||||
RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
|
RW_DATA_SECTION(L1_CACHE_BYTES, PAGE_SIZE, THREAD_SIZE)
|
||||||
_edata = .;
|
_edata = .;
|
||||||
|
|
||||||
NOTES
|
|
||||||
EXCEPTION_TABLE(L1_CACHE_BYTES)
|
EXCEPTION_TABLE(L1_CACHE_BYTES)
|
||||||
BSS_SECTION(L1_CACHE_BYTES, PAGE_SIZE, L1_CACHE_BYTES)
|
BSS_SECTION(L1_CACHE_BYTES, PAGE_SIZE, L1_CACHE_BYTES)
|
||||||
VBR_BASE
|
VBR_BASE
|
||||||
|
|
|
@ -38,7 +38,6 @@ SECTIONS
|
||||||
_etext = . ;
|
_etext = . ;
|
||||||
}
|
}
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
NOTES
|
|
||||||
RO_DATA_SECTION(4)
|
RO_DATA_SECTION(4)
|
||||||
ROMEND = .;
|
ROMEND = .;
|
||||||
#if defined(CONFIG_ROMKERNEL)
|
#if defined(CONFIG_ROMKERNEL)
|
||||||
|
|
|
@ -54,7 +54,6 @@ SECTIONS
|
||||||
_edata = .;
|
_edata = .;
|
||||||
|
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
NOTES
|
|
||||||
|
|
||||||
BSS_SECTION(_PAGE_SIZE, _PAGE_SIZE, _PAGE_SIZE)
|
BSS_SECTION(_PAGE_SIZE, _PAGE_SIZE, _PAGE_SIZE)
|
||||||
|
|
||||||
|
|
|
@ -70,8 +70,6 @@ SECTIONS {
|
||||||
/*
|
/*
|
||||||
* Read-only data
|
* Read-only data
|
||||||
*/
|
*/
|
||||||
NOTES
|
|
||||||
|
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
|
|
||||||
/* MCA table */
|
/* MCA table */
|
||||||
|
|
|
@ -53,7 +53,6 @@ SECTIONS {
|
||||||
. = ALIGN(16);
|
. = ALIGN(16);
|
||||||
RODATA
|
RODATA
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
NOTES
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* sdata2 section can go anywhere, but must be word aligned
|
* sdata2 section can go anywhere, but must be word aligned
|
||||||
|
|
|
@ -81,8 +81,6 @@ SECTIONS
|
||||||
__stop___dbe_table = .;
|
__stop___dbe_table = .;
|
||||||
}
|
}
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
_sdata = .; /* Start of data section */
|
_sdata = .; /* Start of data section */
|
||||||
RODATA
|
RODATA
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ SECTIONS
|
||||||
_edata = .;
|
_edata = .;
|
||||||
|
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
NOTES
|
|
||||||
BSS_SECTION(4, 4, 4)
|
BSS_SECTION(4, 4, 4)
|
||||||
_end = .;
|
_end = .;
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,6 @@ SECTIONS
|
||||||
|
|
||||||
STABS_DEBUG
|
STABS_DEBUG
|
||||||
DWARF_DEBUG
|
DWARF_DEBUG
|
||||||
NOTES
|
|
||||||
|
|
||||||
DISCARDS
|
DISCARDS
|
||||||
}
|
}
|
||||||
|
|
|
@ -79,7 +79,6 @@ SECTIONS
|
||||||
_edata = .;
|
_edata = .;
|
||||||
|
|
||||||
EXCEPTION_TABLE(4)
|
EXCEPTION_TABLE(4)
|
||||||
NOTES
|
|
||||||
|
|
||||||
/* Init code and data */
|
/* Init code and data */
|
||||||
. = ALIGN(PAGE_SIZE);
|
. = ALIGN(PAGE_SIZE);
|
||||||
|
|
|
@ -131,7 +131,6 @@ SECTIONS
|
||||||
|
|
||||||
/* RO because of BUILDTIME_EXTABLE_SORT */
|
/* RO because of BUILDTIME_EXTABLE_SORT */
|
||||||
EXCEPTION_TABLE(8)
|
EXCEPTION_TABLE(8)
|
||||||
NOTES
|
|
||||||
|
|
||||||
/* unwind info */
|
/* unwind info */
|
||||||
.PARISC.unwind : {
|
.PARISC.unwind : {
|
||||||
|
|
|
@ -164,8 +164,6 @@ SECTIONS
|
||||||
#endif
|
#endif
|
||||||
EXCEPTION_TABLE(0)
|
EXCEPTION_TABLE(0)
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Init sections discarded at runtime
|
* Init sections discarded at runtime
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -69,7 +69,6 @@ SECTIONS
|
||||||
BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
|
BSS_SECTION(PAGE_SIZE, PAGE_SIZE, 0)
|
||||||
|
|
||||||
EXCEPTION_TABLE(0x10)
|
EXCEPTION_TABLE(0x10)
|
||||||
NOTES
|
|
||||||
|
|
||||||
.rel.dyn : {
|
.rel.dyn : {
|
||||||
*(.rel.dyn*)
|
*(.rel.dyn*)
|
||||||
|
|
|
@ -52,8 +52,6 @@ SECTIONS
|
||||||
_etext = .; /* End of text section */
|
_etext = .; /* End of text section */
|
||||||
} :text = 0x0700
|
} :text = 0x0700
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
RO_DATA_SECTION(PAGE_SIZE)
|
RO_DATA_SECTION(PAGE_SIZE)
|
||||||
|
|
||||||
. = ALIGN(PAGE_SIZE);
|
. = ALIGN(PAGE_SIZE);
|
||||||
|
|
|
@ -48,7 +48,6 @@ SECTIONS
|
||||||
} = 0x0009
|
} = 0x0009
|
||||||
|
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
NOTES
|
|
||||||
|
|
||||||
_sdata = .;
|
_sdata = .;
|
||||||
RO_DATA(PAGE_SIZE)
|
RO_DATA(PAGE_SIZE)
|
||||||
|
|
|
@ -78,7 +78,6 @@ SECTIONS
|
||||||
__stop___fixup = .;
|
__stop___fixup = .;
|
||||||
}
|
}
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
NOTES
|
|
||||||
|
|
||||||
. = ALIGN(PAGE_SIZE);
|
. = ALIGN(PAGE_SIZE);
|
||||||
__init_begin = ALIGN(PAGE_SIZE);
|
__init_begin = ALIGN(PAGE_SIZE);
|
||||||
|
|
|
@ -16,7 +16,6 @@
|
||||||
PROVIDE (_unprotected_end = .);
|
PROVIDE (_unprotected_end = .);
|
||||||
|
|
||||||
. = ALIGN(4096);
|
. = ALIGN(4096);
|
||||||
NOTES
|
|
||||||
EXCEPTION_TABLE(0)
|
EXCEPTION_TABLE(0)
|
||||||
|
|
||||||
BUG_TABLE
|
BUG_TABLE
|
||||||
|
|
|
@ -48,7 +48,6 @@ SECTIONS
|
||||||
_edata = .;
|
_edata = .;
|
||||||
|
|
||||||
EXCEPTION_TABLE(L1_CACHE_BYTES)
|
EXCEPTION_TABLE(L1_CACHE_BYTES)
|
||||||
NOTES
|
|
||||||
|
|
||||||
BSS_SECTION(0, 0, 0)
|
BSS_SECTION(0, 0, 0)
|
||||||
_end = .;
|
_end = .;
|
||||||
|
|
|
@ -148,8 +148,6 @@ SECTIONS
|
||||||
_etext = .;
|
_etext = .;
|
||||||
} :text = 0x9090
|
} :text = 0x9090
|
||||||
|
|
||||||
NOTES
|
|
||||||
|
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
|
|
||||||
/* .text should occupy whole number of pages */
|
/* .text should occupy whole number of pages */
|
||||||
|
|
|
@ -131,7 +131,6 @@ SECTIONS
|
||||||
.fixup : { *(.fixup) }
|
.fixup : { *(.fixup) }
|
||||||
|
|
||||||
EXCEPTION_TABLE(16)
|
EXCEPTION_TABLE(16)
|
||||||
NOTES
|
|
||||||
/* Data section */
|
/* Data section */
|
||||||
|
|
||||||
_sdata = .;
|
_sdata = .;
|
||||||
|
|
|
@ -28,7 +28,6 @@
|
||||||
* _edata = .;
|
* _edata = .;
|
||||||
*
|
*
|
||||||
* EXCEPTION_TABLE(...)
|
* EXCEPTION_TABLE(...)
|
||||||
* NOTES
|
|
||||||
*
|
*
|
||||||
* BSS_SECTION(0, 0, 0)
|
* BSS_SECTION(0, 0, 0)
|
||||||
* _end = .;
|
* _end = .;
|
||||||
|
@ -512,10 +511,12 @@
|
||||||
__start___modver = .; \
|
__start___modver = .; \
|
||||||
KEEP(*(__modver)) \
|
KEEP(*(__modver)) \
|
||||||
__stop___modver = .; \
|
__stop___modver = .; \
|
||||||
. = ALIGN((align)); \
|
|
||||||
__end_rodata = .; \
|
|
||||||
} \
|
} \
|
||||||
. = ALIGN((align));
|
\
|
||||||
|
NOTES \
|
||||||
|
\
|
||||||
|
. = ALIGN((align)); \
|
||||||
|
__end_rodata = .;
|
||||||
|
|
||||||
/* RODATA & RO_DATA provided for backward compatibility.
|
/* RODATA & RO_DATA provided for backward compatibility.
|
||||||
* All archs are supposed to use RO_DATA() */
|
* All archs are supposed to use RO_DATA() */
|
||||||
|
|
Loading…
Reference in New Issue