From 7e17420b259d6a25425230cd1cc25bfaf602f1df Mon Sep 17 00:00:00 2001 From: ningyu Date: Mon, 27 May 2024 10:34:00 +0000 Subject: [PATCH] upatch-diff: exit with error when any tls var included Signed-off-by: ningyu --- upatch-diff/create-diff-object.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/upatch-diff/create-diff-object.c b/upatch-diff/create-diff-object.c index 6474b22..5ec6f31 100644 --- a/upatch-diff/create-diff-object.c +++ b/upatch-diff/create-diff-object.c @@ -847,6 +847,19 @@ static void include_debug_sections(struct upatch_elf *uelf) /* currently, there si no special section need to be handled */ static void process_special_sections(void) {} +static bool has_tls_included(struct upatch_elf *uelf) +{ + struct symbol *sym; + + list_for_each_entry(sym, &uelf->symbols, list) { + if (sym->include == 1 && sym->type == STT_TLS) { + log_normal("TLS symbol '%s' included, but it's not supported", sym->name); + return true; + } + } + return false; +} + static void verify_patchability(struct upatch_elf *uelf) { struct section *sec; @@ -878,6 +891,10 @@ static void verify_patchability(struct upatch_elf *uelf) if (errs) DIFF_FATAL("%d, Unsupported section changes", errs); + + if (has_tls_included(uelf)) { + DIFF_FATAL("Unsupported symbol included"); + } } static void migrate_included_elements(struct upatch_elf *uelf_patched, struct upatch_elf *uelf_out) -- 2.34.1