|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-devel] [PATCH] x86/livepatch: Fail the build if duplicate symbols exist
From: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
The binary diffing algorithm used by xen-livepatch depends on having unique
symbols.
Signed-off-by: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
---
CC: Jan Beulich <JBeulich@xxxxxxxx>
CC: Wei Liu <wei.liu2@xxxxxxxxxx>
CC: Roger Pau Monné <roger.pau@xxxxxxxxxx>
CC: Stefano Stabellini <sstabellini@xxxxxxxxxx>
CC: Julien Grall <julien.grall@xxxxxxx>
CC: Ross Lagerwall <ross.lagerwall@xxxxxxxxxx>
CC: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>
CC: Norbert Manthey <nmanthey@xxxxxxxxx>
This patch has been part of the XenServer patchqueue for ages, and should have
been upstreamed sooner. It obviously can't be applied while the "block
speculation" issue is outstanding.
---
xen/arch/x86/Makefile | 1 +
xen/tools/symbols.c | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/xen/arch/x86/Makefile b/xen/arch/x86/Makefile
index ef09939..d4ae46b 100644
--- a/xen/arch/x86/Makefile
+++ b/xen/arch/x86/Makefile
@@ -98,6 +98,7 @@ endif
syms-warn-dup-y := --warn-dup
syms-warn-dup-$(CONFIG_SUPPRESS_DUPLICATE_SYMBOL_WARNINGS) :=
+syms-warn-dup-$(CONFIG_LIVEPATCH) := --error-dup
$(TARGET): $(TARGET)-syms $(efi-y) boot/mkelf32
./boot/mkelf32 $(notes_phdrs) $(TARGET)-syms $(TARGET)
$(XEN_IMG_OFFSET) \
diff --git a/xen/tools/symbols.c b/xen/tools/symbols.c
index 05139d1..9f9e2c9 100644
--- a/xen/tools/symbols.c
+++ b/xen/tools/symbols.c
@@ -599,7 +599,7 @@ static int compare_name(const void *p1, const void *p2)
int main(int argc, char **argv)
{
unsigned int i;
- bool unsorted = false, warn_dup = false;
+ bool unsorted = false, warn_dup = false, error_dup = false, found_dup =
false;
if (argc >= 2) {
for (i = 1; i < argc; i++) {
@@ -619,6 +619,8 @@ int main(int argc, char **argv)
sort_by_name = 1;
else if (strcmp(argv[i], "--warn-dup") == 0)
warn_dup = true;
+ else if (strcmp(argv[i], "--error-dup") == 0)
+ warn_dup = error_dup = true;
else if (strcmp(argv[i], "--xensyms") == 0)
map_only = true;
else
@@ -634,14 +636,19 @@ int main(int argc, char **argv)
for (i = 1; i < table_cnt; ++i)
if (strcmp(SYMBOL_NAME(table + i - 1),
SYMBOL_NAME(table + i)) == 0 &&
- table[i - 1].addr != table[i].addr)
+ table[i - 1].addr != table[i].addr) {
fprintf(stderr,
"Duplicate symbol '%s' (%llx !=
%llx)\n",
SYMBOL_NAME(table + i),
table[i].addr, table[i - 1].addr);
+ found_dup = true;
+ }
unsorted = true;
}
+ if (error_dup && found_dup)
+ exit(1);
+
if (unsorted)
qsort(table, table_cnt, sizeof(*table), compare_value);
--
2.1.4
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/xen-devel
|
![]() |
Lists.xenproject.org is hosted with RackSpace, monitoring our |