]> xenbits.xensource.com Git - xen.git/commit
x86/alternatives: fix .init section reference in _apply_alternatives()
authorRoger Pau Monné <roger.pau@citrix.com>
Tue, 9 Apr 2024 12:50:46 +0000 (14:50 +0200)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Tue, 9 Apr 2024 13:05:59 +0000 (14:05 +0100)
commit4be1fef1e6572c2be0bd378902ffb62a6e73faeb
treed5ed32dfd5d863e1a11e401a8fb5fe2275b527b1
parent9926e692c4afc40bcd66f8416ff6a1e93ce402f6
x86/alternatives: fix .init section reference in _apply_alternatives()

The code in _apply_alternatives() will unconditionally attempt to read
__initdata_cf_clobber_{start,end} when called as part of applying alternatives
to a livepatch payload when Xen is using IBT.

That leads to a page-fault as __initdata_cf_clobber_{start,end} living in
.init section will have been unmapped by the time a livepatch gets loaded.

Fix by adding a check that limits the clobbering of endbr64 instructions to
boot time only.

Fixes: 37ed5da851b8 ('x86/altcall: Optimise away endbr64 instruction where possible')
Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
xen/arch/x86/alternative.c