[PATCH][GOLD] Fix PR22233 gold segfault in relocate_erratum_stub on aarch64-linux-gnu
Peter Smith
peter.smith@linaro.org
Mon Nov 13 15:07:00 GMT 2017
Hello,
I've recently investigated
https://sourceware.org/bugzilla/show_bug.cgi?id=22233 which is a
segfault in gold with the --fix-cortex-a53-843419 applied.
The full details are in the PR, to summarise:
- The fix for PR21868 (an internal error when --fix-cortex-a53-843419
is applied) has a small mistake in it.
- When the stub_owner section needs an erratum fix an incorrect
address for the stubs for the section is given to
relocate_erratum_stub.
- If we are lucky we will get a segfault, if we aren't an incorrect
patch or data corruption is possible. The error is visible in PR21868,
but the side-effects aren't fatal.
- The fix is a one line change to add the view_offset to pview.address
when doing the calculation to find the stub address.
This is a first time posting a fix to this mailing list so my
apologies for missing anything out.
Peter
-------------- next part --------------
diff --git a/gold/aarch64.cc b/gold/aarch64.cc
index 4c6e920..c9c1b33 100644
--- a/gold/aarch64.cc
+++ b/gold/aarch64.cc
@@ -2041,7 +2041,8 @@ AArch64_relobj<size, big_endian>::fix_errata_and_relocate_erratum_stubs(
// executed.
stub_table->relocate_erratum_stub(
stub,
- pview.view + view_offset + (stub_table->address() - pview.address));
+ pview.view + view_offset + (stub_table->address() -
+ (pview.address + view_offset)));
// Next erratum stub.
++p;
More information about the Binutils
mailing list