@@ -765,6 +765,11 @@ static int prepare_payload(struct payload *payload,
if ( rc )
return rc;
+ /* Perform the Xen build-id check ahead of doing any more processing. */
+ rc = xen_build_id_dep(payload);
+ if ( rc )
+ return rc;
+
/* Setup the virtual region with proper data. */
region = &payload->region;
@@ -1097,10 +1102,6 @@ static int load_payload_data(struct payload *payload, void *raw, size_t len)
if ( rc )
goto out;
- rc = xen_build_id_dep(payload);
- if ( rc )
- goto out;
-
rc = build_symbol_table(payload, &elf);
if ( rc )
goto out;
The check against the expected Xen build ID should be done ahead of attempting to apply the alternatives contained in the livepatch. If the CPUID in the alternatives patching data is out of the scope of the running Xen featureset the BUG() in _apply_alternatives() will trigger thus bringing the system down. Note the layout of struct alt_instr could also change between versions. It's also possible for struct exception_table_entry to have changed format, hence possibly leading to other errors. Move the Xen build ID check to be done ahead of any processing of the livepatch payload sections. Signed-off-by: Roger Pau Monné <roger.pau@citrix.com> --- xen/common/livepatch.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)