File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -62,6 +62,9 @@ config PCI_QUIRKS
6262config ARCH_SUPPORTS_UPROBES
6363 def_bool y
6464
65+ config DEBUG_RODATA
66+ def_bool y
67+
6568config S390
6669 def_bool y
6770 select ARCH_HAS_ATOMIC64_DEC_IF_POSITIVE
Original file line number Diff line number Diff line change @@ -109,6 +109,13 @@ void __init paging_init(void)
109109 free_area_init_nodes (max_zone_pfns );
110110}
111111
112+ void mark_rodata_ro (void )
113+ {
114+ /* Text and rodata are already protected. Nothing to do here. */
115+ pr_info ("Write protecting the kernel read-only data: %luk\n" ,
116+ ((unsigned long )& _eshared - (unsigned long )& _stext ) >> 10 );
117+ }
118+
112119void __init mem_init (void )
113120{
114121 if (MACHINE_HAS_TLB_LC )
@@ -127,9 +134,6 @@ void __init mem_init(void)
127134 setup_zero_pages (); /* Setup zeroed pages. */
128135
129136 mem_init_print_info (NULL );
130- printk ("Write protected kernel read-only data: %#lx - %#lx\n" ,
131- (unsigned long )& _stext ,
132- PFN_ALIGN ((unsigned long )& _eshared ) - 1 );
133137}
134138
135139void free_initmem (void )
Original file line number Diff line number Diff line change 248248 . = ALIGN(align); \
249249 *(.data..init_task)
250250
251+ /*
252+ * Allow architectures to handle ro_after_init data on their
253+ * own by defining an empty RO_AFTER_INIT_DATA.
254+ */
255+ #ifndef RO_AFTER_INIT_DATA
256+ #define RO_AFTER_INIT_DATA *(.data..ro_after_init)
257+ #endif
258+
251259/*
252260 * Read only Data
253261 */
256264 .rodata : AT(ADDR(.rodata) - LOAD_OFFSET) { \
257265 VMLINUX_SYMBOL(__start_rodata) = .; \
258266 *(.rodata) *(.rodata.*) \
259- *(.data..ro_after_init) /* Read only after init */ \
267+ RO_AFTER_INIT_DATA /* Read only after init */ \
260268 * (__vermagic ) /* Kernel version magic */ \
261269 . = ALIGN (8 ); \
262270 VMLINUX_SYMBOL (__start___tracepoints_ptrs ) = .; \
You can’t perform that action at this time.
0 commit comments