livepatch: account for patch offset when applying NOP patch
authorJan Beulich <jbeulich@suse.com>
Thu, 31 Mar 2022 09:00:57 +0000 (11:00 +0200)
committerJan Beulich <jbeulich@suse.com>
Thu, 31 Mar 2022 09:00:57 +0000 (11:00 +0200)
commite34c16cc6ee029fa75c35bd21f75103d5502ea30
tree4fcd468ec5ddc7779354da9fffa9e8090efdd7d0
parentef63570d8391a35fd734a956865b8295d2c57112
livepatch: account for patch offset when applying NOP patch

While not triggered by the trivial xen_nop in-tree patch on
staging/master, that patch exposes a problem on the stable trees, where
all functions have ENDBR inserted. When NOP-ing out a range, we need to
account for this. Handle this right in livepatch_insn_len().

This requires livepatch_insn_len() to be called _after_ ->patch_offset
was set.

Fixes: 6974c75180f1 ("xen/x86: Livepatch: support patching CET-enhanced functions")
Signed-off-by: Jan Beulich <jbeulich@suse.com>
Reviewed-by: Roger Pau Monné <roger.pau@citrix.com>
master commit: 8a87b9a0fb0564f9d68f0be0a0d1a17c34117b8b
master date: 2022-03-31 10:45:46 +0200
xen/arch/x86/livepatch.c
xen/include/xen/livepatch.h