Skip to content

Commit 2a38110

Browse files
author
Russell King
committed
ARM: Fix XIP kernels
Commit 7619751 ("ARM: 8595/2: apply more __ro_after_init") caused a regression with XIP kernels by moving the __ro_after_init data into the read-only section. With XIP kernels, the read-only section is located in read-only memory from the very beginning. Work around this by moving the __ro_after_init data back into the .data section, which will be in RAM, and hence will be writable. It should be noted that in doing so, this remains writable after init. Fixes: 7619751 ("ARM: 8595/2: apply more __ro_after_init") Reported-by: Andrea Merello <andrea.merello@gmail.com> Tested-by: Andrea Merello <andrea.merello@gmail.com> [ XIP stm32 ] Tested-by: Alexandre Torgue <alexandre.torgue@st.com> Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
1 parent 256ff1c commit 2a38110

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

arch/arm/kernel/vmlinux-xip.lds.S

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
* Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
44
*/
55

6+
/* No __ro_after_init data in the .rodata section - which will always be ro */
7+
#define RO_AFTER_INIT_DATA
8+
69
#include <asm-generic/vmlinux.lds.h>
710
#include <asm/cache.h>
811
#include <asm/thread_info.h>
@@ -223,6 +226,8 @@ SECTIONS
223226
. = ALIGN(PAGE_SIZE);
224227
__init_end = .;
225228

229+
*(.data..ro_after_init)
230+
226231
NOSAVE_DATA
227232
CACHELINE_ALIGNED_DATA(L1_CACHE_BYTES)
228233
READ_MOSTLY_DATA(L1_CACHE_BYTES)

0 commit comments

Comments
 (0)