x86/boot: Support __ro_after_init
authorAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 29 Nov 2021 20:11:01 +0000 (20:11 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 2 Dec 2021 20:02:55 +0000 (20:02 +0000)
commit05657c6d1821dfc4e9a618767a942b3555406046
tree0b96df1a9800924b88f9189cf97c693408b4e25b
parent8de86b5cd4353bf2cc415e4563f973f071b4e8a3
x86/boot: Support __ro_after_init

For security hardening reasons, it advantageous to make setup-once data
immutable after boot.  Borrow __ro_after_init from Linux.

On x86, place .data.ro_after_init at the start of .rodata, excluding it from
the early permission restrictions.  Re-apply RO restrictions to the whole of
.rodata in init_done(), attempting to reform the superpage if possible.

For architectures which don't implement __ro_after_init explicitly, variables
merges into .data.

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/arch/x86/setup.c
xen/arch/x86/xen.lds.S
xen/include/asm-x86/setup.h
xen/include/xen/cache.h