Skip to content

Commit c2b11f6

Browse files
mrutland-armAlex Shi
authored andcommitted
arm64: ensure _stext and _etext are page-aligned
Currently we have separate ALIGN_DEBUG_RO{,_MIN} directives to align _etext and __init_begin. While we ensure that __init_begin is page-aligned, we do not provide the same guarantee for _etext. This is not problematic currently as the alignment of __init_begin is sufficient to prevent issues when we modify permissions. Subsequent patches will assume page alignment of segments of the kernel we wish to map with different permissions. To ensure this, move _etext after the ALIGN_DEBUG_RO_MIN for the init section. This renders the prior ALIGN_DEBUG_RO irrelevant, and hence it is removed. Likewise, upgrade to ALIGN_DEBUG_RO_MIN(PAGE_SIZE) for _stext. Signed-off-by: Mark Rutland <mark.rutland@arm.com> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com> Tested-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org> Tested-by: Jeremy Linton <jeremy.linton@arm.com> Cc: Laura Abbott <labbott@fedoraproject.org> Cc: Will Deacon <will.deacon@arm.com> Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> (cherry picked from commit fca082bfb543ccaaff864fc0892379ccaa1711cd) Signed-off-by: Alex Shi <alex.shi@linaro.org>
1 parent 1adf036 commit c2b11f6

1 file changed

Lines changed: 2 additions & 3 deletions

File tree

arch/arm64/kernel/vmlinux.lds.S

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ SECTIONS
105105
_text = .;
106106
HEAD_TEXT
107107
}
108-
ALIGN_DEBUG_RO
108+
ALIGN_DEBUG_RO_MIN(PAGE_SIZE)
109109
.text : { /* Real text segment */
110110
_stext = .; /* Text and read-only data */
111111
__exception_text_start = .;
@@ -130,10 +130,9 @@ SECTIONS
130130
RO_DATA(PAGE_SIZE)
131131
EXCEPTION_TABLE(8)
132132
NOTES
133-
ALIGN_DEBUG_RO
134-
_etext = .; /* End of text and rodata section */
135133

136134
ALIGN_DEBUG_RO_MIN(PAGE_SIZE)
135+
_etext = .; /* End of text and rodata section */
137136
__init_begin = .;
138137

139138
INIT_TEXT_SECTION(8)

0 commit comments

Comments
 (0)